Supplementary Material: Non-binary relations in RDF

Supplementary Material:
Non-binary relations in RDF
Wiltrud Kessler
Institut für Maschinelle Sprachverarbeitung
Universität Stuttgart
Semantic Web
This work is licensed under a Creative Commons
Attribution-NonCommercial-ShareAlike 3.0 Unported License.
http://creativecommons.org/licenses/by-nc-sa/3.0/
Why
Alternatives
Examples Yes
Examples No
The Semantic Web Stack
[W3C, Tim Berners-Lee]
Semantics
References
User Interface, Software Agents
Trust
Ontology, OWL
SPARQL
RDFS
RDF
Encryption
Logic, Rules
XML, XMLSchema, Namespaces
URI
Wiltrud Kessler
Digital Signatures
Proof
Unicode, UTF-8
Supplementary Material: Non-binary relations in RDF
2 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Outline
Why Empty Nodes
Alternative Representations
Examples with Empty Nodes
Examples without Empty Nodes
Empty Nodes and Semantics
References
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
3 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Outline
Why Empty Nodes
Alternative Representations
Examples with Empty Nodes
Examples without Empty Nodes
Empty Nodes and Semantics
References
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
4 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
What are Empty Nodes?
I
N-ary relations (relations with more than one object) cannot
be expressed directly in RDF.
I
An (empty) helper node has to be introduced.
I
Example: “John plays the violin in the orchestra OUS”.
ex:Violin
ex:plays
ex:instrument
ex:JohnSmith
ex:orchestra
ex:OUS
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
5 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Avoiding Problems 1
“John plays the violin in the orchestra OUS” and
“John plays the cello in the orchestra OO”
ex:Cello
ex:instrument
ex:Violin
ex:plays
ex:plays
ex:instrument
ex:JohnSmith
ex:orchestra
ex:orchestra
ex:OO
ex:OUS
We can easily distinguish what is played where.
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
6 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Avoiding Problems 2
“John plays the violin in the orchestra OUS” and
“A.N. Other plays the violin in the orchestra OO”
ex:Violin
ex:instrument
ex:plays
ex:instrument
ex:plays
ex:JohnSmith
ex:ANOther
ex:orchestra
ex:orchestra
ex:OUS
ex:OO
We can easily distinguish who plays what where.
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
7 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
We can add arbitrary many arguments
ex:Violin
ex:instrument
ex:OUS
ex:orchestra
ex:plays
ex:JohnSmith
ex:startDate
2012-02-15ˆˆxs:date
...
...
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
8 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
When do we need to use empty nodes?
I
A binary relation has additional properties
(e.g., text A is about the topic B with probability P).
I
Different aspects of the same relation need to be modeled
(e.g., Steve has a temperature, which is high, but falling).
I
More than two entities are linked by a relation
(e.g., John buys book A from store B for $15).
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
9 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
When do we NOT need to use empty nodes?
I
There seems to be one relation, but there are in fact several
(e.g., book A is written by persons X and Y).
I
A binary relation has additional properties, but these
properties can be retrieved from the individual relations or are
irrelevant for the domain and application
(e.g., Fred is one of three sons of Molly)
I
More than two entities are linked by a relation, but the
relation is guaranteed to occur only once
(e.g., Paul was born in X on date D)
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
10 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Tests for empty nodes
Tests to check whether we need to introduce an empty node for a
relation in our domain:
I
Can I get meaningful statements when separating the
individual parts (for all of them)?
I
What happens if an instance has more than one of the
relation, can I still distinguish what belongs together?
I
Do I need this level of detail for the information for my
domain and application?
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
11 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Outline
Why Empty Nodes
Alternative Representations
Examples with Empty Nodes
Examples without Empty Nodes
Empty Nodes and Semantics
References
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
12 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Alternative Representations
I
Empty nodes create problems in some applications and when
RDFS or OWL should be used.
I
We can represent the relation as a class rather than a property.
I
Create a new class to represent the concept of the relation.
Use an instance of this class to either
I
A directly replace the empty node, or
B be the subject in a list of statements where all participants in
the relation are objects.
I
Depending on the relation, using alternative A or B may be
more intuitive.
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
13 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Example: Reviews – with Empty Node
Andy writes a five-star review about movie X on 2015-11-04
containing the text “Awesome!”.
ex:FiveStars
ex:hasReviewStars
ex:hasReviewText “Awesome!”
ex:Andy
ex:writesReview
ex:hasReviewMovie
ex:MovieX
ex:hasReviewDate
2015-11-04
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
14 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Example: Reviews – Alternative A
Andy writes a five-star review about movie X on 2015-11-04
containing the text “Awesome!”.
ex:FiveStars
ex:hasReviewStars
“Awesome!”
ex:writesReview
ex:Andy
ex:Review12345
ex:hasReviewText
ex:hasReviewMovie
ex:MovieX
ex:hasReviewDate
2015-11-04
ex:Review12345 is an instance of the new class ex:Review that
represents the concept of an online movie review.
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
15 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Example: Reviews – Alternative B
Andy writes a five-star review about movie X on 2015-11-04
containing the text “Awesome!”.
ex:Andy
ex:hasReviewAuthor
ex:FiveStars
ex:hasReviewStars
ex:Review12345
ex:hasReviewText
ex:hasReviewMovie
“Awesome!”
ex:MovieX
ex:hasReviewDate
2015-11-04
ex:Review12345 is an instance of the new class ex:Review that
represents the concept of an online movie review.
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
16 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Outline
Why Empty Nodes
Alternative Representations
Examples with Empty Nodes
Examples without Empty Nodes
Empty Nodes and Semantics
References
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
17 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Example: Classification [W3C]
Text A is about the topic “China” with probability 0.9 according to
classifier X.
ex:China
ex:hasTopic
ex:hasTopicClassification
ex:TextA
ex:hasBeenClassifiedBy
ex:ClassifierX
ex:hasClassProbablity
0.9
We could separate “Text A is about China”, but no other
separation possible, especially if we allow multiple classification
results by different classifiers with different probabilities.
(“A classified by X” ?? “A has probability 0.9” ??)
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
18 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Example: Temparature [W3C]
Steve has temperature, which is high, but falling.
ex:High
ex:hasTempValue
ex:hasTemparature
ex:Steve
ex:hasTempTrend
ex:Falling
We could separate into two statements “Steve has high
temparature” and “Steve has temparature which is falling”, but
the two are linked and we loose the connection if we store them
separately, especially when several measurements are taken.
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
19 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Example: Temparature [W3C] – Alternative A
Steve has temperature, which is high, but falling.
ex:hasTempValue
ex:High
ex:hasTemparature
ex:Steve
ex:Observation12345
ex:hasTempTrend
ex:Falling
ex:Observation12345 is an instance of the new class
ex:TemperatureObservation that represents the concept of an
observation of a person’s temparature.
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
20 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Example: Purchases [W3C]
John buys a ”Lenny the Lion” book from books.example.com for
$15 as a birthday gift
ex:LennyTheLion
ex:hasObject
ex:books.example.com
ex:hasSeller
ex:buys
ex:John
ex:hasAmount
$15
ex:hasPurpose
ex:BirthdayGift
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
21 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Example: Purchases [W3C] – Alternative B
John buys a ”Lenny the Lion” book from books.example.com for
$15 as a birthday gift.
ex:John
ex:hasBuyer
ex:LennyTheLion
ex:hasObject
ex:hasSeller
ex:books.example.com
ex:Purchase12345
ex:hasAmount
$15
ex:hasPurpose
ex:BirthdayGift
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
22 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Example: Giving
Alice gives the book “The Truth about the Semantic Web”
(ex:SWTruth) to Bob?
ex:Bob
ex:recipient
ex:gives
ex:Alice
ex:item
ex:SWTruth
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
23 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Example: Mango Chutney [HKRS08, HKR09]
Mango Chutney contains 450 gram of green Mango.
ex:GreenMango
ex:ingredient
ex:MangoChutney
ex:hasIngredient
ex:amount
“450 gram”
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
24 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Example: Mango Chutney [HKRS08, HKR09]
Mango Chutney contains 450 gram of green Mango.
ex:GreenMango
ex:hasFoodItem
ex:MangoChutney
ex:hasIngredient
ex:hasAmount
450
ex:hasUnit
ex:Gram
We can add arbitrary many arguments to the relation.
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
25 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Example: Tennis
Steffi Graf won Wimbledon in 1995 and French Open in 1996.
ex:FrenchOpen
ex:Wimbledon
ex:event
ex:event
ex:won
ex:SteffiGraf
ex:won
ex:year
ex:year
1996
1995
We can easily know which event she won in which year,
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
26 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Outline
Why Empty Nodes
Alternative Representations
Examples with Empty Nodes
Examples without Empty Nodes
Empty Nodes and Semantics
References
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
27 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Example: Children
Molly has three sons, Ron, Fred and George?
ex:Fred
ex:hasSon
ex:Molly
ex:hasSon
ex:Ron
ex:hasSon
ex:George
Objects are independent of each other, separation possible: “Molly
has son Ron”, “Molly has son Fred”, “Molly has son George”. We
can get the information about the number of sons by counting how
many “has son” relations Molly has with other resources.
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
28 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Example: Authors
The book “Foundations of Semantic Web Technologies”
(SWFoundations) is written by Pascal Hitzler, Markus Krötzsch and
Sebastian Rudolph.
ex:Krötzsch
ex:hasAuthor
ex:SWFoundations
ex:hasAuthor
ex:Hitzler
ex:hasAuthor
ex:Rudolph
Objects are independent of each other, separation possible:
“Hitzler is author of SWFoundations”, . . .
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
29 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Example: Birth place and date
Johann Wolfgang von Goethe was born on August 28th, 1749 in
Frankfurt/Main.
ex:FrankfurtAmMain
ex:hasPlaceOfBirth
ex:Goethe
ex:hasDateOfBirth
1749-08-28
Even though the two things belong together, each one has
meaningful information on its own and there can never be two
relations of this type, so we don’t need to introduce an empty
node.
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
30 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Outline
Why Empty Nodes
Alternative Representations
Examples with Empty Nodes
Examples without Empty Nodes
Empty Nodes and Semantics
References
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
31 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Semantics
ex:Euro
ex:hasCurrency
ex:Pizza1234
ex:hasPrice
ex:hasAmount
I
Defining domain and range of the properties is problematic:
I
I
I
7.50
What is the range of ex:hasPrice?
What is the domain of ex:hasCurrency and ex:hasAmount?
We also would like to make sure that there can only be one
amount and currency.
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
32 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Semantics in RDFS (Domain and Range)
ex:hasCurrency
ex:Pizza1234
ex:hasPrice
es:Euro
ex:PriceExpression12334
ex:hasAmount
7.50
Introduce new class ex:PriceExpression:
ex:hasPrice Domain: ex:Pizza
Range: ex:PriceExpression
ex:hasCurrency Domain: ex:PriceExpression
Range: ex:Currency
ex:hasAmount Domain: ex:PriceExpression
Range: xs:Float
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
33 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Semantics in OWL (Restrictions)
I
Every instance of ex:PriceExpression can have only one
amount and one currency:
make ex:hasCurrency and ex:hasAmount functional.
I
Make sure there is a value for currency:
create a restriction on ex:PriceExpression
owl:onProperty ex:hasCurrency
owl:someValueFrom ex:Currency
I
Make sure there is a value for the amount:
create a restriction on ex:PriceExpression
owl:onProperty ex:hasAmount
owl:someValueFrom xs:float
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
34 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Outline
Why Empty Nodes
Alternative Representations
Examples with Empty Nodes
Examples without Empty Nodes
Empty Nodes and Semantics
References
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
35 / 36
Why
Alternatives
Examples Yes
Examples No
Semantics
References
Suggested Reading
[HKRS08] Pascal Hitzler, Markus Krötzsch, Sebastian Rudolph
and York Sure. Semantic Web. Grundlagen. Springer
textbook, 2008. (Chapter 3)
[HKR09] Pascal Hitzler, Markus Krötzsch and Sebastian Rudolph.
Foundations of Semantic Web Technologies. Chapman &
Hall/CRC, 2009. (Chapter 2)
[W3C] W3C Working Group. Defining N-ary Relations on the
Semantic Web. 2009.
http://www.w3.org/TR/swbp-n-aryRelations/
Wiltrud Kessler
Supplementary Material: Non-binary relations in RDF
36 / 36