Describing Web Resources in RDF: Grigoris Antoniou Frank Van Harmelen
Describing Web Resources in RDF: Grigoris Antoniou Frank Van Harmelen
Describing Web Resources in RDF: Grigoris Antoniou Frank Van Harmelen
Grigoris Antoniou
Frank van Harmelen
Chapter 3
Lecture Outline
1.
2.
3.
4.
5.
6.
7.
8.
Drawbacks of XML
Chapter 3
triple
It is called a statement
Sentence about Billington is such a statement
This syntax inherits the benefits of XML
Other syntactic representations of RDF possible
Chapter 3
resources
properties
statements
Chapter 3
Resources
We
Every
Properties
Properties
Properties
Statements
Statements
resources
A statement is an object-attribute-value triple
Values
Chapter 3
of a graph
A piece of XML code
Thus an RDF document can be viewed as:
A set of triples
A graph (semantic net)
An XML document
10
Chapter 3
Statements as Triples
(http://www.cit.gu.edu.au/~db,
http://www.mydomain.org/site-owner,
#David Billington)
The
11
Chapter 3
XML Vocabularies
A directed
Known
in AI as a semantic net
The value of a statement may be a resource
12
13
Chapter 3
14
15
Chapter 3
16
17
Chapter 3
Reification
In
Such
18
Reification (2)
Introduce
19
Data Types
Data
20
Chapter 3
XML
21
Example:
22
referee(X,Y,Z)
Chapter 3
We
23
introduce:
Chapter 3
24
25
Chapter 3
Using
26
Chapter 3
Lecture Outline
1.
2.
3.
4.
5.
6.
7.
8.
27
A namespace
28
mechanism is used
Disambiguation
Namespaces are expected to be RDF documents
defining resources that can be reused
Large, distributed collections of knowledge
Chapter 3
29
Chapter 3
30
Chapter 3
31
Chapter 3
Property Elements
Content
of rdf:Description elements
<rdf:Description rdf:about="CIT3116">
<uni:courseName>Knowledge
Representation</uni:courseName>
<uni:isTaughtBy>Grigoris Antoniou</uni:isTaughtBy>
</rdf:Description>
uni:courseName
32
read conjunctively
Chapter 3
Data Types
<rdf:Description rdf:about="949318">
<uni:name>David Billington</uni:name>
<uni:title>Associate Professor</uni:title>
<uni:age rdf:datatype="&xsd:integer">27<uni:age>
</rdf:Description>
33
Chapter 3
34
Chapter 3
36
Chapter 3
37
Chapter 3
38
Chapter 3
Nested Descriptions
Descriptions
descriptions
Other courses, such as CIT3112, can still
refer to the new resource with ID 949318
Although a description may be defined within
another description, its scope is global
39
Chapter 3
40
Chapter 3
Abbreviated Syntax
Simplification rules:
1.
2.
41
42
Chapter 3
43
Chapter 3
44
Chapter 3
Container Elements
Collect
45
Alternatively rdf:li
Chapter 3
46
Chapter 3
47
Chapter 3
48
Chapter 3
49
Chapter 3
RDF Collections
50
Shorthand syntax:
<rdf:Description rdf:about="#CIT2112">
<uni:isTaughtBy rdf:parseType="Collection">
<rdf:Description rdf:about="#949111"/>
<rdf:Description rdf:about="#949352"/>
<rdf:Description rdf:about="#949318"/>
</uni:isTaughtBy>
</rdf:Description>
51
Chapter 3
Reification
52
Chapter 3
Reification Example
<rdf:Description rdf:about="#949352">
<uni:name>Grigoris Antoniou</uni:name>
</rdf:Description>
reifies as
<rdf:Statement rdf:ID="StatementAbout949352">
<rdf:subject rdf:resource="#949352"/>
<rdf:predicate rdf:resource="http://www.mydomain.org/
uni-ns#name"/>
<rdf:object>Grigoris Antoniou</rdf:object>
</rdf:Statement>
53
Chapter 3
Reification (2)
54
Lecture Outline
1.
2.
3.
4.
5.
6.
7.
8.
55
56
57
58
As in programming languages
E.g. A+1, where A is an array
Disallow nonsense from being stated
Chapter 3
59
Class Hierarchies
60
Chapter 3
61
Chapter 3
62
Property Hierarchies
63
64
Chapter 3
65
Chapter 3
Lecture Outline
1.
2.
3.
4.
5.
6.
7.
8.
66
Lecture Outline
1.
2.
3.
Introduction
Detailed Description of XML
Structuring
a)
b)
4.
5.
6.
67
DTDs
XML Schema
Namespaces
Accessing, querying XML documents: XPath
Transformations: XSLT
Chapter 3
68
Core Classes
69
Chapter 3
Core Properties
70
71
Chapter 3
Examples
<rdfs:Class rdf:about="#lecturer">
<rdfs:subClassOf rdf:resource="#staffMember"/>
</rdfs:Class>
<rdf:Property rdf:ID="phone">
<rdfs:domain rdf:resource="#staffMember"/>
<rdfs:range rdf:resource="http://www.w3.org/
2000/01/rdf-schema#Literal"/>
</rdf:Property>
72
Chapter 3
73
Chapter 3
74
Utility Properties
75
Example: A University
<rdfs:Class rdf:ID="lecturer">
<rdfs:comment>
The class of lecturers. All lecturers are
academic staff members.
</rdfs:comment>
<rdfs:subClassOf
rdf:resource="#academicStaffMember"/>
</rdfs:Class>
76
Chapter 3
77
Chapter 3
78
Chapter 3
79
Chapter 3
Lecture Outline
1.
2.
3.
4.
5.
6.
7.
8.
80
81
Chapter 3
82
Chapter 3
83
Chapter 3
84
Chapter 3
The
85
rdfs:subClassOf
Lecture Outline
1.
2.
3.
4.
5.
6.
7.
8.
86
Axiomatic Semantics
87
The Approach
88
Function symbols:
Predicate symbols:
89
Basic Predicates
PropVal(P,R,V)
Type(R,T)
90
Type(?r,?t) PropVal(type,?r,?t)
Chapter 3
RDF Classes
Constants:
Type(Class,Class)
Type(Resource,Class)
Type(Property,Class)
Type(Literal,Class)
91
Chapter 3
Type(?p,Property) Type(?p,Resource)
Type(?c,Class) Type(?c,Resource)
92
PropVal(?p,?r,?v) Type(?p,Property)
Chapter 3
type is a property
PropVal(type,type,Property)
93
Chapter 3
it is a property, and
there are no x, y1 and y2 with P(x,y1), P(x,y2 ) and
y1y2
Type(?p, FuncProp)
(Type(?p, Property)
?r ?v1 ?v2
(PropVal(?p,?r,?v1)
PropVal(?p,?r,?v2) ?v1 = ?v2))
94
Chapter 3
Containers
Type(?c,Container) list(?c)
Type(?c,Container)
(Type(?c,Bag) Type(?c,Seq) Type(?c,Alt))
(Type(?x,Bag) Type(?x,Seq))
95
Chapter 3
Containers (2)
For every natural number n > 0, there is the selector
_n, which selects the nth element of a container
It is a functional property:
Type(_n,FuncProp)
It applies to containers only:
PropVal(_n,?c,?o) Type(?c,Container)
96
Chapter 3
Subclass
subClassOf is a property:
Type(subClassOf,Property)
PropVal(subClassOf,?c,?c')
(Type(?c,Class) Type(?c',Class)
?x (Type(?x,?c) Type(?x,?c')))
97
Chapter 3
Subproperty
Type(subPropertyOf,Property)
PropVal(subPropertyOf,?p,?p')
(Type(?p,Property) Type(?p',Property)
?r ?v (PropVal(?p,?r,?v)
PropVal(?p',?r,?v)))
98
Chapter 3
PropVal(domain,?p,?d)
?x ?y (PropVal(?p,?x,?y) Type(?x,?d))
PropVal(range,?p,?r)
?x ?y (PropVal(?p,?x,?y) Type(?y,?r))
99
Chapter 3
Lecture Outline
1.
2.
3.
4.
5.
6.
7.
8.
100
101
Chapter 3
102
Chapter 3
103
Chapter 3
Lecture Outline
1.
2.
3.
4.
5.
6.
7.
8.
104
105
Examples
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?c
WHERE
{
?c rdf:type rdfs:Class .
}
Retrieves all triple patterns, where:
-the property is rdf:type
-the object is rdfs:Class
Which means that it retrieves all classes
Examples (2)
Get all instances of a particular class (e.g. course) :
(declaration of rdf, rdfs prefixes omitted for brevity)
Using select-from-where
109
Implicit Join
110
Chapter 3
Explicit Join
SELECT ?n
WHERE
{
?x rdf:type uni:Course ;
uni:isTaughtBy :949352 .
?c uni:name ?n .
FILTER (?c = ?x) .
}
112
Chapter 3
Optional Patterns
<uni:lecturer rdf:about=949352>
<uni:name>Grigoris Antoniou</uni:name>
</uni:lecturer>
<uni:professor rdf:about=94318>
<uni:name>David Billington</uni:name>
<uni:email>david@work.example.org</uni:email>
</uni:professor>
113
Chapter 3
?name
David Billington
david@work.example.org
Grigoris
115
Chapter 3
116
Chapter 3
Grigoris Antoniou
David Billington
117
david@work.example.org
Chapter 3
Summary
118
Summary (2)
RDF is domain-independent
- RDF Schema provides a mechanism for describing specific
domains
119
120
Chapter 3