+ All Categories
Home > Technology > Gremlin Queries with DataStax Enterprise Graph

Gremlin Queries with DataStax Enterprise Graph

Date post: 22-Jan-2018
Category:
Upload: stephen-mallette
View: 119 times
Download: 5 times
Share this document with a friend
22
Gremlin Queries with DataStax Enterprise Graph Stephen Mallette @spmallette © 2017. All Rights Reserved.
Transcript

Gremlin Queries with

DataStax Enterprise GraphStephen Mallette

@spmallette

© 2017. All Rights Reserved.

© 2017. All Rights Reserved.

What is a graph?

© 2017. All Rights Reserved.

● A property graph is a collection of vertices and

edges○ A vertex represents entities/domain objects

○ An edge represents a directional relationship between

two vertices

○ Vertices and edges have labels and properties

label: person

name: Stephen

label: company

name: DataStax

label: person

name: Paraslabel: employs

since: 2015label: employs

since: 2016

label: knows

© 2017. All Rights Reserved.

What makes graphs

conceptually simple

to understand?

© 2017. All Rights Reserved.

Graphs are the

foundation of

intelligence

© 2017. All Rights Reserved.

When are graphs

useful?

© 2017. All Rights Reserved.

● Graphs are useful when your data

contains many relationships

● The more relationships you have the

more valuable the graph becomes

© 2017. All Rights Reserved.

How does Apache

TinkerPop support

graph processing?

© 2017. All Rights Reserved.

© 2017. All Rights Reserved.

Gremlin - Graph Traversal Language

● Gremlin is a language composed of

steps

● Steps are chained together to form a

graph traversal

● The output of a previous step is the

input to the step that follows

© 2017. All Rights Reserved.

Gremlin - Graph Traversal Language

g.V()

© 2017. All Rights Reserved.

Gremlin - Graph Traversal Language

g.V()

g.V().has("person","name","Stephen")

© 2017. All Rights Reserved.

Gremlin - Graph Traversal Language

g.V()

g.V().has("person","name","Stephen")

g.V().has("person","name","Stephen").outE()

© 2017. All Rights Reserved.

Gremlin - Graph Traversal Language

g.V()

g.V().has("person","name","Stephen")

g.V().has("person","name","Stephen").outE()

g.V().has("person","name","Stephen").outE().groupCount().

by(label())

© 2017. All Rights Reserved.

Gremlin Language Variants

● Java

● Groovy

● Scala*

● Clojure*

● Python

● .NET

● Javascript**

* Third-party maintained libraries

** Coming soon

© 2017. All Rights Reserved.

DataStax Enterprise (DSE) Graph● A scale-out graph database purposely built for cloud applications that need

to act on complex and highly connected relationships.

● Supports a property graph model natively inside the DataStax product,

engineered specifically for DataStax Enterprise (Apache Cassandra,

Search, Analytics).

● Part of DSE’s multi-model platform.

● Apache TinkerPop-enabled with support for OLTP

and OLAP workloads

© 2017. All Rights Reserved.

DataStax Enterprise (DSE) Graph● Not an embedded graph database

● Schema-based

● Connect with Apache TinkerPop drivers or DataStax drivers

○ Both protocols support Gremlin scripts and bytecode

● DataStax drivers provide additional features over Apache TinkerPop drivers:

○ Cluster awareness/discovery

○ Load balancing

○ Retry policies

○ Cluster metadata

○ Batched requests

○ Advanced security/logging options

○ Native support for Geo types

© 2017. All Rights Reserved.

DataStax Studio

© 2017. All Rights Reserved.

KillrVideo

KillrVideo is an open source reference application for developers learning how to

build solutions with Apache Cassandra and DataStax Enterprise.

https://killrvideo.github.io/

© 2017. All Rights Reserved.

Live Demo

© 2017. All Rights Reserved.

What's next?

© 2017. All Rights Reserved.

● Apache TinkerPop Website○ http://tinkerpop.apache.org/

● The Gremlin Compendium○ http://www.doanduyhai.com/blog/?p=13460

● Graph Databases, Gremlin and TinkerPop○ http://kelvinlawrence.net/book/Gremlin-Graph-Guide.html

● DSE Graph○ https://www.datastax.com/products/datastax-enterprise-graph

● DataStax Studio○ https://www.datastax.com/products/datastax-studio-and-development-tools

Resources


Recommended