SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Downloaden Sie, um offline zu lesen
Find your way in Graph
labyrinths
with SQL, SPARQL, and Gremlin
who we are?
Daniel Camarda
daniel.camarda@gmail.com
https://github.com/mdread
Alfredo Serafini
seralf@gmail.com
https://github.com/seralf
It’s all about relations
for example: northwind DB ...on graph
SEE: http://sql2gremlin.com/
schema?
properties or
relations?
joins or edges?
SQL 1. - ER: tables for Entity and Relations
A table is really similar in practice to a flat CSV. But:
● It introduces types.
● Can be used to materialize important relations, not only entities, normalizing data (=avoiding
duplications)
● Can be fast to access using Indexes
● Logical Entity can be physically splitted into many different Tables, after normalization.
● Relations are not explicit they are:
○ materialized as properties/tables
○ expressed by constraints
○ retrieved by joins
ROW -> TUPLE!
SEE: Northwind schema
RDF 1. - modeling
But tuples can be more “atomic”, if we think differently.
RDF (Resource Description Framework): introduces a conceptual data modeling approach inspired by
several best practices, including the well-known dublin-core.
Similar role to ER schemas (mostly used on relational DB), or class diagram (mostly used in software
design).
RDF is based upon describing resources, by making statements about them: both data and metadata
can be described this way (self-described).
Then we have TUPLEs -> TRIPLEs! (actually QUADs, at least)
subject -> predicate -> object (+ context!)
Thus it is a multigraph labeled and directed: it's the best architecture for managing ontologies, and it
can be also managed more or less as a property graph.
RDF 2. - schema
Have you said schema?
What is a Schema?
● A schema describes your model
● A schema can defines constraints and data types on your model
● A schema provides a good abstraction on the raw data (to be handled manually)
What is the best language to describe schemas?
● XML: DTD is not XML, XSD is XML
● DDL is SQL, but dialect, dictionary and schema changes
● RDF can describe both data and metadata (schema)
○ Are we afraid of standards? Why? Are they too much complex?
○ Schema must be mantained!
RDF 3. - a shared language for schemas
A standardized framework for the
description of models it's only a shared
language!
1) No one is forced to adopt a specific
vocabulary: only a basic syntax is
shared among different domains.
2) However different domains can be
modeled sharing both schema and data
linking, creating a wider knowledge
graph.
examples: all kind of linked data,
vocabularies such as good relations,
schema.org and so on
http://www.google.com/insidesearch/features/search/knowledge.html
https://www.freebase.com/
http://dbpedia.org/
RDF 4. - looking at an RDF vocabulary (schema)
How does one of those RDF vocabulary
can look like?
For example FOAF (Friend Of A Friend)
vocabulary,
using the VOWL toolkit
http://vowl.visualdataweb.org/
SQL & gremlin - 1
SQL
SELECT CategoryName
FROM Categories
Gremlin
g.V('type','category').categoryName
SPARQL
SELECT ?category
WHERE {
?uri a ?category .
}
SQL & gremlin - 2
SQL
SELECT *
FROM Products AS P
INNER JOIN Categories AS C
ON (C.CategoryID = P.CategoryID)
WHERE (C.CategoryName = 'Beverages')
SPARQL
SELECT *
FROM <http://northwind/graph>
WHERE {
?uri a nw:Product .
?uri nw:has_category ?category .
?category a nw:Category .
?category nw:categoryName 'Beverages' .
}
SELECT *
FROM <http://northwind/graph>
WHERE {
?uri a nw:Product .
?uri nw:has_category / nw:categoryName
'Beverages' .
}
Gremlin
g.V('categoryName','Beverages').in('inCategory').map()
From table to graph: two strategies
1. RDF mapping, with tools R2RML (Relational to RDF Mapping Language) and DM (Direct
Mapping)
a. builds an RDF graph, and the mapping itself is also RDF (turtle)
b. triples can be mapped live from the relational engine, or materialized into a triplestore
2. Build your own graph model.
a. no need for learn a new language
b. no need for introduce external tools as dependencies
In both cases, a projection of the graph can be used to produce either different graph or tables
schema
Example: Github graph
The idea
search for repositories on github, get information about those repos along with collaborators and
library dependencies
Why?
Github has lots of interesting data, analyzing it can give us insights on how the opensource
community is evolving. A graph is the best way to represent this kind of deeply interconnected
community
How it works?
Tinkerpop is used on top of OrientDB which is the backend graph engine. The data is retrieved by a
small Scala application
github schema
Graph visualized
generated with gephi https://gephi.org/
● an interactive tool for exploration
and analysis of graphs
● connect with external data sources
with the Stream plugin
● useful when thinking about your
queries
repository
dependency
user
Github data collected on Orient Graph:
https://github.com/randomknot/graph-labyrinth-demo
Is a query language, specifically built for graph traversal
● easy to navigate relationships (edges)
● easy to filter
● start thinking about Paths, not Records
● turing complete language
● default implementation as a Groovy DSL
examples 1
All contributors of a repository
g.v("#11:192").in("contributes").login
projects on which users of this project contribute to
g.v("#11:192").in("contributes").out("contributes").dedup.name
Repositories with more than ten contributors
g.V("node_type", "Repository").filter{it.inE("contributes").count() > 10}.name
examples 2
common contributors of two projects
g.v('#11:47').in("contributes").as("x").out.retain([g.v('#11:57')]).back("x").login
users who work on projects, using a specific library
g.V("node_type", "Contributor").as("usr")
.out("contributes")
.out("depends")
.filter{it.artifact_id == "spring-social-web"}
.back("usr")
.login
how gremlin select nodes?
examples 3
five most used libraries
g.V("node_type", "Dependency").inE("depends").inV.groupCount{it.artifact_id}.cap.orderMap(T.
decr)[0..4]
contributors of projects with more than ten contributors
g.V("node_type", "Repository").filter{it.inE("contributes").count() > 10}.in("contributes").login
The end
references
● Freebase knowledge base
https://www.freebase.com/
● Google Knowledge Graph
http://www.google.com/insidesearch/features/search/knowledge.html
● RDF
○ RDF primer
http://www.w3.org/TR/2014/NOTE-rdf11-primer-20140225/
○ VOWL
http://vowl.visualdataweb.org/
○ FOAF - Friend Of A Friend
http://www.foaf-project.org/
● dbeaver
http://dbeaver.jkiss.org/
references
● gremlin documentation
https://github.com/tinkerpop/gremlin/wiki
http://gremlindocs.com/
● sql2gremlin
http://sql2gremlin.com/
○ visualization: http://sql2gremlin.com/graph/
○ joins: http://sql2gremlin.com/#joining/inner-join
● gremlin examples
http://www.fromdev.com/2013/09/Gremlin-Example-Query-Snippets-Graph-DB.html
● SPARQL + gremlin
https://github.com/tinkerpop/gremlin/wiki/SPARQL-vs.-Gremlin
● using SPARQL qith gephi to visualize co-authorship
http://data.linkededucation.org/linkedup/devtalk/?p=31
● mining github followers in tinkerpop (with R, github, neo4j)
http://patrick.wagstrom.net/weblog/2012/05/13/mining-github-followers-in-tinkerpop/

