Jason Plurad • pluradj@us.ibm.com • @pluradj
Software Developer • IBM Open Technology
Project Management Committee • Apache TinkerPop
November 18, 2017 • Open Camps NYC • #OpenCamps2017
Graph Computing
with Apache TinkerPop
Open Source Graphs – Preach!
2 @pluradj #OpenCamps2017
Social Graphs, Right?
3 @pluradj #OpenCamps2017
Property Graph
4 @pluradj #OpenCamps2017
Apache TinkerPop
§ Open source, vendor-agnostic,
graph computing framework
§ Gremlin graph traversal language
5
Apache TinkerPop™
Maintainer Apache
Software
Foundation
License Apache
Latest Release 3.3.0
August 2017
https://tinkerpop.apache.org
@pluradj #OpenCamps2017
Graph System Integration
6 @pluradj #OpenCamps2017
Graph Provider Landscape
7 @pluradj #OpenCamps2017
Open Source (OLAP)
• Apache Giraph
• Apache Spark
Vendor
• DataStax DSE Graph
• Azure Cosmos DB
• Neo4j
• OrientDB
• Stardog
Open Source
• Apache S2Graph
• HGraphDB
• JanusGraph
• TinkerGraph
• UniPop
Open Source Contributions
Gremlin Traversal Language
9
Recursively show all employees and their supervisors
Daniel Kuppitz @dkuppitz
http://sql2gremlin.com/
@pluradj #OpenCamps2017
Jean-Baptiste Musso @jbmusso
https://github.com/jbmusso/gremlin-javascript
Gremlin Bindings
@pluradj #OpenCamps2017
Gremlin Language Drivers
§ Elevate Gremlin to a top-level citizen in the programming language of choice
§ GLV can work with any modern language
– Function composition
– Function nesting
§ Java and Groovy (native)
§ Python is the first non-JVM GLV
§ Others are coming soon (JavaScript, C#, Go)
§ SPARQL-Gremlin and SQL-Gremlin
http://tinkerpop.apache.org/docs/current/tutorials/gremlin-language-variants
@pluradj #OpenCamps2017
Gremlin Language Variants (GLV)
12
Graph Databases, Gremlin and TinkerPop – A Tutorial
Kelvin Lawrence @gfxman
https://github.com/krlawrence/graph
@pluradj #OpenCamps2017
13
Graph Model: Air Routes
@pluradj #OpenCamps2017
airport
continentcountry
route
code
desc
code
desc
code
city
desc
elev
lat
lon
dist
14
Gremlin: Add a Vertex
@pluradj #OpenCamps2017
Vertex rdu = g.addV('airport').
property('code', 'RDU').
property('city', 'Raleigh').
property('desc', 'Raleigh-Durham International').
property('elev', 435).
property('lat', 35.877601).
property('lon', -78.787498).
next()
15
Gremlin: Add an Edge
@pluradj #OpenCamps2017
Edge rdujfk = g.V().
has('airport', 'code', 'RDU').
addE('route').to(
g.V().has('airport', 'code', 'JFK' ) ).
property('dist', 427).
next()
16
Where can I fly non-stop from Raleigh?
@pluradj #OpenCamps2017
> g.V().has('airport', 'code', 'RDU').
out('route').
values('code').
fold().
toList()
==> [IAH, JFK, LAX, LGA, MCO, MIA, MSP, HOU,
CLE, DFW, FLL, IAD, MSY, YYZ, PHX, BDL, SEA,
CMH, SFO, TTN, TPA, SFB, SLC, PGD, LAS, PIE,
DEN, EWR, ATL, AUS, BNA, BOS, BWI, MDW, DCA,
ORD, STL, DAL, PHL, CDG, DTW, LHR, CLT, PIT,
MEM, CUN, IND, CVG]
17
What international flights depart from Raleigh?
@pluradj #OpenCamps2017
> g.V().has('airport', 'code', 'RDU').
out('route').
has('country', neq('US')).
values('city').
toList()
==> Toronto
==> Paris
==> London
==> Cancun
18
What is the shortest path to Melbourne?
@pluradj #OpenCamps2017
> g.V(rdu).
repeat( out('route').simplePath() ).
until( has('code', 'MEL') ).
limit(5).
path().by('code').
toList()
==> [RDU, LAX, MEL]
==> [RDU, IAH, NRT, MEL]
==> [RDU, IAH, DXB, MEL]
==> [RDU, IAH, AKL, MEL]
==> [RDU, IAH, PEK, MEL]
19
Graph Code Patterns
IBM Cognitive OpenTech & Performance
https://github.com/IBM/janusgraph-utils
§ A 360° view of how Apache TinkerPop and JanusGraph solves a specific problem
– Includes contextual overviews, architecture diagrams, process flows, demos, blog posts,
and source code
§ Twitter-like application in JanusGraph
– Data generator
– Schema loader
– CSV importer
– Graph model and Gremlin queries
§ Contributions welcome!
20
Graphic Design
Ketrina Yim @KetrinaYim
http://ketrinadrawsalot.tumblr.com/
@pluradj #OpenCamps2017
Thank you!

Graph Computing with Apache TinkerPop

  • 1.
    Jason Plurad •pluradj@us.ibm.com • @pluradj Software Developer • IBM Open Technology Project Management Committee • Apache TinkerPop November 18, 2017 • Open Camps NYC • #OpenCamps2017 Graph Computing with Apache TinkerPop
  • 2.
    Open Source Graphs– Preach! 2 @pluradj #OpenCamps2017
  • 3.
    Social Graphs, Right? 3@pluradj #OpenCamps2017
  • 4.
  • 5.
    Apache TinkerPop § Opensource, vendor-agnostic, graph computing framework § Gremlin graph traversal language 5 Apache TinkerPop™ Maintainer Apache Software Foundation License Apache Latest Release 3.3.0 August 2017 https://tinkerpop.apache.org @pluradj #OpenCamps2017
  • 6.
    Graph System Integration 6@pluradj #OpenCamps2017
  • 7.
    Graph Provider Landscape 7@pluradj #OpenCamps2017 Open Source (OLAP) • Apache Giraph • Apache Spark Vendor • DataStax DSE Graph • Azure Cosmos DB • Neo4j • OrientDB • Stardog Open Source • Apache S2Graph • HGraphDB • JanusGraph • TinkerGraph • UniPop
  • 8.
  • 9.
    Gremlin Traversal Language 9 Recursivelyshow all employees and their supervisors Daniel Kuppitz @dkuppitz http://sql2gremlin.com/ @pluradj #OpenCamps2017
  • 10.
    Jean-Baptiste Musso @jbmusso https://github.com/jbmusso/gremlin-javascript GremlinBindings @pluradj #OpenCamps2017 Gremlin Language Drivers
  • 11.
    § Elevate Gremlinto a top-level citizen in the programming language of choice § GLV can work with any modern language – Function composition – Function nesting § Java and Groovy (native) § Python is the first non-JVM GLV § Others are coming soon (JavaScript, C#, Go) § SPARQL-Gremlin and SQL-Gremlin http://tinkerpop.apache.org/docs/current/tutorials/gremlin-language-variants @pluradj #OpenCamps2017 Gremlin Language Variants (GLV)
  • 12.
    12 Graph Databases, Gremlinand TinkerPop – A Tutorial Kelvin Lawrence @gfxman https://github.com/krlawrence/graph @pluradj #OpenCamps2017
  • 13.
    13 Graph Model: AirRoutes @pluradj #OpenCamps2017 airport continentcountry route code desc code desc code city desc elev lat lon dist
  • 14.
    14 Gremlin: Add aVertex @pluradj #OpenCamps2017 Vertex rdu = g.addV('airport'). property('code', 'RDU'). property('city', 'Raleigh'). property('desc', 'Raleigh-Durham International'). property('elev', 435). property('lat', 35.877601). property('lon', -78.787498). next()
  • 15.
    15 Gremlin: Add anEdge @pluradj #OpenCamps2017 Edge rdujfk = g.V(). has('airport', 'code', 'RDU'). addE('route').to( g.V().has('airport', 'code', 'JFK' ) ). property('dist', 427). next()
  • 16.
    16 Where can Ifly non-stop from Raleigh? @pluradj #OpenCamps2017 > g.V().has('airport', 'code', 'RDU'). out('route'). values('code'). fold(). toList() ==> [IAH, JFK, LAX, LGA, MCO, MIA, MSP, HOU, CLE, DFW, FLL, IAD, MSY, YYZ, PHX, BDL, SEA, CMH, SFO, TTN, TPA, SFB, SLC, PGD, LAS, PIE, DEN, EWR, ATL, AUS, BNA, BOS, BWI, MDW, DCA, ORD, STL, DAL, PHL, CDG, DTW, LHR, CLT, PIT, MEM, CUN, IND, CVG]
  • 17.
    17 What international flightsdepart from Raleigh? @pluradj #OpenCamps2017 > g.V().has('airport', 'code', 'RDU'). out('route'). has('country', neq('US')). values('city'). toList() ==> Toronto ==> Paris ==> London ==> Cancun
  • 18.
    18 What is theshortest path to Melbourne? @pluradj #OpenCamps2017 > g.V(rdu). repeat( out('route').simplePath() ). until( has('code', 'MEL') ). limit(5). path().by('code'). toList() ==> [RDU, LAX, MEL] ==> [RDU, IAH, NRT, MEL] ==> [RDU, IAH, DXB, MEL] ==> [RDU, IAH, AKL, MEL] ==> [RDU, IAH, PEK, MEL]
  • 19.
    19 Graph Code Patterns IBMCognitive OpenTech & Performance https://github.com/IBM/janusgraph-utils § A 360° view of how Apache TinkerPop and JanusGraph solves a specific problem – Includes contextual overviews, architecture diagrams, process flows, demos, blog posts, and source code § Twitter-like application in JanusGraph – Data generator – Schema loader – CSV importer – Graph model and Gremlin queries § Contributions welcome!
  • 20.
    20 Graphic Design Ketrina Yim@KetrinaYim http://ketrinadrawsalot.tumblr.com/ @pluradj #OpenCamps2017
  • 21.