SlideShare a Scribd company logo
Rapid development with Neo4J
         under Grails
About Myself
•   Stanislav Shevchenko
•   Located in Riga/Latvia
•   Technical Architect in Accenture
•   Experience since 10 years
•   C#/Java/Groovy/Scala/Erlang
no:sql
Market has significantly different challenges in
dealing with data that the traditional RDBMS
solutions could not cope with.
Issues
•   size data sets
•   data relations are connected
•   distributed processing
•   Data Model -> semi-structured approach
brings to diversity of solutions


                       Data Model




        Distribution                Disk Data
           Model                    Structure
types

 Document store
        Graph
  Key-value store
Multivalue databases
 Object database
       Tabular
     Tuple store
hard to integrate in industrialized
            companies
Grails Support
Name               Type
RIAK               Eventually‐consistent key‐value   +
REDIS              Key-value cache in RAM            +
MemcacheDB         Ordered key-value stores          +-
Apache CouchDB     Document store                    +
MongoDB            Document store                    +
Apache Hadoop      Tabular/Big Table                 +
Apache Cassandra   Eventually‐consistent key‐value   +
Neo4J              Graph                             +
Graph DB implemetations
                      Language
DEX                   C++
FlockDB               Scala
InfiniteGraph         Java
HyperGraphDB          Java
Neo4J                 Java
OpenLink Virtuoso     C++, C#, Java, SPARQL
OrientDB              Java
Sones GraphDB         C#
Graph on(in) Grails
Neo4j is (as of now) the only graph database
that fits nicely in a Grails application.
Data is connected
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.
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
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 Types

1. EmbeddedGraphDatabase: just to local JVM
2. RestGraphDatabase: rest-binding
3. HighAvaibleGraphDatabase: uses Zookeeper
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.
Groovy & Grails Architecture
                   Controller

   View GSP        Service        Domain

                    Plug-in




                                              Gant
                                   GORM

   Site Mesh        Spring        Hibernate

                                     DB

         Java EE                Groovy

                     JVM
GORM
Abstraction on abstractions, wraps:
  – Hibernate
  – JPA
  – Gemfire, Redis, Riak
  – MongoDB, JCR
  – Neo4J
Integration testing via TCK
Neo4j plug-in
Plugin features
• Neo4j -> Groovy/Java
• GORM dynamic finders, criteria and named
  queries
• Session-managed transactions
• Bean Validation
• Neo4j's traversal
• Embedded, REST and HA
Jump into Neo4J
                                     name:staff
                                     type:weapon
name:Splinter
fullName:Hamato Yoshi
type: rat


                                       type: interact




                        type:knows

                                     name:Shredder
                                     fullName:Oroku Saki
Nodes
Relationships
Properties
                                              name:staff
                                              type:weapon
name:Splinter
fullName:Hamato Yoshi
type: rat


                                                type: interact




                        type:knows
Mapping
                      Reference Node

                                  Subreference
Domain Class/Type
                                                 SubreferenceNode

  Domain Class        Instance
    Instance
  Domain Class
   Properties


                      Instance
                     Properties

   Assocoation
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)
Getting Started


grails install-plugin neo4j
grails uninstall-plugin hibernate
Create Domain


grails create-domain-class Hero
Examples

hero.save()

Hero.findByWeightGreaterThan( 100 )
Hero.findAllByFullNameNotNull()

hero.weapons.each {
   …
}
Combining Neo4j And Hibernate

static mapWith = "neo4j”


def hibernateHero = Hero.get(1)
hibernateHero.neo4j.save()
def neo4jHero = Person.neo4j.get(1)
Advanced Configuration
grails-app/conf/DataSource.groovy

       grails {
         neo4j {
            type = "embedded"
            location = "/var/neo4j"
            params = []
         }
       }
Via REST
type = "rest”

grails {
  neo4j {
     type = "rest"
     location = "http://localhost:7474/db/data/"
  }
}
High Availabile
type = "ha”

grails {
  neo4j {
     type = "ha"
     location = "/var/neo4j"
     params = [ // see http://docs.neo4j.org/chunked/stable/ha-configuration.html
         'ha.server_id': 1,
         'ha.coordinators': 'localhost:2181,localhost:2182,localhost:2183'
     ]
  }
}
References
no:sql
   http://nosql-database.org/
neo4j
   http://neo4j.org
