Creating Knowledge Graphs

Wouter Beek (

Core conceptual content
Core technical content


  1. Names
  2. Triples
  3. Graphs

Part 1: Names

Throughout history, in human communication, in databases, in research literature, in spreadsheets, on the Internet, names have always been ambiguous.

An example of ambiguity

What does ‘40’ mean?
“40 feet?”
“40 meters?”

Another example of ambiguity

Who or what is ‘Mew’?

In a Knowledge Graph, names must be unambiguous

Names (1/2): IRIs

Globally unique & unambiguous names.

‘Mew’ the Pokemon
‘Mew’ the band

Names (2/2): Literals

Some things are not easily expressed with IRIs.

Natural language
あらゆる わざを つかうため ポケモンの せんぞと かんがえる がくしゃが たくさん いる。
0.333333; 1,000,000,000; etc.

Syntax for names

  • IRI
  • Literal
    • Typed literal
    • Language-tagged string

Short syntax for names (1/2): IRIs

Full IRI


Prefix declaration

prefix id: <>

Short IRI


Short syntax for names (2/2): Literals

Full literal


Prefix declaration

prefix xsd: <>

Short literal


Difference between URI, URL, IRI

Universal Resource Identifier (URI)
A universal identifier for a specific resource.
Universal Resource Locator (URL)
A URI that works (dereferences).
International Resource Identifier (IRI)
URI with Unicode support
prefix : <>
prefix foaf: <>
prefix graph: <>
prefix id: <>
prefix rdf: <>
prefix time: <>
prefix vocab: <>
prefix void: <>
prefix xsd: <>
In the following, we will assume these prefix declarations.

Part 2: Triples

By combining names, we can express meaning.

The smallest unit of meaning in a Knowledge Graph is called a ‘triple’

Semantics of a triple

“Pikachu knows Mew.”

Syntax of a triple

“Pikachu knows Mew.”
id:pikachu foaf:knows id:mew.


id:pikachu foaf:knows id:mew.


  • Subject (id:pikachu)
  • Predicate (foaf:knows)
  • Object (id:mew)


  • Nodes (id:pikachu and id:mew)
  • Predicate (foaf:knows)

Part 3: Graphs


A collection of zero or more triples.

A graph with 1 triple



id:pikachu foaf:knows id:mew.

A graph with 3 triples

id:pikachu foaf:knows   id:mew.
id:pikachu vocab:name   "ピカチュウ"@ja.
id:pikachu vocab:weight "60"^^xsd:integer.

Short Syntax for triples (1/2)

:s :p :o1;
   :q :o2,
:s :p :o1.
:s :q :o2.
:s :q :o3.
Dot (.)
Regular end of triple symbol.
Semicolon (;)
The next triple uses the same subject term (:s).
Comma (,)
The next triple uses the same subject and predicate terms (:s :q).

Short syntax for triples (2/2)

:s :p 60,
:s :p "60"^^xsd:integer.
:s :p "60.0"^^xsd:decimal.
:s :p "6.0e2"^^xsd:double,
:s :p "6"^^xsd:string.
  • Whole numbers (60) have datatype IRI xsd:integer.
  • Numbers with a decimal separator (60.0) have datatype IRI xsd:decimal.
  • Numbers with decimal separator ánd engineering notation (6.0e2) have datatype IRI xsd:double.
  • Strings ("6") have datatype IRI xsd:string.

A graph with 3 triples (short syntax)

id:pikachu foaf:knows   id:mew;
           vocab:name   "ピカチュウ"@ja;
           vocab:weight 60.

A graph with 5 triples (short syntax)

id:mew     vocab:name   "ミュウ"@ja;
           vocab:weight 40.
id:pikachu foaf:knows   id:mew;
           vocab:name   "ピカチュウ"@ja;
           vocab:weight 60.

Thank you for your attention!