Weitere ähnliche Inhalte

Was ist angesagt?

Explicit Semantics in Graph DBs Driving Digital Transformation With Neo4j
Explicit Semantics in Graph DBs Driving Digital Transformation With Neo4jExplicit Semantics in Graph DBs Driving Digital Transformation With Neo4j
Explicit Semantics in Graph DBs Driving Digital Transformation With Neo4jConnected Data World
 
Resource description framework
Resource description frameworkResource description framework
Resource description frameworkhozifa1010
 
Two graph data models : RDF and Property Graphs
Two graph data models : RDF and Property GraphsTwo graph data models : RDF and Property Graphs
Two graph data models : RDF and Property Graphsandyseaborne
 
Web ontology language (owl)
Web ontology language (owl)Web ontology language (owl)
Web ontology language (owl)Ameer Sameer
 
Owl web ontology language
Owl  web ontology languageOwl  web ontology language
Owl web ontology languagehassco2011
 
Knowledge graph construction with a façade - The SPARQL Anything Project
Knowledge graph construction with a façade - The SPARQL Anything ProjectKnowledge graph construction with a façade - The SPARQL Anything Project
Knowledge graph construction with a façade - The SPARQL Anything ProjectEnrico Daga
 
Introduction to RDF
Introduction to RDFIntroduction to RDF
Introduction to RDFNarni Rajesh
 
Dublin Core In Practice
Dublin Core In PracticeDublin Core In Practice
Dublin Core In PracticeMarcia Zeng
 
The Semantic Web #9 - Web Ontology Language (OWL)
The Semantic Web #9 - Web Ontology Language (OWL)The Semantic Web #9 - Web Ontology Language (OWL)
The Semantic Web #9 - Web Ontology Language (OWL)Myungjin Lee
 
