Graph on(in) GrailsNeo4j is (as of now) the only graph databasethat fits nicely in a Grails application.
Data is connected
Why Graph DB?Insufficient RDBMS performance in hierarchicalstructures. The graph database storage shineswhen storing richly-connected data. Querying isperformed through traversals, which canperform millions of traversal steps per second. Atraversal step resembles a join in a RDBMS.
SQL addonsSome DBs has even special DSL:SELECT empno, ename, job, mgr, hiredate, LEVELFROM empWHERE LEVEL <= 2START WITH mgr IS NULLCONNECT BY PRIOR empno = mgr
Where Graph DB• Network Management• Master Data Management• Social• Finance• Spatial – Map Routing• Bio
Why Neo4J?• true ACID transactions• high availability• scales to billions of nodes and relationships• high speed querying through traversals• well documented• Java• licenses
Why neo4j - details• Disk ready – Native graph storage engine with custom (SSD- ready) binary on-disk format• Transactional – JTA/JTS, XA, 2PC, Tx Recovery, deadlock detection …• Scalable – Billions of nodes on single JVM
Access & Implementation Types1. EmbeddedGraphDatabase: just to local JVM2. RestGraphDatabase: rest-binding3. HighAvaibleGraphDatabase: uses Zookeeper
When Grails shinesRuby platform isn’t a case, Java is too expensive,Scala is too smart.Startups & prototypesModel-driven architecture where GORM isfundament.
Groovy & Grails Architecture Controller View GSP Service Domain Plug-in Gant GORM Site Mesh Spring Hibernate DB Java EE Groovy JVM
GORMAbstraction on abstractions, wraps: – Hibernate – JPA – Gemfire, Redis, Riak – MongoDB, JCR – Neo4JIntegration testing via TCK
Plugin features• Neo4j -> Groovy/Java• GORM dynamic finders, criteria and named queries• Session-managed transactions• Bean Validation• Neo4js traversal• Embedded, REST and HA
Jump into Neo4J name:staff type:weaponname:SplinterfullName:Hamato Yoshitype: rat type: interact type:knows name:Shredder fullName:Oroku Saki
Properties name:staff type:weaponname:SplinterfullName:Hamato Yoshitype: rat type: interact type:knows
Mapping Reference Node SubreferenceDomain Class/Type SubreferenceNode Domain Class Instance Instance Domain Class Properties Instance Properties Assocoation
Compatibility with GORM ✔ ✗Simple persistence methods HQL queriesDynamic finders Dirty checking methodsCriteria queries Composite primary keysNamed queries Any direct interaction with the Hibernate APIInheritance Custom Hibernate user typesEmbedded typesQuery by exampleMany-to-many associations (these can bemodelled with a mapping class)