Introduction to Knowledge Graphs
Jeff Z. Pan
School of Informatics, University of Edinburgh
Slides available online: https://www.slideshare.net/jeffpan_sw/introduction-of-
knowledge-graphs
Copyright © 2021 Jeff Z. Pan
Outline
We will cover:
• Foundation of Knowledge Graph
• What is Knowledge Graph
• Applications
• Standards: RDF, OWL, SPARQL
• Some key research topics
• Knowledge Graph Construction
• Knowledge Graph Reasoning
• Knowledge Graph Querying, etc
Copyright © 2021 Jeff Z. Pan
2
• Term coined by Google
• Knowledge Graph (KG): KB of inter-
connected entities defined by a schema
• Three levels of knowledge
• Entity
• Triple (unit of a multi-relational graph)
• Schema (defining the vocabulary)
3
Knowledge Graph
Copyright © 2021 Jeff Z. Pan
[Photo: https://www.w3.org/TR/rdf11-primer/ ]
• Key benefits
• Find the right thing
• Get the best summary
• Go deeper and broader
Knowledge Graph @ Google
Copyright © 2021 Jeff Z. Pan
[ Introducing the Knowledge Graph: things, not strings (Amit Singhal)]
4
Taj Mahal
Matt Groening
Marie Curie
• Knowledge Graph for Alexa
• Billions of entities
• Combining heterogeneous knowledge sources
• provide answers to customer queries
Knowledge Graph @ Amazon’s Alexa
Copyright © 2021 Jeff Z. Pan
[How Alexa keeps getting smarter (Amazon Staff)]
5
Knowledge Graph @ Alibaba’s Search &
Recommendation Engines
Copyright © 2021 Jeff Z. Pan
[Learn How a Knowledge Graph Can Improve Your Online Shopping Experience (Zhu Muhua et al.)]
• Key benefits
• Structured data
• Detecting noise in data
• Connected data
• Enable deep data cognition
6
Knowledge Graph @ MS’ Office 365
Copyright © 2021 Jeff Z. Pan
[Beyond Office 365 – knowledge graphs, Microsoft Graph & AI! (Landqvist and Molnar)]
• Key benefits
• Enterprise KG provides
connected data supporting
people at work
• Personalised search
7
• Question: Is Knowledge Graph invented by Google?
• Answer: No, there has been a long tradition on research
graph form of knowledge
8
Origin of Knowledge Graph
Copyright © 2021 Jeff Z. Pan
8
Semantic Networks
• Proposed by Richens and
Quillian (independently, 1950s-
60s) to analysis the meaning of
words in sentences
• memory like structure to store
and access knowledge by
machines
• Basic notations:
• Nodes: to represent objects,
concepts, or situations
• Arcs: to represent relationships
Copyright © 2021 Jeff Z. Pan
9
Pros/Cons of Semantic Networks
• Easy to follow hierarchy
• Easy to trace association
• Flexible
• No well defined syntax
• No formal semantics
• Not expressive enough to define meaning of
labels
• Inefficient
• Many were later addressed by KL-ONE
languages, later known as Description Logics
(underpinning of the W3C OWL standard)
Copyright © 2021 Jeff Z. Pan
10
Knowledge Graph: Going Beyond Semantic Network
• Resource Description Framework (RDF, W3C standard
for Knowledge Graph)
• with formal syntax, such as meta-properties like rdf:type
and rdfs:subClassOf
• with formal semantics
• NOT able to define classes though (that’s why OWL is
needed)
• Large open KGs: Dbpedia, Yago, Freebase (2006)
• data sub-graph
• [dbr:Barack_Obama rdf:type dbo:President .]
• [dbr:Barack_Obama dbo:birthPlace dbr:Hawaii .]
• [dbr:Barack_Obama dbo:spouse dbr:Michelle_Obama .]
• Schema sub-graph
• dbo:President ⊑ dbo:Politician
• dbo:spouse ⊑ dbo:spouse- (symmetricObjectProperty in
OWL)
Copyright © 2021 Jeff Z. Pan
11
Knowledge Graph: Going Beyond Semantic Network
• Key KG Standards:
• KG standard: RDF
• KG schema standard: OWL, based on Description
Logics (DL)
• KG query language standard: SPARQL
• An example knowledge graph in DL:
• ABox (data): tom:Koala, (tom,tim):friend,(tom,e1):eat
• TBox (schema / ontology): Koala ⊑ ∀eat.Plant
• This KB infers that e1:Plant
• Expressiveness: mainly based on TBox
12
tom
e1
Koala
eat
Plant
tim
friend
Copyright © 2021 Jeff Z. Pan
12
¡ Infer implicit knowledge from explicit knowledge
13
Copyright © 2021 Jeff Z. Pan
Reasoning
13
Outline
We will cover:
• Foundation of Knowledge Graph
• What is Knowledge Graph
• Applications
• Standards: RDF, OWL, SPARQL
• Some key research topics
• Knowledge Graph Construction
• Knowledge Graph Reasoning
• Knowledge Graph Querying, etc
Copyright © 2021 Jeff Z. Pan
14
DBpedia Knowledge Graph: Construction
15
• Mapping Wikipedia template
elements to elements in DBPedia
elements
• Mappings are created in a
community-driven process
• Example: suppose we consider
some wikipedia pages about
actors
• {{TemplateMapping
• | mapToClass = Actor
• | mappings =
• {{ PropertyMapping | templateProperty =
name | ontologyProperty = foaf:name }}
• {{ PropertyMapping | templateProperty =
birth_place | ontologyProperty = birthPlace
}} }}
Copyright © 2021 Jeff Z. Pan
15
• Exmaple (continued)
• dbpedia:Vince_Vaughn rdf:type
dbpedia-owl:Actor .
• dbpedia:Vince_Vaughn foaf:name
"Vince Vaughn"@en .
• dbpedia:Vince_Vaughn dbpedia-
owl:birthPlace dbpedia:Minneapolis .
DBpedia Knowledge Graph: Construction
Copyright © 2021 Jeff Z. Pan
16
CURIOS: Constructing KG via CMS
• A page template contains
• a page title
• a set of fields, for displaying literal
value
• a set of relations, i.e. links to other
pages
• Mapping between CMS entities
and ontology entities
• template ó (browsing) class
• field ó datatype properties
• relation ó object properties
[Reasoning Driven Configuration of Linked Data Content Management Systems (Taylor et al.)]
Copyright © 2021 Jeff Z. Pan
17
Consistency Checking for Schema Updates
Domain ontology
LDCMS configuration (in php)
Copyright © 2021 Jeff Z. Pan
18
[Reasoning Driven Configuration of Linked Data Content Management Systems (Taylor et al.)]
Knowledge Graph Construction from (Web) Tables
StockTicker Name GICS Sector
AMZN Amazon …
GOOG Alphabet …
Basic_Info
Stock URL CEO Name Country
AMZN www.amazon.com Jeff Bezos USA
Background_Info
Ticker Date Income ($) Liabilities
AMZN 06/01/2018 177.86 billion ...
Finance_Result
Foreign Key
• (Web) Table understanding
• Extraction of Web tables: HTML tables, attribute-value pairs (such as info box),
entity lists
• Alignment with KG schema
• Column type prediction
• Table enhancement
Basic_Info
Background_Info
background_info
name
ceo_name
Finance_Result
finance_result
xsd:int
income
xsd:string
xsd:string
[Credit: J Chen]
[Ten Years of Web Tables (Cafarella et al.)]
Copyright © 2021 Jeff Z. Pan
19
NELL: Never Ending Language Learner
20
• Goals
• Extract information from Web texts to
construct KB
• Learn to read better than before
• Inputs
• schema with 800 types and relations
• 10 - 20 seed examples for each
• Output: continuously growing KB
• Key methods
• Coupled Pattern Learner(CPL)
• Coupled SEAL(CSEAL)
• Coupled Morphological Classifier(CMC)
• Rule Learner(RL)
[Toward an Architecture for Never-Ending Language Learning (Carlson et al.)]
Copyright © 2021 Jeff Z. Pan
20
Open vs Closed Domain KG Construction
21
• Two types of knowledge graphs
• Closed domain knowledge graphs: with closed vocabulary, such as DBpedia and NELL
• Open domain knowledge graphs: with open vocabulary, such as the old fashioned
semantic networks
• Question: if we know Google bought YouTube, how could we make use of
such knowledge in NL form to answer questions like “Who owns YouTube?”
• Entailment graphs are needed for supporting the textual entailment
: company-1 buy company-2 |= company-1 own company-2
• These are meaning postulates, such as (buy sub-relation own)
• From Description Logic’s perspective, they are schema (rdfs:subPropertyOf) axioms
• Two major approaches
• Unsupervised methods: using machine reading (covering 100K relations)
• Supervised methods: using pre-trained language models (such as RoBERTa)
[Building and Interrogating Knowledge Graphs in Natural Language (Mark Steedman)]
Copyright © 2021 Jeff Z. Pan
21
Outline
We will cover:
• Foundation of Knowledge Graph
• What is Knowledge Graph
• Applications
• Standards: RDF, OWL, SPARQL
• Some key research topics
• Knowledge Graph Construction
• Knowledge Graph Reasoning
• Knowledge Graph Querying, etc
Copyright © 2021 Jeff Z. Pan
22
OWL Profiles and Reasoning
• OWL 2 has three tractable (with low
computational complexity ) profiles
• OWL 2 EL: schema reasoning, instance
reasoning and query answering
• Potentially huge TBox
• OWL 2 QL: query answering
• OWL 2 RL: the “rule fragment” of OWL 2
• Unions of any of the two profiles are
no longer tractable
Copyright © 2021 Jeff Z. Pan
23
EL (the core of OWL 2 EL)
• EL Class Description
• existential restriction: $r.C
• conjunction: C ⊓ D
• the top class: ⊤
• not including: value restriction "r.C, disjunction C ⊔ D, the
bottom class ^
• EL Axioms
• GCI: C ⊑ D
• Normal forms for EL
• A ⊑ B
• A1 ⊓ A2 ⊑ B
• A ⊑ $r.B
• $r.A ⊑ B
• where A, A1, A2, B are either named class in Sig(T) or the top
class ⊤
Copyright © 2021 Jeff Z. Pan
24
EL Reasoning: Normalisation
• Input axiom
• $r.A ⊓ $r.$s.A ⊑ A ⊓ B
• Normalisation
1. $r.A ⊓ $r.$s.A ⊑A0, A0 ⊑ A ⊓ B (NF0)
2. $r.A ⊑ A1, A1 ⊓ $r.$s.A ⊑ A0 (NF1l)
3. $r.$s.A ⊑ A2, A1 ⊓ A2 ⊑ A0 (NF1r)
4. $s.A ⊑ A3, $r.A3 ⊑ A2 (NF2)
5. A0 ⊑ A, A0 ⊑ B (NF4)
[credit: F Baader]
Copyright © 2021 Jeff Z. Pan
25
EL Reasoning: Subsumption Checking
1. Extend the KB with {A’ ⊑ A ⊓ C, $r.B ⊑ B’}, which is normalised as {A’ ⊑ A, A’ ⊑ C, $r.B ⊑ B’} (NF4)
2. A ⊑A, B ⊑B, A’ ⊑A’, B’ ⊑B’, B1 ⊑B1, B2 ⊑B2, C ⊑ C (CR1)
3. A ⊑ ⊤, A’ ⊑ ⊤ B1 ⊑ ⊤, B2 ⊑ ⊤, C ⊑ ⊤, B ⊑ ⊤, B’ ⊑ ⊤ (CR2)
4. A ⊑ ⊤, ⊤ ⊑ B => A ⊑ B (CR3)
5. B1 ⊑ ⊤, ⊤ ⊑ B => B1 ⊑ B (CR3)
6. B2 ⊑ ⊤, ⊤ ⊑ B => B2 ⊑ B (CR3)
7. C ⊑ ⊤, ⊤ ⊑ B => C ⊑ B (CR3)
8. A ⊑ $r.A, A ⊑ B, $r.B ⊑ B1 => A ⊑ B1 (CR5)
9. A ⊑ $r.A, A ⊑ B, $r.B ⊑ B’ => A ⊑ B’ (CR5)
10. A’ ⊑A, A ⊑B’ =>A’ ⊑B’ (CR3)
11. Since A’ ⊑B’ holds, we have A ⊓ C ⊑ $r.B
Question: Check if A ⊓ C ⊑ $r.B holds
Copyright © 2021 Jeff Z. Pan
[credit: F Baader] 26
27
Design of OWL 2: Approximate Reasoning
27
• Reasoning Task: TBox classification
• Step 1: Represent non-OWL2-EL concepts with
fresh named concepts
• K ⊑ ∀eat.P is replaced by K ⊑ X1, X1 ≡ ∀eat.P
• Step 2: Maintain semantic relations for these
named concepts
• complementary relations
• cardinality relations
• Step 3: Additional tractable completion Rules (on top of
the EL ones), e.g.
• Handling complement
• E.g. P ⊑ V => ¬V ⊑ ¬P
ALL
eat P
K
V
ALL
H Some
eat nP
K
nV
Some H
P V
X1 X2
28
• K ⊑ ∀eat.P, P ⊑ V, ∀eat.V ⊑ H
Approximate Reasoning: OWL 2 DL => OWL 2 EL
Copyright © 2021 Jeff Z. Pan
[Tractable approximate deduction for OWL (Pan et al.)]
28
Approximate Reasoning: OWL 2 DL => OWL 2 EL
• The above algorithm is for schema reasoning
• Data+Schema reasoning requires further optimisation
(due to the large number of unnecessary negated
nominals)
Ontology Reasoner Evaluation
(ORE 2014):
• A competition for sound and
complete reasoners
• TrOWL (3rd place in OWL 2
DL ABox materialisation) is
an approximate reasoner
• Even getting 99.99% of the
reasoning results is not
counted
• only 100% counted
29
Copyright © 2021 Jeff Z. Pan
29
[Tractable approximate deduction for OWL (Pan et al.)]
Knowledge Graph: Going Beyond Description Logic KBs
• Observation: Approximate reasoning (mode 1) so far tend to
replace complex schema with (faithful) simpler schema
• Questions:
• Q1: What happens if we do not have schema at all, how do
we define approximate reasoning (mode 2) to deal with the
knowledge incompleteness issue?
• Q2: Would it make sense to apply these two kinds of
approximate reasoning (modes 1 and 2) when schema is
available?
30
Copyright © 2021 Jeff Z. Pan
30
Knowledge Graph Embeddings
• Embedding entities and relationships of
multi-relational data in low-dimensional
vector spaces
• Use the embedding model for tasks like
link prediction, or rule extraction
• KGE model is fully expressive
• if given any ground truth,
• there exists an assignment of values
to the embeddings of the entities and
relations that
• accurately separates the correct
triples from incorrect ones
• TransE and DistMult are not fully
expressive but ComplEx and SimplE are
• Bilinear models (inc. ComplEx and
SimplE) cannot strictly represent
relation subsumption rules
[image credit: ampligraph.org]
Copyright © 2021 Jeff Z. Pan
31
[see also From Knowledge Graph Embedding to Ontology Embedding? An Analysisof the Compatibility
between Vector Space Representations and Rules (Gutierrez-Basulto and Schockaert)]
Fake News Detection with Knowledge Graph
• Fake news detection based on KG: given a set of news triples g and a
background knowledge graph G
• true if g U G is consistent
• fake otherwise
● The embedding model M of entities and relations in G obtained by
minimising a global loss function involving all entities and relations
● Bias based on model M can be used for approximate reasoning
32
FAKE "Hillary Clinton and her State department were actively arming Islamic
jihadists, which includes ISIS…"
(Hillary Clinton, arm, Islamic jihadists)
TRUE “Hillary Clinton-led State Department had approved weapon shipments to
Libya during the intervention in 2011, and that those weapons had later ended up
in the hands of jihadists”
(Hillary Clinton, have approved weapon shipments to, Libya)
(https://www.cnbc.com/2016/12/30/read-all-about-it-the-biggest-fake-news-stories-of-2016.html)
[Content based Fake News Detection Using Knowledge Graphs (Pan et al.)]
Copyright © 2021 Jeff Z. Pan
32
Evaluation of KG Embeddings
• Partial gold standard: some entities and relations are selected for manual
annotation
• Pros: usually good quality
• Cons: Costly and only applicable to those with simple schema (if schema is used)
• Silver standard: the KG is assumed to be perfect and used as a test dataset,
widely used for KG completion
• Pros: not expensive to get
• Cons: KGs are not perfect and thus quality is not as good as partial gold standard
• Experimental results suggest KGE based KG completion methods are not
impressive when schema aware correctness is considered, despite good
performance reported in sliver standard based evaluations
Silver S TransE STransE DistMult ComplEx
WN18
Hit@1
8.9% - 72.8% 93.6%
WN18
Hit@10
93.4% 93.4% 93.6% 94.7%
FB15k
Hit@1
23.1% - 54.6% 59.9%
FB15k
Hit@10
64.1% 79.7% 82.4% 84.0%
[Pattern-Based Reasoning to Investigate the Correctness of Knowledge Graphs (Wiharja et al.)]
Copyright © 2021 Jeff Z. Pan
33
Iterative Schema Aware KG Completion
• Hypothesis: Different kinds of KG completion methods might complement each other
[Wiharja et al., 2021]
• Idea: combine three types of triple producers (Embedding based, Rule learning based
and Materialisation based) with approximate consistency checking
• To run in an iterative manner, one after another until stopping condition triggered
• The notion of completeness is replaced by the notion of coverage
• Findings:
• Combinations work well if start with R- or M- based producers
• Different methods completement each other
• Can produce 20-40 times of schema correct triples
[Schema aware iterative Knowledge Graph completion (Wiharja et al.)]
Copyright © 2021 Jeff Z. Pan
34
Outline
We will cover:
• Foundation of Knowledge Graph
• What is Knowledge Graph
• Applications
• Standards: RDF, OWL, SPARQL
• Some key research topics
• Knowledge Graph Construction
• Knowledge Graph Reasoning
• Knowledge Graph Querying, etc
Copyright © 2021 Jeff Z. Pan
35
Knowledge Graph Querying with SPARQL
• SPARQL is the standard query language of and standard protocol for querying KGs
•
•
ABOX
G
TBOX
9hasMother v Mother
9hasMother v Child
9hasP arent v P arent
9hasP arent v Child
Mother v P arent
hasMother v hasP arent
...
S P O
:Mother rdfs:subClassOf :Parent
:hasMother rdfs:subPropertyOf :hasParent
:hasMother rdfs:range :Mother
:hasParent rdfs:domain :Child
:hasParent rdfs:range :Parent
...
S P O
:marie :hasMother :maria_t
:marie :hasParent :maria_t
SELECT ?X ?P ?S WHERE {
?X :hasParent ?P . ?X :hasSpouse ?S .
?P a RulerOfAustria . ?S a :RulerOfFrance .
} ABOX-materialized
S P O
:marie :hasMother :maria_t
:marie a :Child
:marie :hasParent :maria_t
:maria_t a :Mother
:maria_t a :Parent
[credit: A Polleres]
Copyright © 2021 Jeff Z. Pan
36
KG Querying: Open World Assumption
[credit: A Schaerf] Copyright © 2021 Jeff Z. Pan
37
• Some key challenges:
• User queries are in NL, thus semantic
parsing is needed
• How to combine embedding with logical
operators for answering complex queries
17/08/2021
Question Answering over Knowledge Graphs
Copyright © 2021 Jeff Z. Pan
38
Knowledge Graphs as Bridge between Human and AI Systems
• Human intelligence (e.g. to understand image)
• Perception: Dogs, happy ,letters, numbers, red
• Knowledge: Dog year, Spring Festival, red for
celebration
• Reasoning: 2018 is a dog year, best wish for
Spring Festival
• How knowledge graphs help:
• Richer Input for Machine Learning
• Explain Machine Learning
• Meta Learning: Guide learning with
knowledge
Question : What is this device used for?
Question : Which food seen here has a
country for the first part of its name?
Question : What sport is this? Question : Is this television broken or working?
Copyright © 2021 Jeff Z. Pan
39
• Knowledge Graph (or Big Knowledge), Big Data and Deep Learning
are key drivers of AI
• unique technology for both reasoning and learning
• reduce the need of large, labelled datasets, facilitate transfer learning and
explain-ability
• encode domain, task and application knowledge that would be costly to
learning from data alone
• facilitate the upgrade of AI from perceptual intelligence to cognitive
intelligence
KGs have become the epicentre of the AI hyperbole
Copyright © 2021 Jeff Z. Pan
[Photo : https://www.w3.org/TR/rdf11-primer/ ] 40
Thank you!
Jeff Z. Pan
@jpansw
http://knowledge-representation.org/j.z.pan/
Copyright © 2021 Jeff Z. Pan

Introduction of Knowledge Graphs

  • 1.
    Introduction to KnowledgeGraphs Jeff Z. Pan School of Informatics, University of Edinburgh Slides available online: https://www.slideshare.net/jeffpan_sw/introduction-of- knowledge-graphs Copyright © 2021 Jeff Z. Pan
  • 2.
    Outline We will cover: •Foundation of Knowledge Graph • What is Knowledge Graph • Applications • Standards: RDF, OWL, SPARQL • Some key research topics • Knowledge Graph Construction • Knowledge Graph Reasoning • Knowledge Graph Querying, etc Copyright © 2021 Jeff Z. Pan 2
  • 3.
    • Term coinedby Google • Knowledge Graph (KG): KB of inter- connected entities defined by a schema • Three levels of knowledge • Entity • Triple (unit of a multi-relational graph) • Schema (defining the vocabulary) 3 Knowledge Graph Copyright © 2021 Jeff Z. Pan [Photo: https://www.w3.org/TR/rdf11-primer/ ]
  • 4.
    • Key benefits •Find the right thing • Get the best summary • Go deeper and broader Knowledge Graph @ Google Copyright © 2021 Jeff Z. Pan [ Introducing the Knowledge Graph: things, not strings (Amit Singhal)] 4 Taj Mahal Matt Groening Marie Curie
  • 5.
    • Knowledge Graphfor Alexa • Billions of entities • Combining heterogeneous knowledge sources • provide answers to customer queries Knowledge Graph @ Amazon’s Alexa Copyright © 2021 Jeff Z. Pan [How Alexa keeps getting smarter (Amazon Staff)] 5
  • 6.
    Knowledge Graph @Alibaba’s Search & Recommendation Engines Copyright © 2021 Jeff Z. Pan [Learn How a Knowledge Graph Can Improve Your Online Shopping Experience (Zhu Muhua et al.)] • Key benefits • Structured data • Detecting noise in data • Connected data • Enable deep data cognition 6
  • 7.
    Knowledge Graph @MS’ Office 365 Copyright © 2021 Jeff Z. Pan [Beyond Office 365 – knowledge graphs, Microsoft Graph & AI! (Landqvist and Molnar)] • Key benefits • Enterprise KG provides connected data supporting people at work • Personalised search 7
  • 8.
    • Question: IsKnowledge Graph invented by Google? • Answer: No, there has been a long tradition on research graph form of knowledge 8 Origin of Knowledge Graph Copyright © 2021 Jeff Z. Pan 8
  • 9.
    Semantic Networks • Proposedby Richens and Quillian (independently, 1950s- 60s) to analysis the meaning of words in sentences • memory like structure to store and access knowledge by machines • Basic notations: • Nodes: to represent objects, concepts, or situations • Arcs: to represent relationships Copyright © 2021 Jeff Z. Pan 9
  • 10.
    Pros/Cons of SemanticNetworks • Easy to follow hierarchy • Easy to trace association • Flexible • No well defined syntax • No formal semantics • Not expressive enough to define meaning of labels • Inefficient • Many were later addressed by KL-ONE languages, later known as Description Logics (underpinning of the W3C OWL standard) Copyright © 2021 Jeff Z. Pan 10
  • 11.
    Knowledge Graph: GoingBeyond Semantic Network • Resource Description Framework (RDF, W3C standard for Knowledge Graph) • with formal syntax, such as meta-properties like rdf:type and rdfs:subClassOf • with formal semantics • NOT able to define classes though (that’s why OWL is needed) • Large open KGs: Dbpedia, Yago, Freebase (2006) • data sub-graph • [dbr:Barack_Obama rdf:type dbo:President .] • [dbr:Barack_Obama dbo:birthPlace dbr:Hawaii .] • [dbr:Barack_Obama dbo:spouse dbr:Michelle_Obama .] • Schema sub-graph • dbo:President ⊑ dbo:Politician • dbo:spouse ⊑ dbo:spouse- (symmetricObjectProperty in OWL) Copyright © 2021 Jeff Z. Pan 11
  • 12.
    Knowledge Graph: GoingBeyond Semantic Network • Key KG Standards: • KG standard: RDF • KG schema standard: OWL, based on Description Logics (DL) • KG query language standard: SPARQL • An example knowledge graph in DL: • ABox (data): tom:Koala, (tom,tim):friend,(tom,e1):eat • TBox (schema / ontology): Koala ⊑ ∀eat.Plant • This KB infers that e1:Plant • Expressiveness: mainly based on TBox 12 tom e1 Koala eat Plant tim friend Copyright © 2021 Jeff Z. Pan 12
  • 13.
    ¡ Infer implicitknowledge from explicit knowledge 13 Copyright © 2021 Jeff Z. Pan Reasoning 13
  • 14.
    Outline We will cover: •Foundation of Knowledge Graph • What is Knowledge Graph • Applications • Standards: RDF, OWL, SPARQL • Some key research topics • Knowledge Graph Construction • Knowledge Graph Reasoning • Knowledge Graph Querying, etc Copyright © 2021 Jeff Z. Pan 14
  • 15.
    DBpedia Knowledge Graph:Construction 15 • Mapping Wikipedia template elements to elements in DBPedia elements • Mappings are created in a community-driven process • Example: suppose we consider some wikipedia pages about actors • {{TemplateMapping • | mapToClass = Actor • | mappings = • {{ PropertyMapping | templateProperty = name | ontologyProperty = foaf:name }} • {{ PropertyMapping | templateProperty = birth_place | ontologyProperty = birthPlace }} }} Copyright © 2021 Jeff Z. Pan 15
  • 16.
    • Exmaple (continued) •dbpedia:Vince_Vaughn rdf:type dbpedia-owl:Actor . • dbpedia:Vince_Vaughn foaf:name "Vince Vaughn"@en . • dbpedia:Vince_Vaughn dbpedia- owl:birthPlace dbpedia:Minneapolis . DBpedia Knowledge Graph: Construction Copyright © 2021 Jeff Z. Pan 16
  • 17.
    CURIOS: Constructing KGvia CMS • A page template contains • a page title • a set of fields, for displaying literal value • a set of relations, i.e. links to other pages • Mapping between CMS entities and ontology entities • template ó (browsing) class • field ó datatype properties • relation ó object properties [Reasoning Driven Configuration of Linked Data Content Management Systems (Taylor et al.)] Copyright © 2021 Jeff Z. Pan 17
  • 18.
    Consistency Checking forSchema Updates Domain ontology LDCMS configuration (in php) Copyright © 2021 Jeff Z. Pan 18 [Reasoning Driven Configuration of Linked Data Content Management Systems (Taylor et al.)]
  • 19.
    Knowledge Graph Constructionfrom (Web) Tables StockTicker Name GICS Sector AMZN Amazon … GOOG Alphabet … Basic_Info Stock URL CEO Name Country AMZN www.amazon.com Jeff Bezos USA Background_Info Ticker Date Income ($) Liabilities AMZN 06/01/2018 177.86 billion ... Finance_Result Foreign Key • (Web) Table understanding • Extraction of Web tables: HTML tables, attribute-value pairs (such as info box), entity lists • Alignment with KG schema • Column type prediction • Table enhancement Basic_Info Background_Info background_info name ceo_name Finance_Result finance_result xsd:int income xsd:string xsd:string [Credit: J Chen] [Ten Years of Web Tables (Cafarella et al.)] Copyright © 2021 Jeff Z. Pan 19
  • 20.
    NELL: Never EndingLanguage Learner 20 • Goals • Extract information from Web texts to construct KB • Learn to read better than before • Inputs • schema with 800 types and relations • 10 - 20 seed examples for each • Output: continuously growing KB • Key methods • Coupled Pattern Learner(CPL) • Coupled SEAL(CSEAL) • Coupled Morphological Classifier(CMC) • Rule Learner(RL) [Toward an Architecture for Never-Ending Language Learning (Carlson et al.)] Copyright © 2021 Jeff Z. Pan 20
  • 21.
    Open vs ClosedDomain KG Construction 21 • Two types of knowledge graphs • Closed domain knowledge graphs: with closed vocabulary, such as DBpedia and NELL • Open domain knowledge graphs: with open vocabulary, such as the old fashioned semantic networks • Question: if we know Google bought YouTube, how could we make use of such knowledge in NL form to answer questions like “Who owns YouTube?” • Entailment graphs are needed for supporting the textual entailment : company-1 buy company-2 |= company-1 own company-2 • These are meaning postulates, such as (buy sub-relation own) • From Description Logic’s perspective, they are schema (rdfs:subPropertyOf) axioms • Two major approaches • Unsupervised methods: using machine reading (covering 100K relations) • Supervised methods: using pre-trained language models (such as RoBERTa) [Building and Interrogating Knowledge Graphs in Natural Language (Mark Steedman)] Copyright © 2021 Jeff Z. Pan 21
  • 22.
    Outline We will cover: •Foundation of Knowledge Graph • What is Knowledge Graph • Applications • Standards: RDF, OWL, SPARQL • Some key research topics • Knowledge Graph Construction • Knowledge Graph Reasoning • Knowledge Graph Querying, etc Copyright © 2021 Jeff Z. Pan 22
  • 23.
    OWL Profiles andReasoning • OWL 2 has three tractable (with low computational complexity ) profiles • OWL 2 EL: schema reasoning, instance reasoning and query answering • Potentially huge TBox • OWL 2 QL: query answering • OWL 2 RL: the “rule fragment” of OWL 2 • Unions of any of the two profiles are no longer tractable Copyright © 2021 Jeff Z. Pan 23
  • 24.
    EL (the coreof OWL 2 EL) • EL Class Description • existential restriction: $r.C • conjunction: C ⊓ D • the top class: ⊤ • not including: value restriction "r.C, disjunction C ⊔ D, the bottom class ^ • EL Axioms • GCI: C ⊑ D • Normal forms for EL • A ⊑ B • A1 ⊓ A2 ⊑ B • A ⊑ $r.B • $r.A ⊑ B • where A, A1, A2, B are either named class in Sig(T) or the top class ⊤ Copyright © 2021 Jeff Z. Pan 24
  • 25.
    EL Reasoning: Normalisation •Input axiom • $r.A ⊓ $r.$s.A ⊑ A ⊓ B • Normalisation 1. $r.A ⊓ $r.$s.A ⊑A0, A0 ⊑ A ⊓ B (NF0) 2. $r.A ⊑ A1, A1 ⊓ $r.$s.A ⊑ A0 (NF1l) 3. $r.$s.A ⊑ A2, A1 ⊓ A2 ⊑ A0 (NF1r) 4. $s.A ⊑ A3, $r.A3 ⊑ A2 (NF2) 5. A0 ⊑ A, A0 ⊑ B (NF4) [credit: F Baader] Copyright © 2021 Jeff Z. Pan 25
  • 26.
    EL Reasoning: SubsumptionChecking 1. Extend the KB with {A’ ⊑ A ⊓ C, $r.B ⊑ B’}, which is normalised as {A’ ⊑ A, A’ ⊑ C, $r.B ⊑ B’} (NF4) 2. A ⊑A, B ⊑B, A’ ⊑A’, B’ ⊑B’, B1 ⊑B1, B2 ⊑B2, C ⊑ C (CR1) 3. A ⊑ ⊤, A’ ⊑ ⊤ B1 ⊑ ⊤, B2 ⊑ ⊤, C ⊑ ⊤, B ⊑ ⊤, B’ ⊑ ⊤ (CR2) 4. A ⊑ ⊤, ⊤ ⊑ B => A ⊑ B (CR3) 5. B1 ⊑ ⊤, ⊤ ⊑ B => B1 ⊑ B (CR3) 6. B2 ⊑ ⊤, ⊤ ⊑ B => B2 ⊑ B (CR3) 7. C ⊑ ⊤, ⊤ ⊑ B => C ⊑ B (CR3) 8. A ⊑ $r.A, A ⊑ B, $r.B ⊑ B1 => A ⊑ B1 (CR5) 9. A ⊑ $r.A, A ⊑ B, $r.B ⊑ B’ => A ⊑ B’ (CR5) 10. A’ ⊑A, A ⊑B’ =>A’ ⊑B’ (CR3) 11. Since A’ ⊑B’ holds, we have A ⊓ C ⊑ $r.B Question: Check if A ⊓ C ⊑ $r.B holds Copyright © 2021 Jeff Z. Pan [credit: F Baader] 26
  • 27.
    27 Design of OWL2: Approximate Reasoning 27
  • 28.
    • Reasoning Task:TBox classification • Step 1: Represent non-OWL2-EL concepts with fresh named concepts • K ⊑ ∀eat.P is replaced by K ⊑ X1, X1 ≡ ∀eat.P • Step 2: Maintain semantic relations for these named concepts • complementary relations • cardinality relations • Step 3: Additional tractable completion Rules (on top of the EL ones), e.g. • Handling complement • E.g. P ⊑ V => ¬V ⊑ ¬P ALL eat P K V ALL H Some eat nP K nV Some H P V X1 X2 28 • K ⊑ ∀eat.P, P ⊑ V, ∀eat.V ⊑ H Approximate Reasoning: OWL 2 DL => OWL 2 EL Copyright © 2021 Jeff Z. Pan [Tractable approximate deduction for OWL (Pan et al.)] 28
  • 29.
    Approximate Reasoning: OWL2 DL => OWL 2 EL • The above algorithm is for schema reasoning • Data+Schema reasoning requires further optimisation (due to the large number of unnecessary negated nominals) Ontology Reasoner Evaluation (ORE 2014): • A competition for sound and complete reasoners • TrOWL (3rd place in OWL 2 DL ABox materialisation) is an approximate reasoner • Even getting 99.99% of the reasoning results is not counted • only 100% counted 29 Copyright © 2021 Jeff Z. Pan 29 [Tractable approximate deduction for OWL (Pan et al.)]
  • 30.
    Knowledge Graph: GoingBeyond Description Logic KBs • Observation: Approximate reasoning (mode 1) so far tend to replace complex schema with (faithful) simpler schema • Questions: • Q1: What happens if we do not have schema at all, how do we define approximate reasoning (mode 2) to deal with the knowledge incompleteness issue? • Q2: Would it make sense to apply these two kinds of approximate reasoning (modes 1 and 2) when schema is available? 30 Copyright © 2021 Jeff Z. Pan 30
  • 31.
    Knowledge Graph Embeddings •Embedding entities and relationships of multi-relational data in low-dimensional vector spaces • Use the embedding model for tasks like link prediction, or rule extraction • KGE model is fully expressive • if given any ground truth, • there exists an assignment of values to the embeddings of the entities and relations that • accurately separates the correct triples from incorrect ones • TransE and DistMult are not fully expressive but ComplEx and SimplE are • Bilinear models (inc. ComplEx and SimplE) cannot strictly represent relation subsumption rules [image credit: ampligraph.org] Copyright © 2021 Jeff Z. Pan 31 [see also From Knowledge Graph Embedding to Ontology Embedding? An Analysisof the Compatibility between Vector Space Representations and Rules (Gutierrez-Basulto and Schockaert)]
  • 32.
    Fake News Detectionwith Knowledge Graph • Fake news detection based on KG: given a set of news triples g and a background knowledge graph G • true if g U G is consistent • fake otherwise ● The embedding model M of entities and relations in G obtained by minimising a global loss function involving all entities and relations ● Bias based on model M can be used for approximate reasoning 32 FAKE "Hillary Clinton and her State department were actively arming Islamic jihadists, which includes ISIS…" (Hillary Clinton, arm, Islamic jihadists) TRUE “Hillary Clinton-led State Department had approved weapon shipments to Libya during the intervention in 2011, and that those weapons had later ended up in the hands of jihadists” (Hillary Clinton, have approved weapon shipments to, Libya) (https://www.cnbc.com/2016/12/30/read-all-about-it-the-biggest-fake-news-stories-of-2016.html) [Content based Fake News Detection Using Knowledge Graphs (Pan et al.)] Copyright © 2021 Jeff Z. Pan 32
  • 33.
    Evaluation of KGEmbeddings • Partial gold standard: some entities and relations are selected for manual annotation • Pros: usually good quality • Cons: Costly and only applicable to those with simple schema (if schema is used) • Silver standard: the KG is assumed to be perfect and used as a test dataset, widely used for KG completion • Pros: not expensive to get • Cons: KGs are not perfect and thus quality is not as good as partial gold standard • Experimental results suggest KGE based KG completion methods are not impressive when schema aware correctness is considered, despite good performance reported in sliver standard based evaluations Silver S TransE STransE DistMult ComplEx WN18 Hit@1 8.9% - 72.8% 93.6% WN18 Hit@10 93.4% 93.4% 93.6% 94.7% FB15k Hit@1 23.1% - 54.6% 59.9% FB15k Hit@10 64.1% 79.7% 82.4% 84.0% [Pattern-Based Reasoning to Investigate the Correctness of Knowledge Graphs (Wiharja et al.)] Copyright © 2021 Jeff Z. Pan 33
  • 34.
    Iterative Schema AwareKG Completion • Hypothesis: Different kinds of KG completion methods might complement each other [Wiharja et al., 2021] • Idea: combine three types of triple producers (Embedding based, Rule learning based and Materialisation based) with approximate consistency checking • To run in an iterative manner, one after another until stopping condition triggered • The notion of completeness is replaced by the notion of coverage • Findings: • Combinations work well if start with R- or M- based producers • Different methods completement each other • Can produce 20-40 times of schema correct triples [Schema aware iterative Knowledge Graph completion (Wiharja et al.)] Copyright © 2021 Jeff Z. Pan 34
  • 35.
    Outline We will cover: •Foundation of Knowledge Graph • What is Knowledge Graph • Applications • Standards: RDF, OWL, SPARQL • Some key research topics • Knowledge Graph Construction • Knowledge Graph Reasoning • Knowledge Graph Querying, etc Copyright © 2021 Jeff Z. Pan 35
  • 36.
    Knowledge Graph Queryingwith SPARQL • SPARQL is the standard query language of and standard protocol for querying KGs • • ABOX G TBOX 9hasMother v Mother 9hasMother v Child 9hasP arent v P arent 9hasP arent v Child Mother v P arent hasMother v hasP arent ... S P O :Mother rdfs:subClassOf :Parent :hasMother rdfs:subPropertyOf :hasParent :hasMother rdfs:range :Mother :hasParent rdfs:domain :Child :hasParent rdfs:range :Parent ... S P O :marie :hasMother :maria_t :marie :hasParent :maria_t SELECT ?X ?P ?S WHERE { ?X :hasParent ?P . ?X :hasSpouse ?S . ?P a RulerOfAustria . ?S a :RulerOfFrance . } ABOX-materialized S P O :marie :hasMother :maria_t :marie a :Child :marie :hasParent :maria_t :maria_t a :Mother :maria_t a :Parent [credit: A Polleres] Copyright © 2021 Jeff Z. Pan 36
  • 37.
    KG Querying: OpenWorld Assumption [credit: A Schaerf] Copyright © 2021 Jeff Z. Pan 37
  • 38.
    • Some keychallenges: • User queries are in NL, thus semantic parsing is needed • How to combine embedding with logical operators for answering complex queries 17/08/2021 Question Answering over Knowledge Graphs Copyright © 2021 Jeff Z. Pan 38
  • 39.
    Knowledge Graphs asBridge between Human and AI Systems • Human intelligence (e.g. to understand image) • Perception: Dogs, happy ,letters, numbers, red • Knowledge: Dog year, Spring Festival, red for celebration • Reasoning: 2018 is a dog year, best wish for Spring Festival • How knowledge graphs help: • Richer Input for Machine Learning • Explain Machine Learning • Meta Learning: Guide learning with knowledge Question : What is this device used for? Question : Which food seen here has a country for the first part of its name? Question : What sport is this? Question : Is this television broken or working? Copyright © 2021 Jeff Z. Pan 39
  • 40.
    • Knowledge Graph(or Big Knowledge), Big Data and Deep Learning are key drivers of AI • unique technology for both reasoning and learning • reduce the need of large, labelled datasets, facilitate transfer learning and explain-ability • encode domain, task and application knowledge that would be costly to learning from data alone • facilitate the upgrade of AI from perceptual intelligence to cognitive intelligence KGs have become the epicentre of the AI hyperbole Copyright © 2021 Jeff Z. Pan [Photo : https://www.w3.org/TR/rdf11-primer/ ] 40
  • 41.
    Thank you! Jeff Z.Pan @jpansw http://knowledge-representation.org/j.z.pan/ Copyright © 2021 Jeff Z. Pan