Building Blocks of Linked Data
• Technological foundations
– Identifiers: URIs
– Data Model: RDF
– Terminology and Semantics: RDFS, OWL
People’s
Republic of
China
23,019,148
20,693,000
located in
population
capital
located in
population
Shanghai
Beijing
name
上海
located in
SJTU name "Shanghai Jiao Tong University"
SJTU located in Shanghai
SJTU
• Graph
• Triple
name
Shanghai
Jiao
Shanghai
name "上海"
Tong
University
Shanghai population
"23,019,148"
Shanghai located in People’s Republic of China
People’s Republic of China capital Beijing
Beijing located in People’s Republic of China
Beijing population "20,693,000"
RDF*
Subject
Predicate
Object
SJTU
located in
Shanghai
name
Shanghai
population "23,019,148"
Beijing
population "20,693,000"
Subject
Shanghai
"上海"
Predicate
Object
*Resource Description Framework
RDF – N-Triples Syntax
Subject
<sjtu>
Predicate
Object
<located_in> <shanghai> .
<shanghai> <name>
"\u4E0A\u6D77" .
<shanghai> <population> "23019148" .
<beijing>
Subject
<population> "20693000" .
Predicate
Object
http://www.w3.org/TR/rdf-testcases/#ntriples
RDF – Resources and Literals
Resource
<sjtu>
Resource
Resource
<located_in> <shanghai> .
<shanghai> <name>
"\u4E0A\u6D77" .
<shanghai> <population> "23019148" .
<beijing>
Resource
<population> "20693000" .
Resource
Literal
peoples_
republic_of
_china
23,019,148
20,693,000
located in
population
capital
located in
population
shanghai
beijing
name
上海
located in
sjtu
name
Shanghai Jiao Tong
University
Resources – URIs
URI
URI
URI
<sjtu> <located_in> <shanghai> .
<shanghai> <name>
"\u4E0A\u6D77" .
<shanghai> <population> "23019148" .
<beijing>
URI
<population> "20693000" .
URI
Use HTTP-URIs!
• sjtu, name, located_in: valid URIs, but no
scheme, no host, just a path
• any URI valid: ftp://files.nasa.gov, sjtu, urn:isbn:0451450523,
etc.
• but:
– RDF is datamodel for the Web
– Web is based on HTTP
– HTTP-URIs can be resolved, looked up
use HTTP-URIs: http://data.example.org/sjtu
Use HTTP-URIs!
<http://data.example.org/sjtu> <http://voc.example.org/located_in>
<http://data.example.org/shanghai> .
<http://data.example.org/shanghai> <http://voc.example.org/name>
"\u4E0A\u6D77" .
<http://data.example.org/shanghai> <http://voc.example.org/population>
"23019148" .
<http://data.example.org/beijing> <http://voc.example.org/population>
"20693000" .
Qualifying Literals
<shanghai> <name> "\u4E0A\u6D77”@zh .
<shanghai> <name> "Shanghai"@en .
<shanghai> <name> "Shang-hai”@ga .
language
<shanghai> <population>
"23019148"^^<http://www.w3.org/2001/XMLSchema#int> .
<beijing>
<population>
"20693000"^^<http://www.w3.org/2001/XMLSchema#int> .
<knud> <birthdate>
"1974-07-06"^^<http://www.w3.org/2001/XMLSchema#date> .
datatype
Named Graphs
• divide RDF graph in a dataset into several
subgraphs
• each subgraph labelled with a URI
• useful for keeping track of provenance,
timestamps, versioning, etc.
• not officially part of the standard, but widely
supported by tools (and by SPARQL, see
tomorrow)
RDF – Summary
• Graph data model for the Web
• Triples (or “statements”):
– <subject> <predicate> <object>
– (or <thing> <relationship> <thing>)
• Resources
– Things about which we want to make statements
– URIs (ideally HTTP URIs)
• Literals:
– Values like strings, numbers, dates, booleans, …
– Either language tag (zh, en, …) or XML Schema datatype
• Subjects and predicates are always resources
• Objects can be resources or literals
• Named Graphs (not standard): divide graph into subgraphs
RDF – Summary
• N-Triples Syntax:
– most basic RDF syntax; very verbose
– one triple per line
– line terminated with .
– resources (URIs) enclosed in < >
– literals enclosed in " "
– qualify literals with language tag: @zh
– or with datatype:
^^<http://www.w3.org/2001/XMLSchema#int>
http://www.w3.org/TR/rdf-testcases/#ntriples
Turtle Syntax
@prefix data: <http://data.example.org/> .
define prefixes
@prefix vocab: <http://voc.example.org/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
group triples with
same subject
data:shanghai
vocab:located_in data:peoples_republic_of_china ;
vocab:name "Shang-hai"@ga, "Shanghai"@en, "上海"@zh ;
vocab:population "23019148"^^xsd:int .
abbreviate URIs as CURIEs
data:sjtu
vocab:located_in data:shanghai ;
Unicode
group triples with
same subject,predicate
vocab:name "Shanghai Jiao Tong University"@en .
http://www.w3.org/TR/turtle/
CURIEs
• Compact URIs
• replace URI up to last element with prefix
http://www.w3.org/2001/XMLSchema#date
“namespace”
xsd
xsd:date
• define prefix in Turtle:
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
http://www.w3.org/TR/curie/
Turtle: Group Triples
• use ; to group triples with same subject
data:shanghai vocab:located_in data:peoples_republic_of_china .
data:shanghai vocab:name "Shang-hai"@ga .
data:shanghai vocab:name "Shanghai"@en .
data:shanghai vocab:name "上海"@zh .
data:shanghai vocab:population "23019148"^^xsd:int .
data:shanghai
vocab:located_in data:peoples_republic_of_china ;
vocab:name "Shang-hai"@ga ;
vocab:name "Shanghai"@en ;
vocab:name "上海"@zh ;
vocab:population "23019148"^^xsd:int .
Turtle: Group Triples
• use , to group triples with same
subject,predicate
data:shanghai vocab:name "Shang-hai"@ga .
data:shanghai vocab:name "Shanghai"@en .
data:shanghai vocab:name "上海"@zh .
data:shanghai vocab:name "Shang-hai"@ga, "Shanghai"@en, "上海"@zh .
Turtle - Summary
• human-readable, less verbose syntax
• Turtle is based on N-Triples
(N-Triples ⊆ Turtle)
• Unicode
• shorten URIs with CURIEs
• group triples with common elements
Other Syntaxes
• RDF/XML
– XML-based syntax
– still widely used, but less readable than Turtle
• RDFa
– RDF embedded in HTML, using element attributes
• JSON-LD
– JSON serialisation
• Named Graph Support: Trig (Turtle), Trix
(RDF/XML), N-Quads (N-Triples)
Vocabularies (Ontologies, Schemata)
• URIs are globally unique, so we can use globally
valid terminology
• necessary for
– data integration
– inferencing
• Vocabularies define
– properties to use as predicates
– classes to assign types to resources
• just like software libraries, vocabularies are data
libraries
Vocabularies: Examples
• FOAF (Friend of a Friend): People, Organisations,
Social Networks
• schema.org (Google, Yahoo!, Bing, Yandex):
cross-domain, what search engines are interested
in (people, events, products, locations)
• Dbpedia (Wikipedia as LOD): cross-domain
• Dublin Core (Bibliographic): publications,
authors, media, etc.
• Good Relations: business, products, etc.
http://www.explosm.net/comics/1589/
Where do Vocabularies Come from?
Defining Vocabularies
• RDF is self-describing (it’s “triples all the way
down”):
– RDF vocabularies are also defined in RDF
• special terms to define other terms
–
–
–
–
–
what is a relationship (“property”)?
what is a type of thing (“classes”)?
documentation
class and property hierarchies
other semantics
• from rdf, rdfs (RDF Schema) and owl (Web
Ontology Language) namespaces
FOAF Examples: Some Data
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix people: <http://data.example.org/people/> .
people:knud
a foaf:Person ;
foaf:name "Knud Möller"@de ;
foaf:knows people:victor .
people:victor
a foaf:Person ;
foaf:name "Victor de Boer"@nl ;
foaf:knows people:knud .
FOAF Examples: Classes
foaf:Person
a rdfs:Class, owl:Class ;
rdfs:label "Person" ;
rdfs:comment "A person." ;
owl:disjointWith foaf:Organization, foaf:Project ;
rdfs:subClassOf <http://www.w3.org/2000/10/swap/pim/contact#Person>,
<http://www.w3.org/2003/01/geo/wgs84_pos#SpatialThing>,
foaf:Agent ;
rdfs:isDefinedBy <http://xmlns.com/foaf/0.1/> .
FOAF Examples: Properties
foaf:name
a rdf:Property, owl:DatatypeProperty ;
rdfs:label "name" ;
rdfs:comment "A name for some thing." ;
rdfs:domain owl:Thing ;
rdfs:range rdfs:Literal ;
rdfs:subPropertyOf rdfs:label ;
rdfs:isDefinedBy <http://xmlns.com/foaf/0.1/> .
Some Terms to Define Terms
• rdf:type (or just a in Turtle)
– special property to say what kind of a thing ("class") a
resource is
• rdfs:label, rdfs:comment
– documentation for humans
• rdfs:Class, owl:Class
– this term is a class
• rdfs:Property, owl:DatatypeProperty,
owl:ObjectProperty
– this term is a property, special kind of property
Some Terms to Define Terms
• rdfs:subClassOf
– defining class hierarchies
• rdfs:subPropertyOf
– defining property hierarchies
• rdfs:definedBy
– where is this term defined, where can I get the
specification?
© Copyright 2026 Paperzz