Library Version 12.1.3.0

Use SPARQL Construct
Prev | Chapter 7. Inference on an RDF Graph | Next

## Use SPARQL Construct

Take RDFS entailment rule rdfs2 for example (see http://www.w3.org/TR/rdf-mt/#RDFSRules for details). One can use the following code snippet to materialize the hidden relationships.

    String szConstruct =
          " PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>"
          + " PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> "
          + " CONSTRUCT   { ?x rdf:type ?c } "
          + "     WHERE   { ?x ?p ?y . ?p rdfs:domain ?c } " ;

After adding the above code snippet into the ExampleOntModel source code (after the triples insertion), the following can be found from the output.

    Rule execution results <ModelCom {http://sub/a @rdf:type http://C} | >

Prev | Up | Next
Chapter 7. Inference on an RDF Graph | Home | Use External Reasoner together with Jena APIs