The SPARQL Anything project
The SPARQL Anything projectThe SPARQL Anything project
The SPARQL Anything projectEnrico Daga
 
Trying SPARQL Anything with MEI
Trying SPARQL Anything with MEITrying SPARQL Anything with MEI
Trying SPARQL Anything with MEIEnrico Daga
 
What’s in a structured value?
What’s in a structured value?What’s in a structured value?
What’s in a structured value?Andy Powell
 
Rdf Overview Presentation
Rdf Overview PresentationRdf Overview Presentation
Rdf Overview PresentationKen Varnum
 
Semantic Pipes and Semantic Mashups
Semantic Pipes and Semantic MashupsSemantic Pipes and Semantic Mashups
Semantic Pipes and Semantic Mashupsgiurca
 
Graph databases & data integration v2
Graph databases & data integration v2Graph databases & data integration v2
Graph databases & data integration v2Dimitris Kontokostas
 

Was ist angesagt? (20)

Explicit Semantics in Graph DBs Driving Digital Transformation With Neo4j
Explicit Semantics in Graph DBs Driving Digital Transformation With Neo4jExplicit Semantics in Graph DBs Driving Digital Transformation With Neo4j
Explicit Semantics in Graph DBs Driving Digital Transformation With Neo4j
 
Resource description framework
Resource description frameworkResource description framework
Resource description framework
 
Rdf
RdfRdf
Rdf
 
Two graph data models : RDF and Property Graphs
Two graph data models : RDF and Property GraphsTwo graph data models : RDF and Property Graphs
Two graph data models : RDF and Property Graphs
 
Web ontology language (owl)
Web ontology language (owl)Web ontology language (owl)
Web ontology language (owl)
 
Owl web ontology language
Owl  web ontology languageOwl  web ontology language
Owl web ontology language
 
Sparql
SparqlSparql
Sparql
 
Knowledge graph construction with a façade - The SPARQL Anything Project
Knowledge graph construction with a façade - The SPARQL Anything ProjectKnowledge graph construction with a façade - The SPARQL Anything Project
Knowledge graph construction with a façade - The SPARQL Anything Project
 
Data in RDF
Data in RDFData in RDF
Data in RDF
 
Introduction to RDF
Introduction to RDFIntroduction to RDF
Introduction to RDF
 
Dublin Core In Practice
Dublin Core In PracticeDublin Core In Practice
Dublin Core In Practice
 
The Semantic Web #9 - Web Ontology Language (OWL)
The Semantic Web #9 - Web Ontology Language (OWL)The Semantic Web #9 - Web Ontology Language (OWL)
The Semantic Web #9 - Web Ontology Language (OWL)
 
The SPARQL Anything project
The SPARQL Anything projectThe SPARQL Anything project
The SPARQL Anything project
 
Trying SPARQL Anything with MEI
Trying SPARQL Anything with MEITrying SPARQL Anything with MEI
Trying SPARQL Anything with MEI
 
What’s in a structured value?
What’s in a structured value?What’s in a structured value?
What’s in a structured value?
 
Rdf Overview Presentation
Rdf Overview PresentationRdf Overview Presentation
Rdf Overview Presentation
 
469 talk
469 talk469 talk
469 talk
 
Introduction to RDF
Introduction to RDFIntroduction to RDF
Introduction to RDF
 
Semantic Pipes and Semantic Mashups
Semantic Pipes and Semantic MashupsSemantic Pipes and Semantic Mashups
Semantic Pipes and Semantic Mashups
 
Graph databases & data integration v2
Graph databases & data integration v2Graph databases & data integration v2
Graph databases & data integration v2
 

Ähnlich wie Find your way in Graph labyrinths

Making the semantic web work
Making the semantic web workMaking the semantic web work
Making the semantic web workPaul Houle
 
RDF SHACL, Annotations, and Data Frames
RDF SHACL, Annotations, and Data FramesRDF SHACL, Annotations, and Data Frames
RDF SHACL, Annotations, and Data FramesKurt Cagle
 
aRangodb, un package per l'utilizzo di ArangoDB con R
aRangodb, un package per l'utilizzo di ArangoDB con RaRangodb, un package per l'utilizzo di ArangoDB con R
aRangodb, un package per l'utilizzo di ArangoDB con RGraphRM
 
RDF APIs for .NET Framework
RDF APIs for .NET FrameworkRDF APIs for .NET Framework
RDF APIs for .NET FrameworkAdriana Ivanciu
 