grails-neo4j plug-in
  http://jira.grails.org/browse/GPNEO4J
  http://springsource.github.com/grails-data-
  mapping/neo4j/manual/guide/index.html
Questions




Q are guaranteed in life – answers aren’t.

More Related Content

What's hot (20)

PDF
The Evolution of Scala / Scala進化論
scalaconfjp
 
PDF
Scalax
Martin Odersky
 
PPT
Writing DSL's in Scala
Abhijit Sharma
 
PDF
Using Scala for building DSLs
IndicThreads
 
PDF
Lightbend Lagom: Microservices Just Right (Scala Days 2016 Berlin)
mircodotta
 
PDF
Scala : language of the future
AnsviaLab
 
KEY
The Why and How of Scala at Twitter
Alex Payne
 
PPTX
Java Serialization Facts and Fallacies
Roman Elizarov
 
PPT
Scala Days San Francisco
Martin Odersky
 
PPTX
From Ruby to Scala
tod esking
 
PDF
Introduction to Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介
scalaconfjp
 
PPTX
flatMap Oslo presentation slides
Martin Odersky
 
PDF
Advanced Production Debugging
Takipi
 
PDF
What To Leave Implicit
Martin Odersky
 
PDF
Java 8 and Beyond, a Scala Story
Tomer Gabel
 
PDF
Scarab: SAT-based Constraint Programming System in Scala / Scala上で実現された制約プログラ...
scalaconfjp
 
PPTX
The Evolution of Scala
Martin Odersky
 
PPTX
Introduction to Scala
Rahul Jain
 
PDF
Spring one2gx2010 spring-nonrelational_data
Roger Xia
 
PDF
Preparing for Scala 3
Martin Odersky
 
The Evolution of Scala / Scala進化論
scalaconfjp
 
Writing DSL's in Scala
Abhijit Sharma
 
Using Scala for building DSLs
IndicThreads
 
Lightbend Lagom: Microservices Just Right (Scala Days 2016 Berlin)
mircodotta
 
Scala : language of the future
AnsviaLab
 
The Why and How of Scala at Twitter
Alex Payne
 
Java Serialization Facts and Fallacies
Roman Elizarov
 
Scala Days San Francisco
Martin Odersky
 
From Ruby to Scala
tod esking
 
Introduction to Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介
scalaconfjp
 
flatMap Oslo presentation slides
Martin Odersky
 
Advanced Production Debugging
Takipi
 
What To Leave Implicit
Martin Odersky
 
Java 8 and Beyond, a Scala Story
Tomer Gabel
 
Scarab: SAT-based Constraint Programming System in Scala / Scala上で実現された制約プログラ...
scalaconfjp
 
The Evolution of Scala
Martin Odersky
 
Introduction to Scala
Rahul Jain
 
Spring one2gx2010 spring-nonrelational_data
Roger Xia
 
Preparing for Scala 3
Martin Odersky
 

Similar to Neo4 + Grails (20)

PPTX
Neo4J and Grails
Dmitry Buzdin
 
PDF
Grails and Neo4j
darthvader42
 
PDF
GR8Conf 2011: Neo4j Plugin
GR8Conf
 
PPTX
ExSchema
jccastrejon
 
KEY
Spring Data Neo4j Intro SpringOne 2011
jexp
 
ODP
Grails goes Graph
darthvader42
 
PPT
Wmware NoSQL
Murat Çakal
 
KEY
Lag Sucks! GDC 2012
realjenius
 
PPTX
Introduction to Graph Databases
Max De Marzi
 
PDF
Development without Constraint
Chad Davis
 
PDF
Data access 2.0? Please welcome: Spring Data!
Oliver Gierke
 
PDF
An introduction into Spring Data
Oliver Gierke
 
PPTX
NoSQL Endgame LWJUG 2021
Thodoris Bais
 
PDF
The State of NoSQL
Ben Scofield
 
PPTX
How to use NoSQL in Enterprise Java Applications - NoSQL Roadshow Basel
Patrick Baumgartner
 
PDF
Overview of Grails Object Relational Mapping (GORM)
Chris Richardson
 
KEY
Neo4j
Von Stark
 
PPTX
NoSQL Endgame DevoxxUA Conference 2020
Thodoris Bais
 
KEY
using Spring and MongoDB on Cloud Foundry
Joshua Long
 
Neo4J and Grails
Dmitry Buzdin
 
