2. +
Disclaimer
License
This work is licensed under a
Creative Commons Attribution-Share Alike 3.0 License
(http://creativecommons.org/licenses/by-sa/3.0/)
3. +
Reading material
Foundations of Semantic Web Chapter 3.
Semantic Web for the Working Ontologist. Chapter 8
http://proquest.safaribooksonline.com/book/-/9780123859655
4. +
Core concepts
Systems that perform inference are often called reasoning
engines or reasoners.
Reasoner engine
a 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
5. +
Giving semantics to RDFS
Implementing semantics for RDFS
Overview
Using RDFS inference with Sesame
7. +
RDFS rule-based semantics
Example: Type propagation through rdfs:subClassOf described
as a rule
[IF]
?class1 rfds:subClassOf ?class2 AND ?instance rdf:type ?class1
[THEN]
?instance rdf:type ?class2
Subclass transitivity as a rule
[IF]
?class1 rfds:subClassOf ?class2 AND ?class2 rfds:subClassOf ?class3
[THEN]
?class1 rdf:type ?class3
8. +
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
9. RDFS Entailment Rules
+
Name
Condition
Conclusion
rdfs1
uuu aaa lll.
_:nnn rdf:type rdfs:Literal .
where lll is a plain literal
(with or without a language tag).
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 .
12. +
Datatype entailment rules
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 .
Note, infinite number of rules!
Semantics by rules is easy to understand (most of them), but
“hacky”
13. +
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
14. +
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
Then b holds in the data
Pre-condition
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
16. +
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
17. +
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
18. +
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
19. +
Forward chaining, cons and pros
Pros
Rules are already given by the RDFS rule-based semantics
Easy to implement
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)
21. +
Forward chaining, cons and pros
Pros
Cons
Easy to implement
Rules are already given by the RDFS rule-based semantics
Retrieval is FAST (also query answering)
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)
22. +
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.
23. +
Forward chaining, cons and pros
Pros
No data is generated, no extra loading time
Easy to implement
Simple update management or truth maintenance
Cons
Retrieval is slower
Fast query time may require complex optimization techniques
Possible optimizations: caching, low level indexes
24. +
Forward or Backward
Key aspects in deciding for forward
or backward chaining:
Loading time
Query time
Space constraints
Updates
25. +
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
27. +
Sesame RDFS Sail
RDFS entailments are implemented using a SAIL
The sail is a ForwardChainingRDFSInferencer
On load time it will perform forward chaining
28. +
Sesame RDFS Sail
RDFS entailments are implemented using a SAIL
The sail is a ForwardChainingRDFSInferencer
On load time it will perform forward chaining
29. +
Setting it up
Create the repository of your choice and attach the sail
Repository myRepository = new SailRepository(
new ForwardChainingRDFSInferencer(
new MemoryStore()));
myRepository.initialize();
As with any forward chaining inference engine, load time will be
affected by the use of this sail
30. +
Sesame RDFS in the console
In the console, simply create the pre-configured repos:
in-memory-rdfs
native-rdfs-types
31. +
Sesame and reasoning
Sesame’s native support for inferences is poor, only RDFS
Performance is not great
Options on large scenarios: OWLIM