SlideShare a Scribd company logo
1 of 39
Download to read offline
Join our community at grakn.ai/community
T H E D A T A B A S E F O R A I
Logical Inference in a 

Hyper-Relational database


By Domenico Corapi
Lead Engineer at GRAKN.AI
1
Follow us @GraknLabs
• @DomenicoCorapi
• PhD in Computational Logic /
Machine Learning at Imperial
College
• Web Services and Distributed
Systems at Microsoft Yammer and
Skyscanner
• Finance stuff at Citi and
Bloomberg
WHO AM I?
Follow us @GraknLabs
What is inference?
LAZY INFERENCE IN GRAKN
• We know some facts about the
world: a Knowledge Base
• Using some inference rules,
what other facts can we derive?
Knowledge
Base
Conclusions
Inference
INFERENCE
• Deductive reasoning
• Abductive reasoning
• Inductive reasoning
• Probabilistic reasoning
• …
INFERENCE
Knowledge
Base
Today is a sunny day
I don’t work if it’s a sunny day
or if it’s a bank holiday
Conclusions
Inference
I don’t work today
Deduction
INFERENCE
Knowledge
Base
Conclusions
Inference
I don’t work today
SELECT * FROM …
Sunny days table, bank holiday table
+ Application logic
Follow us @GraknLabs
Some notation and
useful concepts
LAZY INFERENCE IN GRAKN
Follow us @GraknLabs
SOME NOTATION
First-order logic Formal logic
Computational logic
Prolog
Datalog
Answer Set Programming
Graql rules
Follow us @GraknLabs
SOME NOTATION
• human(socrates)

socrates is human
• human(X)

X is human
• likes(socrates, X), paradox(X)

socrates likes X and X is a paradox
• likes(socrates, X) <- paradox(X)

socrates likes X if X is a paradox
• h <- b1, b2, …, bn

Definite clause
Follow us @GraknLabs
DEDUCTION
• human(socrates)
• human(X) -> mortal(X)
• mortal(socrates)
Follow us @GraknLabs
DEDUCTION
• good_at(me, numbers)
• made_of(stock_market, numbers)
• good_at(me, stock_market)
?
good_at(P, X),
made_of(Y, X) ->
good_at(P, Y)
Follow us @GraknLabs
HERBRAND BASE
• human(socrates)
• human(X) -> mortal(X)
• human(socrates)
• mortal(socrates)
A Herbrand Base is the
set of all possible ground
(no variables) assertions
Herbrand Base:
Follow us @GraknLabs
INTERPRETATION
• human(socrates)
• mortal(socrates)
A Interpretation is an
assignment of truth
values to elements in the
Herbrand Base
Herbrand Base:
• {}
• {human(socrates)}
• {mortal(socrates)}
• {mortal(socrates), human(socrates)}
Possible interpretations:
Follow us @GraknLabs
MODEL
• human(socrates)
• human(X) -> mortal(X)A Model for a Knowledge
Base KB is an
interpretation of KB that
satisfies each clause in KB
Possible interpretations:
• {}
• {human(socrates)}
• {mortal(socrates)}
• {mortal(socrates), human(socrates)}Model
Follow us @GraknLabs
SOME FUNDAMENTAL THEOREM
A Knowledge Base with no negation has one and only
one minimal model
Follow us @GraknLabs
COMPUTATIONAL LOGIC IN A NUTSHELL
KB ⊨ G
G is entailed by KB
KB ⊢ G
G is provable from KB
• What language is KB in?
• What semantics is represented by ⊨?
• What proof procedure is used in ⊢?
• In what conditions is true?
Follow us @GraknLabs
CLOSED WORLD ASSUMPTION
Flights
Airline Number Origin Dest
AS 98 ANC SEA
AA 2336 LAX PBI
US 840 SFO CLT
AA 258 LAX MIA
AS 153 SEA ANC
…
select * from flights
where origin = ‘LHR’
What do we know about entries that are NOT in the table?
Not added yet?
They don’t exist?
We don’t know?
Follow us @GraknLabs
NEGATION IS HARD
man(adam).
single(X) <- man(X), not husband(X).
husband(X) <- man(X), not single(X).
Herbrand Base:
{man(adam), 

single(adam),
husband(adam)}
Minimal models:
• {man(adam), single(adam)}
• {man(adam), husband(adam)}
Follow us @GraknLabs
Bottom Up
Inference
LAZY INFERENCE IN GRAKN
Follow us @GraknLabs
BOTTOM UP INFERENCE
• Answer Set Programming
• Multiple models as answer
• Use of disjunction, cardinality constraints, integrity constraints,
classical negation, cwa negation… (no functors)
• Variables are typed
Follow us @GraknLabs
BOTTOM UP INFERENCE
1. Ground the knowledge base
2. Compute the models
Follow us @GraknLabs
GROUNDING
• human(plato)
• human(socrates)
• human(X) -> mortal(X)
• human(socrates) -> mortal(socrates)
• human(plato) -> mortal(plato)
• human(plato)
• human(socrates)
Follow us @GraknLabs
COMPUTE THE MODELS
(NOT human(socrates) OR mortal(socrates)) 

AND 

(NOT human(plato) OR mortal(plato)) 

