Lecture6 Knowledge Graphs
Lecture6 Knowledge Graphs
Laptop 97%
Tabea Tietz, Jörg Waitelonis, Mehwish Alam and Harald Sack. Knowledge Graph based Analysis and Exploration of Historical
Theatre Photographs. Proceedings of the Conference on Digital Curation Technologies (Qurator 2020), Berlin, January 20-21,
2020. https://publikationen.bibliothek.kit.edu/1000105566
Limits of second-Wave AI and Deep Learning:
Don't trust "end-to-end" Deep-
Learning solutions.
Hybrid AI models are the way
forward.
https://www.spiegel.de/plus/kuenstliche-intelligenz-in-der-krise-zu-dumm-zum-rechnen-a-00000000-0002-0001-0000-000166735218
https://www.nature.com/articles/d41586-019-03013-
5?utm_source=twt_nnc&utm_medium=social&utm_campaign=naturenews&sf221156507=1
Truthfulness/Understanding:
• Not solvable without contextual+conceptual background knowledge!
Trends: Transfer Learning/Fine-tuning:
https://cra.org/ccc/ai-roadmap-integrated-intelligence/
Typical applications nowadays need/use both:
Gameplaying:
Symbolic (1st wave): Subsymbolic (2nd wave):
12
Typical application need/use both:
Autonomous driving:
Symbolic: Subsymbolic:
Road network+ Routing algorithms:
Traffic Rules:
13
Typical application need/use both:
Converstational agents/Chatbots:
Symbolic: Intent extraction:
Subsymbolic:
Response Policy Rules: Speech Recognition:
https://rasa.com/products/rasa-stack/
https://rasa.com/products/rasa-stack/
https://machinelearning.apple.com/2017/10/01/hey-siri.html
14
Recall: Good morning!
connecting to my previous lecture ;-)
https://twitter.com/nixcraft/status/1595472418084356096/
Also language models open up a whole lot of new
possibilities for hybrid combinations!
Not limited to natural language,
But also usable for
• Programming
• Database queries
For instance:
https://github.com/features/copilot
https://w.wiki/6Enj
Four pillars of today’s AI systems
(to be taken with a grain of salt):
(Old but still true: http://web.archive.org/web/20181018045806/https://www.reasoning.world/ai-is-about-machine-reasoning-or-when-
machine-learning-is-just-a-fancy-plugin/ )
• Learning: First, a system has to be taught. This can be done by single experts or a community is used where people teach the machine
bits of knowledge. This is what the machine uses to be able to learn on its own. You might think this way it doesn’t learn on its own,
but it does. Consider how a child learns. It learns by being taught by his parents, teacher, other children or anyone else teaching things
and it just copies and pastes everything with its “sensors” like ears and eyes. Thus, the AI learns best practices and reasoning from
experts. Knowledge is taught in atomic pieces of information that represent individual steps of a process.
• Semantic Graph: The taught knowledge has to be stored, which is done within a data store. The store is used to supply information for
the understanding of the world doing semantic reasoning. Like: I know that my mom is connected to dad. And I am connected to my
sister. And my sister is connected to her work colleagues. And she works in this city in that building. This is a semantic map of the
world that we know. That is part of our memory – a semantic graph. By creating a semantic data map, the AI understands the world in
which it operates.
• Process Engine: The engine is the central back-end service that puts everything together and thus delivers a solution to a certain
problem. The engine knows the map of the world where a system is acting in. In doing so, the engine takes everything it knows and
finds the correct solution to a specific problem on its own, step by step based on the knowledge it has.
• Problem Solving: Problem solving also known as machine reasoning (MR) is the ability to dynamically react to change and by doing
this, reusing existing knowledge for new and unknown problems. With machine reasoning, problems are solved in ambiguous and
changing environments. The AI dynamically reacts to the ever-changing context, selecting the best course of action. Thus, machine
reasoning is the basis for a general artificial intelligence (General AI).
• Learning: First, a system has to be taught. This can be done by single experts or a community is used where people teach the machine bits of
knowledge. This is what the machine uses to be able to learn on its own. You might think this way it doesn’t learn on its own, but it does.
Consider how a child learns. It learns by being taught by his parents, teacher, other children or anyone else teaching things and it just copies
and pastes everything with its “sensors” like ears and eyes. Thus, the AI learns best practices and reasoning from experts. Knowledge is
taught in atomic pieces of information that represent individual steps of a process.
• Semantic Graph: The taught knowledge has to be stored, which is done within a data store. The store is used to supply information for the
understanding of the world doing semantic reasoning. Like: I know that my mom is connected to dad. And I am connected to my sister. And
my sister is connected to her work colleagues. And she works in this city in that building. This is a semantic map of the world that we know.
That is part of our memory – a semantic graph. By creating a semantic data map, the AI understands the world in which it operates.
• Process Engine: The engine is the central back-end service that puts everything together and thus delivers a solution to a certain problem.
The engine knows the map of the world where a system is acting in. In doing so, the engine takes everything it knows and finds the correct
solution to a specific problem on its own, step by step based on the knowledge it has.
We have not talked about this yet!
• Problem Solving: Problem solving also known as machine reasoning (MR) is the ability to dynamically react to change and by doing this,
reusing existing knowledge for new and unknown problems. Let’s
With get back
machine to those
reasoning, two
problems areguys!
solved in ambiguous and changing
environments. The AI dynamically reacts to the ever-changing context, selecting the best course of action. Thus, machine reasoning is the
basis for a general artificial intelligence (General AI).
What is a Knowledge Graph?
… good question!
20
More Knowledge Graphs
Other companies with knowledge graphs:
● Facebook Entity Graph
● LinkedIn
● How NASA Finds Critical Data through a Knowledge
Graph [Neo4j Blog]
● Amazon Product graph
● Yandex, Baidu
Some free open knowledge graphs:
●Dbpedia
●WikiData
●Linked Open Data project
21
Knowledge Graphs are Big Data:
https://twitter.com/rminHaller/status/1380309606618963969
What is a Knowledge Graph?
By properties:
McCusker, Chastain, Erickson, and McGuinness. What is a
Knowledge Graph? (unpublished, 2016).
identify some principles: p.2+3
“principled” aggregation of Linked Data? p.7
23
Applications of Knowledge graphs in AI:
Why are Knowledge Graphs important for hybrid (third wave) AI?
Improve AI (search/perceiving) by “knowing how things are connected”.
Enabling AI (reasoning) by “knowing how things are connected”.
Explain AI (learning/abstrations) by “knowing how things are connected”.
24
AI(?) Applications of Knowledge Graphs:
Google – Search:
- Rich Snippets
- Personalised recommendations across services:
25
AI(?) Applications of Knowledge Graphs:
IBM Watson - Reasoning :
• Used DBpedia as one of its fact bases! (predates the #LLM hype!)
https://youtu.be/P0Obm0DBvwI?t=951
26
AI(?) Technologies behind Knowledge Graphs:
27
KG enrichment by Rule-based Logical Reasoning:
RDFS (RDF Schema) and OWL: Two More standards
extending RDF to encode
• schema information
• taxonomic relationships
• and implicit triples
instance data:
dbr:Marta_Grandi a dbo:Entomologist ;
dbo:birthPlace dbr:Bologna . Bologna
Marta_Grandi birthplace
dbr:Costanzo_Varolio a dbo:Medician;
dbo:birthPlace dbr:Bologna . a
Agent
a
⊑ ⊑
a
Ontology (schema data): a Person Organisation
dbo:Entomologist rdfs:subClassOf dbo:Scientist.
⊑
dbo:Medician rdfs:subClassOf dbo:Scientist.
dbo:Scientist rdfs:subClassOf dbo:Person. Scientist
dbo:Person rdfs:subClassOf dbo:Agent. ⊑ ⊑
dbo:Organisation rdfs:subClassOf dbo:Agent.
dbo:birthPlace rdfs:domain dbo:Person . Entomologist Medician
29
dbo:Organisation owl:disjointWith dbo:Place.
...
RDFS deduction rules:
cf. https://www.w3.org/TR/rdf11-mt/
instance data:
dbr:Marta_Grandi a dbo:Entomologist ; dbr:Marta_Grandi a dbo:Scientist,
dbo:birthPlace dbr:Bologna . dbo:Person, dbo:Agent.
instance data:
dbr:Marta_Grandi a dbo:Entomologist ; Alternatively, the rules can be
dbo:birthPlace dbr:Bologna . used “backwards” to rewrite the
original query to yield a more
dbr:Costanzo_Varolio a dbo:Medician; generic query!
dbo:birthPlace dbr:Bologna .
instance data:
dbr:Marta_Grandi a dbo:Entomologist ; Alternatively, the rules can be
dbo:birthPlace dbr:Bologna . used “backwards” to rewrite the
original query to yield a more
dbr:Costanzo_Varolio a dbo:Medician; generic query!
dbo:birthPlace dbr:Bologna .
You can also use SPARQL path
expressions in this query
Ontology (schema data):
rewriting! [1]
dbo:Entomologist rdfs:subClassOf dbo:Scientist.
dbo:Medician rdfs:subClassOf dbo:Scientist.
dbo:Scientist rdfs:subClassOf dbo:Person.
dbo:Person rdfs:subClassOf dbo:Agent.
1. Stefan Bischof, Markus Krötzsch, Axel Polleres, and Sebastian Rudolph. Schema-
dbo:Organisation rdfs:subClassOf dbo:Agent.
agnostic query rewriting in SPARQL 1.1. In Proceedings of the 13th International
dbo:birthPlace rdfs:domain dbo:Person .
35 Semantic Web Conference (ISWC 2014), Lecture Notes in Computer Science
(LNCS). Springer, October 2014. [ .pdf ]
dbo:Organisation owl:disjointWith dbo:Place.
...
Existing KGs aren’t (logically) consistent L [1]
• E.g.
Dbpedia Ontology:
1. Stefan Bischof, Markus Krötzsch, Axel Polleres, and Sebastian Rudolph. Schema-agnostic query rewriting in
36 SPARQL 1.1. In Proceedings of the 13th International Semantic Web Conference (ISWC 2014), Lecture Notes in
Computer Science (LNCS). Springer, October 2014. [ .pdf ]
Reasoning by Querying – Consistency checking:
SELECT
ASK {?X ?C1 ?C2}
WHERE { ?X a/subClassOf* ?C1;
a/subClassOf* ?C2.
?C1 owl:disjointWith ?C2. }
instance data:
dbr:European_Union a dbo:Country. Similarly, RDFS and OWL
inconsistency checking also can
dbr:European_Union a dbo:Organisation. be done by querying! [1]
(simplified)
38
Contextualised Information is better modeled
in another Open Knowledge Graph: Wikidata
• Wikidata can also be queried as RDF with SPARQL!
39
Wikidata as RDF … can be queried by SPARQL
• “Simple” surface query:
• What’s this?
40 SEITE 40
Wikidata as RDF … can be queried by SPARQL
• However, Wikidata has more complex info:
(temporal context, provenance,…)
• Rome:
What do we learn?
• https://www.wikidata.org/wiki/Q220 • Data and meta-data
(context/ provenance)
… Can I query since when which Italian cities at the same level à
have more than 1M population with SPARQL? Yes! one RDF graph, mixing
reification and plain
data, cf. [Hernandez et
al. 2015]
• Quite some
Knowledge about the
ontology required!
SEITE 41
Reification/Property Graphs:
• How to (best) describe contextual statements (aka meta-modeling) about triples in RDF is a bit open…
Entity1 Entity1
predicate
• Property graphs – supported by other graph databases (e.g. Neo4J, BlazeGraph, etc.)
type: capitalOf
Name: Rome added: 2019-06-12 Name: Italy
Type: City author: @Axel Type: Country
added: 2019-06-11 added: 2019-06-11
42 author: @Sebastian author: @Sebastian
Reification/Property Graphs:
• How to (best) describe contextual statements (aka meta-modeling) about triples in RDF is a bit open
• no real prevalent standard… the way Wikidata models it (see above) is just one option.
• various other options and proposals, inter-translatable but affect performance of querying:
Challenge:
RDF reification: [ a rdf:Statement;
How to
rdf:subject :Rome;
rdf:predicate :capitalOf; reformulate
rdf:object :Italy ] :yearBegins 1861 . the inference
rules or
“Named Graphs” :G1 {:Rome :capitalOf :Italy. } rewritings
:G1 :yearBegins 1861 . from slide 58?
44
Rule-Learning/Mining over Knowledge Graphs
• AMIE (Association Rule Mining under Incomplete Evidence)
• extracts supported and confident logical rules from a Knowledge Graph, such as:
https://www.mpi-inf.mpg.de/departments/databases-and-information-systems/research/yago-naga/amie/
Rule-Learning/Mining over Knowledge Graphs
• AMIE (Association Rule Mining under Incomplete Evidence)
• AMIE sample session:
https://www.mpi-inf.mpg.de/departments/databases-and-information-systems/research/yago-naga/amie/
Code: https://github.com/lajus/amie/
Technology behind Knowledge Graphs:
• Storing & Querying Knowledge Graphs:
• Enriching/Verifying Knowledge Graphs via AI:
• Rule-based Reasoning
• Rule-Learning
• Link prediction via Graph Embeddings
• Advanced AI applications that leverage KGs
47
Embeddings, recall word embeddings:
• encoding words to vectors:
• frequency based (e.g. TF/IDF)
• context-based
• co-occurrence based
• prediction-based
• Encode/train NN to predict context-word(s) from word(s) n-grams
(e.g. training with sentences with missing words, or predicting next
words, essentially what LLMs do!)
• Applications:
• Document Classification
• Search (ranking)
• Machine translation
• Conversational AI
• Question answering
Similar idea: Graph embeddings
• General idea:
• embed nodes and relations in a KG in a vectorspace…
• learn embeddings that should filfill certain properties using neural networks, e,g,
TransE [*] embedding:
Example:
Maria
married_to
Theresia
Franz Stephan von Lothringen
Elizabeth II
Other embeddings proposed Prince Philipp, Duke of Edinburgh
• … where this vector embedding can be used again for other AI (particularly ML tasks.
• e.g. Link prediction, Node Classification (i.e. enriching a KG by missing links)
• item recommendation cf. https://www.slideshare.net/EnricoPalumbo2/an-empirical-comparison-
of-knowledge-graph-embeddings-for-item-recommendation
[*] Antoine Bordes, Nicolas Usunier, Alberto García-Durán, Jason Weston, Oksana Yakhnenko:
Translating Embeddings for Modeling Multi-relational Data. NIPS 2013: 2787-2795
Technology behind Knowledge Graphs:
• Storing & Querying Knowledge Graphs:
• Enriching/Verifying Knowledge Graphs via AI
• Advanced AI applications that leverage KGs
• Question Answering
• Semantic Search
50
Some of our own research in this space:
● HDT - Lightweight/portable compressed graph/triple store.
● Extending SPARQL with “real” path queries (prototype)
● Connecting Knowledge Graphs to text and conversations
● Understanding and Searching Open Data by linking it to a Knowledge Graph
Svitlana Vakulenko, Maarten de Rijke, Michael Cochez, Vadim Savenkov, and Axel Polleres. Measuring semantic coherence of a conversation. In Proceedings of the 17th International
Semantic Web Conference (ISWC 2018), volume 11136 of Lecture Notes in Computer Science (LNCS), pages 634--651, Monterey, CA, October 2018. Springer. [ DOI | .pdf ]
Svitlana Vakulenko, Javier Fernández, Axel Polleres, Maarten de Rijke, and Michael Cochez. Message passing for complex question answering over knowledge graphs. In 28th ACM
International Conference on Information and Knowledge Management (CIKM2019, Beijing, China, November 2019. [ http ]
Sebastian Neumaier and Axel Polleres. Enabling spatio-temporal search in open data. Journal of Web Semantics (JWS), pre-print available at http://epub.wu.ac.at/6758/, 2019. to
appear (accepted for publication).
Javier D. Fernández, Miguel A. Martinez-Prieto, Claudio Gutiérrez, Axel Polleres, and Mario Arias. Binary RDF Representation for Publication and Exchange (HDT). Journal of Web
Semantics (JWS), 19(2), 2013. [ http ]
Vadim Savenkov, Qaiser Mehmood, Jürgen Umbrich, and Axel Polleres. Counting to k, or how SPARQL 1.1 could be efficiently enhanced with top k shortest path queries. In 13th
International Conference on Semantic Systems (SEMANTiCS), pages 97--103, Amsterdam, the Netherlands, September 2017. ACM. [ .pdf ]
51
Tackling hard NLP problems with Knowledge Graphs:
Svitlana Vakulenko, Maarten de Rijke, Michael Cochez, Vadim Savenkov, and Axel Polleres. Measuring semantic coherence
of a conversation. In Proceedings of the 17th International Semantic Web Conference (ISWC 2018), volume 11136 of
Lecture Notes in Computer Science (LNCS), pages 634--651, Monterey, CA, October 2018. Springer. [ DOI | .pdf ]
2) Be sure to NOT feed any sensitive (personal) or copyrighted data into OpenAI!
Recall:
https://w.wiki/6Enj
https://chat.openai.com/share/0a263a93-
c978-4b1f-acd0-44a7bbaf3c51
Appendix: More of our own (ongoing anf older) reseach using Knowledge Graphs
CiyData Pipeline:
Enriching and completing Open City Data with a combination of using Equational Knowledge and Machine Learning
Thesis:
http://polleres.net/supervised_theses/Stefan_Bischof_Dissertation_2017.pdf
Indicators
Problem: different
sources conatin
different indicators
(area, population,
popultiondensity,
economic factors, for
different years.
city Vienna
year 2016
indicator
source value
error population
1 852 997
eurostat 0.0
63
Use equational knowledge for missing
computed/computable values:
population area
indicator indicator
city Vienna city
year year
value 2016
error error
value
city
1 852 997 year 0.0
0.0
414.650
population
populationdensity =
area
indicator
derived From error value
population density
population 4 467
populationdensity Ü 0.0
area
64
equations: deal with
approximated values by using
error propagation
population area
indicator indicator
city Vienna city
65
More Details:
Stefan Bischof, Andreas Harth, Benedikt Kämpgen, Axel Polleres, and PatrikSchneider.Enriching integrated statistical open city data by
combining equational knowledge and missing value imputation. Journal of Web Semantics (JWS), October 2017.In press.
Main idea:
Combine
(1) ontological reasoning, (2)ML, (3)
equations “iteratively” with
QB equations
Evaluation Combination
PCA Regression + QB Equations
• Statistics one iteration (PCA regression + QB Equations)
• 991k observations from crawled data
• 522k new or better observations from PCA regression
• 230k better observations from QB Equations
• 232k new observations from QB Equations
• Same or better values (improved RMSE) for 80 of 82 indicators
• QB Equations are sensitive to correct error estimates
67
City Data Pipeline
Prototype
citydata.wu.ac.at
• Search for indicators & cities
• obtain results incl. sources
• Integrated data served as Linked Open Data
• Predicted values AND estimated error rates for
missing data...
Thesis:
http://polleres.net/supervised_theses/Sebastian_Neumaier_PhD_2019.pdf
Tackling hard research problems with Knowledge Graphs:
https://www.youtube.com/watch?v=kCAymmbYIvc
vs.
70
Our research:
Knowledge Graphs for Natural Data Search &
Integration!
• 2 approaches how knowledge graphs could help to solve the Open Data search problem:
1. Hierarchical labelling of Labeling of numeric data
2. Hierarchical labelling of Spatio-Temporal entities
71
Example Table
… … … … …
72
Open Data CSVs look more like this
… … … …
73 Source: https://www.data.gv.at/katalog/dataset/e108dcc3-1304-4076-8619-f2185c37ef81
Why not use the numeric values?
• Identifying the most likely semantic label for a bag of
numerical values
• Deliberately ignore surroundings
… … … …
74
Why not use numeric values?
• Identifying the most likely semantic label for a bag of
numerical values
• Deliberately ignore surroundings
98157
18763
29730
75
Background Knowledge Graph
• Cities
• Population
• Area
• Country
• Location (Coordinates)
• Economic indicators
• …
• Organisations:
• Revenues
• Board members
• …
• Persons (e.g. celebrities, sports)
• Name
• Profession
What’s in there? • Height
• Landmarks (e.g. famous buildings)
• Country
• Location
• Height
• Events
• Dates
• Location
76
Background Knowledge Graph
• Find properties with
numerical range
• Hierarchical clustering approach
• Property-object hierarchy
(shared property-object pairs)
77
Label based on Nearest Neighbors
2
4
3
6 5
1
78
Example OD Labelling
populationTotal (a Settlement)
populationDensity (a City)
79
79 Source: http://data.wu.ac.at/iswc2016_numlabels/submission/col14.html
Lessons learned
• We can assign fine-grained semantic labels
• If there is enough evidence in Background Knowledge Graph
• However: Missing domain knowledge for labelling OD
Future work:
• Complementary to existing approaches (column header labeling, entity linking and relation extraction)
• Combined approaches may improve results
• Focusing on core dimensions of specific domains e.g. city data, maye more promising than “general”
value labeling.
80
What else can we do/use?
Focus on specific dimensions:
• Particularly temporal and geospatial queries require better support [2]
… … … …
[2] Emilia Kacprzak, et al.: A Query Log Analysis of Dataset Search. International Conference on Web Engineering (2017)
81
Available Geospatial Knowledge Bases
82
82
Geo-Knowledge Graph Construction
European Classification
Wikidata,
of Territorial Units
GeoNames
Wikidata links
Extracting OSM
streets and places
83
Available Temporal Knowledge
Temporal Knowledge Graph Construction
}
• Temporal extent, i.e. a
single beginning and end
date
85
85
Dataset Labelling
Metadata descriptions
• Geo-entities in titles, descriptions,
organizations
• Restricted to „origin“ country of the
dataset (from portal)
• Temporal tagging using Heideltime
framework [3]
87
RDF Export 1/2:
Knowledge Graph
Details: cf.:
http://data.wu.ac.at/ns/csvwx
[4] R. Pollock et al., Metadata Vocabulary for Tabular Data, W3C CSV on the Web (2015)
89
Enable e.g. Search by GeoSPARQL Queries:
• Standard for representation and querying of geospatial linked data
• (Almost) no complete implementations of GeoSPARQL
90
Search Interface
https://data.wu.ac.at/odgraphsearch/
Faceted query interface:
§ Timespan
§ Time pattern
§ Geo-entities
§ Full-text queries
Back end:
§ MongoDB for efficient key
look-ups
§ ElasticSearch for indexing
and full-text queries
§ Virtuoso as a triple store
91
91
Lessons learned
• Geospatial and Temporal scope is the most useful search
feature for Open Data
• Respective Hierarchical Knowledge Graphs can be built
from existing Linked Data Sources
• Our algorithms annotate CSV tables and their metadata
descriptions
92
92