Limited T-Box Inferencing in NEPOMUK's RDF store

We do inference during insert into the store. That means, all inferred data is already available when the data is inserted, and no inference is needed when querying data. That allows NEPOMUK to be very fast when users interact with it (reading) and a little slower when manipulating data. To keep the storage requirements low and to allow efficient inference (within milliseconds) on large datasets, we implement only TBox inferencing. So we infer the subclass and sub-property relations and also inverse triples. We do not infer instance relations and individual triples. When querying the pimo-service, you can rely on all subclass and subproperty and inverse relations. The missing Abox-related relations can be easily added.

Rules of thumb:

  • Instead of ?x rdf:type pimo:Person use ?x rdf:type ?t. ?t rdfs:subClassOf pimo:Person
  • Instead of ?x rdfs:label ?l use ?x ?p ?l. ?p rdfs:subPropertyOf rdfs:label

So, to interpret superproperties and superclasses, you must extend your queries. This does not change the semantics of the query, it will return the same result when run on a standard RDFS-inferencing store, so code written for NEPOMUK should run on other systems without change.

see also:

The rules used for inference the normal RDFS rules, but adding NRL inverse-relations and excluding some RDFS rules. The following facts are not inferred, for your reference:

THERE ARE NOT INFERRED IN NEPOMUK
[rdfs2:  (?x ?p ?y), (?p rdfs:domain ?c) -> (?x rdf:type ?c)]
[rdfs3:  (?x ?p ?y), (?p rdfs:range ?c) -> (?y rdf:type ?c)]
[rdfs6:  (?a ?p ?b), (?p rdfs:subPropertyOf ?q) -> (?a ?q ?b)]
[rdfs7b: (?a rdf:type rdfs:Class) -> (?a rdfs:subClassOf rdfs:Resource)]
[rdfs9:  (?x rdfs:subClassOf ?y), (?a rdf:type ?x) -> (?a rdf:type ?y)]
[rdfs10: (?x rdf:type rdfs:ContainerMembershipProperty) -> (?x rdfs:subPropertyOf rdfs:member)]

State of NRL Inference

The inference engine deployed in the NEPOMUK Java version does only support nrl:inverseProperty, but nothing else. No union-graphs, inference graphs, etc. This is called the CrappyInferencingSail?, meaning that it is fast, efficient, but not feature-complete:

There is a second, experimental, inference engine aiming towards supporting full NRL:

Additional triples inserted by the service

As we inference all subclass and sub-property relations, we lose the original super-class of a class and it is non-trivial to find it. So we decided to add additional helping triples that we find these assertions. As a hack, we invented two more properties in the NRL namespace for this reason:

  • the direct superclass of a class ?subclass <http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#directSubClassOf> ?superclass
  • the direct superproperty of a property ?subproperty <http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#directSubPropertyOf> ?superproperty

Querying with regards to limited TBox/ABox inference

To get all classes of all instances, use this SeRQL query:

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX nrl: <http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#>
PREFIX pimo: <http://www.semanticdesktop.org/ontologies/2007/11/01/pimo#>

SELECT ?x ?y WHERE {?x rdf:type ?t. ?t rdfs:subClassOf ?y.}

To get all instances of the class pimo:Person (including subclasses) use this:

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX nrl: <http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#>
PREFIX pimo: <http://www.semanticdesktop.org/ontologies/2007/11/01/pimo#>

SELECT ?x ?y WHERE {?x rdf:type ?t. ?t rdfs:subClassOf pimo:Person.}

To get all direct subclasses of Pimo:Thing, use this:

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX nrl: <http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#>
PREFIX pimo: <http://www.semanticdesktop.org/ontologies/2007/11/01/pimo#>

SELECT ?x WHERE {?x nrl:directSubClassOf pimo:Thing.}

To all values of a property including sub-properties. For example, all objects related to a thing:

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX nrl: <http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#>
PREFIX pimo: <http://www.semanticdesktop.org/ontologies/2007/11/01/pimo#>

SELECT ?y WHERE {?myresource ?p ?y. ?p rdfs:subPropertyOf pimo:objectProperty.}