Home
Categories
Dictionary
Download
Project Details
Changes Log
FAQ
License

PrefixInclusionType



The PrefixInclusionType interface allows to specify how to include the prefixes in serialized requests.

This interface is used when creating a SPARQLRequest.

Type values

The values of the interface are:

Examples

Not including the prefixes

By default SPARQL requests created by the framework do not include the prefix declarations.

For example suppose the following code:
   SparqlRequest request = new SparqlRequest("sitac");
   request.addSelect("zone");
   request.addType("zone", "TaskZone");
   request.addPropertyValue("zone", "isTasked", true);
   String sparql = request.getSPARQL();
The result will be:
   SELECT ?zone
   WHERE {
     ?zone rdf:type sitac:TaskZone .
     ?zone sitac:isTasked "true" .
   }
It is the same result as with:
   SparqlRequest request = new SparqlRequest("sitac", PrefixInclusionType.NOT_INCLUDE);
   request.addSelect("zone");
   request.addType("zone", "TaskZone");
   request.addPropertyValue("zone", "isTasked", true);
   String sparql = request.getSPARQL();

Including the prefixes

Suppose the following code:
   SparqlRequest request = new SparqlRequest("sitac", PrefixInclusionType.INCLUDE);
   request.addSelect("zone");
   request.addType("zone", "TaskZone");
   request.addPropertyValue("zone", "isTasked", true);
   String sparql = request.getSPARQL();
The result will be:
   PREFIX owl: <http://www.w3.org/2002/07/owl#>
   PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
   PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
   PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>      
   SELECT ?zone
   WHERE {
     ?zone rdf:type sitac:TaskZone .
     ?zone sitac:isTasked "true" .
   }

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