Graph Abstractions Matter by Ora Lassila
Graph Abstractions Matter by Ora LassilaGraph Abstractions Matter by Ora Lassila
Graph Abstractions Matter by Ora LassilaConnected Data World
 
Introduction to Graph Databases
Introduction to Graph DatabasesIntroduction to Graph Databases
Introduction to Graph DatabasesPaolo Pareti
 
State of the Semantic Web
State of the Semantic WebState of the Semantic Web
State of the Semantic WebIvan Herman
 
Linked Open Data: A simple how-to
Linked Open Data: A simple how-toLinked Open Data: A simple how-to
Linked Open Data: A simple how-tonvitucci
 
guacamole: an Object Document Mapper for ArangoDB
guacamole: an Object Document Mapper for ArangoDBguacamole: an Object Document Mapper for ArangoDB
guacamole: an Object Document Mapper for ArangoDBMax Neunhöffer
 
How To Model and Construct Graphs with Oracle Database (AskTOM Office Hours p...
How To Model and Construct Graphs with Oracle Database (AskTOM Office Hours p...How To Model and Construct Graphs with Oracle Database (AskTOM Office Hours p...
How To Model and Construct Graphs with Oracle Database (AskTOM Office Hours p...Jean Ihm
 
Semantic web
Semantic webSemantic web
Semantic webtariq1352
 
Intro to the semantic web (for libraries)
Intro to the semantic web (for libraries) Intro to the semantic web (for libraries)
Intro to the semantic web (for libraries) robin fay
 
BLOGIC. (ISWC 2009 Invited Talk)
BLOGIC.  (ISWC 2009 Invited Talk)BLOGIC.  (ISWC 2009 Invited Talk)
BLOGIC. (ISWC 2009 Invited Talk)Pat Hayes
 
Deploying PHP applications using Virtuoso as Application Server
Deploying PHP applications using Virtuoso as Application ServerDeploying PHP applications using Virtuoso as Application Server
Deploying PHP applications using Virtuoso as Application Serverwebhostingguy
 
Ontology Access Kit_ Workshop Intro Slides.pptx
Ontology Access Kit_ Workshop Intro Slides.pptxOntology Access Kit_ Workshop Intro Slides.pptx
Ontology Access Kit_ Workshop Intro Slides.pptxChris Mungall
 
Regal - a Repository for Electronic Documents and Bibliographic Data
Regal - a Repository for Electronic Documents and Bibliographic DataRegal - a Repository for Electronic Documents and Bibliographic Data
Regal - a Repository for Electronic Documents and Bibliographic DataFelix Ostrowski
 

Ähnlich wie Find your way in Graph labyrinths (20)

Making the semantic web work
Making the semantic web workMaking the semantic web work
Making the semantic web work
 
RDF SHACL, Annotations, and Data Frames
RDF SHACL, Annotations, and Data FramesRDF SHACL, Annotations, and Data Frames
RDF SHACL, Annotations, and Data Frames
 
aRangodb, un package per l'utilizzo di ArangoDB con R
aRangodb, un package per l'utilizzo di ArangoDB con RaRangodb, un package per l'utilizzo di ArangoDB con R
aRangodb, un package per l'utilizzo di ArangoDB con R
 
.Net and Rdf APIs
.Net and Rdf APIs.Net and Rdf APIs
.Net and Rdf APIs
 
Graph databases
Graph databasesGraph databases
Graph databases
 
RDF APIs for .NET Framework
RDF APIs for .NET FrameworkRDF APIs for .NET Framework
RDF APIs for .NET Framework
 
Graph Abstractions Matter by Ora Lassila
Graph Abstractions Matter by Ora LassilaGraph Abstractions Matter by Ora Lassila
Graph Abstractions Matter by Ora Lassila
 
Introduction to Graph Databases
Introduction to Graph DatabasesIntroduction to Graph Databases
Introduction to Graph Databases
 
State of the Semantic Web
State of the Semantic WebState of the Semantic Web
State of the Semantic Web
 
Linked Open Data: A simple how-to
Linked Open Data: A simple how-toLinked Open Data: A simple how-to
Linked Open Data: A simple how-to
 
guacamole: an Object Document Mapper for ArangoDB
guacamole: an Object Document Mapper for ArangoDBguacamole: an Object Document Mapper for ArangoDB
guacamole: an Object Document Mapper for ArangoDB
 
How To Model and Construct Graphs with Oracle Database (AskTOM Office Hours p...
How To Model and Construct Graphs with Oracle Database (AskTOM Office Hours p...How To Model and Construct Graphs with Oracle Database (AskTOM Office Hours p...
How To Model and Construct Graphs with Oracle Database (AskTOM Office Hours p...
 
Semantic web
Semantic webSemantic web
Semantic web
 
Intro to the semantic web (for libraries)
Intro to the semantic web (for libraries) Intro to the semantic web (for libraries)
Intro to the semantic web (for libraries)
 
Anything-to-Graph
Anything-to-GraphAnything-to-Graph
Anything-to-Graph
 
BLOGIC. (ISWC 2009 Invited Talk)
BLOGIC.  (ISWC 2009 Invited Talk)BLOGIC.  (ISWC 2009 Invited Talk)
BLOGIC. (ISWC 2009 Invited Talk)
 
20110728 datalift-rpi-troy
20110728 datalift-rpi-troy20110728 datalift-rpi-troy
20110728 datalift-rpi-troy
 
Deploying PHP applications using Virtuoso as Application Server
Deploying PHP applications using Virtuoso as Application ServerDeploying PHP applications using Virtuoso as Application Server
Deploying PHP applications using Virtuoso as Application Server
 
Ontology Access Kit_ Workshop Intro Slides.pptx
Ontology Access Kit_ Workshop Intro Slides.pptxOntology Access Kit_ Workshop Intro Slides.pptx
Ontology Access Kit_ Workshop Intro Slides.pptx
 
Regal - a Repository for Electronic Documents and Bibliographic Data
Regal - a Repository for Electronic Documents and Bibliographic DataRegal - a Repository for Electronic Documents and Bibliographic Data
Regal - a Repository for Electronic Documents and Bibliographic Data
 

Kürzlich hochgeladen

Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile EnvironmentVictorSzoltysek
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
tonesoftg
tonesoftgtonesoftg
tonesoftglanshi9
 

Kürzlich hochgeladen (20)

Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 

Find your way in Graph labyrinths

  • 1. Find your way in Graph labyrinths with SQL, SPARQL, and Gremlin
  • 2. who we are? Daniel Camarda daniel.camarda@gmail.com https://github.com/mdread Alfredo Serafini seralf@gmail.com https://github.com/seralf
  • 3. It’s all about relations for example: northwind DB ...on graph SEE: http://sql2gremlin.com/ schema? properties or relations? joins or edges?
  • 4. SQL 1. - ER: tables for Entity and Relations A table is really similar in practice to a flat CSV. But: ● It introduces types. ● Can be used to materialize important relations, not only entities, normalizing data (=avoiding duplications) ● Can be fast to access using Indexes ● Logical Entity can be physically splitted into many different Tables, after normalization. ● Relations are not explicit they are: ○ materialized as properties/tables ○ expressed by constraints ○ retrieved by joins ROW -> TUPLE! SEE: Northwind schema
  • 5. RDF 1. - modeling But tuples can be more “atomic”, if we think differently. RDF (Resource Description Framework): introduces a conceptual data modeling approach inspired by several best practices, including the well-known dublin-core. Similar role to ER schemas (mostly used on relational DB), or class diagram (mostly used in software design). RDF is based upon describing resources, by making statements about them: both data and metadata can be described this way (self-described). Then we have TUPLEs -> TRIPLEs! (actually QUADs, at least) subject -> predicate -> object (+ context!) Thus it is a multigraph labeled and directed: it's the best architecture for managing ontologies, and it can be also managed more or less as a property graph.
  • 6. RDF 2. - schema Have you said schema? What is a Schema? ● A schema describes your model ● A schema can defines constraints and data types on your model ● A schema provides a good abstraction on the raw data (to be handled manually) What is the best language to describe schemas? ● XML: DTD is not XML, XSD is XML ● DDL is SQL, but dialect, dictionary and schema changes ● RDF can describe both data and metadata (schema) ○ Are we afraid of standards? Why? Are they too much complex? ○ Schema must be mantained!
  • 7. RDF 3. - a shared language for schemas A standardized framework for the description of models it's only a shared language! 1) No one is forced to adopt a specific vocabulary: only a basic syntax is shared among different domains. 2) However different domains can be modeled sharing both schema and data linking, creating a wider knowledge graph. examples: all kind of linked data, vocabularies such as good relations, schema.org and so on http://www.google.com/insidesearch/features/search/knowledge.html https://www.freebase.com/ http://dbpedia.org/
  • 8. RDF 4. - looking at an RDF vocabulary (schema) How does one of those RDF vocabulary can look like? For example FOAF (Friend Of A Friend) vocabulary, using the VOWL toolkit http://vowl.visualdataweb.org/
  • 9. SQL & gremlin - 1 SQL SELECT CategoryName FROM Categories Gremlin g.V('type','category').categoryName SPARQL SELECT ?category WHERE { ?uri a ?category . }
  • 10. SQL & gremlin - 2 SQL SELECT * FROM Products AS P INNER JOIN Categories AS C ON (C.CategoryID = P.CategoryID) WHERE (C.CategoryName = 'Beverages') SPARQL SELECT * FROM <http://northwind/graph> WHERE { ?uri a nw:Product . ?uri nw:has_category ?category . ?category a nw:Category . ?category nw:categoryName 'Beverages' . } SELECT * FROM <http://northwind/graph> WHERE { ?uri a nw:Product . ?uri nw:has_category / nw:categoryName 'Beverages' . } Gremlin g.V('categoryName','Beverages').in('inCategory').map()
  • 11. From table to graph: two strategies 1. RDF mapping, with tools R2RML (Relational to RDF Mapping Language) and DM (Direct Mapping) a. builds an RDF graph, and the mapping itself is also RDF (turtle) b. triples can be mapped live from the relational engine, or materialized into a triplestore 2. Build your own graph model. a. no need for learn a new language b. no need for introduce external tools as dependencies In both cases, a projection of the graph can be used to produce either different graph or tables schema
  • 12. Example: Github graph The idea search for repositories on github, get information about those repos along with collaborators and library dependencies Why? Github has lots of interesting data, analyzing it can give us insights on how the opensource community is evolving. A graph is the best way to represent this kind of deeply interconnected community How it works? Tinkerpop is used on top of OrientDB which is the backend graph engine. The data is retrieved by a small Scala application
  • 14. Graph visualized generated with gephi https://gephi.org/ ● an interactive tool for exploration and analysis of graphs ● connect with external data sources with the Stream plugin ● useful when thinking about your queries repository dependency user Github data collected on Orient Graph: https://github.com/randomknot/graph-labyrinth-demo
  • 15. Is a query language, specifically built for graph traversal ● easy to navigate relationships (edges) ● easy to filter ● start thinking about Paths, not Records ● turing complete language ● default implementation as a Groovy DSL
  • 16. examples 1 All contributors of a repository g.v("#11:192").in("contributes").login projects on which users of this project contribute to g.v("#11:192").in("contributes").out("contributes").dedup.name Repositories with more than ten contributors g.V("node_type", "Repository").filter{it.inE("contributes").count() > 10}.name
  • 17. examples 2 common contributors of two projects g.v('#11:47').in("contributes").as("x").out.retain([g.v('#11:57')]).back("x").login users who work on projects, using a specific library g.V("node_type", "Contributor").as("usr") .out("contributes") .out("depends") .filter{it.artifact_id == "spring-social-web"} .back("usr") .login
  • 19. examples 3 five most used libraries g.V("node_type", "Dependency").inE("depends").inV.groupCount{it.artifact_id}.cap.orderMap(T. decr)[0..4] contributors of projects with more than ten contributors g.V("node_type", "Repository").filter{it.inE("contributes").count() > 10}.in("contributes").login
  • 21. references ● Freebase knowledge base https://www.freebase.com/ ● Google Knowledge Graph http://www.google.com/insidesearch/features/search/knowledge.html ● RDF ○ RDF primer http://www.w3.org/TR/2014/NOTE-rdf11-primer-20140225/ ○ VOWL http://vowl.visualdataweb.org/ ○ FOAF - Friend Of A Friend http://www.foaf-project.org/ ● dbeaver http://dbeaver.jkiss.org/
  • 22. references ● gremlin documentation https://github.com/tinkerpop/gremlin/wiki http://gremlindocs.com/ ● sql2gremlin http://sql2gremlin.com/ ○ visualization: http://sql2gremlin.com/graph/ ○ joins: http://sql2gremlin.com/#joining/inner-join ● gremlin examples http://www.fromdev.com/2013/09/Gremlin-Example-Query-Snippets-Graph-DB.html ● SPARQL + gremlin https://github.com/tinkerpop/gremlin/wiki/SPARQL-vs.-Gremlin ● using SPARQL qith gephi to visualize co-authorship http://data.linkededucation.org/linkedup/devtalk/?p=31 ● mining github followers in tinkerpop (with R, github, neo4j) http://patrick.wagstrom.net/weblog/2012/05/13/mining-github-followers-in-tinkerpop/