AND 

human(plato) 

AND 

human(socrates)
SAT SOLVER
Follow us @GraknLabs
Grakn
LAZY INFERENCE IN GRAKN
Follow us @GraknLabs
Entity
GRAKN KNOWLEDGE MODEL
has has
plays relates
Attribute
Relationship
Role
Follow us @GraknLabs
Entity
GRAKN KNOWLEDGE MODEL
Attribute
Relationship
Role
socrates, plato
mortal
e.g. mortal(socrates)
teaches
e.g. teaches(socrates, plato)
teacher, student
e.g. teaches(teacher: socrates,
student: plato)
Follow us @GraknLabs
LOCATIONS
Follow us @GraknLabs
Lazy inference in
Grakn
LAZY INFERENCE IN GRAKN
Follow us @GraknLabs
RULES IN GRAKN
human(X) -> mortal(X)
when {
$x isa human
}, then {
$x has mortal “true”
}
human sub mortal
Follow us @GraknLabs
RULES IN GRAKN
is_located_in(X, Y), is_located_in(Y, Z) -> is_located_in(X, Z)
when {
(geo-entity: $x, entity-location: $y) isa is-located-in;
(geo-entity: $y, entity-location: $z) isa is-located-in;
}, then {
(geo-entity: $x, entity-location: $z) isa is-located-in;
}
Follow us @GraknLabs
STEP BY STEP
match $x isa city; $y has name 'Poland'; ($x, $y) isa is-located-in; get;
iterator.next()
1. Pop a subgoal from the stack
2. If subgoal is an answer return
3. Else expand goal into subgoals and push to stack.

Back to 1.
Follow us @GraknLabs
STEP BY STEP
$y has name ‘Poland’
($x, $y) isa is-located-in
match $x isa city
G
lookup $y such that $y has name ‘Poland’
($x, $y) isa is-located-in
match $x isa city
($x, NODE_POLAND) isa is-located-in
match $x isa city
$y / NODE_POLAND
lookup ($x, NODE_POLAND) isa is-located-in
match $x isa city
Follow us @GraknLabs
STEP BY STEP
$y has name ‘Poland’
($x, $y) isa is-located-in
match $x isa city
lookup $y such that $y has name ‘Poland’
G
G
($x, NODE_POLAND) isa is-located-in
match $x isa city
$y / NODE_POLAND
lookup ($x, NODE_POLAND) isa is-located-in
match $x isa city
lookup ($x, NODE_POLAND) isa is-located-in
…
lookup $y has name Poland
…
match NODE_SILESIA isa city
$x / NODE_SILESIA
Follow us @GraknLabs
STEP BY STEP
$y has name ‘Poland’
($x, $y) isa is-located-in
match $x isa city
lookup $y such that $y has name ‘Poland’
G
G
($x, NODE_POLAND) isa is-located-in
match $x isa city
$y / NODE_POLAND
lookup ($x, NODE_POLAND) isa is-located-in
match $x isa city
$x / NODE_SILESIA
match NODE_SILESIA isa city
{}
Follow us @GraknLabs
STEP BY STEP
lookup ($x, NODE_POLAND) isa is-located-in
match $x isa city
$x / NODE_SILESIA
match NODE_MASOVIA isa city
{}
match NODE_SILESIA isa city
$x / NODE_MASOVIA
{}
($x, NODE_POLAND) isa is-located-in
match $x isa city is-located-in($x, NODE_POLAND)
<- is-located-in($x, $z),
is-located-in($z, NODE_POLAND)
($x, $z) isa is-located-in
($z, NODE_POLAND) isa is-located-in

match $x isa city
is_located_in(X, Z) <-
is_located_in(X, Y),
is_located_in(Y, Z)
X/$x
Z/NODE_POLAND
Follow us @GraknLabs
STEP BY STEP
($x, $z) isa is-located-in
($z, NODE_POLAND) isa is-located-in
($x, NODE_MASOVIA) isa is-located-in

match $x isa city
$z / NODE_MASOVIA
Answer: {$x: NODE_WARSAW}
…
…
Follow us @GraknLabs
SLD RESOLUTION
This is very similar to what Prolog implementations do
Differences
• Things are represented as nodes! No index lookup, but just getting the edges
• Interleaving graph lookups with resolution steps
• Type checks and roles in relationships
• Fetching results lazily. We keep a pointer rather than saving goals on the stack
• Caching intermediate results (similar to tabling in Prolog)
Follow us @GraknLabs
CONCLUSION
Inference is a more powerful and general way to derive conclusions from data.
Grakn uses rules to define higher level concepts and applies a top-down procedure to perform
inference.
Lookups are expensive, we need to be lazy.

Using a stack to save the state of the computation. We keep pointers to nodes in the underlying
graph from which we resume the inference procedure.
Follow us @GraknLabs
Thank you!
@GraknLabs
https://grakn.ai/
https://github.com/graknlabs/grakn
domenico@grakn.ai
@DomenicoCorapi

More Related Content

What's hot

Introducing GRAKN.AI
Introducing GRAKN.AIIntroducing GRAKN.AI
Introducing GRAKN.AIVaticle
 
