SlideShare uma empresa Scribd logo
1 de 22
Baixar para ler offline
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/

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Semelhante a 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
 

Semelhante a 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
 

Último

Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 
Data modeling 101 - Basics - Software Domain
Data modeling 101 - Basics - Software DomainData modeling 101 - Basics - Software Domain
Data modeling 101 - Basics - Software DomainAbdul Ahad
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolsosttopstonverter
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingShane Coughlan
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesKrzysztofKkol1
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...OnePlan Solutions
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...OnePlan Solutions
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfRTS corp
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingShane Coughlan
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jNeo4j
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsJean Silva
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxRTS corp
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonApplitools
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 

Último (20)

Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 
Data modeling 101 - Basics - Software Domain
Data modeling 101 - Basics - Software DomainData modeling 101 - Basics - Software Domain
Data modeling 101 - Basics - Software Domain
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration tools
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero results
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 

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/