Upcoming SlideShare
×

# Neo4 jv2 english

1,185 views

Published on

Published in: Technology
1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Thank you so much!

Are you sure you want to  Yes  No
• Nice presentation..

Are you sure you want to  Yes  No
Views
Total views
1,185
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
39
2
Likes
1
Embeds 0
No embeds

No notes for slide

### Neo4 jv2 english

1. 1. Neo4j NOSQL , Graph Databases and Neo4j Thiago Oliveirahttp://about.me/thiagooliveira@tjsoliveira
2. 2. Agenda• NOSQL• Graph Databases• Neo4j
3. 3. NOSQL Overview• NoSQL is NOT “Never SQL”• NoSQL is NOT “No To SQL”• NoSQL is simply “Not Only SQL”
4. 4. Graph Database• Inspired by Graph Theory;• Data model: Nodes, relationships, properties on both;• Relational Databases have a very heavy language to represent a graph in the Database. NOSQL makes it more easy!• Neo4j
5. 5. Neo4j
6. 6. Creating a Node//Create Thomas “Neo” AndersonNode mrAnderson = db.createNode();mrAnderson.setProperty( “name”, “Thomas Anderson” );mrAnderson.setProperty( “age”, 29 );//Create MorpheusNode morpheus = db.createNode();morpheus.setProperty( “name”, “Morpheus” );morpheus.setProperty( “rank”, “Captain” );morpheus.setProperty( “occupation”, “Total bad ass” );//Create a relationship between Neo and MorpheusmrAnderson.createRelationship( morpheus, RelTypes.KNOWS );
7. 7. Creating a NodeTransaction tx = db.beginTx();//Create Thomas “Neo” AndersonNode mrAnderson = db.createNode();mrAnderson.setProperty( “name”, “Thomas Anderson” );mrAnderson.setProperty( “age”, 29 );//Create MorpheusNode morpheus = db.createNode();morpheus.setProperty( “name”, “Morpheus” );morpheus.setProperty( “rank”, “Captain” );morpheus.setProperty( “occupation”, “Total bad ass” );//Create a relationship between Neo and MorpheusmrAnderson.createRelationship( morpheus, RelTypes.KNOWS );tx.commit();
8. 8. Defining Relationships//Creating a interface! (Low Coupling)public interface RelationshipType { public String getName();;}//Creating my Relationshippublic class MyRelationship implements RelationshipType { private final string name; MyRelationship(String name){ this.name = name; } public String getName(){ return this.name; }}//Or simply:public enum MyRelationship implements RelationshipType { KNOWS, WORKS_FOR,}
9. 9. Travesing a Node space//Creating a interface! (Low Coupling)Traverser friendsTraverser = mrAnderson.traverse ( Traverser.Order..BREADTH_FIRST, StopEvaluator.END_OF_GRAPH, RelTypes.KNOWS, Direction.OUTGOING );//Traverse the node space and print out the resultSystem.out.println( “Mr Anderson Friends:” );for ( Node friend: friendsTraverser ) { friend.getProperty( “name” );}
10. 10. Main Characteristics• Scales Up – Serveral billions of nodes/relationships/properties on single JVM;• Robust – 6+ years in 24/7 production
11. 11. Conclusions• Why NoSQL and Neo4j? – Massive data stores; – Scalability; – Some services simpler to implement than using Relational Databases;• Why NOT NoSQL and Neo4j? – Relational Databases are mature; – Data consistency, transactions – “Don’t scale until you need it”
12. 12. Questions?
13. 13. References• http://www.slideshare.net/harrikauhanen/nosql- 3376398 - NoSql Databases – Harri Kauhanen (2010-03-09)• http://www.slideshare.net/emileifrem/nosql- east-a-nosql-overview-and-the-benefits-of-graph- databases - Neo4j – Emil Eifrem (2009)• http://wiki.neo4j.org