Knowledge graph convolutional networks - London 2018
Knowledge graph convolutional networks - London 2018Knowledge graph convolutional networks - London 2018
Knowledge graph convolutional networks - London 2018Vaticle
 
Visual Analytics for Linguistics - Day 4 ESSLLI - structured data
Visual Analytics for Linguistics - Day 4 ESSLLI - structured dataVisual Analytics for Linguistics - Day 4 ESSLLI - structured data
Visual Analytics for Linguistics - Day 4 ESSLLI - structured dataOlga Scrivner
 
Natural Language Processing with Graph Databases and Neo4j
Natural Language Processing with Graph Databases and Neo4jNatural Language Processing with Graph Databases and Neo4j
Natural Language Processing with Graph Databases and Neo4jWilliam Lyon
 
Visual Analytics for Linguistics - Day 5 ESSLLI 2017
Visual Analytics for Linguistics - Day 5 ESSLLI 2017Visual Analytics for Linguistics - Day 5 ESSLLI 2017
Visual Analytics for Linguistics - Day 5 ESSLLI 2017Olga Scrivner
 
Improve ML Predictions using Connected Feature Extraction
Improve ML Predictions using Connected Feature ExtractionImprove ML Predictions using Connected Feature Extraction
Improve ML Predictions using Connected Feature ExtractionDatabricks
 
R, Data Wrangling & Predicting NFL with Elo like Nate SIlver & 538
R, Data Wrangling & Predicting NFL with Elo like Nate SIlver & 538R, Data Wrangling & Predicting NFL with Elo like Nate SIlver & 538
R, Data Wrangling & Predicting NFL with Elo like Nate SIlver & 538Krishna Sankar
 
UM03 - Learning Know..
UM03 - Learning Know..UM03 - Learning Know..
UM03 - Learning Know..butest
 

What's hot (8)

Introducing GRAKN.AI
Introducing GRAKN.AIIntroducing GRAKN.AI
Introducing GRAKN.AI
 
Knowledge graph convolutional networks - London 2018
Knowledge graph convolutional networks - London 2018Knowledge graph convolutional networks - London 2018
Knowledge graph convolutional networks - London 2018
 
Visual Analytics for Linguistics - Day 4 ESSLLI - structured data
Visual Analytics for Linguistics - Day 4 ESSLLI - structured dataVisual Analytics for Linguistics - Day 4 ESSLLI - structured data
Visual Analytics for Linguistics - Day 4 ESSLLI - structured data
 
Natural Language Processing with Graph Databases and Neo4j
Natural Language Processing with Graph Databases and Neo4jNatural Language Processing with Graph Databases and Neo4j
Natural Language Processing with Graph Databases and Neo4j
 
Visual Analytics for Linguistics - Day 5 ESSLLI 2017
Visual Analytics for Linguistics - Day 5 ESSLLI 2017Visual Analytics for Linguistics - Day 5 ESSLLI 2017
Visual Analytics for Linguistics - Day 5 ESSLLI 2017
 
Improve ML Predictions using Connected Feature Extraction
Improve ML Predictions using Connected Feature ExtractionImprove ML Predictions using Connected Feature Extraction
Improve ML Predictions using Connected Feature Extraction
 
R, Data Wrangling & Predicting NFL with Elo like Nate SIlver & 538
R, Data Wrangling & Predicting NFL with Elo like Nate SIlver & 538R, Data Wrangling & Predicting NFL with Elo like Nate SIlver & 538
R, Data Wrangling & Predicting NFL with Elo like Nate SIlver & 538
 
UM03 - Learning Know..
UM03 - Learning Know..UM03 - Learning Know..
UM03 - Learning Know..
 

Similar to Logical Inference in a Hyper-Relational Database

Big Data LDN 2017: Machine Learning on Structured Data. Why Is Learning Rules...
Big Data LDN 2017: Machine Learning on Structured Data. Why Is Learning Rules...Big Data LDN 2017: Machine Learning on Structured Data. Why Is Learning Rules...
Big Data LDN 2017: Machine Learning on Structured Data. Why Is Learning Rules...Matt Stubbs
 
Should a Graph Database Be in Your Next Data Warehouse Stack?
Should a Graph Database Be in Your Next Data Warehouse Stack?Should a Graph Database Be in Your Next Data Warehouse Stack?
Should a Graph Database Be in Your Next Data Warehouse Stack?Cambridge Semantics
 
Introducing: A Complete Algebra of Data
Introducing: A Complete Algebra of DataIntroducing: A Complete Algebra of Data
Introducing: A Complete Algebra of DataInside Analysis
 
Soft Shake Event / A soft introduction to Neo4J
Soft Shake Event / A soft introduction to Neo4JSoft Shake Event / A soft introduction to Neo4J
Soft Shake Event / A soft introduction to Neo4JFlorent Biville
 
Open LSH - september 2014 update
Open LSH  - september 2014 updateOpen LSH  - september 2014 update
Open LSH - september 2014 updateJ Singh
 
07-Classification.pptx
07-Classification.pptx07-Classification.pptx
07-Classification.pptxShree Shree
 
DevFest Istanbul - a free guided tour of Neo4J
DevFest Istanbul - a free guided tour of Neo4JDevFest Istanbul - a free guided tour of Neo4J
DevFest Istanbul - a free guided tour of Neo4JFlorent Biville
 
