This document discusses using the Neo4J graph database with Grails. It provides an overview of NoSQL databases and why graph databases are useful. It then discusses Neo4J specifically and how its data model is suited to connected data. The document outlines how to install the Neo4J plugin for Grails and use GORM to work with Neo4J. It also discusses advanced configurations like embedded, REST, and high availability modes.
2. About Myself
• Stanislav Shevchenko
• Located in Riga/Latvia
• Technical Architect in Accenture
• Experience since 10 years
• C#/Java/Groovy/Scala/Erlang
3. no:sql
Market has significantly different challenges in
dealing with data that the traditional RDBMS
solutions could not cope with.
4. Issues
• size data sets
• data relations are connected
• distributed processing
• Data Model -> semi-structured approach
5. brings to diversity of solutions
Data Model
Distribution Disk Data
Model Structure
6. types
Document store
Graph
Key-value store
Multivalue databases
Object database
Tabular
Tuple store
12. Why Graph DB?
Insufficient RDBMS performance in hierarchical
structures. The graph database storage shines
when storing richly-connected data. Querying is
performed through traversals, which can
perform millions of traversal steps per second. A
traversal step resembles a join in a RDBMS.
13. SQL addons
Some DBs has even special DSL:
SELECT empno,
ename,
job,
mgr,
hiredate,
LEVEL
FROM emp
WHERE LEVEL <= 2
START WITH mgr IS NULL
CONNECT BY PRIOR empno = mgr
14. Where Graph DB
• Network Management
• Master Data Management
• Social
• Finance
• Spatial
– Map Routing
• Bio
15. Why Neo4J?
• true ACID transactions
• high availability
• scales to billions of nodes and relationships
• high speed querying through traversals
• well documented
• Java
• licenses
16. 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
17. Access & Implementation Types
1. EmbeddedGraphDatabase: just to local JVM
2. RestGraphDatabase: rest-binding
3. HighAvaibleGraphDatabase: uses Zookeeper
18. When Grails shines
Ruby platform isn’t a case, Java is too expensive,
Scala is too smart.
Startups & prototypes
Model-driven architecture where GORM is
fundament.
19. Groovy & Grails Architecture
Controller
View GSP Service Domain
Plug-in
Gant
GORM
Site Mesh Spring Hibernate
DB
Java EE Groovy
JVM
26. Properties
name:staff
type:weapon
name:Splinter
fullName:Hamato Yoshi
type: rat
type: interact
type:knows
27. Mapping
Reference Node
Subreference
Domain Class/Type
SubreferenceNode
Domain Class Instance
Instance
Domain Class
Properties
Instance
Properties
Assocoation
28. Compatibility with GORM
✔ ✗
Simple persistence methods HQL queries
Dynamic finders Dirty checking methods
Criteria queries Composite primary keys
Named queries Any direct interaction with the Hibernate API
Inheritance Custom Hibernate user types
Embedded types
Query by example
Many-to-many associations (these can be
modelled with a mapping class)