KG02 Basic Knowledge Graph Infrastructure
KG02 Basic Knowledge Graph Infrastructure
02-01
How to Identify and Access Things?
02: Basic Knowledge Graph Infrastructure
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
3
What is this?
Semiotic Triangle
Shared
Concept
Concept is a substitute of
Symbolizes Refers to
A Resource can be every object with a clear identity (according to the context of the application)
as e.g., web pages, books, locations, persons, relations among objects, abstract concepts, etc.
URL vs URI
URL URI
Identifies Identifies
what exists on the web
on the web what exists
http://www.imranihsan.com http://www.au.edu.pk/faculty_foaf.rd#me
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
7
HTML communication
HTTP
WEB
reference address
URI
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
8
??
https://www.xyz.org/apple
https://www.xyz.org/سیب
https://www.xyz.org/pomme
https://www.xyz.org/苹果
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
9
??
https://www.wikidata.org/entity/Q312
https://www.wikidata.org/entity/Q89
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
10
Identification vs Lexicalization
rdfs:label
wd:Q89 “apple”@en
rdfs:label
“@”سیبur
rdfs:label
“pomme”@fr
rdfs:label
“苹果”@cn
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
11
HTML communication
HTTP
WEB
reference address
URI
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
15
RDF communication
HTTP
WEB
OF DATA
reference address
URI
Knowledge Graphs for Explainable AI
16
02-01
How to Represent Simple Facts with RDF?
02: Basic Knowledge Graph Infrastructure
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
17
N-Triple Serialization
<http://dbpedia.org/resource/Spock> <http://dbpedia.org/property/origin> <http://dbpedia.org/resource/Vulcan>
Graph Representation
http://dbpedia.org/property/origin
http://dbpedia.org/resource/Spock http://dbpedia.org/resource/Vulcan
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
19
http://dbpedia.org/property/affiliation
http://dbpedia.org/resource/Starfleet
http://www.w3.org/2000/01/rdf-schema#label
“Spock”@en
http://dbpedia.org/property/origin
http://dbpedia.org/resource/Spock http://dbpedia.org/resource/Vulcan_(Star_Trek)
http://dbpedia.org/resource/Lennord_Nimoy
http://dbpedia.org/ontology/portrayer
http://dbpedia.org/resource/Zachary_Quinto
http://dbpedia.org/ontology/portrayer
http://dbpedia.org/ontology/portrayer http://dbpedia.org/resource/Ethen_Peck
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
20
Literal
“Spock”@en
http://www.w3.org/2000/01/rdf-schema#label
http://dbpedia.org/property/origin
http://dbpedia.org/resource/Spock http://dbpedia.org/resource/Vulcan
Entity
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
21
Examples:
“Semantics” ^ ^<http://www.w3.org/2001/XMLSchema#string>
“1161.00” ^ ^<http://www.w3.org/2001/XMLSchema#float>
“2015-08-02” ^ ^<http://www.w3.org/2001/XMLSchema#date>
Blank Node
http://dbpedia.org/property/origin
http://dbpedia.org/resource/Vulcan_(Star_Trek)
Cannot be
referenced
externally http://dbpedia.org/resource/Lenord_Nimoy
http://dbpedia.org/ontology/portrayer
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
23
RDF Serializations
RDF comes with several different serialization formats:
N-Triples, RDF/XML, JSON-LD, Turtle, N-Quads, RDFa, Notation3, HexTuples...
HDT RDFa
JSON-LD
02-03
RDF Turtle Serialization
02: Basic Knowledge Graph Infrastructure
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
26
N-Triples Serialization
“Spock”@en
http://www.w3.org/2000/01/rdf-schema#label
http://dbpedia.org/property/origin
http://dbpedia.org/resource/Spock http://dbpedia.org/resource/Vulcan
N-Triples Notation
URIs/IRIs in angle brackets
Literals in quotation marks
Triple ends with a period
.
N-Triples Serialization
<http://dbpedia.org/resource/Spock> <http://www.w3.org/2000/01/rdf-schema#label> “Spock”@en .
<http://dbpedia.org/resource/Spock> <http://dbpedia.org/property/origin> <http://dbpedia.org/resource/Vulcan> .
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
27
N-Triples Serialization
“Spock”@en
http://www.w3.org/2000/01/rdf-schema#label
http://dbpedia.org/property/origin
http://dbpedia.org/resource/Spock http://dbpedia.org/resource/Vulcan _(Star_Trek)
N-Triples Serialization
“Spock”@en
http://www.w3.org/2000/01/rdf-schema#label
http://dbpedia.org/property/origin
http://dbpedia.org/resource/Spock http://dbpedia.org/resource/Vulcan _(Star_Trek)
@base directive
<Spock> rdfs:label "Spock"@en . provides URI to complement all relative URIs
<Spock> dbp:origin <Vulcan_(Star_Trek)> .
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
29
N-Triples Serialization
“Spock”@en
http://www.w3.org/2000/01/rdf-schema#label
http://dbpedia.org/property/origin
http://dbpedia.org/resource/Spock http://dbpedia.org/resource/Vulcan _(Star_Trek)
N-Triples Serialization
http://dbpedia.org/ontology/portrayer
http://dbpedia.org/resource/Lennord_Nimoy
http://dbpedia.org/ontology/portrayer
http://dbpedia.org/resource/Spock http://dbpedia.org/resource/Zachary_Quinto
http://dbpedia.org/ontology/portrayer
http://dbpedia.org/resource/Ethen_Peck
Further RDF abbreviations with Turtle
N-Triples Serialization
http://dbpedia.org/ontology/birthdate http://www.w3.org/2000/01/rdf-schema#label
“1931-03-26” ^ ^xsd:date “Spock”@en
http://dbpedia.org/resource/Spock
N-Triples Serialization
dbp:position
dbr:Spock “First Officer”@en
dbp:startDate
“2265-01-01” ^ ^xsd: gYear
dbp:startDate
“2287-01-01” ^ ^xsd:gYear
dbp:vessel
dbr:USS_Enterprise_(NCC-1701)
dbp:vessel
dbr:USS_Enterprise_(NCC-1701)-A
N-ary Relations
Spock had different deployments in the Star Trek universe
How to model this in RDF?
Problem: unique association
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
33
dbp:startDate
“2265-01-01” ^ ^xsd: gYear
dbp:deployment dbp:vessel
dbr:USS_Enterprise_(NCC-1701)
dbr:Spock
dbp:position
“First Officer”@en
dbp:deployment
dbp:startDate
“2287-01-01” ^ ^xsd: gYear
dbp:vessel
dbr:USS_Enterprise_(NCC-1701)-A
N-ary Relations
Blank Nodes (Bnodes) can be introduced to represent multivalued relationships.
Blank Nodes can be introduced for resources that don’t need a name (auxiliary nodes).
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
34
dbp:startDate
“2265-01-01” ^ ^xsd: gYear
dbp:vessel
dbr:USS_Enterprise_(NCC-1701)
dbp:startDate
“2265-01-01” ^ ^xsd: gYear
dbp:deployment dbp:vessel
dbr:USS_Enterprise_(NCC-1701)
dbp:startDate
_:ID1 “2265-01-01” ^ ^xsd: gYear
dbp:deployment dbp:vessel
@prefix dbo: <http://dbpedia.org/ontology/> . dbr:USS_Enterprise_(NCC-1701)
dbp:vessel
dbr:USS_Enterprise_(NCC-1701)-A
_:ID1 dbp:position "First Officer/ Science Officer"@en ;
dbp:startDate "2265-01-01“ ^ ^xsd:gYear ;
dbp:vessel dbr:USS_Enterprise_(NCC-1701) .
dereferenceable blank nodes
_:ID2 dbp:position "First Officer/ Science Officer"@en ; can only be referenced from
dbp:startDate "2287-01-01“ ^ ^xsd:gYear ; inside a document / graph
dbp:vessel dbr:USS_Enterprise_(NCC-1701)-A .
Knowledge Graphs for Explainable AI
37
02-04
Vocabularies and Model Building with RDFS
02: Basic Knowledge Graph Infrastructure
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
38
http://dbpedia.org/property/origin
http://dbpedia.org/resource/Spock http://dbpedia.org/resource/Vulcan_(Star_Trek)
something which can be uniquely identified via the URI something which can be uniquely identified via the URI
http://dbpedia.org/resource/Spock http://dbpedia.org/resource/ Vulcan_(Star_Trek)
but the URI for the same resource could also be but the URI for the same resource could also be
http://wikidata.org/entity/Q16341 http://wikidata.org/entity/Q1088708
RDF Schema
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
40
A schema is a formal description of the high-level structure of a dataset that may be used
for a variety of purposes, including managing, storing, indexing, querying, validating, and/or
reasoning over a dataset.
A semantic schema is a schema that allows for defining the meaning of high-level terms
(aka vocabulary or terminology), which facilitates reasoning over graphs using those terms.
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
41
:firstName
:person xsd:string
semi-formal description
:familyName
Person xsd:string
• firstName <string> :birthDate
• familyName <string>
xsd:date
• birthDate <date> :birthPlace
• birthPlace <location>
• address <string> :location
• …
:address xsd:string
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
42
rdf:type :firstName
:LeonardNimoy :person xsd:string
:familyName
xsd:string
:birthDate
xsd:date
:birthPlace
:location
:address xsd:string
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
43
LeonardNimoy ∈ Perosn
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
44
Definition of property restrictions on domain and range via rdfs:domain and rdfs:range
Example
:Person rdf:type rdfs:Class .
:Occupation rdf:type rdfs:Class .
:profession rdf:type rdf:Property .
:profession rdfs:domain :Person .
:profession rdfs:range :Occupation .
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
45
Example:
:Scientist rdfs:subClassOf :Occupation .
Scientist ⊆ Occupation
:occupation
:scientist
Semantics of rdfs:subClassOf (denoted as “⊆”):
x x
∀A,B: Classes, a: Instance,
A ⊆ B (a ∈ A → a ∈ B)
i.e., ∀a,A,B: T(a, rdf:type, A) ∧ T(A, rdfs:subClassOf, B) → T(a, rdf:type, B) :scienceOfficer
:scientificAssistant
Example:
:firstName rdfs:subPropertyOf :name .
subProperty superProperty
rdfs:seeAlso
defines a relation of a resource to another, which explains it
rdfs:isDefinedBy
subproperty of rdfs:seeAlso, defines the relation of a resource to its definition
rdfs:comment
Semantics of rdfs:seeAlso, rdfs:isDefinedBy, rdfs:comment, rdfs:label
comment, usually as text
is only denoted via natural language definitions,
rdfs:label
“readable” name of a resource (contrary to ID)
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
49
RDF Schema
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix : <http://example.org/KG2023#> .
:Person rdf:type rdfs:Class .
:FictionalCharacter rdf:type rdfs:Class .
T – BOX
Datasets that agree on vocabularies are better integrable since they “speak the same language”.
Naming convention:
Classes are given upper case singular names
(:Occupation, :Person, :FictionalCharacter, …)
Properties are given lower case singular names
(:profession, :birthPlace, :birthDate, …)
Knowledge Graphs for Explainable AI
51
02-05
RDF Complex Data Structures
02: Basic Knowledge Graph Infrastructure
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
52
RDF Lists
General data structures to enumerate any resources or literals and to introduce an
ordering. No new semantics, just “syntactic sugar”.
Distinguish between:
Container open list, i.e. extension (new entries) possible
Collection closed list, i.e. no extension possible
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
53
rdf:_2
defines the type of container, e.g. :starTrekTVSeriee :TheAnimatdSeries
Bag - unordered set
:contains rdf:_3
Seq - ordered set :TheNextGeneration
Alt - alternatives
:DeepSpace9
rdf:type rdf:_4
rdf:Bag
:Voyager
rdf:_5
@prefix : <http://example.org/KG2024#> .
rdf:_2
:starTrekTVSeriee :TheAnimatdSeries
:StarTrekTVSeries :contains [
:contains rdf:_3
a rdf:Bag ; :TheNextGeneration
rdf:_1 :TheOriginalSeries ;
rdf:_2 :TheAnimatedSeries ; :DeepSpace9
rdf:type rdf:_4
rdf:_3 :TheNextGeneration ;
rdf:_4 :DeepSpace9 ; rdf:Bag
:Voyager
rdf:_5 :Voyager ; rdf:_5
RDF Datasets
Sometimes it is beneficial to keep data in separate RDF graphs, e.g.,
data from different sources (of different trustworthiness or accuracy),
the same data, but from different points in time,
etc.
st1:distributor
st1:ElPaso st1:MBC
:portrayer st2:createdBy
:Spock :LeonardNimoy st2:USEnterprise st2:MattJeffries
st2:lengthInMeters
:birthDate :deathDate
288.6
st2:massInMetricTons
“1931-03-26”xsd:date “2015-02-27”xsd:date st2:constHeavyCrusier 190,000
For Example:
st2:GeneRoddenberry st2:birthPlace st2:ElPaso .
02-06
Reification and RDF
02: Basic Knowledge Graph Infrastructure
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
60
ChatGPT
One literary role model for Spock, the science officer of the USS Enterprise, could be Sherlock Homes.
Both characters are known for their logical and analytical thinking, as well as their ability to remain calm
and rational in difficult situations. Additionally, both characters have a strong sense of duty and
commitment to solving problems, whether they be scientific or criminal nature.
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
61
RDF Reification
RDF also permits the interleaving of statements,
i.e. to make statements about statements.
Example:
ChatGPT states that Sherlock Holmes is a role model for Mr. Spock
RDF Statement
rdf:Statment defines an RDF statement consisting of subject, predicate, object.
RDF Statement
“ChatGPT states that Sherlock Holmes is a role model for Mr. Spock”.
rdf:subject
:ChatGPT :SherlockHomes
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix : <http://example.org/KG2023#> . :statedBy
rdf:predicate
:Statement :roleModel
:statement1 a rdf:Statement ;
rdf:subject :SherlockHolmes ;
rdf:type
rdf:predicate :roleModel ;
rdf:object :Spock . rdf:Statement :Spock
rdf:object
:statedBy rdf:singletonPropertyOf
:ChatGPT :roleModel
“ChatGPT states that Sherlock Holmes is a role model for Mr. Spock”.
:roleModel
:SherlockHomes :Spock
:statedBy
:ChatGPT
@prefix : <http://example.org/KG2023#> .
<< :SherlockHolmes :roleModel :Spock >> :statedBy :ChatGPT .
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
66
RDF Reification
What is the use of reification?
Modeling data provenance
Formalizing statements about reliability and trust
Define metadata about statements
02-07
Logical Inference with RDF(S)
02: Basic Knowledge Graph Infrastructure
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
68
http://dbpedia.org/property/origin
http://dbpedia.org/resource/Spock http://dbpedia.org/resource/Vulcan_(Star_Trek)
something which can be uniquely identified via the URI something which can be uniquely identified via the URI
http://dbpedia.org/resource/Spock http://dbpedia.org/resource/ Vulcan_(Star_Trek)
but the URI for the same resource could also be but the URI for the same resource could also be
http://wikidata.org/entity/Q16341 http://wikidata.org/entity/Q1088708
Inductive reasoning involves learning patterns from lots of examples and is the
main subject of Machine Learning.
RDF(S) Semantics
In contrast to other data definition languages, RDF(S) is based on formal semantics.
Formal semantics enables RDF(S) to draw valid and sound logical inferences.
Examples:
:Spock rdf:type :FictionalCharacter .
:FictionalCharacter rdfs:subClassOf :Character .
:birthPlace rdfs:subPropertyOf :origin .
:Spock ∈ :FictionalCharacter
:FictionalCharacter ⊆ :Character
:birthPlace ⊆ :origin
Model-theoretic Semantics
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
71
rdfs:subClassOf
:FictionalCharacter
rdf:type
:birthPlace
:Spock :Vulcan
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
72
rdfs:subClassOf
rdf:type :FictionalCharacter
rdf:type
:birthPlace
:Spock :Vulcan
rdf:type
rdfs:domain rdfs:range
:Character :birthPalace :Location
:birthPlace
:Spock :Vulcan
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
74
rdf:type
rdfs:domain rdfs:range
:Character :birthPalace :Location
rdf:type rdf:type
:birthPlace
:Spock :Vulcan
2) Deduction of entity class membership from the domain of one of its properties
∀𝑖1 , 𝑖2 , 𝑐1 , 𝑐2 , 𝑝: 𝑇(𝑖1 , 𝑝, 𝑖2 ) ∧ 𝑇(𝑝, 𝑟𝑑𝑓𝑠: 𝑑𝑜𝑚𝑎𝑖𝑛, 𝑐1 ) ∧ 𝑇(𝑝, 𝑟𝑑𝑓𝑠: 𝑟𝑎𝑛𝑔𝑒, 𝑐2 )
→ 𝑇(𝑖1 , 𝑟𝑑𝑓: 𝑡𝑦𝑝𝑒, 𝑐1 ) ∧ 𝑇(𝑖2 , 𝑟𝑑𝑓: 𝑡𝑦𝑝𝑒, 𝑐2 )
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
75
rdf:type
rdfs:domain rdfs:range
:Character :birthPalace :Location
rdf:type rdf:type
:birthPlace
:Spock :Vulcan
3) Deduction of entity class membership from the range of one of its properties
∀𝑖1 , 𝑖2 , 𝑐1 , 𝑐2 , 𝑝: 𝑇(𝑖1 , 𝑝, 𝑖2 ) ∧ 𝑇(𝑝, 𝑟𝑑𝑓𝑠: 𝑑𝑜𝑚𝑎𝑖𝑛, 𝑐1 ) ∧ 𝑇(𝑝, 𝑟𝑑𝑓𝑠: 𝑟𝑎𝑛𝑔𝑒, 𝑐2 ) →
𝑇(𝑖1 , 𝑟𝑑𝑓: 𝑡𝑦𝑝𝑒, 𝑐1 ) ∧ 𝑇(𝑖2 , 𝑟𝑑𝑓: 𝑡𝑦𝑝𝑒, 𝑐2 )
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
76
rdf:type
rdfs:domain rdfs:range
:Character :birthPalace :Location
rdf:type rdf:type
:birthPlace
:Spock :Vulcan
Knowledge Graphs for Explainable AI 02: Basic Knowledge Graph Infrastructure
77
rdf:type
rdfs:domain rdfs:range
:Character :birthPalace :Location
:birthPlace
:Spock :Vulcan