RDF Triple
Also RDF Triples
An RDF triple `subject predicate object .` is the single unit of data in RDF; a set of triples forms a knowledge graph, a directed graph with one node per entity and one predicate-labelled edge per triple.
Properties#
- Identifiers. Entities and predicates are named by IRIs (International Resource Identifiers): globally unique, URL-like, but Unicode characters (ä, ö, ü, …) are allowed. IRIs are often ID-like (
wd:Q37459= Nicole Kidman); human-readable names are attached by separate triples, e.g. withrdfs:label. - Literals. An object can be a literal instead of an IRI: a string with optional language tag (
"Nicole Kidman"@en) or a typed value ("1967-06-20"^^xsd:date). - Prefixes. Long IRIs are abbreviated by prefixes, e.g.
wd:=<http://www.wikidata.org/entity/>, sowd:Q18094=<http://www.wikidata.org/entity/Q18094>(see Wikidata Prefix System). - Schema-free. There is no fixed schema: any entity may have any predicate, and triples can share subjects, predicates and objects.
- Only binary relations. A triple relates exactly two things. Facts with more components (-ary relations, , e.g. award + year + film) need Reification.
- Interoperability. Two datasets are combined by adding a few triples that relate their IDs, e.g.
wd:Q183 wdtn:P402 osmrel:51477 .(Germany in Wikidata ↔ Germany in OpenStreetMap). This enables federated queries over several KGs, which is hard for relational databases with different schemas and identifiers. - Storage in a relational DB. A KG fits into one table
triples(subject, predicate, object), or into one two-column table per predicate; this is the basis of SPARQL to SQL Translation. - Large KGs: Wikidata (21 B triples, 62 k predicates), UniProt (240 B), PubChem (26 B), OpenStreetMap (202 B), DBLP (1.5 B).
Example#
<Nicole_Kidman> <acted_in> <Eyes_Wide_Shut> .
<Tom_Cruise> <acted_in> <Eyes_Wide_Shut> .
<Nicole_Kidman> <married_to> <Tom_Cruise> .
<Stanley_Kubrick> <directed> <Eyes_Wide_Shut> .
Four triples, four nodes (Nicole_Kidman, Tom_Cruise, Eyes_Wide_Shut, Stanley_Kubrick), four directed labelled edges; e.g. the edge Nicole_Kidman → Tom_Cruise carries the label married_to. Likewise, <Albert_Einstein> <born_in> <Ulm> ., <Albert_Einstein> <occupation> <Physicist> ., <Ulm> <country> <Germany> . give 4 nodes and 3 edges.
With entity IRIs and literals:
wd:Q37459 wdt:P19 wd:Q18094 . # Nicole Kidman, place of birth, Honolulu
wd:Q37459 wdt:P569 "1967-06-20"^^xsd:date . # date of birth (typed literal)
wd:Q37459 rdfs:label "Nicole Kidman"@en . # name (language-tagged literal)
Sources#
- Slides 07, p. 5–6 (RDF, KG as graph), p. 7 (IRIs), pp. 8–9 (large KGs), p. 11 (interoperability)
- DBIS_VL07 > Knowledge Graphs / RDF, DBIS_VL07 > IRIs, DBIS_VL07 > Interoperability