The Road to Data Science - Joel Grus, June 2015
The Road to Data Science - Joel Grus, June 2015The Road to Data Science - Joel Grus, June 2015
The Road to Data Science - Joel Grus, June 2015Seattle DAML meetup
 
Meet Gremlin – your guide through graphs in Cosmos DB
Meet Gremlin – your guide through graphs in Cosmos DBMeet Gremlin – your guide through graphs in Cosmos DB
Meet Gremlin – your guide through graphs in Cosmos DBRafał Hryniewski
 
Haystack 2019 - Natural Language Search with Knowledge Graphs - Trey Grainger
Haystack 2019 - Natural Language Search with Knowledge Graphs - Trey GraingerHaystack 2019 - Natural Language Search with Knowledge Graphs - Trey Grainger
Haystack 2019 - Natural Language Search with Knowledge Graphs - Trey GraingerOpenSource Connections
 
Rule Mining and Applications in Social Data
Rule Mining and Applications in Social DataRule Mining and Applications in Social Data
Rule Mining and Applications in Social DataLuis Galárraga
 
Natural Language Search with Knowledge Graphs (Haystack 2019)
Natural Language Search with Knowledge Graphs (Haystack 2019)Natural Language Search with Knowledge Graphs (Haystack 2019)
Natural Language Search with Knowledge Graphs (Haystack 2019)Trey Grainger
 
Apache Spark GraphX & GraphFrame Synthetic ID Fraud Use Case
Apache Spark GraphX & GraphFrame Synthetic ID Fraud Use CaseApache Spark GraphX & GraphFrame Synthetic ID Fraud Use Case
Apache Spark GraphX & GraphFrame Synthetic ID Fraud Use CaseMo Patel
 
Learning to assess Linked Data relationships using Genetic Programming
Learning to assess Linked Data relationships using Genetic ProgrammingLearning to assess Linked Data relationships using Genetic Programming
Learning to assess Linked Data relationships using Genetic ProgrammingVrije Universiteit Amsterdam
 
Constructing your search
Constructing your searchConstructing your search
Constructing your searchJamie Bisset
 
Bootstrapping Recommendations with Neo4j
Bootstrapping Recommendations with Neo4jBootstrapping Recommendations with Neo4j
Bootstrapping Recommendations with Neo4jMax De Marzi
 
Economies of Scaling Software
Economies of Scaling SoftwareEconomies of Scaling Software
Economies of Scaling SoftwareJoshua Long
 
How Graph Databases used in Police Department?
How Graph Databases used in Police Department?How Graph Databases used in Police Department?
How Graph Databases used in Police Department?Samet KILICTAS
 

Similar to Logical Inference in a Hyper-Relational Database (20)

Big Data LDN 2017: Machine Learning on Structured Data. Why Is Learning Rules...
Big Data LDN 2017: Machine Learning on Structured Data. Why Is Learning Rules...Big Data LDN 2017: Machine Learning on Structured Data. Why Is Learning Rules...
Big Data LDN 2017: Machine Learning on Structured Data. Why Is Learning Rules...
 
Christian Jakenfelds
Christian JakenfeldsChristian Jakenfelds
Christian Jakenfelds
 
20151020 Metis
20151020 Metis20151020 Metis
20151020 Metis
 
Should a Graph Database Be in Your Next Data Warehouse Stack?
Should a Graph Database Be in Your Next Data Warehouse Stack?Should a Graph Database Be in Your Next Data Warehouse Stack?
Should a Graph Database Be in Your Next Data Warehouse Stack?
 
Introducing: A Complete Algebra of Data
Introducing: A Complete Algebra of DataIntroducing: A Complete Algebra of Data
Introducing: A Complete Algebra of Data
 
Soft Shake Event / A soft introduction to Neo4J
Soft Shake Event / A soft introduction to Neo4JSoft Shake Event / A soft introduction to Neo4J
Soft Shake Event / A soft introduction to Neo4J
 
Open LSH - september 2014 update
Open LSH  - september 2014 updateOpen LSH  - september 2014 update
Open LSH - september 2014 update
 
07-Classification.pptx
07-Classification.pptx07-Classification.pptx
07-Classification.pptx
 
DevFest Istanbul - a free guided tour of Neo4J
DevFest Istanbul - a free guided tour of Neo4JDevFest Istanbul - a free guided tour of Neo4J
DevFest Istanbul - a free guided tour of Neo4J
 
The Road to Data Science - Joel Grus, June 2015
The Road to Data Science - Joel Grus, June 2015The Road to Data Science - Joel Grus, June 2015
The Road to Data Science - Joel Grus, June 2015
 
Meet Gremlin – your guide through graphs in Cosmos DB
Meet Gremlin – your guide through graphs in Cosmos DBMeet Gremlin – your guide through graphs in Cosmos DB
Meet Gremlin – your guide through graphs in Cosmos DB
 
Haystack 2019 - Natural Language Search with Knowledge Graphs - Trey Grainger
Haystack 2019 - Natural Language Search with Knowledge Graphs - Trey GraingerHaystack 2019 - Natural Language Search with Knowledge Graphs - Trey Grainger
Haystack 2019 - Natural Language Search with Knowledge Graphs - Trey Grainger
 
