This module adds RDF datatype extensions for ARQ constructs, such as queries, expressions and bindings. The main benefits are:

  • Syntax validation of appropriately typed RDF literals when parsing RDF data
  • Automatic mapping of RDF literals to the appropriate Java objects, e.g. Query query = (Query)rdfNode.asLiteral().getValue();

Maven Dependency

<dependency>
  <groupId>org.aksw.jenax</groupId>
  <artifactId>jenax-arq-plugins-datatype</artifactId>
</dependency>

Table

Type Implementation RDF Datatype IRI
Query
org.apache.jena.query.Query
org.aksw.jenax.arq.datatype.RDFDatatypeQuery http://jsa.aksw.org/dt/sparql/query
Binding
org.apache.jena.sparql.engine.binding.Binding
org.aksw.jenax.arq.datatype.RDFDatatypeBinding http://jsa.aksw.org/dt/sparql/binding
Expr
org.apache.jena.sparql.expr.Expr
org.aksw.jenax.arq.datatype.RDFDatatypeExpr http://jsa.aksw.org/dt/sparql/expr
ExprList
org.apache.jena.sparql.expr.ExprList
org.aksw.jenax.arq.datatype.RDFDatatypeExprList Used internally for the Binding datatype. No public IRI yet.
NodeList
org.aksw.jenax.arq.util.node.NodeList
org.aksw.jenax.arq.datatype.RDFDatatypeNodeList http://jsa.aksw.org/dt/sparql/array
Query
org.aksw.jenax.arq.util.node.NodeSet
org.aksw.jenax.arq.datatype.RDFDatatypeNodeSet http://jsa.aksw.org/dt/sparql/set

Example

@prefix eg:  <http://www.example.org/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xdt: <http://jsa.aksw.org/dt/sparql/> .

<urn:example:s>  eg:hasArray  "<http://www.w3.org/2000/01/rdf-schema#Class> <http://www.w3.org/2002/07/owl#Class>"^^rdf:array ;
        eg:hasBinding  "coalesce(( ?s = rdf:type ))"^^xdt:binding ;
        eg:hasExpr     "concat(\"foo\", ?bar)"^^xdt:expr ;
        eg:hasQuery    "SELECT  *\nWHERE\n  { ?s  ?p  ?o }\n"^^xdt:query ;
        eg:hasSet      "<http://www.w3.org/2000/01/rdf-schema#comment> <http://www.w3.org/2000/01/rdf-schema#label>"^^rdf:set .

Note: Currently array and set are in the rdf namespace. However, eventually they will be moved to the xdt namespace.