SparqlHelperConfig.printRelease();will print on System.out:
SparlHelper version: 0.3 release: 11/03/2026
SparqlPrefixDeclarations prefixDecl = new SparqlPrefixDeclarations(); prefixDecl.addPrefix("sitac", "http://example.com/"); prefixDecl.addGeoSparqlPrefix(); prefixDecl.addOwlTimePrefix(); SparqlHelperConfig.getInstance().setDefaultPrefixDeclarations(prefixDecl); 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:
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#> PREFIX geo: <http://www.opengis.net/ont/geosparql#> PREFIX geof: <http://www.opengis.net/def/function/geosparql/> PREFIX sitac: <http://example.com/> PREFIX time: <http://www.w3.org/2006/time#> PREFIX unit: <http://qudt.org/vocab/unit#> PREFIX uom: <http://www.opengis.net/def/uom/OGC/1.0/#> SELECT ?zone WHERE { ?zone rdf:type sitac:TaskZone . ?zone sitac:isTasked "true" . }
VariableExpression varExpr = new VariableExpression("var"); FunctionExpression expression = new FunctionExpression("floor", varExpr); short functionType = expression.getFunction(); // function type will be FunctionTypes.FUNCTION_CUSTOMIf you set the SparqlHelperConfig.normalizeStandardFunctions(boolean normalize) method, then the built-in function will be defined by their id even if they are created by their names. For example:
SparqlHelperConfig.normalizeStandardFunctions(true); VariableExpression varExpr = new VariableExpression("var"); FunctionExpression expression = new FunctionExpression("floor", varExpr); short functionType = expression.getFunction(); // function type will be FunctionTypes.FLOOR
SparqlRequest request = new SparqlRequest("sitac"); request.addSelect("elt"); request.addType("elt", "Aircraft"); String query = request.getSPARQL();You will have the following result:
SELECT ?elt WHERE { ?elt rdf:type sitac:Aircraft . }But if you perform:
SparqlHelperConfig.getInstance().setIndentationValue(2); SparqlRequest request = new SparqlRequest("sitac"); request.addSelect("elt"); request.addType("elt", "Aircraft"); String query = request.getSPARQL();You will have the following result:
SELECT ?elt WHERE { ?elt rdf:type sitac:Aircraft . }
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