Rule Mining and Applications in Social Data
Rule Mining and Applications in Social DataRule Mining and Applications in Social Data
Rule Mining and Applications in Social Data
 
Natural Language Search with Knowledge Graphs (Haystack 2019)
Natural Language Search with Knowledge Graphs (Haystack 2019)Natural Language Search with Knowledge Graphs (Haystack 2019)
Natural Language Search with Knowledge Graphs (Haystack 2019)
 
Apache Spark GraphX & GraphFrame Synthetic ID Fraud Use Case
Apache Spark GraphX & GraphFrame Synthetic ID Fraud Use CaseApache Spark GraphX & GraphFrame Synthetic ID Fraud Use Case
Apache Spark GraphX & GraphFrame Synthetic ID Fraud Use Case
 
Learning to assess Linked Data relationships using Genetic Programming
Learning to assess Linked Data relationships using Genetic ProgrammingLearning to assess Linked Data relationships using Genetic Programming
Learning to assess Linked Data relationships using Genetic Programming
 
Constructing your search
Constructing your searchConstructing your search
Constructing your search
 
Bootstrapping Recommendations with Neo4j
Bootstrapping Recommendations with Neo4jBootstrapping Recommendations with Neo4j
Bootstrapping Recommendations with Neo4j
 
Economies of Scaling Software
Economies of Scaling SoftwareEconomies of Scaling Software
Economies of Scaling Software
 
How Graph Databases used in Police Department?
How Graph Databases used in Police Department?How Graph Databases used in Police Department?
How Graph Databases used in Police Department?
 

More from Vaticle

Building Biomedical Knowledge Graphs for In-Silico Drug Discovery
Building Biomedical Knowledge Graphs for In-Silico Drug DiscoveryBuilding Biomedical Knowledge Graphs for In-Silico Drug Discovery
Building Biomedical Knowledge Graphs for In-Silico Drug DiscoveryVaticle
 
Loading Huge Amounts of Data
Loading Huge Amounts of DataLoading Huge Amounts of Data
Loading Huge Amounts of DataVaticle
 
Natural Language Interface to Knowledge Graph
Natural Language Interface to Knowledge GraphNatural Language Interface to Knowledge Graph
Natural Language Interface to Knowledge GraphVaticle
 
A Data Modelling Framework to Unify Cyber Security Knowledge
A Data Modelling Framework to Unify Cyber Security KnowledgeA Data Modelling Framework to Unify Cyber Security Knowledge
A Data Modelling Framework to Unify Cyber Security KnowledgeVaticle
 
Unifying Space Mission Knowledge with NLP & Knowledge Graph
Unifying Space Mission Knowledge with NLP & Knowledge GraphUnifying Space Mission Knowledge with NLP & Knowledge Graph
Unifying Space Mission Knowledge with NLP & Knowledge GraphVaticle
 
The Next Big Thing in AI - Causality
The Next Big Thing in AI - CausalityThe Next Big Thing in AI - Causality
The Next Big Thing in AI - CausalityVaticle
 
Building a Cyber Threat Intelligence Knowledge Graph
Building a Cyber Threat Intelligence Knowledge GraphBuilding a Cyber Threat Intelligence Knowledge Graph
Building a Cyber Threat Intelligence Knowledge GraphVaticle
 
Knowledge Graphs for Supply Chain Operations.pdf
Knowledge Graphs for Supply Chain Operations.pdfKnowledge Graphs for Supply Chain Operations.pdf
Knowledge Graphs for Supply Chain Operations.pdfVaticle
 
Building a Distributed Database with Raft.pdf
Building a Distributed Database with Raft.pdfBuilding a Distributed Database with Raft.pdf
Building a Distributed Database with Raft.pdfVaticle
 
Enabling the Computational Future of Biology.pdf
Enabling the Computational Future of Biology.pdfEnabling the Computational Future of Biology.pdf
Enabling the Computational Future of Biology.pdfVaticle
 
TypeDB Academy | Inference with Rules
TypeDB Academy | Inference with RulesTypeDB Academy | Inference with Rules
TypeDB Academy | Inference with RulesVaticle
 
TypeDB Academy | Modelling Principles
TypeDB Academy | Modelling PrinciplesTypeDB Academy | Modelling Principles
TypeDB Academy | Modelling PrinciplesVaticle
 
Beyond SQL - Comparing SQL to TypeQL
Beyond SQL - Comparing SQL to TypeQLBeyond SQL - Comparing SQL to TypeQL
Beyond SQL - Comparing SQL to TypeQLVaticle
 
TypeDB Academy- Getting Started with Schema Design
TypeDB Academy- Getting Started with Schema DesignTypeDB Academy- Getting Started with Schema Design
TypeDB Academy- Getting Started with Schema DesignVaticle
 
Comparing Semantic Web Technologies to TypeDB
Comparing Semantic Web Technologies to TypeDBComparing Semantic Web Technologies to TypeDB
Comparing Semantic Web Technologies to TypeDBVaticle
 