Grails and Neo4j
darthvader42
 
GR8Conf 2011: Neo4j Plugin
GR8Conf
 
ExSchema
jccastrejon
 
Spring Data Neo4j Intro SpringOne 2011
jexp
 
Grails goes Graph
darthvader42
 
Wmware NoSQL
Murat Çakal
 
Lag Sucks! GDC 2012
realjenius
 
Introduction to Graph Databases
Max De Marzi
 
Development without Constraint
Chad Davis
 
Data access 2.0? Please welcome: Spring Data!
Oliver Gierke
 
An introduction into Spring Data
Oliver Gierke
 
NoSQL Endgame LWJUG 2021
Thodoris Bais
 
The State of NoSQL
Ben Scofield
 
How to use NoSQL in Enterprise Java Applications - NoSQL Roadshow Basel
Patrick Baumgartner
 
Overview of Grails Object Relational Mapping (GORM)
Chris Richardson
 
Neo4j
Von Stark
 
NoSQL Endgame DevoxxUA Conference 2020
Thodoris Bais
 
using Spring and MongoDB on Cloud Foundry
Joshua Long
 
Ad

Recently uploaded (20)

PDF
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
Impact of IEEE Computer Society in Advancing Emerging Technologies including ...
Hironori Washizaki
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PPTX
Building a Production-Ready Barts Health Secure Data Environment Tooling, Acc...
Barts Health
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PPTX
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
Impact of IEEE Computer Society in Advancing Emerging Technologies including ...
Hironori Washizaki
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
July Patch Tuesday
Ivanti
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
Building a Production-Ready Barts Health Secure Data Environment Tooling, Acc...
Barts Health
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
Ad

Neo4 + Grails

  • 1. Rapid development with Neo4J under Grails
  • 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
  • 7. hard to integrate in industrialized companies
  • 8. Grails Support Name Type RIAK Eventually‐consistent key‐value + REDIS Key-value cache in RAM + MemcacheDB Ordered key-value stores +- Apache CouchDB Document store + MongoDB Document store + Apache Hadoop Tabular/Big Table + Apache Cassandra Eventually‐consistent key‐value + Neo4J Graph +
  • 9. Graph DB implemetations Language DEX C++ FlockDB Scala InfiniteGraph Java HyperGraphDB Java Neo4J Java OpenLink Virtuoso C++, C#, Java, SPARQL OrientDB Java Sones GraphDB C#
  • 10. Graph on(in) Grails Neo4j is (as of now) the only graph database that fits nicely in a Grails application.
  • 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
  • 20. GORM Abstraction on abstractions, wraps: – Hibernate – JPA – Gemfire, Redis, Riak – MongoDB, JCR – Neo4J Integration testing via TCK
  • 22. Plugin features • Neo4j -> Groovy/Java • GORM dynamic finders, criteria and named queries • Session-managed transactions • Bean Validation • Neo4j's traversal • Embedded, REST and HA
  • 23. Jump into Neo4J name:staff type:weapon name:Splinter fullName:Hamato Yoshi type: rat type: interact type:knows name:Shredder fullName:Oroku Saki
  • 24. Nodes
  • 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)
  • 29. Getting Started grails install-plugin neo4j grails uninstall-plugin hibernate
  • 32. Combining Neo4j And Hibernate static mapWith = "neo4j” def hibernateHero = Hero.get(1) hibernateHero.neo4j.save() def neo4jHero = Person.neo4j.get(1)
  • 33. Advanced Configuration grails-app/conf/DataSource.groovy grails { neo4j { type = "embedded" location = "/var/neo4j" params = [] } }
  • 34. Via REST type = "rest” grails { neo4j { type = "rest" location = "http://localhost:7474/db/data/" } }
  • 35. High Availabile type = "ha” grails { neo4j { type = "ha" location = "/var/neo4j" params = [ // see http://docs.neo4j.org/chunked/stable/ha-configuration.html 'ha.server_id': 1, 'ha.coordinators': 'localhost:2181,localhost:2182,localhost:2183' ] } }
  • 36. References no:sql http://nosql-database.org/ neo4j http://neo4j.org grails-neo4j plug-in http://jira.grails.org/browse/GPNEO4J http://springsource.github.com/grails-data- mapping/neo4j/manual/guide/index.html
  • 37. Questions Q are guaranteed in life – answers aren’t.