1. "Golden Delicious"
"Elstar"
rdfs:label
el
"Conference"
:lab
bot:GoldenDelicious
rdfs
"Gala" "Fuji"
rdfs:l
el
abel bot:Elstar
:lab
bot:Gala
el
rdfs
b
:la "any edible part of a plant with a sweet flavor"
bot:Braeburn fs
bot:Apple rd
Conference bot:Fuji
l
labe
rdfs:
t
rdf
men
"Braeburn" "Fig"
s:la
:com
be
"Fruit"
l
rdfs:label
rdfs
"Pear" "Apple" l
: labe
rdfs
cul:Fruit
el bot:Fig
"Pommegranate"
l ab
s:
df :label
rdfs
bot:pomaceousFruit bot:accessoryFruit
bot:Pommegranate
"Structure of
label
el
ab
hinese Pear" "Fruit"
s:l
rdfs:
rdf
el
:lab
el lab
rdfs rdfs:
" #" "Pomaceous Fruit" "Accessory Fruit" bot:Fruit
bo bot:PlantStructure
bot:Strawberry t:c
el on
ab ta
l ins bot:N
bo
:
fs
t
t:p
rd
el
en
ar
:lab
Semantic Web mm
tO
gkeum
s
f
:co
rdf
:Seed
s
rd
rdf
fs: bot:Plant
la "Strawberry"
be
l
DON WILLEMS
RDF and Inferencing
"!"" bo
INTELLIGENT SYSTEMS ONTOLOGY LUNCH MEETING JUNE 14TH 2011
"the ovary of a seed-bearing plant"
WAGENINGEN UR/FOOD & BIOBASEDtOf
:par
RESEARCH
bot
bot:Tomato
2. based on:
Chapter 5 - RDF and Inferencing
Semantic Web for the Working Ontologist
Dean Allemang and Jim Hendler
ISBN 978-0-12-373556-0
3. Making Data Smarter
In the semantic web we have an integrated and
distributed representation of data
Modeling is needed to make sense of this network
of data
But how can a model help us make sense of this
network of data?
4. Example
bot:Fruit cul:Fruit
Suppose you find RDF
data concerning bot:accessoryFruit
bot:Kosui
How would you know bot:pomaceousFruit
that Kosui is a type of
fruit? bot:Pear
bot:EuropeanPear bot:ChinesePear
bot:Conference bot:DoyenneDuComice bot:BlakesPride bot:Forelle bot:Kosui bot:Shinko bot:Whangkeum
5. Example: Query
Solution 1: Leverage the power of the query:
SELECT ?super WHERE {{
bot:Kosui rdfs:subClassOf ?super.
} UNION {
bot:Kosui rdfs:subClassOf [rdfs:subClassOf ?super].
} UNION {
bot:Kosui rdfs:subClassOf [rdfs:subClassOf [rdfs:subClassOf ?super]].
} UNION {
bot:Kosui rdfs:subClassOf [rdfs:subClassOf [rdfs:subClassOf
[rdfs:subClassOf ?super]]].
} UNION {
bot:Kosui rdfs:subClassOf [rdfs:subClassOf [rdfs:subClassOf
[rdfs:subClassOf [rdfs:subClassOf ?super]]]].
} ...
}
6. Example: Query
Solution 1: Leverage the power of the query:
SELECT ?super WHERE {{
bot:Kosui rdfs:subClassOf ?super. ---> bot:ChinesePear
} UNION {
bot:Kosui rdfs:subClassOf [rdfs:subClassOf ?super].
} UNION {
bot:Kosui rdfs:subClassOf [rdfs:subClassOf [rdfs:subClassOf ?super]].
} UNION {
bot:Kosui rdfs:subClassOf [rdfs:subClassOf [rdfs:subClassOf
[rdfs:subClassOf ?super]]].
} UNION {
bot:Kosui rdfs:subClassOf [rdfs:subClassOf [rdfs:subClassOf
[rdfs:subClassOf [rdfs:subClassOf ?super]]]].
} ...
}
7. Example: Query
Solution 1: Leverage the power of the query:
SELECT ?super WHERE {{
bot:Kosui rdfs:subClassOf ?super.
} UNION {
bot:Kosui rdfs:subClassOf [rdfs:subClassOf ?super].---> bot:Pear
} UNION {
bot:Kosui rdfs:subClassOf [rdfs:subClassOf [rdfs:subClassOf ?super]].
} UNION {
bot:Kosui rdfs:subClassOf [rdfs:subClassOf [rdfs:subClassOf
[rdfs:subClassOf ?super]]].
} UNION {
bot:Kosui rdfs:subClassOf [rdfs:subClassOf [rdfs:subClassOf
[rdfs:subClassOf [rdfs:subClassOf ?super]]]].
} ...
}
8. Example: Query
Solution 1: Leverage the power of the query:
SELECT ?super WHERE {{
bot:Kosui rdfs:subClassOf ?super.
} UNION {
bot:Kosui rdfs:subClassOf [rdfs:subClassOf ?super].
} UNION {
bot:Kosui rdfs:subClassOf [rdfs:subClassOf [rdfs:subClassOf ?super]].
} UNION { ---> bot:pomaceousFruit
bot:Kosui rdfs:subClassOf [rdfs:subClassOf [rdfs:subClassOf
[rdfs:subClassOf ?super]]].
} UNION {
bot:Kosui rdfs:subClassOf [rdfs:subClassOf [rdfs:subClassOf
[rdfs:subClassOf [rdfs:subClassOf ?super]]]].
} ...
}
9. Example: Query
Solution 1: Leverage the power of the query:
SELECT ?super WHERE {{
bot:Kosui rdfs:subClassOf ?super.
} UNION {
bot:Kosui rdfs:subClassOf [rdfs:subClassOf ?super].
} UNION {
bot:Kosui rdfs:subClassOf [rdfs:subClassOf [rdfs:subClassOf ?super]].
} UNION {
bot:Kosui rdfs:subClassOf [rdfs:subClassOf [rdfs:subClassOf
[rdfs:subClassOf ?super]]].
} UNION {
---> bot:accessoryFruit
bot:Kosui rdfs:subClassOf [rdfs:subClassOf [rdfs:subClassOf
[rdfs:subClassOf [rdfs:subClassOf ?super]]]].
} ...
}
10. Example: Query
Solution 1: Leverage the power of the query:
SELECT ?super WHERE {{
bot:Kosui rdfs:subClassOf ?super.
} UNION {
bot:Kosui rdfs:subClassOf [rdfs:subClassOf ?super].
} UNION {
bot:Kosui rdfs:subClassOf [rdfs:subClassOf [rdfs:subClassOf ?super]].
} UNION {
bot:Kosui rdfs:subClassOf [rdfs:subClassOf [rdfs:subClassOf
[rdfs:subClassOf ?super]]].
} UNION {
bot:Kosui rdfs:subClassOf [rdfs:subClassOf [rdfs:subClassOf
[rdfs:subClassOf [rdfs:subClassOf ?super]]]].
} ...
}
---> bot:Fruit
---> cul:Fruit
11. Example: Inferencing
Solution 2: Inferencing
IF
IF ?A rdfs:subClassOf ?B.
?A rdfs:subClassOf ?super. AND
AND ?B rdfs:subClassOf ?C.
?x rdf:type ?A. THEN
THEN ?A rdfs:subClassOf ?C.
?x rdf:type ?super.
subclass-propagation
type-propagation rule
rule
12. Example: Inferencing
bot:Fruit cul:Fruit
IF
?A rdfs:subClassOf ?B.
bot:accessoryFruit
AND
?B rdfs:subClassOf ?C.
THEN
?A rdfs:subClassOf ?C.
bot:pomaceousFruit
bot:Pear
bot:EuropeanPear bot:ChinesePear
bot:Conference bot:DoyenneDuComice bot:BlakesPride bot:Forelle bot:Kosui bot:Shinko bot:Whangkeum
13. Example: Inferencing
bot:Fruit cul:Fruit
IF
?A rdfs:subClassOf ?B.
bot:accessoryFruit
AND
?B rdfs:subClassOf ?C.
THEN
?A rdfs:subClassOf ?C.
bot:pomaceousFruit
bot:Pear
bot:EuropeanPear bot:ChinesePear
bot:Conference bot:DoyenneDuComice bot:BlakesPride bot:Forelle bot:Kosui bot:Shinko bot:Whangkeum
14. Example: Inferencing
bot:Fruit cul:Fruit
IF
?A rdfs:subClassOf ?B.
bot:accessoryFruit
AND
?B rdfs:subClassOf ?C.
THEN
?A rdfs:subClassOf ?C.
bot:pomaceousFruit
bot:Pear
bot:EuropeanPear bot:ChinesePear
bot:Conference bot:DoyenneDuComice bot:BlakesPride bot:Forelle bot:Kosui bot:Shinko bot:Whangkeum
15. Example: Inferencing
bot:Fruit cul:Fruit
IF
?A rdfs:subClassOf ?B.
bot:accessoryFruit
AND
?B rdfs:subClassOf ?C.
THEN
?A rdfs:subClassOf ?C.
bot:pomaceousFruit
bot:Pear
bot:EuropeanPear bot:ChinesePear
bot:Conference bot:DoyenneDuComice bot:BlakesPride bot:Forelle bot:Kosui bot:Shinko bot:Whangkeum
16. Example: Inferencing
bot:Fruit cul:Fruit
IF
?A rdfs:subClassOf ?B.
AND bot:accessoryFruit
?B rdfs:subClassOf ?C.
THEN
?A rdfs:subClassOf ?C.
bot:pomaceousFruit
bot:Pear
bot:EuropeanPear bot:ChinesePear
bot:Conference bot:DoyenneDuComice bot:BlakesPride bot:Forelle bot:Kosui bot:Shinko bot:Whangkeum
17. Example: Inferencing
bot:Fruit cul:Fruit
IF
?A rdfs:subClassOf ?B.
AND bot:accessoryFruit
?B rdfs:subClassOf ?C.
THEN
?A rdfs:subClassOf ?C.
bot:pomaceousFruit
bot:Pear
bot:EuropeanPear bot:ChinesePear
bot:Conference bot:DoyenneDuComice bot:BlakesPride bot:Forelle bot:Kosui bot:Shinko bot:Whangkeum
18. Example: Inferencing
bot:Fruit cul:Fruit
How would you know bot:accessoryFruit
that Kosui is a type of
fruit?
bot:pomaceousFruit
Kosui is a subclass of
Fruit bot:Pear
bot:EuropeanPear bot:ChinesePear
bot:Conference bot:DoyenneDuComice bot:BlakesPride bot:Forelle bot:Kosui bot:Shinko bot:Whangkeum
19. Inferencing
bot:Fruit cul:Fruit
bot:accessoryFruit
Problem: Possible
explosion of the bot:pomaceousFruit
number of triples
bot:Pear
bot:EuropeanPear bot:ChinesePear
bot:Conference bot:DoyenneDuComice bot:BlakesPride bot:Forelle bot:Kosui bot:Shinko bot:Whangkeum
21. Inferencing:
asserted vs. inferred Triples
Think of inferencing and querying
Asserted Triples as separate processes
Inferred Triples 1. Use inference rules to find all
inferred triples using the
asserted triples as a conditional
2. Run SPARQL query over
asserted and inferred triples
22. Inferencing:
when does inferencing happen?
Out of range of the RDFS and OWL definitions
Depends on the implementation of the inference
engine
• As soon as a conditional pattern is identified,
inference happens and inferred triples are
stored in the same RDF store --> explosion
risk
• Never store inferred triples. Inference only
happens in response to a query --> duplicate
inference work
23. Inferencing:
change management
One problem (if inferred triples are stored) is
change management.
• What happens when a data source changes
• A triple is added --> inferencing
• A triple is removed/changed -->
• Which inferred triples need to be
removed?
24. Example:
change management
cul:Ingredient
State of triple store
before inference bot:Fruit cul:Vegetable
bot:Tomato
26. Example:
change management
cul:Ingredient
Apply subclass-
propagation rule
Resulting (inferred)
triple already exists bot:Fruit cul:Vegetable
and is not added
again
bot:Tomato
27. Example:
change management
cul:Ingredient
State of triple store
after inference bot:Fruit cul:Vegetable
bot:Tomato
28. Example:
change management
cul:Ingredient
Remove erroneous
triple
(not all Fruits (in a botanical
X
sense) are ingredients (in a
bot:Fruit cul:Vegetable
culinary sense).
bot:Tomato
29. Example:
change management
cul:Ingredient
Remove triples that
were inferred as a
result of the
existence of the
erroneous triple.
bot:Fruit
X cul:Vegetable
bot:Tomato
30. Example:
change management
State after triple cul:Ingredient
removal
Problem: The
inferred triple should
not have been bot:Fruit cul:Vegetable
removed because it
could have been
inferred using
another set of
bot:Tomato
conditionals
31. Example:
change management
State after triple cul:Ingredient
removal
Problem: The
inferred triple should
not have been bot:Fruit cul:Vegetable
removed because it
could have been
inferred using
another set of
bot:Tomato
conditionals
32. Example:
change management
Desired state after
triple removal cul:Ingredient
Two solutions:
1. Very complex
inference and bot:Fruit cul:Vegetable
change
management
2. Remove all inferred
triples and re-infer bot:Tomato
everything
33. Inferencing:
forward vs. backward chaining
Until now we used forward chaining as inference
method.
1. Find all existing triples that can be used as
condition (the IF part) in the inference rule.
2. Add a new triple specified in the result (THEN)
part of the inference rule.
This inference method is mostly used after (a) new
fact(s) are added to the triple store.
34. Inferencing:
forward vs. backward chaining
Backward chaining works the other way around.
1. Find all triples that can be seen as a result
(THEN part) of an inference rule.
cul:Ingredient
IF
?A rdfs:subClassOf ?B.
AND
bot:Fruit cul:Vegetable
?B rdfs:subClassOf ?C.
THEN
?A rdfs:subClassOf ?C.
bot:Tomato
35. Inferencing:
forward vs. backward chaining
Backward chaining works the other way around.
1. Find all triples that can be seen as a result
(THEN part) of an inference rule.
cul:Ingredient
IF
?A rdfs:subClassOf ?B.
AND
bot:Fruit cul:Vegetable
?B rdfs:subClassOf ?C.
THEN
?A rdfs:subClassOf ?C.
bot:Tomato
36. Inferencing:
forward vs. backward chaining
Backward chaining works the other way around.
2. If the triple(s) in the condition do not yet exist
try to fulfill the condition by other means (ask
the user)
Is cul:Vegetable Is Fruit
a subclass a subclass
cul:Ingredient cul:Ingredient
of cul:Ingredient? of cul:Ingredient?
? ?
bot:Fruit cul:Vegetable bot:Fruit cul:Vegetable
bot:Tomato bot:Tomato
37. Inferencing:
forward vs. backward chaining
Backward chaining works the other way around.
3. If the condition is fulfilled add the inferred triple
(defined in the condition) to the triple store.
cul:Ingredient
NO YES
bot:Fruit cul:Vegetable
bot:Tomato
38. Conclusion
• We want to be able to write a single query that
can fetch related data from all integrated data
sources.
• RDF provides a consistent way to represent data
so that information from multiple sources can
be brought together.
• Information integration is achieved by invoking
inference before or during the query process.