Graph databases are a type of NoSQL database that uses nodes and relationships to represent and store data. Nodes can have properties and be connected to other nodes via relationships. This allows for complex queries of connected data. Neo4j is an example of a graph database that uses these concepts to store and query data. Code examples are shown for how to programmatically create nodes and relationships in Neo4j and traverse the graph to find connected nodes.
Chen Salomon introduces himself as a data architect at Playbuzz, a 3-year-old company with 100 employees and 30 in R&D. Playbuzz creates engaging content formats for over 7,000 publishers. To scale efficiently, Playbuzz uses Redis for distributed caching, ETL session management, IP location lookups, and more. Their most recent Redis project converts IP addresses to integers for fast location lookups from cached hashmaps.
A presentation on how Showyou uses the Riak datastore at Showyou.com, as well as work we've been doing on a custom Riak backend for search and analytics.
Riak Use Cases : Dissecting The Solutions To Hard ProblemsAndy Gross
This document summarizes a presentation on using Riak to solve hard distributed systems problems. It discusses Riak's key features and tradeoffs in consistency and data model. It then provides examples of how companies like Comcast, Yammer, and Github use Riak for high availability and low latency applications like user metadata storage, notifications, and as a document store. The presentation emphasizes that choosing the right database requires understanding your problem and tradeoffs in consistency, availability and data model. It also highlights how Riak and Erlang help enable high availability, low latency and operational simplicity through features like Bitcask storage, fault tolerance and lightweight threading.
This document discusses recommendations engines that use graph databases like Neo4j. It introduces GraphAware, an open-source recommendation engine plugin for Neo4j. The document outlines the business and technical challenges of building recommendation engines, and how GraphAware addresses these challenges through its flexible, high-performance architecture and APIs. It provides an example of building a simple friend recommendation engine using GraphAware.
Advanced Neo4j Use Cases with the GraphAware FrameworkMichal Bachman
The document discusses GraphAware Framework, which makes it easy to build, test, and deploy custom APIs, transaction-driven behavior, and asynchronous computation functionality for Neo4j. It provides examples like representing time series data, tracking graph changes, assigning UUIDs, and running algorithms. GraphAware Framework is open source and supports building both generic and domain-specific Neo4j extensions.
Modelling Data in Neo4j, bidirectional relationships, qualifying relationships with properties vs. relationship types (performance comparison), Neo4j hardware sizing, Cypher vs. Java API
This was a presentation from Bethany Kinsella of Best Buy at the HR Executive Forum in the Twin Cities on Feb. 5, 2009. I volunteered to post all of the presentations so those in attendance at the forum could review.
Introduction to Redis Data Structures: Sorted SetsScaleGrid.io
We provide an overview on what Redis is, what are sorted sets, common use cases for sorted sets, sorted set operations in Redis, internal implementation, and a comparison of Redis hashes and Redis sorted sets.
Redis is an open source, advanced key-value store that can be used for caching, sessions, publishing/subscribing, job queues, and more. It supports atomic operations, ordered lists, sets, hashes and sorted sets. Data can be saved to disk for persistence. Redis has client libraries for many languages like Node.js and can be accessed via a command line interface. Popular use cases include caching application data to improve performance, storing sessions to allow user authentication across requests, and processing jobs asynchronously in the background via pub/sub and queues.
This document introduces top Redis use cases. It begins by introducing the speaker, Dr. Josiah Carlson, and providing a brief overview of what Redis is - an in-memory non-relational key-value store with optional persistence and replication. The top five use cases discussed are distributed locking, analytics, storing web cookies, queues/message passing, and anything previously done with Memcached. The document concludes by noting there are many additional use cases for Redis like caching, rankings, and as a general data store.
A review of BestBuy.com's cloud architecture for its browse cloud. A description of what BestBuy.com has built to support a high scale, high availability ecommerce system.
The document discusses how Redis is used at Facebook to solve two problems:
1) Serving user configurations in real-time by using a hierarchical master-slave replication architecture with global and regional masters and slaves to distribute reads and allow writes at different levels.
2) Processing stats data in real-time by using a split data processing model where daily bulk processing is done separately from real-time processing by tailers that insert stats into a sharded Redis cluster using HINCRBY.
Bootstrapping Recommendations with Neo4jMax De Marzi
This document provides an overview of using Neo4j and graph databases for bootstrapping recommendations in real-time. It discusses common recommendation approaches like popularity, content-based, collaborative filtering and hybrid recommendations. It also covers challenges of real-time recommendations like processing relationships and accommodating new data continuously. Additionally, it demonstrates sample Cypher queries for calculating similarity between users and providing movie recommendations based on a user's nearest neighbors.
Neo4j GraphTalks - Einführung in GraphdatenbankenNeo4j
Neo4j GraphTalks event on November 2016 included:
1) An introduction to graph databases and Neo4j by Bruno Ungermann from Neo4j.
2) Darko Krizic from PRODYNA AG presenting their experience implementing a global knowledge hub for product information using Neo4j.
3) An open networking session.
Redis Use Patterns (DevconTLV June 2014)Itamar Haber
An introduction to Redis for the SQL practitioner, covering data types and common use cases.
The video of this session can be found at: https://www.youtube.com/watch?v=8Unaug_vmFI
This document introduces Neo4j, the world's leading graph database. It discusses Neo4j's product and company details, how graph databases are different than other databases by focusing on relationships between connected data. Common use cases for Neo4j are also summarized, such as recommendations, master data management, network operations, identity and access management, and fraud detection. The document provides examples of how customers use Neo4j and discusses patterns of fraud that Neo4j can help detect.
This document discusses data processing flows and the value of relationships in graph databases. It provides examples of how a graph database was used to process over 3 million files from a large data leak in just 1.5 weeks using Amazon instances. The document also lists several uses for graph databases, including fraud detection and identity access management.
These webinar slides are an introduction to Neo4j and Graph Databases. They discuss the primary use cases for Graph Databases and the properties of Neo4j which make those use cases possible. They also cover the high-level steps of modeling, importing, and querying your data using Cypher and touch on RDBMS to Graph.
Importing Data into Neo4j quickly and easily - StackOverflowNeo4j
In this GraphConnect presentation Mark and Michael show several ways to import large amounts of highly connected data from different formats into Neo4j. Both Cypher's LOAD CSV as well as the bulk importer is demonstrated along with many tips.
We use the well know StackOverflow Q&A site data which is interestingly very graphy.
The document discusses using Neo4j and graph databases for fraud detection solutions. It describes how Neo4j allows for agile development, high productivity, and real-time response times when working with connected fraud data. The document outlines a fraud detection demo using Neo4j to load operational data, inject fraud cases, generate alerts, and export detected fraud data for investigation. It proposes using Neo4j as the foundation for a 360-degree fraud prevention solution integrated with other systems and data sources.
This document discusses graph databases and provides examples of how the Neo4j graph database can be used. It shows how Neo4j supports social, spatial, financial and other types of connected data. It also summarizes Neo4j's REST API, support for object-oriented programming, routing algorithms, multiple indexes, recommendation systems, and other use cases. The document advocates for graph databases for any problem involving multiple relationships and connections between entities.
This document provides an overview of graph databases and their use cases. It begins with definitions of graphs and graph databases. It then gives examples of how graph databases can be used for social networking, network management, and other domains where data is interconnected. It provides Cypher examples for creating and querying graph patterns in a social networking and IT network management scenario. Finally, it discusses the graph database ecosystem and how graphs can be deployed for both online transaction processing and batch processing use cases.
Neo4j is a powerful and expressive tool for storing, querying and manipulating data. However modeling data as graphs is quite different from modeling data under a relational database. In this talk, Michael Hunger will cover modeling business domains using graphs and show how they can be persisted and queried in Neo4j. We'll contrast this approach with the relational model, and discuss the impact on complexity, flexibility and performance.
Startups in Sweden vs Startups in Silicon Valley, 2015 editionEmil Eifrem
Differences between running a startup in Sweden and a startup in Silicon Valley. Bonus: How Neo Technology (Neo4j) uses aspects of Scandinavian culture as a competitive advantage. Presented at the Nordic themed Monki Gräs in London, Jan of 2015.
Btw, we at Neo4j are hiring: http://neo4j.com/jobs/ :)
This document contains snippets from a Neo Technology conference presentation on graphs and graph databases. It discusses how graphs can be used to model real-world domains like social networks, telecommunications networks, financial networks, healthcare networks, and more. It also provides examples of how specific companies like Accenture are using graph databases and outlines Neo Technology's roadmap for improving the user experience of its graph database platform.
An Overview of the Emerging Graph Landscape (Oct 2013)Emil Eifrem
Recent years have seen an explosion of technologies for managing, processing and analyzing graphs, ranging from community projects like Apache Giraph, to vendor led products such as Neo4j and spin outs from established companies like Twitter’s FlockDB. The sheer number of technologies makes it difficult to keep track of these tools and what sets them apart, even for those of us who are active in the space!
But all graph technologies are not created equal. This session will provide a high level framework for making sense of the emerging graph landscape. It will describe the three dominant graph data models today, define top level categories like graph compute engines (Graphlab, Giraph, Pegasus, YarcData, etc) and graph databases (Neo4j, FlockDB, OrientDB, etc) and discuss common characteristics and important properties of each category.
Modelling Data in Neo4j, bidirectional relationships, qualifying relationships with properties vs. relationship types (performance comparison), Neo4j hardware sizing, Cypher vs. Java API
This was a presentation from Bethany Kinsella of Best Buy at the HR Executive Forum in the Twin Cities on Feb. 5, 2009. I volunteered to post all of the presentations so those in attendance at the forum could review.
Introduction to Redis Data Structures: Sorted SetsScaleGrid.io
We provide an overview on what Redis is, what are sorted sets, common use cases for sorted sets, sorted set operations in Redis, internal implementation, and a comparison of Redis hashes and Redis sorted sets.
Redis is an open source, advanced key-value store that can be used for caching, sessions, publishing/subscribing, job queues, and more. It supports atomic operations, ordered lists, sets, hashes and sorted sets. Data can be saved to disk for persistence. Redis has client libraries for many languages like Node.js and can be accessed via a command line interface. Popular use cases include caching application data to improve performance, storing sessions to allow user authentication across requests, and processing jobs asynchronously in the background via pub/sub and queues.
This document introduces top Redis use cases. It begins by introducing the speaker, Dr. Josiah Carlson, and providing a brief overview of what Redis is - an in-memory non-relational key-value store with optional persistence and replication. The top five use cases discussed are distributed locking, analytics, storing web cookies, queues/message passing, and anything previously done with Memcached. The document concludes by noting there are many additional use cases for Redis like caching, rankings, and as a general data store.
A review of BestBuy.com's cloud architecture for its browse cloud. A description of what BestBuy.com has built to support a high scale, high availability ecommerce system.
The document discusses how Redis is used at Facebook to solve two problems:
1) Serving user configurations in real-time by using a hierarchical master-slave replication architecture with global and regional masters and slaves to distribute reads and allow writes at different levels.
2) Processing stats data in real-time by using a split data processing model where daily bulk processing is done separately from real-time processing by tailers that insert stats into a sharded Redis cluster using HINCRBY.
Bootstrapping Recommendations with Neo4jMax De Marzi
This document provides an overview of using Neo4j and graph databases for bootstrapping recommendations in real-time. It discusses common recommendation approaches like popularity, content-based, collaborative filtering and hybrid recommendations. It also covers challenges of real-time recommendations like processing relationships and accommodating new data continuously. Additionally, it demonstrates sample Cypher queries for calculating similarity between users and providing movie recommendations based on a user's nearest neighbors.
Neo4j GraphTalks - Einführung in GraphdatenbankenNeo4j
Neo4j GraphTalks event on November 2016 included:
1) An introduction to graph databases and Neo4j by Bruno Ungermann from Neo4j.
2) Darko Krizic from PRODYNA AG presenting their experience implementing a global knowledge hub for product information using Neo4j.
3) An open networking session.
Redis Use Patterns (DevconTLV June 2014)Itamar Haber
An introduction to Redis for the SQL practitioner, covering data types and common use cases.
The video of this session can be found at: https://www.youtube.com/watch?v=8Unaug_vmFI
This document introduces Neo4j, the world's leading graph database. It discusses Neo4j's product and company details, how graph databases are different than other databases by focusing on relationships between connected data. Common use cases for Neo4j are also summarized, such as recommendations, master data management, network operations, identity and access management, and fraud detection. The document provides examples of how customers use Neo4j and discusses patterns of fraud that Neo4j can help detect.
This document discusses data processing flows and the value of relationships in graph databases. It provides examples of how a graph database was used to process over 3 million files from a large data leak in just 1.5 weeks using Amazon instances. The document also lists several uses for graph databases, including fraud detection and identity access management.
These webinar slides are an introduction to Neo4j and Graph Databases. They discuss the primary use cases for Graph Databases and the properties of Neo4j which make those use cases possible. They also cover the high-level steps of modeling, importing, and querying your data using Cypher and touch on RDBMS to Graph.
Importing Data into Neo4j quickly and easily - StackOverflowNeo4j
In this GraphConnect presentation Mark and Michael show several ways to import large amounts of highly connected data from different formats into Neo4j. Both Cypher's LOAD CSV as well as the bulk importer is demonstrated along with many tips.
We use the well know StackOverflow Q&A site data which is interestingly very graphy.
The document discusses using Neo4j and graph databases for fraud detection solutions. It describes how Neo4j allows for agile development, high productivity, and real-time response times when working with connected fraud data. The document outlines a fraud detection demo using Neo4j to load operational data, inject fraud cases, generate alerts, and export detected fraud data for investigation. It proposes using Neo4j as the foundation for a 360-degree fraud prevention solution integrated with other systems and data sources.
This document discusses graph databases and provides examples of how the Neo4j graph database can be used. It shows how Neo4j supports social, spatial, financial and other types of connected data. It also summarizes Neo4j's REST API, support for object-oriented programming, routing algorithms, multiple indexes, recommendation systems, and other use cases. The document advocates for graph databases for any problem involving multiple relationships and connections between entities.
This document provides an overview of graph databases and their use cases. It begins with definitions of graphs and graph databases. It then gives examples of how graph databases can be used for social networking, network management, and other domains where data is interconnected. It provides Cypher examples for creating and querying graph patterns in a social networking and IT network management scenario. Finally, it discusses the graph database ecosystem and how graphs can be deployed for both online transaction processing and batch processing use cases.
Neo4j is a powerful and expressive tool for storing, querying and manipulating data. However modeling data as graphs is quite different from modeling data under a relational database. In this talk, Michael Hunger will cover modeling business domains using graphs and show how they can be persisted and queried in Neo4j. We'll contrast this approach with the relational model, and discuss the impact on complexity, flexibility and performance.
Startups in Sweden vs Startups in Silicon Valley, 2015 editionEmil Eifrem
Differences between running a startup in Sweden and a startup in Silicon Valley. Bonus: How Neo Technology (Neo4j) uses aspects of Scandinavian culture as a competitive advantage. Presented at the Nordic themed Monki Gräs in London, Jan of 2015.
Btw, we at Neo4j are hiring: http://neo4j.com/jobs/ :)
This document contains snippets from a Neo Technology conference presentation on graphs and graph databases. It discusses how graphs can be used to model real-world domains like social networks, telecommunications networks, financial networks, healthcare networks, and more. It also provides examples of how specific companies like Accenture are using graph databases and outlines Neo Technology's roadmap for improving the user experience of its graph database platform.
An Overview of the Emerging Graph Landscape (Oct 2013)Emil Eifrem
Recent years have seen an explosion of technologies for managing, processing and analyzing graphs, ranging from community projects like Apache Giraph, to vendor led products such as Neo4j and spin outs from established companies like Twitter’s FlockDB. The sheer number of technologies makes it difficult to keep track of these tools and what sets them apart, even for those of us who are active in the space!
But all graph technologies are not created equal. This session will provide a high level framework for making sense of the emerging graph landscape. It will describe the three dominant graph data models today, define top level categories like graph compute engines (Graphlab, Giraph, Pegasus, YarcData, etc) and graph databases (Neo4j, FlockDB, OrientDB, etc) and discuss common characteristics and important properties of each category.
Startups in Sweden vs Startups in Silicon ValleyEmil Eifrem
Differences between running a startup in Sweden and a startup in Silicon Valley. Presented at Stanford's "European Entrepreneurship & Innovation" (http://www.europeanentrepreneursatstanford.com) in Jan of 2012.
NOSQL part of the SpringOne 2GX 2010 keynoteEmil Eifrem
The document discusses Spring Data support for non-relational databases (NOSQL) to address challenges of proliferating and complex data not suitable for relational databases. It provides examples of using Spring Data with the Neo4j graph database to model complex domains like social networks by adding graph features to existing JPA data models and handling relationships as entities rather than raw database operations. A new Spring Roo add-on is presented for simplified Neo4j integration.
This document discusses trends driving the emergence of NoSQL databases and provides an overview of NoSQL. The key trends include: (1) rapidly increasing data set sizes, (2) greater connectivity of data, and (3) more semi-structured and decentralized content. These trends have challenged the performance and architecture of traditional relational databases. NoSQL databases emerged in response and come in four main categories: key-value stores, BigTable clones, document databases, and graph databases. Each has a different data model suited to different types of use cases. Looking ahead, the best approach may be "polyglot persistence" using both SQL and NoSQL solutions.
A NOSQL Overview And The Benefits Of Graph Databases (nosql east 2009)Emil Eifrem
Presentation given at nosql east 2009 in Atlanta. Introduces the NOSQL space by offering a framework for categorization and discusses the benefits of graph databases. Oh, and also includes some tongue-in-cheek party poopers about sucky things in the NOSQL space.
Neo4j - The Benefits of Graph Databases (OSCON 2009)Emil Eifrem
This document discusses the benefits of graph databases like Neo4j compared to relational databases. It notes that data is becoming more connected and semi-structured, and graph databases can better represent these types of connections. It provides examples of building a node space and traversing relationships in Neo4j using code snippets. It also discusses scaling Neo4j through replication and partitioning. In summary, graph databases like Neo4j are well-suited for complex, connected data and can provide better performance than relational databases for network and semantic queries.
A presentation of the Neo4j graph database given at QCon SF 2008. It describes why relational databases are increasingly unfit for many applications today and why graphs may be a good fit. It also covers the fundamentals of how to program with Neo4j.
4. The Graph DB model: representation
Core abstractions:
name = “Emil”
Nodes
age = 29
sex = “yes”
Relationships between nodes
Properties on both 1 2
type = KNOWS
time = 4 years 3
type = car
vendor = “SAAB”
model = “95 Aero”
5. Example: The Matrix
name = “The Architect”
name = “Morpheus”
rank = “Captain”
name = “Thomas Anderson”
occupation = “Total badass” 42
age = 29
disclosure = public
KNOWS KNOWS CODED_BY
KNO
1 7 3 W S
KN
13
S
OW name = “Cypher”
KNOW
S last name = “Reagan”
name = “Agent Smith”
disclosure = secret version = 1.0b
age = 3 days age = 6 months language = C++
2
name = “Trinity”
6. Code (1): Building a node space
GraphDatabaseService graphDb = ... // Get factory
// Create Thomas 'Neo' Anderson
Node mrAnderson = graphDb.createNode();
mrAnderson.setProperty( "name", "Thomas Anderson" );
mrAnderson.setProperty( "age", 29 );
// Create Morpheus
Node morpheus = graphDb.createNode();
morpheus.setProperty( "name", "Morpheus" );
morpheus.setProperty( "rank", "Captain" );
morpheus.setProperty( "occupation", "Total bad ass" );
// Create a relationship representing that they know each other
mrAnderson.createRelationshipTo( morpheus, RelTypes.KNOWS );
// ...create Trinity, Cypher, Agent Smith, Architect similarly
7. Code (1): Building a node space
GraphDatabaseService graphDb = ... // Get factory
Transaction tx = graphDb.beginTx();
// Create Thomas 'Neo' Anderson
Node mrAnderson = graphDb.createNode();
mrAnderson.setProperty( "name", "Thomas Anderson" );
mrAnderson.setProperty( "age", 29 );
// Create Morpheus
Node morpheus = graphDb.createNode();
morpheus.setProperty( "name", "Morpheus" );
morpheus.setProperty( "rank", "Captain" );
morpheus.setProperty( "occupation", "Total bad ass" );
// Create a relationship representing that they know each other
mrAnderson.createRelationshipTo( morpheus, RelTypes.KNOWS );
// ...create Trinity, Cypher, Agent Smith, Architect similarly
tx.commit();
8. Code (1b): Def ning RelationshipTypes
i
// In package org.neo4j.graphdb
public interface RelationshipType
{
String name();
}
// In package org.yourdomain.yourapp
// Example on how to roll dynamic RelationshipTypes
class MyDynamicRelType implements RelationshipType
{
private final String name;
MyDynamicRelType( String name ){ this.name = name; }
public String name() { return this.name; }
}
// Example on how to kick it, static-RelationshipType-like
enum MyStaticRelTypes implements RelationshipType
{
KNOWS,
WORKS_FOR,
}
10. The Graph DB model: traversal
Traverser framework for
high-performance traversing name = “Emil”
age = 31
across the node space sex = “yes”
1 2
type = KNOWS
time = 4 years 3
type = car
vendor = “SAAB”
model = “95 Aero”
11. Example: Mr Anderson’s friends
name = “The Architect”
name = “Morpheus”
rank = “Captain”
name = “Thomas Anderson”
occupation = “Total badass” 42
age = 29
disclosure = public
KNOWS KNOWS CODED_BY
KNO
1 7 3 W S
KN
13
S
OW name = “Cypher”
KNOW
S last name = “Reagan”
name = “Agent Smith”
disclosure = secret version = 1.0b
age = 3 days age = 6 months language = C++
2
name = “Trinity”
12. Code (2): Traversing a node space
// Instantiate a traverser that returns Mr Anderson's friends
Traverser friendsTraverser = mrAnderson.traverse(
Traverser.Order.BREADTH_FIRST,
StopEvaluator.END_OF_GRAPH,
ReturnableEvaluator.ALL_BUT_START_NODE,
RelTypes.KNOWS,
Direction.OUTGOING );
// Traverse the node space and print out the result
System.out.println( "Mr Anderson's friends:" );
for ( Node friend : friendsTraverser )
{
System.out.printf( "At depth %d => %s%n",
friendsTraverser.currentPosition().getDepth(),
friend.getProperty( "name" ) );
}
13. name = “The Architect”
name = “Morpheus”
rank = “Captain”
name = “Thomas Anderson”
occupation = “Total badass” 42
age = 29
disclosure = public
KNOWS KNOWS CODED_BY
KNO
1 7 3 W S
KN 13
S
OW name = “Cypher”
KNOW
S last name = “Reagan”
name = “Agent Smith”
disclosure = secret version = 1.0b
age = 3 days age = 6 months language = C++
2
name = “Trinity”
$ bin/start-neo-example
Mr Anderson's friends:
At depth 1 => Morpheus
friendsTraverser = mrAnderson.traverse(
Traverser.Order.BREADTH_FIRST, At depth 1 => Trinity
StopEvaluator.END_OF_GRAPH, At depth 2 => Cypher
ReturnableEvaluator.ALL_BUT_START_NODE,
RelTypes.KNOWS,
At depth 3 => Agent Smith
Direction.OUTGOING ); $
14. Example: Friends in love?
name = “The Architect”
name = “Morpheus”
rank = “Captain”
name = “Thomas Anderson”
occupation = “Total badass” 42
age = 29
disclosure = public
KNOWS KNOWS CODED_BY
KNO
1 7 3 W S
KN 13
S
KNOW
OW name = “Cypher”
S last name = “Reagan”
name = “Agent Smith”
LO disclosure = secret version = 1.0b
VE age = 6 months language = C++
S
2
name = “Trinity”
15. Code (3a): Custom traverser
// Create a traverser that returns all “friends in love”
Traverser loveTraverser = mrAnderson.traverse(
Traverser.Order.BREADTH_FIRST,
StopEvaluator.END_OF_GRAPH,
new ReturnableEvaluator()
{
public boolean isReturnableNode( TraversalPosition pos )
{
return pos.currentNode().hasRelationship(
RelTypes.LOVES, Direction.OUTGOING );
}
},
RelTypes.KNOWS,
Direction.OUTGOING );
16. Code (3a): Custom traverser
// Traverse the node space and print out the result
System.out.println( "Who’s a lover?" );
for ( Node person : loveTraverser )
{
System.out.printf( "At depth %d => %s%n",
loveTraverser.currentPosition().getDepth(),
person.getProperty( "name" ) );
}
17. name = “The Architect”
name = “Morpheus”
rank = “Captain”
name = “Thomas Anderson”
occupation = “Total badass” 42
age = 29
disclosure = public
KNOWS KNOWS KNO CODED_BY
1 7 3 W S
KN 13
S
name = “Cypher”
KNOW
OW
S last name = “Reagan”
name = “Agent Smith”
LO disclosure = secret version = 1.0b
VE age = 6 months language = C++
S
2
name = “Trinity”
$ bin/start-neo-example
new ReturnableEvaluator()
Who’s a lover?
{
public boolean isReturnableNode(
TraversalPosition pos)
At depth 1 => Trinity
{ $
return pos.currentNode().
hasRelationship( RelTypes.LOVES,
Direction.OUTGOING );
}
},
18. Bonus code: domain model
How do you implement your domain model?
Use the delegator pattern, i.e. every domain entity wraps a
Neo4j primitive:
// In package org.yourdomain.yourapp
class PersonImpl implements Person
{
private final Node underlyingNode;
PersonImpl( Node node ){ this.underlyingNode = node; }
public String getName()
{
return (String) this.underlyingNode.getProperty( "name" );
}
public void setName( String name )
{
this.underlyingNode.setProperty( "name", name );
}
}
19. Domain layer frameworks
Qi4j (www.qi4j.org)
Framework for doing DDD in pure Java5
Def nes Entities / Associations / Properties
i
Sound familiar? Nodes / Rel’s / Properties!
Neo4j is an “EntityStore” backend
Jo4neo (http://code.google.com/p/jo4neo)
Annotation driven
Weaves Neo4j-backed persistence into domain objects at runtime
S pring D a ta G ra ph (http://www.springsource.org/spring-data)
Collaboration with SpringSource
Annotation driven, AspectJ based
20. Neo4j system characteristics
Disk-based
Native graph storage engine with custom binary on-disk
format
Transactional
JTA/JTS, XA, 2PC, Tx recovery, deadlock detection,
MVCC, etc
Scales up
Many billions of nodes/rels/props on single JVM
Robust
7+ years in 24/7 production
22. Social data (customer: e.g. EU largest social network)
name = “Marcy Runkle”
name = “Hank”
last_name = “Moody”
name = “Mike”
age = 42 42
age = 29 S
W
NO
disclosure = public
K
KNOWS KNOWS KNO
1 7 3 W S
KN
13
S
OW name = “Charlie”
KNOW
S last_name = “Runkle”
name = “Dani”
last_name = “California”
age = 3 days age = 27
2
name = “Karen”
24. Spatial data (customer: large telecom company)
name = ...
name = “The Tavern”
lat = 1295238237
name = “Omni Hotel”
long = 234823492 42
lat = 3492848
long = 283823423 length = 7 miles AD
RO
ROAD ROAD ROO
1 7 3 OAD
RO
13
AD name = ...
ROAD
lat, long = ...
name = “Swedland”
lat = 23410349
length = 3 miles long = 2342348852
2
name = ...
26. Social AND spatial data (customer: LBS)
name = “Peter”
name = “The Tavern”
lat = 1295238237
name = “Omni Hotel”
long = 234823492 42
lat = 3492848 S
W
NO
long = 283823423 weight = 10
K
ROAD LIKES SIBL
1 7 3 IN G
RO
13
AD name = “Emil”
ROAD
beer_qual = expert
name = “Maria”
age = 30
length = 3 miles beer_qual = non-existant
2
name = ...
27. Financial data (customer: international bank)
name = ...
name = “The Tavern”
lat = 1295238237
long = 234823492 42
name = “Mr Godfather” AW
karma = veeeery-low
HDR
cash = more-than-you amount = $1000
IT
W
OWNS TRANSFER WIT
1 7 3 HDR
AW
13
S FE R
DE name = “Emil”
P OS cash = always-too-li'l
IT TRAN
title = “ATM @ Wall St”
id = 230918484233
amount = $1000 cash_left = 384204
2
name = ...
28. Cute. But what about performance?
name = ...
name = “The Tavern”
lat = 1295238237
long = 234823492 42
name = “Mr Godfather” AW
karma = veeeery-low
HDR
cash = more-than-you amount = $1000
IT
W
WITHDRAW TRANSFER WIT
1 7 3 HDR
AW
13
S FE R
DE name = “Emil”
P OS cash = always-too-li'l
IT TRAN
title = “ATM @ Wall St”
id = 230918484233
amount = $1000 cash_left = 384204
2
name = ...
pathExists(a, b, 5)
# nodes query time
Relational database (MySQL) 1 000 2 000 ms
Graph database (Neo4j) 1 000 2 ms
Graph database (Neo4j) 1 000 000 2 ms
29. How ego are you? (aka other impls?)
Franz’ A lle g roG ra ph (http://agraph.franz.com)
Proprietary, Lisp, RDF-oriented but real graphdb
Sones g ra phD B (http://sones.com)
.NET, open source version available
Twitter's Flo c k D B (http://github.com/twitter/flockdb)
Twitter's graph database for large and shallow graphs
Sparsity Technologies D ex (http://sparsitytechnologies.com)
New on the scene, spun out of Spanish university
Objectivity I nfiniteG ra ph (http://infinitegraph.com)
Graph db on-top-of OODB
30. Conclusion
Graphs && Neo4j => teh awesome!
Available NOW under AGPLv3 / commercial license
AGPLv3: “if you’re open source, we’re open source”
If you have proprietary software? Must buy a commercial
license
But the first one is free!
Download
http://neo4j.org
Feedback
http://lists.neo4j.org
32. T he N eo 4j tea m
is hiring !
Do you see the Matrix?
Apply now.