(Note: click background or use left/right cursors to navigate this presentation. Home and End keys take you to the start/end)


To allow anyone to say anything about anything
A typical relational database table for books

The rows represent the things you are storing information about

The columns represent the properties or attributes of those things

The intersection gives the value of that property for that thing

the book has a title with value "Javascript"

the book has a title with value "Javascript"

subject has a property with value "value" (s,p,v)

This is the essence of RDF: the (s,p,v) triple

What about showing more properties

Equivilent to...

Publishers table: publisherID is primary key and exists as foreign key in Books table


Graphs can have named things - resources...

...and text values (literals)

...and numeric values (also literals)

...and named relations

...and unnamed things

...that can also be related to other things




Suppose you have a simple piece of information

Fetching the URL of the class returns RDF

If every thing that is a book is an artistic work then...

Another tiny piece of information

Fetching the URL of the property returns RDF

So we can infer the types of the subject and object



This is the end of the high level stuff...

<http://example.com/thing> <http://example.com/relation> "Some Text" .ex:thing ex:relation "Some Text" .ex:thing means concatenate http://example.com/ with thing to give http://example.com/thing@PREFIX ex: <http://example.com/> .
ex:thing ex:relation "Some Text" .
ex:thing ex:otherrelation ex:otherthing .
can be written as:
@PREFIX ex: <http://example.com/> .
ex:thing ex:relation "Some Text" ;
ex:otherrelation ex:otherthing .
Semicolon separates statements that differ in property and value
@PREFIX ex: <http://example.com/> .
ex:thing ex:relation "Some Text" .
ex:thing ex:relation ex:otherthing .
can be written as:
@PREFIX ex: <http://example.com/> .
ex:thing ex:relation "Some Text" ,
ex:otherthing .
Comma separates statements that differ in value only
@PREFIX ex: <http://example.com/> .
ex:thing ex:relation "Some Text" .
ex:thing ex:relation "Some Text" .
has same meaning as:
@PREFIX ex: <http://example.com/> .
ex:thing ex:relation "Some Text" .
@PREFIX ex: <http://example.com/> .
_:a ex:relation "Some Text" .
'a' is the label - valid only within a single document
if above triple appeared in another document it would refer to different node
@PREFIX ex: <http://example.com/> .
ex:thing ex:relation _:a .
_:a ex:property "foo" .
_:a ex:property "bar"
is same as
ex:thing ex:relation [
ex:property "foo" ;
ex:property "bar"
] .
In RDF, literals can have a language
Written in Turtle as:
@PREFIX ex: <http://example.com/> .
ex:thing ex:relation "Hello"@en .
ex:thing ex:relation "Bonjour"@fr .
In RDF, literals can have a datatype
Written in Turtle as:
@PREFIX ex: <http://example.com/> .
ex:thing ex:relation "49"^^<http://example.com/datatype> .
Can't have both a datatype and a language
@PREFIX dc: <http://purl.org/dc/elements/1.1/> .
@PREFIX foaf: <http://xmlns.com/foaf/0.1/ .
<http://www.talis.com/>
dc:title "Talis Information Ltd." ;
dc:description "The home page of Talis" ;
dc:publisher [
foaf:name "Talis"
] ;
dc:date "2005-08-01" .
Interpreted as... the resource denoted by the URI http://www.talis.com/ has a title ..., a description ..., was published by ...

'a' keyword is shorthand for the URI http://www.w3.org/1999/02/22-rdf-syntax-ns#type
@PREFIX dct: <http://purl.org/dc/terms/> .
_:x
a dct:Collection .
Same as
@PREFIX dct: <http://purl.org/dc/terms/> .
@PREFIX rdf: .
_:x
rdf:type dct:Collection .
Suppose we have this RDF schema:
@PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@PREFIX ex: <http://example.com/schema#> .
ex:Person a rdfs:Class .
ex:spouse a rdfs:Property .
We could use it like this:
@PREFIX ex: <http://example.com/schema#> .
_:fred
a ex:Person ;
ex:spouse _:wilma .
A query for all things with type ex:Person would return fred
ex:Person a rdfs:Class .
ex:spouse a rdfs:Property ;
rdfs:range ex:Person .
Now whenever we use the property ex:spouse we can infer that the value is a ex:Person
A query against the data will now return wilma as well.
We can simplify by adding a domain for the property
ex:Person a rdfs:Class .
ex:spouse a rdfs:Property ;
rdfs:range ex:Person .
rdfs:domain ex:Person .
Which lets us omit the type from our data - we can infer it instead
@PREFIX ex: <http://example.com/schema#> .
_:fred
ex:spouse _:wilma .
owl:InverseFunctionalProperty (IFP)


