Home
Categories
Dictionary
Download
Project Details
Changes Log
FAQ
License

SPARQL request comparison



It is possible to compare requests to check if two requests are identical.

The SPARQLRequest.equals(Object o) method allows to compare two SPARQL requests.

Usage

For example with parsed requests:
   SPARQLParser parser = new SPARQLParser("sitac");
   SparqlRequest request = parser.parseQuery(<the first request String>);
      
   SparqlRequest request2 = parser.parseQuery(<the second request String>);      
   boolean isEqual = request.equals(request2);

Behavior

Order in SELECT

The order in the SELECT declarations is not significant.

For example:
   SELECT ?software ?date
   WHERE {
      ?software wd:P571 ?date .
   }   
Will be considered equal to:
   SELECT ?date ?software
   WHERE {
      ?software wd:P571 ?date .
   }   

Order in WHERE, INSERT, or DELETE

The order of Triplets in WHERE, INSERT, or DELETE is not significant.

For example:
   SELECT ?zone ?auto_1
   WHERE {
      ?zone rdf:type sitac:TaskZone .
      ?zone sitac:Label ?auto_1 .
   } 
Will be considered equal to:
   SELECT ?zone ?auto_1
   WHERE {
      ?zone sitac:Label ?auto_1 .      
      ?zone rdf:type sitac:TaskZone .
   } 

Order in VALUES declarations

The order of values in VALUES declarations is not significant.

For example:
   SELECT ?zone
   WHERE {
      ?zone rdf:type sitac:TaskZone .
      ?zone sitac:Label ?auto_1 .
   VALUES ?auto_1 { "label1" "label2" }
   }    
Will be considered equal to:
   SELECT ?zone
   WHERE {
      ?zone rdf:type sitac:TaskZone .
      ?zone sitac:Label ?auto_1 .
   VALUES ?auto_1 { "label2" "label1" }
   }       

Comments

comments are not taken into account when comparing two requests.

For example:
   SELECT ?zone
   WHERE {
      ?zone rdf:type sitac:TaskZone .
      ?zone sitac:isTasked "true"^^xsd:boolean .
      ?zone sitac:hasIndex ?index . # Comment on hasIndex
   }      
Will be considered equal to:
   SELECT ?zone
   WHERE {
      ?zone rdf:type sitac:TaskZone .
      ?zone sitac:isTasked "true"^^xsd:boolean .
      ?zone sitac:hasIndex ?index .
   }      

See also


Categories: Requestcreation

Copyright 2025 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence

Project Web Hosted by SourceForge.net Copyright 1999-2010 - Geeknet, Inc., All Rights Reserved About - Legal - Help