Home
Categories
Dictionary
Download
Project Details
Changes Log
FAQ
License

Handling comments



Comments can be added in most of the elements in the SPARQL request. The SparqlElement interface is the root interface of these classes.

The SparqlElement.setComment(String comment) method allow to add a commment to the element. Alternatively the OperationResult.setCommentOnElement(String comment) method allow to add a comment on the element which is the result of an expression creation in the SPARQL request.

List of elements which support comments

The list of classes which implement the interface comprise:

Example

For example:
   SparqlRequest request = new SparqlRequest("sitac");
   request.addSelect("zone");
   request.addAdditionalVariable("index");
   request.addType("zone", "TaskZone");
   request.addPropertyValue("zone", "isTasked", true);
   OperationResult<PropertyRef> propRef = request.addPropertyRef("zone", "hasIndex", "index");
   propRef.setCommentOnElement("Comment on hasIndex");
      
   String content = request.getSPARQL(true);
Will have the following result:
   SELECT ?zone
   WHERE {
      ?zone rdf:type sitac:TaskZone .
      ?zone sitac:isTasked "true" .
      ?zone sitac:hasIndex ?index . # Comment on hasIndex
   }      

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