Updated the SPARQL query

Fixed the bugs in the SPARQL query