+
RDFS Semantics, Inference techniques and Sesame
Mariano Rodriguez-Muro, Free University of Bozen-Bolzano
+Disclaimer
License This work is licensed under a
Creative Commons Attribution-Share Alike 3.0 License (http://creativecommons.org/licenses/by-sa/3.0/)
+Reading material
Foundations of Semantic Web Chapter 3.
Semantic Web for the Working Ontologist. Chapter 8http://proquest.safaribooksonline.com/book/-/9780123859655
+Core concepts
Systems that perform inference are often called reasoning engines or reasoners.
Reasoner enginea system that infers new information based on the contents of a knowledgebase. This can be accomplished using rules and a rule engine, triggers on a database or RDF store, decision trees, tableau algorithms, or even programmatically using hard-coded business logic
A reasoner must be compliant to the semantics of the ontology language it supports
Hence, an ontology language must state it’s semantics in a formal way
+
Overview
Giving semantics to RDFS
Implementing semantics for RDFS
Using RDFS inference with Sesame
+RDFS rule-based semantics
+RDFS rule-based semantics
Example: Type propagation through rdfs:subClassOf described as a rule
Subclass transitivity as a rule
[IF] ?class1 rfds:subClassOf ?class2 AND ?instance rdf:type ?class1[THEN] ?instance rdf:type ?class2
[IF]?class1 rfds:subClassOf ?class2 AND ?class2 rfds:subClassOf ?class3 [THEN]?class1 rdf:type ?class3
+RDFS rule-based semantics
The RDFS specification defines RDFS semantics in terms of 26 rules grouped as follows: RDFS entailment rules core rules, simple “reasonable”
entailments (incomplete w.r.t. domain/range/subPropertyOf and subClassOf)
RDFS rdfsensional rules complete the rule set w.r.t. to domain/range/subPropertyOf and subClassOf
Datatype entailment rules covers inference related to datatype’s lexical forms
See http://www.w3.org/TR/rdf-mt/#rules
See Section 3.3 of Foundations of Semantic Web
+RDFS Entailment RulesName Condition Conclusion
rdfs1 uuu aaa lll.
where lll is a plain literal (with or without a language tag).
_:nnn rdf:type rdfs:Literal .
where _:nnn identifies a blank node allocated to lll by rule rule lg.
rdfs2 aaa rdfs:domain xxx .uuu aaa yyy .
uuu rdf:type xxx .
rdfs3 aaa rdfs:range xxx .uuu aaa vvv .
vvv rdf:type xxx .
rdfs4a uuu aaa xxx . uuu rdf:type rdfs:Resource .
rdfs4b uuu aaa vvv. vvv rdf:type rdfs:Resource .
rdfs5 uuu rdfs:subPropertyOf vvv .vvv rdfs:subPropertyOf xxx .
uuu rdfs:subPropertyOf xxx .
rdfs6 uuu rdf:type rdf:Property . uuu rdfs:subPropertyOf uuu .
rdfs7 aaa rdfs:subPropertyOf bbb .uuu aaa yyy .
uuu bbb yyy .
+RDFS Entailment Rules (cont.)Name
Condition Conclusion
rdfs8 uuu rdf:type rdfs:Class . uuu rdfs:subClassOf rdfs:Resource .
rdfs9 uuu rdfs:subClassOf xxx .vvv rdf:type uuu .
uuu rdf:type xxx .
rdfs10 uuu rdf:type rdfs:Class . uuu rdfs:subClassOf uuu .
rdfs11 uuu rdfs:subClassOf vvv .vvv rdfs:subClassOf xxx .
uuu rdfs:subClassOf xxx .
rdfs12 uuu rdf:type rdfs:ContainerMembershipProperty .
uuu rdfs:subPropertyOf rdfs:member .
rdfs13 uuu rdf:type rdfs:Datatype . uuu rdfs:subClassOf rdfs:Literal .
+RDFS extensional entailment rulesName Condition Conclusion
ext1 uuu rdfs:domain vvv .vvv rdfs:subClassOf zzz
uuu rdfs:domain zzz .
ext2 uuu rdfs:range vvv .vvv rdfs:subClassOf zzz .
uuu rdfs:range zzz .
ext3 uuu rdfs:domain vvv .www rdfs:subPropertyOf uuu .
www rdfs:domain vvv .
ext4 uuu rdfs:range vvv .www rdfs:subPropertyOf uuu .
www rdfs:range vvv .
ext5 rdf:type rdfs:subPropertyOf www .www rdfs:domain vvv .
rdfs:Resource rdfs:subClassOf vvv .
ext6 rdfs:subClassOf rdfs:subPropertyOf www .www rdfs:domain vvv .
rdfs:Class rdfs:subClassOf vvv .
ext7 rdfs:subPropertyOf rdfs:subPropertyOf www .www rdfs:domain vvv .
rdf:Property rdfs:subClassOf vvv .
ext8 rdfs:subClassOf rdfs:subPropertyOf www .www rdfs:range vvv .
rdfs:Class rdfs:subClassOf vvv .
ext9 rdfs:subPropertyOf rdfs:subPropertyOf www .www rdfs:range vvv .
rdf:Property rdfs:subClassOf vvv .
+Datatype entailment rules
Note, infinite number of rules!
Semantics by rules is easy to understand (most of them), but “hacky”
Name Condition Conclusion
rdfsD1 ddd rdf:type rdfs:Datatype .uuu aaa "sss"^^ddd .
_:nnn rdf:type ddd .
where _:nnn identifies a blank node allocated to "sss"^^ddd by rule rule lg.
rdfsD2 ddd rdf:type rdfs:Datatype .uuu aaa "sss"^^ddd .
uuu aaa "ttt"^^ddd
rdfsD3 ddd rdf:type rdfs:Datatype .eee rdf:type rdfs:Datatype .uuu aaa "sss"^^ddd .
uuu aaa "ttt"^^eee .
+Other semantics for RDFS
RDFS rule-based semantics are SYNTACTIC, easy to understand, implemented everywhere
Syntactic rules are prone to incompleteness (several passes were necessary to fix RDFS rule-based semantics)
Sometimes not-intuitive
RDFS also has model-theoretic semantics, clear semantics based on set theory
Won’t see them in this course, see Chapter 3 in Foundations of Semantic Web
+Rule-based inference
Basic idea, describe all mandatory inferences as rules.
A rule describes how new information based on the current state of the data/knowledge base.
IF a holds in the data Pre-condition
Then b holds in the data conclusion
Rule based inference cannot be used for ANY language., (key factors, non-determinism and termination)
They are enough to capture the semantics of RDFS
+Implementing RDFS semantics
+Implementing RDFS semantics
Most (really, almost all) reasoners that implement RDFS semantics use one (or both) of the following techniques Forward chaining
Deduction calculus for all the rules in the RDFS rules. Backward chaining
Looking for all possible facts from which we may derive the conclusion
+Forward chaining
Objective: Is fact X implied by the data?
How: Pre-compute all implied facts, then just check if fact X is there
How it works Works at “load” time Infers new facts based on the existing ones Continues applying inferences until reaching a fix point
(graphs are sets)
New facts are added “immediately” to the repository
Natural match to RDFS rule-based semantics
+Forward chaining
How it works Works at “load” time Infers new facts based on the existing ones Continues applying inferences until reaching a fix point
(graphs are sets)
New facts are added “immediately” to the repository
Natural match to RDFS rule-based semantics
Complex interactions in forward chaining
+Forward chaining, cons and pros
Pros Easy to implement Rules are already given by the RDFS rule-based semantics Retrieval is FAST (also query answering)
Cons Adds a lot of new information (maybe not necessary) Extra space Extra time Updates are VERY complicated (truth maintenance)
+Forward chaining (cont.)
+Forward chaining, cons and pros
Pros Easy to implement Rules are already given by the RDFS rule-based semantics Retrieval is FAST (also query answering)
Cons Adds a lot of new information (maybe not necessary) Extra space Extra time Updates are VERY complicated (truth maintenance)
Possible optimizations: application order, parallelism (often incomplete)
+Backward chaining
Objective: is fact X implied by the data?
How: Compute the facts that would be necessary for fact X to be implied, verify if any of those conditions is true.
+Forward chaining, cons and pros
Pros Easy to implement No data is generated, no extra loading time Simple update management or truth maintenance
Cons Retrieval is slower Fast query time may require complex optimization
techniques
Possible optimizations: caching, low level indexes
+Forward or Backward
Key aspects in deciding for forward or backward chaining: Loading time Query time Space constraints Updates
+Any other ways to implement with RDFS semantics
There are other, more efficient methods
Not implemented in common frameworks
More to come in this course
+RDFS reasoning in SesameEasy
+Sesame RDFS Sail
RDFS entailments are implemented using a SAIL
The sail is a ForwardChainingRDFSInferencer On load time it will perform forward chaining
+Sesame RDFS Sail
RDFS entailments are implemented using a SAIL
The sail is a ForwardChainingRDFSInferencer On load time it will perform forward chaining
+Setting it up
Create the repository of your choice and attach the sail
As with any forward chaining inference engine, load time will be affected by the use of this sail
Repository myRepository = new SailRepository( new ForwardChainingRDFSInferencer( new MemoryStore()));myRepository.initialize();
+Sesame RDFS in the console
In the console, simply create the pre-configured repos: in-memory-rdfs native-rdfs-types
+Sesame and reasoning
Sesame’s native support for inferences is poor, only RDFS
Performance is not great
Options on large scenarios: OWLIM