Resource Description Framework (RDF)
Resource Description Framework (RDF)
Resource Description Framework (RDF)
1
07/07/2017
RDF Components
3
An Introduction to Web Semantic Technologies
3
2
07/07/2017
3
07/07/2017
4
07/07/2017
(http://www.cit.gu.edu.au/~db,
http://www.mydomain.org/site-owner, #DavidBillington).
5
07/07/2017
(#DavidBillington, http://www.mydomain.org/uses,
http://www.cit.gu.edu.au/~arock/defeasible/Defeasible.cgi)
(http://www.cit.gu.edu.au/~arock/defeasible/Defeasible.cgi,
http://www.mydomain.org/site-owner, ‘‘Andrew Rock’’)
6
07/07/2017
<rdf:Description rdf:about="http://www.cit.gu.edu.au/~db">
<mydomain:site-owner rdf:resource="#DavidBillington"/>
</rdf:Description>
</rdf:RDF>
7
07/07/2017
RDF Statements
The combination of a Resource, a Property, and a
Property value forms a Statement (known as
the subject, predicate and object of a Statement).
These Statements are also known as Triples
(<http://…isbn…6682>, <http://…/original>, <http://…isbn…409X>)
8
07/07/2017
Resource Value
Property
Statement
9
07/07/2017
John Smith
page.html
Basic Example
John Smith
page.html
2-Nov- 20
An Introduction to Web Semantic Technologies
1998/swick 20
10
07/07/2017
<?xml version=“1.0”?>
<rdf:RDF
xmlns:rdf=“http://www.w3.org/TR/WD-rdf-syntax#”
xmlns:dc=“http://purl.org/metadata/dublin_core#”>
<rdf:Description about=“page.html”>
<dc:Creator>John Smith</dc:Creator>
<dc:Title>John’s Home Page</dc:Title>
</rdf:Description>
</rdf:RDF>
2-Nov- 21
An Introduction to Web Semantic Technologies
1998/swick 21
Structured Value
page.html
Creator
11
07/07/2017
page.html
dc:Creator
<?xml version=“1.0”?>
<RDF
xmlns=“http://www.w3.org/TR/WD-rdf-syntax#”
xmlns:dc=“http://purl.org/metadata/dublin_core#
”
xmlns:corp=“http://mycorp.com/corpSchema/”>
...
2-Nov- 24
An Introduction to Web Semantic Technologies
1998/swick 24
12
07/07/2017
2-Nov- 25
An Introduction to Web Semantic Technologies
1998/swick 25
Abbreviations: 1
<rdf:RDF>
<rdf:Description about=“page.html”>
<dc:Creator>
<rdf:Description
corp:Name=“John Smith”
corp:Email=“js@corp.com”
/>
</dc:Creator>
<dc:Title>John’s Home Page</dc:Title>
</rdf:Description>
</rdf:RDF>
2-Nov- 26
An Introduction to Web Semantic Technologies
1998/swick 26
13
07/07/2017
Abbreviations: 2
<rdf:RDF>
<rdf:Description about=“page.html”>
<dc:Creator
corp:Name=“John Smith”
corp:Email=“js@corp.com” />
<dc:Title>John’s Home Page</dc:Title>
</rdf:Description>
</rdf:RDF>
2-Nov- 27
An Introduction to Web Semantic Technologies
1998/swick 27
RDF:ABOUT/RDF:RESOURCE/RDF:ID
How do we introduce subject and object URIs in RDF/XML?
rdf:resource sets the object URI of a statement, once again either absolute or
relative.
rdf:ID sets the subject URI, but it can only be within this document. An ID can also
only be used once. Very like <a name=“anchor"> or id=“anchor" in html.
rdf:ID is discouraged since you can replace it with an rdf:about or rdf:resource with a
fragment #anchor and it can cause xml issues if you use the same id more than once.
That is, it's redundant and a potential source of errors.
14
07/07/2017
Reification
In RDF it is possible to make statements about
statements.
Example: Grigoris believes that David Billington is the
creator of the Web page
http://www.cit.gu.edu.au/∼db.
This kind of statement can be used to describe belief or
trust in other statements, which is important in some
kinds of applications.
The solution is to assign a unique identifier to each
statement, which can be used to refer to the
statement.
RDF allows this using a reification mechanism
Reification (Cont..)
Example: Let´s take the next Description
<rdf:Description rdf:about="949352">
<uni:name>Grigoris Antoniou</uni:name>
</rdf:Description>
15
07/07/2017
Meta-description
page.html $0.15
Cost
ValidUntil
18-Apr-2013
Property Reification
page.html $0.15
Cost
Subject
Object
type ValidUntil
Predicate
Statement 18-Apr-2013
Cost
16
07/07/2017
Meta-description Example - 1
<?xml version=“1.0”?>
<RDF
xmlns:rdf
=“http://www.w3.org/TR/WD-rdf-syntax#”
xmlns:corp
=“http://mycorp.com/schema/”>
...
2-Nov- 33
An Introduction to Web Semantic Technologies
1998/swick 33
Meta-description Example - 2
...
<rdf:Description about=“page.html”
bagID=“D_001”>
<corp:Cost>$0.15</corp:Cost>
</rdf:Description>
<rdf:Description aboutEach=“#D_001”>
<corp:ValidUntil>18-Apr-2013</corp:ValidUntil>
</rdf:Description>
</rdf:RDF>
2-Nov- 34
An Introduction to Web Semantic Technologies
1998/swick 34
17
07/07/2017
Meta-description Example - 3
<rdf:RDF>
<rdf:Description about=“page.html”
bagID=“D_001”
corp:Cost=“$0.15”/>
<rdf:Description aboutEach=“#D_001”
corp:ValidUntil=“18-Apr-1999”/>
</rdf:RDF>
2-Nov- 35
An Introduction to Web Semantic Technologies
1998/swick 35
Data Types
Programs need to know how to interpret a resource
Example, how to know that a literal represents an age:
(#DavidBillington, http://www.mydomain.org/age,
"27"^^http://www.w3.org/2001/XMLSchema#integer )
To define 2 categories (course and lecturer):
<rdf:Description rdf:about="CIT1111">
<rdf:type rdf:resource="&uni;course"/>
<uni:courseName>Discrete Mathematics</uni:courseName>
<uni:isTaughtBy rdf:resource="949318"/>
</rdf:Description>
<rdf:Description rdf:about="949318">
<rdf:type rdf:resource="&uni;lecturer"/>
<uni:name>David Billington</uni:name>
<uni:title>Associate Professor</uni:title>
</rdf:Description>
18
07/07/2017
<rdf:Description rdf:about="http://…/isbn/2020386682">
<f:titre xml:lang="fr">Le palais des mirroirs</f:titre>
<f:original rdf:resource="http://…/isbn/000651409X"/>
</rdf:Description>
<http://…/isbn/2020386682>
f:titre "Le palais des mirroirs"@fr ;
f:original <http://…/isbn/000651409X> .
19
07/07/2017
“Internal” nodes
Consider the following statement:
“the publisher is a «thing» that has a name and an
address (city)”
Until now, nodes were identified with a URI. But…
…what is the URI of «thing»?
London
a:publisher
http://…isbn/000651409X
Harper Collins
20
07/07/2017
<rdf:Description rdf:about="http://…/isbn/000651409X">
<a:publisher rdf:resource="urn:uuid:f60ffb40-307d-…"/>
</rdf:Description>
<rdf:Description rdf:about="urn:uuid:f60ffb40-307d-…">
<a:p_name>HarpersCollins</a:p_name>
<a:city>HarpersCollins</a:city>
</rdf:Description>
London
a:publisher
http://…isbn/000651409X
Harper Collins
21
07/07/2017
OWL
Ontology API
Work with models, RDFS and the Web Ontology Language (OWL) to add extra semantics to your RDF data.
Inference API
Reason over your data to expand and check the content of your triple store. Configure your own inference rules or use
the built-in OWL and RDFS reasoners.
22
07/07/2017
Jena example
// create a model
Model model=new ModelMem();
Resource subject=model.createResource("URI_of_Subject")
// 'in' refers to the input file
model.read(new InputStreamReader(in));
StmtIterator iter=model.listStatements(subject,null,null);
while(iter.hasNext()) {
st = iter.next();
p = st.getProperty();
o = st.getObject();
do_something(p,o);
}
*Exhibit: http://www.simile-widgets.org/exhibit/
An Introduction to Web Semantic Technologies
46
23
07/07/2017
24
07/07/2017
25
07/07/2017
26
07/07/2017
Classes, resources, …
Think of well known traditional vocabularies:
use the term “novel”
“every novel is a fiction”
“«The Glass Palace» is a novel”
etc.
RDFS defines resources and classes:
everything in RDF is a “resource”
“classes” are also resources, but…
…they are also a collection of possible resources (i.e.,
“individuals”)
“fiction”, “novel”, …
27
07/07/2017
rdf:type
http://…isbn/000651409X #Novel
Inferred properties
#Fiction
rdf:type
http://…isbn/000651409X #Novel
28
07/07/2017
If:
uuu rdfs:subClassOf xxx .
vvv rdf:type uuu .
Then add:
vvv rdf:type xxx .
Properties
Property is a special class (rdf:Property)
properties are also resources identified by URI-s
There is also a possibility for a “sub-property”
all resources bound by the “sub” are also bound by the
other
Range and domain of properties can be specified
i.e., what type of resources serve as object and subject
29
07/07/2017
:title
rdf:type rdf:Property;
rdfs:domain :Fiction;
rdfs:range rdfs:Literal.
30
07/07/2017
Literals
Literals may have a data type
floats, integers, booleans, etc, defined in XML Schemas
full XML fragments
(Natural) language can also be specified
<http://…/isbn/000651409X>
:page_number "543"^^xsd:integer ;
:publ_date "2000"^^xsd:gYear ;
:price "6.99"^^xsd:float .
31
07/07/2017
Simple approach
Write RDF/XML, RDFa, or Turtle “manually”
In some cases that is necessary, but it really does
not scale…
32
07/07/2017
33
07/07/2017
https://credible.i3s.unice.fr/lib/exe/fetch.php?media=credible-13-2-v1-rdb2rdf.pdf
34