Neo4J and Grails

Embed Size (px)

Text of Neo4J and Grails

  • 1.Rapid development with Neo4J under Grails

2. About Myself Located in Riga/Latvia Technical Architect in Accenture Experience since 10 years C#/Java/Groovy/Scala/Erlang 3. no:sqlMarket has significantly different challenges indealing with data that the traditional RDBMSsolutions 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 ModelDistributionDisk Data ModelStructure 6. types Document storeGraphKey-value storeMultivalue databases Object database Tabular Tuple store 7. hard to integrate in industrializedcompanies 8. Grails SupportName TypeRIAK Eventuallyconsistent keyvalue +REDISKey-value cache in RAM+MemcacheDB Ordered key-value stores+-Apache CouchDB Document store+MongoDBDocument store+Apache HadoopTabular/Big Table +Apache Cassandra Eventuallyconsistent keyvalue +Neo4JGraph + 9. Graph DB implemetationsLanguageDEX C++FlockDB ScalaInfiniteGraph JavaHyperGraphDBJavaNeo4J JavaOpenLink Virtuoso C++, C#, Java, SPARQLOrientDBJavaSones GraphDB C# 10. Graph on(in) GrailsNeo4j is (as of now) the only graph databasethat fits nicely in a Grails application. 11. Data is connected 12. 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. 13. SQL addonsSome DBs has even special DSL:SELECT empno, ename, job, mgr, hiredate, LEVELFROM empWHERE LEVEL Groovy/Java GORM dynamic finders, criteria and namedqueries Session-managed transactions Bean Validation Neo4js traversal Embedded, REST and HA 23. Jump into Neo4J name:staff type:weaponname:SplinterfullName:Hamato Yoshitype: rat type: interacttype:knows name:Shredder fullName:Oroku Saki 24. Nodes 25. Relationships 26. Propertiesname:stafftype:weaponname:SplinterfullName:Hamato Yoshitype: rattype: interacttype:knows 27. MappingReference NodeSubreferenceDomain Class/Type SubreferenceNodeDomain ClassInstanceInstanceDomain Class PropertiesInstance Properties Assocoation 28. Compatibility with GORM Simple persistence methodsHQL queriesDynamic finders Dirty checking methodsCriteria queriesComposite 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) 29. Getting Startedgrails install-plugin neo4jgrails uninstall-plugin hibernate 30. Create Domaingrails create-domain-class Hero 31. 100 )Hero.findAllByFullNameNotNull()hero.weapons.each { } 32. Combining Neo4j And Hibernatestatic mapWith = "neo4jdef hibernateHero = Hero.get(1) neo4jHero = Person.neo4j.get(1) 33. Advanced Configurationgrails-app/conf/DataSource.groovy grails { neo4j {type = "embedded"location = "/var/neo4j"params = [] } } 34. Via RESTtype = "restgrails {neo4j { type = "rest" location = "http://localhost:7474/db/data/"}} 35. High Availabiletype = "hagrails {neo4j { type = "ha" location = "/var/neo4j" params = [ // see ha.server_id: 1, ha.coordinators: localhost:2181,localhost:2182,localhost:2183 ]}} 36. Referencesno:sql http://neo4j.orggrails-neo4j plug-in 37. QuestionsQ are guaranteed in life answers arent.