Reasoner, Meet Actors | TypeDB's Native Reasoning Engine
Reasoner, Meet Actors | TypeDB's Native Reasoning EngineReasoner, Meet Actors | TypeDB's Native Reasoning Engine
Reasoner, Meet Actors | TypeDB's Native Reasoning EngineVaticle
 
Intro to TypeDB and TypeQL | A strongly-typed database
Intro to TypeDB and TypeQL | A strongly-typed databaseIntro to TypeDB and TypeQL | A strongly-typed database
Intro to TypeDB and TypeQL | A strongly-typed databaseVaticle
 
Graph Databases vs TypeDB | What you can't do with graphs
Graph Databases vs TypeDB | What you can't do with graphsGraph Databases vs TypeDB | What you can't do with graphs
Graph Databases vs TypeDB | What you can't do with graphsVaticle
 
Pandora Paper Leaks With TypeDB
 Pandora Paper Leaks With TypeDB Pandora Paper Leaks With TypeDB
Pandora Paper Leaks With TypeDBVaticle
 
Strongly Typed Data for Machine Learning
Strongly Typed Data for Machine LearningStrongly Typed Data for Machine Learning
Strongly Typed Data for Machine LearningVaticle
 

More from Vaticle (20)

Building Biomedical Knowledge Graphs for In-Silico Drug Discovery
Building Biomedical Knowledge Graphs for In-Silico Drug DiscoveryBuilding Biomedical Knowledge Graphs for In-Silico Drug Discovery
Building Biomedical Knowledge Graphs for In-Silico Drug Discovery
 
Loading Huge Amounts of Data
Loading Huge Amounts of DataLoading Huge Amounts of Data
Loading Huge Amounts of Data
 
Natural Language Interface to Knowledge Graph
Natural Language Interface to Knowledge GraphNatural Language Interface to Knowledge Graph
Natural Language Interface to Knowledge Graph
 
A Data Modelling Framework to Unify Cyber Security Knowledge
A Data Modelling Framework to Unify Cyber Security KnowledgeA Data Modelling Framework to Unify Cyber Security Knowledge
A Data Modelling Framework to Unify Cyber Security Knowledge
 
Unifying Space Mission Knowledge with NLP & Knowledge Graph
Unifying Space Mission Knowledge with NLP & Knowledge GraphUnifying Space Mission Knowledge with NLP & Knowledge Graph
Unifying Space Mission Knowledge with NLP & Knowledge Graph
 
The Next Big Thing in AI - Causality
The Next Big Thing in AI - CausalityThe Next Big Thing in AI - Causality
The Next Big Thing in AI - Causality
 
Building a Cyber Threat Intelligence Knowledge Graph
Building a Cyber Threat Intelligence Knowledge GraphBuilding a Cyber Threat Intelligence Knowledge Graph
Building a Cyber Threat Intelligence Knowledge Graph
 
Knowledge Graphs for Supply Chain Operations.pdf
Knowledge Graphs for Supply Chain Operations.pdfKnowledge Graphs for Supply Chain Operations.pdf
Knowledge Graphs for Supply Chain Operations.pdf
 
Building a Distributed Database with Raft.pdf
Building a Distributed Database with Raft.pdfBuilding a Distributed Database with Raft.pdf
Building a Distributed Database with Raft.pdf
 
Enabling the Computational Future of Biology.pdf
Enabling the Computational Future of Biology.pdfEnabling the Computational Future of Biology.pdf
Enabling the Computational Future of Biology.pdf
 
TypeDB Academy | Inference with Rules
TypeDB Academy | Inference with RulesTypeDB Academy | Inference with Rules
TypeDB Academy | Inference with Rules
 
TypeDB Academy | Modelling Principles
TypeDB Academy | Modelling PrinciplesTypeDB Academy | Modelling Principles
TypeDB Academy | Modelling Principles
 
Beyond SQL - Comparing SQL to TypeQL
Beyond SQL - Comparing SQL to TypeQLBeyond SQL - Comparing SQL to TypeQL
Beyond SQL - Comparing SQL to TypeQL
 
TypeDB Academy- Getting Started with Schema Design
TypeDB Academy- Getting Started with Schema DesignTypeDB Academy- Getting Started with Schema Design
TypeDB Academy- Getting Started with Schema Design
 
Comparing Semantic Web Technologies to TypeDB
Comparing Semantic Web Technologies to TypeDBComparing Semantic Web Technologies to TypeDB
Comparing Semantic Web Technologies to TypeDB
 
Reasoner, Meet Actors | TypeDB's Native Reasoning Engine
Reasoner, Meet Actors | TypeDB's Native Reasoning EngineReasoner, Meet Actors | TypeDB's Native Reasoning Engine
Reasoner, Meet Actors | TypeDB's Native Reasoning Engine
 
Intro to TypeDB and TypeQL | A strongly-typed database
Intro to TypeDB and TypeQL | A strongly-typed databaseIntro to TypeDB and TypeQL | A strongly-typed database
Intro to TypeDB and TypeQL | A strongly-typed database
 
Graph Databases vs TypeDB | What you can't do with graphs
Graph Databases vs TypeDB | What you can't do with graphsGraph Databases vs TypeDB | What you can't do with graphs
Graph Databases vs TypeDB | What you can't do with graphs
 
