SlideShare une entreprise Scribd logo
1  sur  26
Inductive Triple Graphs: A purely
functional approach to represent RDF
Johan Jeuring
Utrecht University
Open University of the
Netherlands
The Netherlands
j.t.jeuring@uu.nl
Jose María Álvarez Rodríguez
South East European Research
Center
The Netherlands
jmalvarez@seerc.org
Jose Emilio Labra Gayo
University of Oviedo
Spain
labra@uniovi.es
Motivation
Combine Purely Functional Programming and Semantic Web?
Purely Functional Programming
Referential transparency
Immutable datastructures
Scalability
Concurrency, parallelism
Higher-order functions
Combinators
Program transformation
. . .
Semantic Web
RDF Graphs
URIs as properties
Blank nodes
Graph manipulation
SPARQL
Inference
Big Data
. . .
2 separate communities
This talk in one slide
Review Inductive definitions of Graphs
...so we can use the same techniques as with lists
...this work was done by M. Erwig
1st Proposal: Inductive Triple graphs
...predicates can be subjects and objects
...no need for index handling (simplified API)
2nd Proposal: Inductive RDF Graphs
...based on inductive triple graphs
...higher-order functions like foldRDFGraph
Inductive Graphs
Define the context of a node
Nodes are uniquely identified by an Int key
type Context a b = ([(Int,b)], ─ Predecessors
Int, ─ Node index
a, ─ Label
[(Int,b)] ─ Succesors
)
([(1,'p')],
2,
'b',
[(1,'q'), (3,'r')]
)
Context of b =
a
c
b
p
q
r
s
1 2
3
Inductive graphs
data Graph a b = Empty
| Context a b :& Graph a b
([(2,'r')] ,3,'c',[(1,'s')]) :&
Empty
([] ,1,'a',[] ) :&
([(1,'p')] ,2,'b',[(1,'q')]) :&
([(2,'q'),(3,'s')],1,'a',[(2,'p')]) :&
Empty
([], 3,'c',[] ) :&
([], 2,'b',[(3,'r')]) :&
Same graph can be represented in different ways
a
c
b
p
q
r
s
1 2
3
a
c
b
p
q
r
s
1 2
3
Inductive graphs
FGL library
Widely used in Haskell since 2001
Users of the library handle node indexes (Int values)
It is possible to create bad formed graphs.
Empty
([], 1,'a',[] ) :&
([], 2,'b',[(42,'p')]) :&
?
a b1 2
42 ?
p
Inductive Triple Graphs
Simplified representation of
Inductive Graphs
1st Proposal
Assumptions
Each node/edge hava a label
Labels are unique
Label of an edge can also be the label of a node
Motivation
No need for node indexes
Edges that can also be nodes
a b
r
p
q
Contexts
Context of node: list of predecessors, successors
and related nodes
type TContext a = ( a, ─ Node
[(a,a)], ─ Predecessors
[(a,a)], ─ Successors
[(a,a)] ─ Nodes Related
)
a
c
b
p
q
r
s
Context of b = ('b',
[('a','p')],
[('q','a'),('r','c')],
[]
)
Context of r = ('r',[],[],[('b','c')])
Inductive definition
data TGraph a = Empty
| TContext a :& TGraph a
('a',[],[('p','b')],[]) :&
a b
r
p
q
('p',[],[('q','r')],[]) :&
a b
r
p
q
('r',[('p','q')],[],[]) :&
Empty
('p',[],[],[('a','b')]) :&
Empty
Same graph can also be represented in several ways
API
In Haskell they are implemented as a type class
Can be seen as an API that hides internal representation
class TGr gr where
empty ∷ gr a
match ∷ a → gr a → (TContext a,gr a)
mkGraph ∷ [(a,a,a)] → gr a
nodes ∷ gr a → [a]
extend ∷ TContext a → gr a → gr a
─ empty graph
─ decompose a graph
─ Graph from triples
─ nodes of a graph
─ extend a graph (:&)
Folds
It is possible to define the Fold combinator over
inductive triple graphs
foldTGraph ∷ TGr gr ⇒ b → (TContext a → b → b) → gr a → b
foldTGraph e f g = case nodes g of
[] → e
(n:_) → let (ctx,g') = match n g
in f ctx (foldTGraph e f g')
Fold is one of the most general combinators.
Captures primitive recursion
Lots of operations can be defined in terms of folds
Other operations
Map
rev ∷ (TGr gr) ⇒ gr a → gr a
rev = mapTGraph swapCtx
where
swapCtx (n,pred,succ,rels) = (n,succ,pred,map swap rels)
Reverse the edges in a graph
mapTGraph ∷ (TGr gr) ⇒
(TContext a → TContext b) → gr a → gr b
mapTGraph f = foldTGraph empty (λc g → extend (f c) g)
Other examples...
Depth First Search, Breadth First Search, topological sort, ...
Review
Users don't need to be aware of node indexes
Not possible to define graphs with errors
Conversion
Inductive graphs Triple inductive graphs
Algorithm presented in paper
Triple inductive graphs Inductive graphs
Triple inductive graphs are implemented using FGL
Inductive RDF Graphs
Based on Inductive Triple Graphs
2nd Proposal
RDF Graphs
RDF model = graph made from triples (s,p,o)
where: s = subject (URI or blanknode)
p = predicate (URI)
o = Object (URI, blanknode, literal)
_1:p
:b_2
@prefix : <http://example.org#> .
:a :p _:1 .
:a :p _:2 .
_:1 :q :b .
_:2 :r :b .
:q :year 2013 .
:a
:p :q
:r
:year 2013
Turtle syntax
RDF Graphs
3 aspects:
Predicates (URIs) can be subjects or objects
Each node has a unique label (URI, literal, BNode Id)
Blank nodes (BNodes) are locally scoped
BNodes can be seen as existential values
x:p
:by
∃x∃y
:a
:p :q
:r
:year 2013
Definition
RDF Graphs can be:
Ground: Inductive Triple Graphs over Resources
Blank nodes: Encode bNodes with logical variables
data Resource = IRI String
| Literal String
| BNode BNodeId
type BNodeId = Int
data RDFGraph = Ground (TGraph Resource)
| Exists (BNodeId → RDFGraph)
Example with bNodes
x:p
:by
∃x
:a
:p :q
:r
:year 2013
Exists (λx →
Exists (λy →
Ground (
(IRI "a",[],[(IRI "p",BNode x),(IRI "p",BNode y)],[]) :&
(IRI "b",[(BNode x,IRI "q"),(BNode y,IRI "r")],[],[]) :&
(IRI "q", [(IRI "year",Literal "2013")], [], []) :&
Empty
)))
∃y
Some operations
Some operations on RDF Graphs
Fold RDF graphs
mergeRDF ∷ RDFGraph → RDFGraph → RDFGraph
mergeRDF g (Exists f) = Exists (λx → mergeRDF g (f x))
mergeRDF g (Basic g1) = foldTGraph g (λc g' → compRDF c g') g1
Merge 2 graphs
foldRDFGraph ∷ a → (TContext Resource → a → a) → RDFGraph → a
foldRDFGraph e h = foldRDFGraph' e h 0
where
foldRDFGraph' e h s (Basic g) = foldTGraph e h g
foldRDFGraph' e h s (Exists f) = foldRDFGrap' e h (s + 1) (f s)
Implementation
Haskell
Scala
Haskell Implementation
Haskell implementation
Available at GitHub:
https://github.com/labra/haws
2 Implementations
Using Church like encoding
Based on the FGL library
Scala Implementation
Based on Graph for Scala (Peter Empen)
Available in GitHub
https://github.com/labra/wesin
Triple graphs are implemented as Hypergraph with 3-
hyperedges
a b
r
p
q
a b
r
p
q
e1
e2
Conclusions
RDF graphs can be encoded using Inductive
Triple Graphs
Possible applications:
Higher-order combinators: Folds, maps, etc.
Program transformation and reasoning
Concurrency
Purely
Functional
Programming
RDF
Graphs
Future Work
Inductive Triple Graphs
Other domains?
Inductive RDF Graphs
Algebra of RDF Graphs
RDF Graph Library
Datatype Literals, Named graphs
Implement Common RDF algorithms
Normalization and comparison
RDF Querying and traversal
Real applications and performance comparisons
End of presentation

Contenu connexe

Tendances

Datomic rtree-pres
Datomic rtree-presDatomic rtree-pres
Datomic rtree-presjsofra
 
An Algebraic Data Model for Graphs and Hypergraphs (Category Theory meetup, N...
An Algebraic Data Model for Graphs and Hypergraphs (Category Theory meetup, N...An Algebraic Data Model for Graphs and Hypergraphs (Category Theory meetup, N...
An Algebraic Data Model for Graphs and Hypergraphs (Category Theory meetup, N...Joshua Shinavier
 
Gremlin Queries with DataStax Enterprise Graph
Gremlin Queries with DataStax Enterprise GraphGremlin Queries with DataStax Enterprise Graph
Gremlin Queries with DataStax Enterprise GraphStephen Mallette
 
Extending Gremlin with Foundational Steps
Extending Gremlin with Foundational StepsExtending Gremlin with Foundational Steps
Extending Gremlin with Foundational StepsStephen Mallette
 
Web-based framework for online sketch-based image retrieval
Web-based framework for online sketch-based image retrievalWeb-based framework for online sketch-based image retrieval
Web-based framework for online sketch-based image retrievalLukas Tencer
 
A Graph is a Graph is a Graph: Equivalence, Transformation, and Composition o...
A Graph is a Graph is a Graph: Equivalence, Transformation, and Composition o...A Graph is a Graph is a Graph: Equivalence, Transformation, and Composition o...
A Graph is a Graph is a Graph: Equivalence, Transformation, and Composition o...Joshua Shinavier
 
Presentation on Bayesian Structure from Motion
Presentation on Bayesian Structure from MotionPresentation on Bayesian Structure from Motion
Presentation on Bayesian Structure from MotionAaron Karper
 
presentation
presentationpresentation
presentationjie ren
 
Roberto Trasarti PhD Thesis
Roberto Trasarti PhD ThesisRoberto Trasarti PhD Thesis
Roberto Trasarti PhD ThesisRoberto Trasarti
 
Motivation and Mechanics behind some aspects of Shapeless
Motivation and Mechanics behind some aspects of ShapelessMotivation and Mechanics behind some aspects of Shapeless
Motivation and Mechanics behind some aspects of ShapelessAnatolii Kmetiuk
 
Jinnai fukunaga-2016
Jinnai fukunaga-2016Jinnai fukunaga-2016
Jinnai fukunaga-2016Yuu Jinnai
 
A25.8 modelingquads
A25.8 modelingquadsA25.8 modelingquads
A25.8 modelingquadsvhiggins1
 
Matplotlib Review 2021
Matplotlib Review 2021Matplotlib Review 2021
Matplotlib Review 2021Bhaskar J.Roy
 

Tendances (17)

Datomic rtree-pres
Datomic rtree-presDatomic rtree-pres
Datomic rtree-pres
 
An Algebraic Data Model for Graphs and Hypergraphs (Category Theory meetup, N...
An Algebraic Data Model for Graphs and Hypergraphs (Category Theory meetup, N...An Algebraic Data Model for Graphs and Hypergraphs (Category Theory meetup, N...
An Algebraic Data Model for Graphs and Hypergraphs (Category Theory meetup, N...
 
Gremlin's Anatomy
Gremlin's AnatomyGremlin's Anatomy
Gremlin's Anatomy
 
Gremlin Queries with DataStax Enterprise Graph
Gremlin Queries with DataStax Enterprise GraphGremlin Queries with DataStax Enterprise Graph
Gremlin Queries with DataStax Enterprise Graph
 
Extending Gremlin with Foundational Steps
Extending Gremlin with Foundational StepsExtending Gremlin with Foundational Steps
Extending Gremlin with Foundational Steps
 
Functional Concepts
Functional ConceptsFunctional Concepts
Functional Concepts
 
Web-based framework for online sketch-based image retrieval
Web-based framework for online sketch-based image retrievalWeb-based framework for online sketch-based image retrieval
Web-based framework for online sketch-based image retrieval
 
A Graph is a Graph is a Graph: Equivalence, Transformation, and Composition o...
A Graph is a Graph is a Graph: Equivalence, Transformation, and Composition o...A Graph is a Graph is a Graph: Equivalence, Transformation, and Composition o...
A Graph is a Graph is a Graph: Equivalence, Transformation, and Composition o...
 
Presentation on Bayesian Structure from Motion
Presentation on Bayesian Structure from MotionPresentation on Bayesian Structure from Motion
Presentation on Bayesian Structure from Motion
 
presentation
presentationpresentation
presentation
 
Roberto Trasarti PhD Thesis
Roberto Trasarti PhD ThesisRoberto Trasarti PhD Thesis
Roberto Trasarti PhD Thesis
 
Motivation and Mechanics behind some aspects of Shapeless
Motivation and Mechanics behind some aspects of ShapelessMotivation and Mechanics behind some aspects of Shapeless
Motivation and Mechanics behind some aspects of Shapeless
 
distance_matrix_ch
distance_matrix_chdistance_matrix_ch
distance_matrix_ch
 
Jinnai fukunaga-2016
Jinnai fukunaga-2016Jinnai fukunaga-2016
Jinnai fukunaga-2016
 
A25.8 modelingquads
A25.8 modelingquadsA25.8 modelingquads
A25.8 modelingquads
 
Linear search
Linear searchLinear search
Linear search
 
Matplotlib Review 2021
Matplotlib Review 2021Matplotlib Review 2021
Matplotlib Review 2021
 

Similaire à Inductive Triple Graphs: A purely functional approach to represent RDF

Graph Analyses with Python and NetworkX
Graph Analyses with Python and NetworkXGraph Analyses with Python and NetworkX
Graph Analyses with Python and NetworkXBenjamin Bengfort
 
Graph convolutional networks in apache spark
Graph convolutional networks in apache sparkGraph convolutional networks in apache spark
Graph convolutional networks in apache sparkEmiliano Martinez Sanchez
 
19. Data Structures and Algorithm Complexity
19. Data Structures and Algorithm Complexity19. Data Structures and Algorithm Complexity
19. Data Structures and Algorithm ComplexityIntro C# Book
 
Extending lifespan with Hadoop and R
Extending lifespan with Hadoop and RExtending lifespan with Hadoop and R
Extending lifespan with Hadoop and RRadek Maciaszek
 
Graph technology meetup slides
Graph technology meetup slidesGraph technology meetup slides
Graph technology meetup slidesSean Mulvehill
 
Fact checking using Knowledge graphs (course: CS584 @Emory U)

Fact checking using Knowledge graphs (course: CS584 @Emory U)
Fact checking using Knowledge graphs (course: CS584 @Emory U)

Fact checking using Knowledge graphs (course: CS584 @Emory U)
Ramraj Chandradevan
 
Stack squeues lists
Stack squeues listsStack squeues lists
Stack squeues listsJames Wong
 
Stacksqueueslists
StacksqueueslistsStacksqueueslists
StacksqueueslistsFraboni Ec
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues listsYoung Alista
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues listsTony Nguyen
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues listsHarry Potter
 

Similaire à Inductive Triple Graphs: A purely functional approach to represent RDF (20)

Graph Analyses with Python and NetworkX
Graph Analyses with Python and NetworkXGraph Analyses with Python and NetworkX
Graph Analyses with Python and NetworkX
 
Java 8
Java 8Java 8
Java 8
 
AlgorithmAnalysis2.ppt
AlgorithmAnalysis2.pptAlgorithmAnalysis2.ppt
AlgorithmAnalysis2.ppt
 
Compact Representation of Large RDF Data Sets for Publishing and Exchange
Compact Representation of Large RDF Data Sets for Publishing and ExchangeCompact Representation of Large RDF Data Sets for Publishing and Exchange
Compact Representation of Large RDF Data Sets for Publishing and Exchange
 
Graph convolutional networks in apache spark
Graph convolutional networks in apache sparkGraph convolutional networks in apache spark
Graph convolutional networks in apache spark
 
19. Data Structures and Algorithm Complexity
19. Data Structures and Algorithm Complexity19. Data Structures and Algorithm Complexity
19. Data Structures and Algorithm Complexity
 
Extending lifespan with Hadoop and R
Extending lifespan with Hadoop and RExtending lifespan with Hadoop and R
Extending lifespan with Hadoop and R
 
Distributed computing with spark
Distributed computing with sparkDistributed computing with spark
Distributed computing with spark
 
Big o
Big oBig o
Big o
 
Graph technology meetup slides
Graph technology meetup slidesGraph technology meetup slides
Graph technology meetup slides
 
Fact checking using Knowledge graphs (course: CS584 @Emory U)

Fact checking using Knowledge graphs (course: CS584 @Emory U)
Fact checking using Knowledge graphs (course: CS584 @Emory U)

Fact checking using Knowledge graphs (course: CS584 @Emory U)

 
R Language Introduction
R Language IntroductionR Language Introduction
R Language Introduction
 
Stack squeues lists
Stack squeues listsStack squeues lists
Stack squeues lists
 
Stacksqueueslists
StacksqueueslistsStacksqueueslists
Stacksqueueslists
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
 
Dijkstra
DijkstraDijkstra
Dijkstra
 
d
dd
d
 

Plus de Jose Emilio Labra Gayo

Introducción a la investigación/doctorado
Introducción a la investigación/doctoradoIntroducción a la investigación/doctorado
Introducción a la investigación/doctoradoJose Emilio Labra Gayo
 
Challenges and applications of RDF shapes
Challenges and applications of RDF shapesChallenges and applications of RDF shapes
Challenges and applications of RDF shapesJose Emilio Labra Gayo
 
Legislative data portals and linked data quality
Legislative data portals and linked data qualityLegislative data portals and linked data quality
Legislative data portals and linked data qualityJose Emilio Labra Gayo
 
Validating RDF data: Challenges and perspectives
Validating RDF data: Challenges and perspectivesValidating RDF data: Challenges and perspectives
Validating RDF data: Challenges and perspectivesJose Emilio Labra Gayo
 
Legislative document content extraction based on Semantic Web technologies
Legislative document content extraction based on Semantic Web technologiesLegislative document content extraction based on Semantic Web technologies
Legislative document content extraction based on Semantic Web technologiesJose Emilio Labra Gayo
 
Como publicar datos: hacia los datos abiertos enlazados
Como publicar datos: hacia los datos abiertos enlazadosComo publicar datos: hacia los datos abiertos enlazados
Como publicar datos: hacia los datos abiertos enlazadosJose Emilio Labra Gayo
 
Arquitectura de la Web y Computación en el Servidor
Arquitectura de la Web y Computación en el ServidorArquitectura de la Web y Computación en el Servidor
Arquitectura de la Web y Computación en el ServidorJose Emilio Labra Gayo
 

Plus de Jose Emilio Labra Gayo (20)

Publicaciones de investigación
Publicaciones de investigaciónPublicaciones de investigación
Publicaciones de investigación
 
Introducción a la investigación/doctorado
Introducción a la investigación/doctoradoIntroducción a la investigación/doctorado
Introducción a la investigación/doctorado
 
Challenges and applications of RDF shapes
Challenges and applications of RDF shapesChallenges and applications of RDF shapes
Challenges and applications of RDF shapes
 
Legislative data portals and linked data quality
Legislative data portals and linked data qualityLegislative data portals and linked data quality
Legislative data portals and linked data quality
 
Validating RDF data: Challenges and perspectives
Validating RDF data: Challenges and perspectivesValidating RDF data: Challenges and perspectives
Validating RDF data: Challenges and perspectives
 
Wikidata
WikidataWikidata
Wikidata
 
Legislative document content extraction based on Semantic Web technologies
Legislative document content extraction based on Semantic Web technologiesLegislative document content extraction based on Semantic Web technologies
Legislative document content extraction based on Semantic Web technologies
 
ShEx by Example
ShEx by ExampleShEx by Example
ShEx by Example
 
Introduction to SPARQL
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
 
Introducción a la Web Semántica
Introducción a la Web SemánticaIntroducción a la Web Semántica
Introducción a la Web Semántica
 
RDF Data Model
RDF Data ModelRDF Data Model
RDF Data Model
 
2017 Tendencias en informática
2017 Tendencias en informática2017 Tendencias en informática
2017 Tendencias en informática
 
RDF, linked data and semantic web
RDF, linked data and semantic webRDF, linked data and semantic web
RDF, linked data and semantic web
 
Introduction to SPARQL
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
 
19 javascript servidor
19 javascript servidor19 javascript servidor
19 javascript servidor
 
Como publicar datos: hacia los datos abiertos enlazados
Como publicar datos: hacia los datos abiertos enlazadosComo publicar datos: hacia los datos abiertos enlazados
Como publicar datos: hacia los datos abiertos enlazados
 
16 Alternativas XML
16 Alternativas XML16 Alternativas XML
16 Alternativas XML
 
XSLT
XSLTXSLT
XSLT
 
XPath
XPathXPath
XPath
 
Arquitectura de la Web y Computación en el Servidor
Arquitectura de la Web y Computación en el ServidorArquitectura de la Web y Computación en el Servidor
Arquitectura de la Web y Computación en el Servidor
 

Dernier

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 

Dernier (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 

Inductive Triple Graphs: A purely functional approach to represent RDF

  • 1. Inductive Triple Graphs: A purely functional approach to represent RDF Johan Jeuring Utrecht University Open University of the Netherlands The Netherlands j.t.jeuring@uu.nl Jose María Álvarez Rodríguez South East European Research Center The Netherlands jmalvarez@seerc.org Jose Emilio Labra Gayo University of Oviedo Spain labra@uniovi.es
  • 2. Motivation Combine Purely Functional Programming and Semantic Web? Purely Functional Programming Referential transparency Immutable datastructures Scalability Concurrency, parallelism Higher-order functions Combinators Program transformation . . . Semantic Web RDF Graphs URIs as properties Blank nodes Graph manipulation SPARQL Inference Big Data . . . 2 separate communities
  • 3. This talk in one slide Review Inductive definitions of Graphs ...so we can use the same techniques as with lists ...this work was done by M. Erwig 1st Proposal: Inductive Triple graphs ...predicates can be subjects and objects ...no need for index handling (simplified API) 2nd Proposal: Inductive RDF Graphs ...based on inductive triple graphs ...higher-order functions like foldRDFGraph
  • 4. Inductive Graphs Define the context of a node Nodes are uniquely identified by an Int key type Context a b = ([(Int,b)], ─ Predecessors Int, ─ Node index a, ─ Label [(Int,b)] ─ Succesors ) ([(1,'p')], 2, 'b', [(1,'q'), (3,'r')] ) Context of b = a c b p q r s 1 2 3
  • 5. Inductive graphs data Graph a b = Empty | Context a b :& Graph a b ([(2,'r')] ,3,'c',[(1,'s')]) :& Empty ([] ,1,'a',[] ) :& ([(1,'p')] ,2,'b',[(1,'q')]) :& ([(2,'q'),(3,'s')],1,'a',[(2,'p')]) :& Empty ([], 3,'c',[] ) :& ([], 2,'b',[(3,'r')]) :& Same graph can be represented in different ways a c b p q r s 1 2 3 a c b p q r s 1 2 3
  • 6. Inductive graphs FGL library Widely used in Haskell since 2001 Users of the library handle node indexes (Int values) It is possible to create bad formed graphs. Empty ([], 1,'a',[] ) :& ([], 2,'b',[(42,'p')]) :& ? a b1 2 42 ? p
  • 7. Inductive Triple Graphs Simplified representation of Inductive Graphs 1st Proposal
  • 8. Assumptions Each node/edge hava a label Labels are unique Label of an edge can also be the label of a node Motivation No need for node indexes Edges that can also be nodes a b r p q
  • 9. Contexts Context of node: list of predecessors, successors and related nodes type TContext a = ( a, ─ Node [(a,a)], ─ Predecessors [(a,a)], ─ Successors [(a,a)] ─ Nodes Related ) a c b p q r s Context of b = ('b', [('a','p')], [('q','a'),('r','c')], [] ) Context of r = ('r',[],[],[('b','c')])
  • 10. Inductive definition data TGraph a = Empty | TContext a :& TGraph a ('a',[],[('p','b')],[]) :& a b r p q ('p',[],[('q','r')],[]) :& a b r p q ('r',[('p','q')],[],[]) :& Empty ('p',[],[],[('a','b')]) :& Empty Same graph can also be represented in several ways
  • 11. API In Haskell they are implemented as a type class Can be seen as an API that hides internal representation class TGr gr where empty ∷ gr a match ∷ a → gr a → (TContext a,gr a) mkGraph ∷ [(a,a,a)] → gr a nodes ∷ gr a → [a] extend ∷ TContext a → gr a → gr a ─ empty graph ─ decompose a graph ─ Graph from triples ─ nodes of a graph ─ extend a graph (:&)
  • 12. Folds It is possible to define the Fold combinator over inductive triple graphs foldTGraph ∷ TGr gr ⇒ b → (TContext a → b → b) → gr a → b foldTGraph e f g = case nodes g of [] → e (n:_) → let (ctx,g') = match n g in f ctx (foldTGraph e f g') Fold is one of the most general combinators. Captures primitive recursion Lots of operations can be defined in terms of folds
  • 13. Other operations Map rev ∷ (TGr gr) ⇒ gr a → gr a rev = mapTGraph swapCtx where swapCtx (n,pred,succ,rels) = (n,succ,pred,map swap rels) Reverse the edges in a graph mapTGraph ∷ (TGr gr) ⇒ (TContext a → TContext b) → gr a → gr b mapTGraph f = foldTGraph empty (λc g → extend (f c) g) Other examples... Depth First Search, Breadth First Search, topological sort, ...
  • 14. Review Users don't need to be aware of node indexes Not possible to define graphs with errors Conversion Inductive graphs Triple inductive graphs Algorithm presented in paper Triple inductive graphs Inductive graphs Triple inductive graphs are implemented using FGL
  • 15. Inductive RDF Graphs Based on Inductive Triple Graphs 2nd Proposal
  • 16. RDF Graphs RDF model = graph made from triples (s,p,o) where: s = subject (URI or blanknode) p = predicate (URI) o = Object (URI, blanknode, literal) _1:p :b_2 @prefix : <http://example.org#> . :a :p _:1 . :a :p _:2 . _:1 :q :b . _:2 :r :b . :q :year 2013 . :a :p :q :r :year 2013 Turtle syntax
  • 17. RDF Graphs 3 aspects: Predicates (URIs) can be subjects or objects Each node has a unique label (URI, literal, BNode Id) Blank nodes (BNodes) are locally scoped BNodes can be seen as existential values x:p :by ∃x∃y :a :p :q :r :year 2013
  • 18. Definition RDF Graphs can be: Ground: Inductive Triple Graphs over Resources Blank nodes: Encode bNodes with logical variables data Resource = IRI String | Literal String | BNode BNodeId type BNodeId = Int data RDFGraph = Ground (TGraph Resource) | Exists (BNodeId → RDFGraph)
  • 19. Example with bNodes x:p :by ∃x :a :p :q :r :year 2013 Exists (λx → Exists (λy → Ground ( (IRI "a",[],[(IRI "p",BNode x),(IRI "p",BNode y)],[]) :& (IRI "b",[(BNode x,IRI "q"),(BNode y,IRI "r")],[],[]) :& (IRI "q", [(IRI "year",Literal "2013")], [], []) :& Empty ))) ∃y
  • 20. Some operations Some operations on RDF Graphs Fold RDF graphs mergeRDF ∷ RDFGraph → RDFGraph → RDFGraph mergeRDF g (Exists f) = Exists (λx → mergeRDF g (f x)) mergeRDF g (Basic g1) = foldTGraph g (λc g' → compRDF c g') g1 Merge 2 graphs foldRDFGraph ∷ a → (TContext Resource → a → a) → RDFGraph → a foldRDFGraph e h = foldRDFGraph' e h 0 where foldRDFGraph' e h s (Basic g) = foldTGraph e h g foldRDFGraph' e h s (Exists f) = foldRDFGrap' e h (s + 1) (f s)
  • 22. Haskell Implementation Haskell implementation Available at GitHub: https://github.com/labra/haws 2 Implementations Using Church like encoding Based on the FGL library
  • 23. Scala Implementation Based on Graph for Scala (Peter Empen) Available in GitHub https://github.com/labra/wesin Triple graphs are implemented as Hypergraph with 3- hyperedges a b r p q a b r p q e1 e2
  • 24. Conclusions RDF graphs can be encoded using Inductive Triple Graphs Possible applications: Higher-order combinators: Folds, maps, etc. Program transformation and reasoning Concurrency Purely Functional Programming RDF Graphs
  • 25. Future Work Inductive Triple Graphs Other domains? Inductive RDF Graphs Algebra of RDF Graphs RDF Graph Library Datatype Literals, Named graphs Implement Common RDF algorithms Normalization and comparison RDF Querying and traversal Real applications and performance comparisons