Adding sparql version of queries using ordering