Click here to load reader
Jan 27, 2015
The Problem
Aggregation Ordered data Truly tabular data Few or clearly defined relationships
RDBMS are good at
Relational databases aren’t very good with relationships.
Graph DB’s
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.
NODESNodes represent Entities such as people, businesses, accounts, or any other item you might want to keep track of.
PropertiesProperties are pertinent information that relate to nodes.
EDGESEdges 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.
Graph databases focus on the interconnection
between Entities
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.
Compared with relational databases
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
Modelling a Domain with Graphs
Graphs are "whiteboard-friendly" Nouns become nodes Verbs become relationships Properties are adjectives and adverbs
NEO4J
Key FeaturesJava Based Property Graph Model Uses Lucene for indexing of graph/relationship properties ACID Transactions Massive scalability Extensible High performance on deep transversal
Key FeaturesProperty 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
Key FeaturesACID 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
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
Enterprise strength database
Finding Stuff
TRANSVERSAL
CYPHERCypher 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
CYPHERSTART: 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.
Graph AlgorithmsShortest paths,
all paths,
all simple paths,
Dijkstra and
A*.
REST API
DEMO TIME
That’s All Folks Thank you!
!
!
@ptraca