SparqlRequest request = new SparqlRequest("sitac"); request.addSelect("elt"); request.addType("elt", "Waypoint"); request.addPropertyValue("elt", "inFlightPlan", true); String query = request.getSPARQL();We will generate the following query:
SELECT ?elt WHERE { ?elt rdf:type sitac:Waypoint . ?elt sitac:inFlightPlan "true"^^xsd:boolean . }
boolean: the datatype IRI will be xsd:booleanint: the datatype IRI will be xsd:intlong: the datatype IRI will be xsd:longfloat: the datatype IRI will be xsd:floatdouble: the datatype IRI will be xsd:doubleshort: the datatype IRI will be xsd:shortbyte: the datatype IRI will be xsd:byteSparqlRequest request = new SparqlRequest("sitac"); request.addSelect("elt"); request.addType("elt", "Waypoint"); OperationResult result = request.addPropertyValue("elt", "CustomProperty", "myData"); String query = request.getSPARQL();Then you need to get the associated SparqlElement and cast it to a Property:
Property property = (Property)result.getSparqlElement();Then two methods allow to define the value type:
property.setValueType("my:CustomType");
SparqlRequest request = new SparqlRequest("sitac"); request.addSelect("zone"); request.addType("zone", "TaskZone"); request.addAdditionalVariable("hostile"); request.addPropertyRef("zone", "Hostile", "hostile"); request.addPropertyValues("hostile", SparqlRequest.createValuesList(true, false));Will return the following SPARQL content:
SELECT ?zone WHERE { ?zone rdf:type sitac:TaskZone . ?zone sitac:Hostile ?hostile . VALUES ?hostile {"true"^^xsd:boolean "false"^^xsd:boolean } }
SparqlRequest request = new SparqlRequest("sitac"); request.addSelect("elt"); request.addType("elt", "Waypoint"); request.addPropertyValue("elt", "inFlightPlan", true); String query = request.getSPARQL();We will generate the following query:
SELECT ?elt WHERE { ?elt rdf:type sitac:Waypoint . ?elt sitac:inFlightPlan "true"^^xsd:boolean . }But this code:
SparqlRequest request = new SparqlRequest("sitac"); request.addSelect("elt"); request.addType("elt", "Waypoint"); request.addPropertyValue("elt", "inFlightPlan", "true"); String query = request.getSPARQL();We will generate the following query:
SELECT ?elt WHERE { ?elt rdf:type sitac:Waypoint . ?elt sitac:inFlightPlan "true" . }
SparqlRequest request = new SparqlRequest("sitac"); request.addSelect("elt"); request.addType("elt", "Waypoint"); OperationResult result = request.addPropertyValue("elt", "CustomProperty", "myData"); Property property = (Property)result.getSparqlElement(); property.setValueType("my:CustomType"); String query = request.getSPARQL();Will generate the following query:
SELECT ?elt WHERE { ?elt rdf:type sitac:Waypoint . ?elt sitac:CustomProperty "myData"^^my:CustomType . }
Copyright 2025 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence
Project Web Hosted by
Copyright 1999-2010 -
Geeknet, Inc., All Rights Reserved
About
-
Legal
-
Help