6. A graph database uses graph structure with nodes,
edges, and properties to represent and store data.
!
By definition, a graph database is any storage system
that provides index-free adjacency. This means that
every element contains a direct pointer to its adjacent
element and no index lookups are necessary.
9. EDGES
Edges are the lines that connect nodes to nodes or nodes to properties and
they represent the relationship between the two. Most of the important
information is really stored in the edges. Meaningful patterns emerge
when one examines the connections and interconnections of nodes,
properties, and edges.
11. Compared with relational databases
Graph databases are often faster for associative data sets
!
map more directly to the structure of object-oriented applications
!
Scale more naturally to large data sets as they do not typically require expensive
join operations.
!
As they depend less on a rigid schema, they are more suitable to manage ad-hoc
and changing data with evolving schemas.
12. What to find
vs
How to find
// Find all the directors who have directed a movie scored by John Williams
// that starred Kevin Bacon
!
START actor=(actors, 'Kevin Bacon'), composer=(compsers, 'John Williams')
MATCH (actor)-[:IN]->(movie)<-[:DIRECTED]-(director),
(movie)<-[:SCORED]-(composer)
RETURN director
13. Modelling a Domain with Graphs
Graphs are "whiteboard-friendly"
Nouns become nodes
Verbs become relationships
Properties are adjectives and adverbs
15. Key Features
Java Based
Property Graph Model
Uses Lucene for indexing of graph/relationship properties
ACID Transactions
Massive scalability
Extensible
High performance on deep transversal
16. Key Features
Property Graph Model
!
. Nodes
. Nodes have key / value properties
. Relationships between nodes
. Relationships have labels
. Relationships have key / value properties
. Relationships are directed but transversal at equals speed in both directions
. Semantics of the directions is up to the applications
17. Key Features
ACID Transactions
Custom JTA/JTS compliant transaction manager
distributed transactions
two-phase commit (2PC)
Transaction recovery
deadlock detection
!
Massive Scalability
Supporting billions of nodes/relationships props on a single machine
18. Key Features
.Can run embedded or Standalone via REST
. Plugins : Spatial data, Lucene, RDF, SOLR
. Runs on major platforms : Mac | Windows | Unix
. Extensive documentation
. Active community
. Open Source
22. CYPHER
Cypher is a declarative graph query language that allows
for expressive and efficient querying and updating of the
graph store without having to write traversals through the
graph structure in code
23. CYPHER
START: Starting points in the graph, obtained via index lookups or by element IDs.
MATCH: The graph pattern to match, bound to the starting points in START.
WHERE: Filtering criteria.
RETURN: What to return.
CREATE: Creates nodes and relationships.
DELETE: Removes nodes, relationships and properties.
SET: Set values to properties.
FOREACH: Performs updating actions once per element in a list.
WITH: Divides a query into multiple, distinct parts.