foaf:aimChatID,
foaf:homepage,
foaf:icqChatID,
foaf:isPrimaryTopicOf,
foaf:jabberID,
foaf:mbox,
foaf:msnChatID,
foaf:yahooChatID_:person foaf:isPrimaryTopicOf <http://en.wikipedia.org/wiki/Shakespeare> .
owl:cardinality (humans have exactly 2 parents)owl:minCardinality (cars have at least 3 wheels)owl:maxCardinality (silver support contracts allow a max of 5 calls)_:fred ex:spouse _:wilma ._:fred married to _:betty?_:fred ex:spouse _:wilma ._:fred ex:spouse _:betty .ex:spouse was one_:wilma and _:betty are the same individualTwo sons and two fathers went to a pizza restaurant. They ordered three pizzas. When they arrived, everyone had a whole pizza. How can that be?
This Turtle...
@PREFIX ex: <http://example.com/schema#> .
<http://example.com/house>
ex:title "a house" ;
ex:owner _:owner .
_:owner
a ex:Person ;
ex:name "Fred" .
Corresponds to this RDF/XML...
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ex="http://example.com/schema#" >
<rdf:Description rdf:about="http://example.com/house">
<ex:title>a house</ex:title>
<ex:owner rdf:nodeID="owner"/>
</rdf:Description>
<rdf:Description rdf:nodeID="owner">
<rdf:type rdf:resource="http://example.com/schema#Person"/>
<ex:name>Fred</ex:name>
</rdf:Description>
</rdf:RDF>
Class names can be used explicitly as xml elements.
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ex="http://example.com/schema#" >
<rdf:Description rdf:about="http://example.com/house">
<ex:title>a house</ex:title>
<ex:owner rdf:nodeID="owner"/>
</rdf:Description>
<ex:Person rdf:nodeID="owner">
<ex:name>Fred</ex:name>
</ex:Person>
</rdf:RDF>
Without blank node labels:
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ex="http://example.com/schema#" >
<rdf:Description rdf:about="http://example.com/house">
<ex:title>a house</ex:title>
<ex:owner>
<ex:Person>
<ex:name>Fred</ex:name>
</ex:Person>
</ex:owner>
</rdf:Description>
</rdf:RDF>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ex="http://example.com/schema#" >
<NODE rdf:about="http://example.com/house">
<PROPERTY>
<NODE>
<PROPERTY>Fred</PROPERTY>
</NODE>
</PROPERTY>
</NODE>
</rdf:RDF>
languages use xml:lang, datatypes use rdf:datatype
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ex="http://example.com/schema#" >
<rdf:Description rdf:about="http://example.com/house">
<ex:title xml:lang="en">a house</ex:title>
<ex:owner>
<ex:Person>
<ex:name
rdf:datatype="http://www.w3.org/2000/10/XMLSchema#string">Fred</ex:name>
</ex:Person>
</ex:owner>
</rdf:Description>
</rdf:RDF>
There are (too) many ways to write a single graph as RDF/XML - literals as attributes is one variation
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ex="http://example.com/schema#" >
<rdf:Description rdf:about="http://example.com/house" ex:title="a house">
<ex:owner>
<ex:Person ex:name="Fred" />
</ex:owner>
</rdf:Description>
</rdf:RDF>
First of all a robbery takes place. The robber drops his gun while fleeing. A report is filed by the investigating officers:
<RobberyEvent>
<date>14th June 2005</date>
<description>Armed robbery at Kwik-e-Mart</description>
<evidence>
<Gun>
<serial>983GTE-H5TF</serial>
</Gun>
</evidence>
<robber>
<Person /> <!-- an unknown person -->
</robber>
</RobberyEvent>
Subsequently a car is pulled over for speeding. The traffic officer files a report electronically while issuing a ticket:
<SpeedingOffence>
<date>26 October 2005</date>
<description>Car observed driving at speed along M42</description>
<speeder>
<Person>
<name>John Doe</name>
<driversLicenseNumber>7431224667</driversLicenseNumber>
</Person>
</speeder>
</SpeedingOffence>
At police HQ, the computer analyses each report as it is filed. The following OWL description tells the computer that a driversLicenseNumber is unique to a Person:
<owl:InverseFunctionalProperty rdf:ID="driversLicenseNumber">
<rdfs:domain rdf:resource="Person" />
<rdfs:range rdf:resource="&rdf;Literal" />
</owl:FunctionalProperty>
The computer uses this information to look up any other records it has about that person and finds a gun license:
<GunLicense>
<registeredGun>
<Gun>
<serial>983GTE-H5TF</serial>
</Gun>
</registeredGun>
<holder>
<Person>
<name>John Doe</name>
<driversLicenseNumber>7431224667</driversLicenseNumber>
</Person>
</holder>
</GunLicense>
The next OWL description tells the computer that the registeredGun property uniquely identifies a GunLicense. i.e. each gun is associated with only a single GunLicense
<owl:InverseFunctionalProperty rdf:ID="registeredGun">
<rdfs:domain rdf:resource="GunLicense" />
<rdfs:range rdf:resource="Gun" />
</owl:FunctionalProperty>
The computer now knows that the person stopped for speeding owns a gun. The next description tells the computer that each gun is uniquely identified by its serial.
<owl:InverseFunctionalProperty rdf:ID="serial">
<rdfs:domain rdf:resource="Gun" />
<rdfs:range rdf:resource="&rdf;Literal" />
</owl:FunctionalProperty>
The computer uses this to determine that the gun on the license is the same gun used in the robbery. This final description, seals the speeder's fate. It tells the computer that each GunLicense applies to only one gun and one person, so there is no doubt that the speeder is the person who owns the gun:
<owl:Class rdf:ID="GunLicense">
<owl:intersectionOf rdf:parseType="Collection">
<owl:Restriction>
<owl:onProperty rdf:resource="#registeredGun"/>
<owl:cardinality>1</owl:cardinality>
</owl:Restriction>
<owl:Restriction>
<owl:onProperty rdf:resource="#holder"/>
<owl:cardinality>1</owl:cardinality>
</owl:Restriction>
</owl:intersectionOf>
</owl:Class>
The computer reports back to the traffic cop who duly arrests the speeder on suspicion of armed robbery.