Pandora Paper Leaks With TypeDB
 Pandora Paper Leaks With TypeDB Pandora Paper Leaks With TypeDB
Pandora Paper Leaks With TypeDB
 
Strongly Typed Data for Machine Learning
Strongly Typed Data for Machine LearningStrongly Typed Data for Machine Learning
Strongly Typed Data for Machine Learning
 

Recently uploaded

costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 

Recently uploaded (20)

costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 

Logical Inference in a Hyper-Relational Database

  • 1. Join our community at grakn.ai/community T H E D A T A B A S E F O R A I Logical Inference in a 
 Hyper-Relational database 
 By Domenico Corapi Lead Engineer at GRAKN.AI 1
  • 2. Follow us @GraknLabs • @DomenicoCorapi • PhD in Computational Logic / Machine Learning at Imperial College • Web Services and Distributed Systems at Microsoft Yammer and Skyscanner • Finance stuff at Citi and Bloomberg WHO AM I?
  • 3. Follow us @GraknLabs What is inference? LAZY INFERENCE IN GRAKN
  • 4. • We know some facts about the world: a Knowledge Base • Using some inference rules, what other facts can we derive? Knowledge Base Conclusions Inference INFERENCE
  • 5. • Deductive reasoning • Abductive reasoning • Inductive reasoning • Probabilistic reasoning • … INFERENCE Knowledge Base Today is a sunny day I don’t work if it’s a sunny day or if it’s a bank holiday Conclusions Inference I don’t work today Deduction
  • 6. INFERENCE Knowledge Base Conclusions Inference I don’t work today SELECT * FROM … Sunny days table, bank holiday table + Application logic
  • 7. Follow us @GraknLabs Some notation and useful concepts LAZY INFERENCE IN GRAKN
  • 8. Follow us @GraknLabs SOME NOTATION First-order logic Formal logic Computational logic Prolog Datalog Answer Set Programming Graql rules
  • 9. Follow us @GraknLabs SOME NOTATION • human(socrates)
 socrates is human • human(X)
 X is human • likes(socrates, X), paradox(X)
 socrates likes X and X is a paradox • likes(socrates, X) <- paradox(X)
 socrates likes X if X is a paradox • h <- b1, b2, …, bn
 Definite clause
  • 10. Follow us @GraknLabs DEDUCTION • human(socrates) • human(X) -> mortal(X) • mortal(socrates)
  • 11. Follow us @GraknLabs DEDUCTION • good_at(me, numbers) • made_of(stock_market, numbers) • good_at(me, stock_market) ? good_at(P, X), made_of(Y, X) -> good_at(P, Y)
  • 12. Follow us @GraknLabs HERBRAND BASE • human(socrates) • human(X) -> mortal(X) • human(socrates) • mortal(socrates) A Herbrand Base is the set of all possible ground (no variables) assertions Herbrand Base:
  • 13. Follow us @GraknLabs INTERPRETATION • human(socrates) • mortal(socrates) A Interpretation is an assignment of truth values to elements in the Herbrand Base Herbrand Base: • {} • {human(socrates)} • {mortal(socrates)} • {mortal(socrates), human(socrates)} Possible interpretations:
  • 14. Follow us @GraknLabs MODEL • human(socrates) • human(X) -> mortal(X)A Model for a Knowledge Base KB is an interpretation of KB that satisfies each clause in KB Possible interpretations: • {} • {human(socrates)} • {mortal(socrates)} • {mortal(socrates), human(socrates)}Model
  • 15. Follow us @GraknLabs SOME FUNDAMENTAL THEOREM A Knowledge Base with no negation has one and only one minimal model
  • 16. Follow us @GraknLabs COMPUTATIONAL LOGIC IN A NUTSHELL KB ⊨ G G is entailed by KB KB ⊢ G G is provable from KB • What language is KB in? • What semantics is represented by ⊨? • What proof procedure is used in ⊢? • In what conditions is true?
  • 17. Follow us @GraknLabs CLOSED WORLD ASSUMPTION Flights Airline Number Origin Dest AS 98 ANC SEA AA 2336 LAX PBI US 840 SFO CLT AA 258 LAX MIA AS 153 SEA ANC … select * from flights where origin = ‘LHR’ What do we know about entries that are NOT in the table? Not added yet? They don’t exist? We don’t know?
  • 18. Follow us @GraknLabs NEGATION IS HARD man(adam). single(X) <- man(X), not husband(X). husband(X) <- man(X), not single(X). Herbrand Base: {man(adam), 
 single(adam), husband(adam)} Minimal models: • {man(adam), single(adam)} • {man(adam), husband(adam)}
  • 19. Follow us @GraknLabs Bottom Up Inference LAZY INFERENCE IN GRAKN
  • 20. Follow us @GraknLabs BOTTOM UP INFERENCE • Answer Set Programming • Multiple models as answer • Use of disjunction, cardinality constraints, integrity constraints, classical negation, cwa negation… (no functors) • Variables are typed
  • 21. Follow us @GraknLabs BOTTOM UP INFERENCE 1. Ground the knowledge base 2. Compute the models
  • 22. Follow us @GraknLabs GROUNDING • human(plato) • human(socrates) • human(X) -> mortal(X) • human(socrates) -> mortal(socrates) • human(plato) -> mortal(plato) • human(plato) • human(socrates)
  • 23. Follow us @GraknLabs COMPUTE THE MODELS (NOT human(socrates) OR mortal(socrates)) 
 AND 
 (NOT human(plato) OR mortal(plato)) 
 AND 
 human(plato) 
 AND 
 human(socrates) SAT SOLVER
  • 24. Follow us @GraknLabs Grakn LAZY INFERENCE IN GRAKN
  • 25. Follow us @GraknLabs Entity GRAKN KNOWLEDGE MODEL has has plays relates Attribute Relationship Role
  • 26. Follow us @GraknLabs Entity GRAKN KNOWLEDGE MODEL Attribute Relationship Role socrates, plato mortal e.g. mortal(socrates) teaches e.g. teaches(socrates, plato) teacher, student e.g. teaches(teacher: socrates, student: plato)
  • 28. Follow us @GraknLabs Lazy inference in Grakn LAZY INFERENCE IN GRAKN
  • 29. Follow us @GraknLabs RULES IN GRAKN human(X) -> mortal(X) when { $x isa human }, then { $x has mortal “true” } human sub mortal
  • 30. Follow us @GraknLabs RULES IN GRAKN is_located_in(X, Y), is_located_in(Y, Z) -> is_located_in(X, Z) when { (geo-entity: $x, entity-location: $y) isa is-located-in; (geo-entity: $y, entity-location: $z) isa is-located-in; }, then { (geo-entity: $x, entity-location: $z) isa is-located-in; }
  • 31. Follow us @GraknLabs STEP BY STEP match $x isa city; $y has name 'Poland'; ($x, $y) isa is-located-in; get; iterator.next() 1. Pop a subgoal from the stack 2. If subgoal is an answer return 3. Else expand goal into subgoals and push to stack.
 Back to 1.
  • 32. Follow us @GraknLabs STEP BY STEP $y has name ‘Poland’ ($x, $y) isa is-located-in match $x isa city G lookup $y such that $y has name ‘Poland’ ($x, $y) isa is-located-in match $x isa city ($x, NODE_POLAND) isa is-located-in match $x isa city $y / NODE_POLAND lookup ($x, NODE_POLAND) isa is-located-in match $x isa city
  • 33. Follow us @GraknLabs STEP BY STEP $y has name ‘Poland’ ($x, $y) isa is-located-in match $x isa city lookup $y such that $y has name ‘Poland’ G G ($x, NODE_POLAND) isa is-located-in match $x isa city $y / NODE_POLAND lookup ($x, NODE_POLAND) isa is-located-in match $x isa city lookup ($x, NODE_POLAND) isa is-located-in … lookup $y has name Poland … match NODE_SILESIA isa city $x / NODE_SILESIA
  • 34. Follow us @GraknLabs STEP BY STEP $y has name ‘Poland’ ($x, $y) isa is-located-in match $x isa city lookup $y such that $y has name ‘Poland’ G G ($x, NODE_POLAND) isa is-located-in match $x isa city $y / NODE_POLAND lookup ($x, NODE_POLAND) isa is-located-in match $x isa city $x / NODE_SILESIA match NODE_SILESIA isa city {}
  • 35. Follow us @GraknLabs STEP BY STEP lookup ($x, NODE_POLAND) isa is-located-in match $x isa city $x / NODE_SILESIA match NODE_MASOVIA isa city {} match NODE_SILESIA isa city $x / NODE_MASOVIA {} ($x, NODE_POLAND) isa is-located-in match $x isa city is-located-in($x, NODE_POLAND) <- is-located-in($x, $z), is-located-in($z, NODE_POLAND) ($x, $z) isa is-located-in ($z, NODE_POLAND) isa is-located-in
 match $x isa city is_located_in(X, Z) <- is_located_in(X, Y), is_located_in(Y, Z) X/$x Z/NODE_POLAND
  • 36. Follow us @GraknLabs STEP BY STEP ($x, $z) isa is-located-in ($z, NODE_POLAND) isa is-located-in ($x, NODE_MASOVIA) isa is-located-in
 match $x isa city $z / NODE_MASOVIA Answer: {$x: NODE_WARSAW} … …
  • 37. Follow us @GraknLabs SLD RESOLUTION This is very similar to what Prolog implementations do Differences • Things are represented as nodes! No index lookup, but just getting the edges • Interleaving graph lookups with resolution steps • Type checks and roles in relationships • Fetching results lazily. We keep a pointer rather than saving goals on the stack • Caching intermediate results (similar to tabling in Prolog)
  • 38. Follow us @GraknLabs CONCLUSION Inference is a more powerful and general way to derive conclusions from data. Grakn uses rules to define higher level concepts and applies a top-down procedure to perform inference. Lookups are expensive, we need to be lazy.
 Using a stack to save the state of the computation. We keep pointers to nodes in the underlying graph from which we resume the inference procedure.
  • 39. Follow us @GraknLabs Thank you! @GraknLabs https://grakn.ai/ https://github.com/graknlabs/grakn domenico@grakn.ai @DomenicoCorapi