SlideShare une entreprise Scribd logo
1  sur  26
Télécharger pour lire hors ligne
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
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues listsHarry Potter
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues listsYoung Alista
 
Stacksqueueslists
StacksqueueslistsStacksqueueslists
StacksqueueslistsFraboni Ec
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues listsTony Nguyen
 

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
 
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
 
Stacksqueueslists
StacksqueueslistsStacksqueueslists
Stacksqueueslists
 
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

Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Will Schroeder
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
20200723_insight_release_plan_v6.pdf20200723_insight_release_plan_v6.pdf
20200723_insight_release_plan_v6.pdf20200723_insight_release_plan_v6.pdf20200723_insight_release_plan_v6.pdf20200723_insight_release_plan_v6.pdf
20200723_insight_release_plan_v6.pdf20200723_insight_release_plan_v6.pdfJamie (Taka) Wang
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.francesco barbera
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Adtran
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
Introduction to Quantum Computing
Introduction to Quantum ComputingIntroduction to Quantum Computing
Introduction to Quantum ComputingGDSC PJATK
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 

Dernier (20)

Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
20200723_insight_release_plan_v6.pdf20200723_insight_release_plan_v6.pdf
20200723_insight_release_plan_v6.pdf20200723_insight_release_plan_v6.pdf20200723_insight_release_plan_v6.pdf20200723_insight_release_plan_v6.pdf
20200723_insight_release_plan_v6.pdf20200723_insight_release_plan_v6.pdf
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
Introduction to Quantum Computing
Introduction to Quantum ComputingIntroduction to Quantum Computing
Introduction to Quantum Computing
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 

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