SlideShare a Scribd company logo
1 of 42
Download to read offline
`whoami`
@fbiville @LateraIThoughts
:WORKS_FOR
:IS_REACHABLE
{on:“Twitter”}
:IS_REACHABLE
{on:“Twitter”}
:LOVES :IS_PARTNER_WITH
Calendar
Conference
October / http://tinyurl.com/soft-shake-neo4j
Training
http://www.lateral-thoughts.com/formation-neo4j
BBL : just ping me!
http://www.brownbaglunch.fr/baggers.html#Florent_Biville
On one side: graph databases!
Flock DB
On one side: graph databases!
Flock DB
VERY
DYNAM
IC
LANDSCAPE
On the other side: the enterprise
On the other side: the enterprise
LIVE
LONG
AND
PROSPER
The Enterprise Architecture
● Entities
● DAO
● Service
● Controllers
The Enterprise Architecture
● Entities
● DAO
● Service
● Controllers
?
featuring an Oh Real Monster!
Object-Relational Mapping
Applies only to Relational DBMS
Lowest common denominator
80% easy
20% … painful
Java and ORMs
Java Persistence API
JSR 220 - JSR 317
Main implementors
● EclipseLink
● Apache OpenJPA
● Hibernate
@Entity
@Table(name = "channels")
public class Channel {
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", nullable = false)
private long id;
@Column(name = "title", nullable = false,
unique = true)
private String title = "";
@Column(name = "description", nullable =
false)
private String description = "";
// [...]
}
Java and ORMs
Java Persistence API
JSR 220 - JSR 317
Main implementors
● EclipseLink
● Apache OpenJPA
● Hibernate
@Repository
public class CastRepository implements /.../ {
@PersistenceContext
private EntityManager entityManager;
@Override
@Transactional
public void delete(final Cast cast) {
entityManager.remove(cast);
}
@Override
@Transactional(readOnly = true)
public Cast findById(final long id) {
checkArgument(id >= 0);
return entityManager.find(Cast.class, id);
}
}
Java and ORMs: the good parts
Familiar programming model
● @Transactional [SPRING]
● @Entity, @Table...
● @Repository [SPRING]
Java and ORMs: the bad parts
Defines its own universe
see JPA entity lifecycle ;-(
Relation-Objects = 2 <> paradigms!
1+n query problem
inheritance strategies
SQL knowledge needed -> abstraction leak
What model REALLY is relational? :)
Why does Neo4J kick ass? cuz...
Graph = generic Data Structure
...and powerful ;-)
Natural fit with objects
Frictionless mapping!
Mapping with Neo4J?!
BUT No predefined schema
Labeled nodes can be very <>
Same with relationships
Schema-optionality = a problem?
see the awesome GraphGist challenge!
Schema-optionality = a problem?
Typical apps do not handle
gazillion of entities
More like a finite number
Let’s map then!
First approach: Hibernate OGM
Reuses Hibernate Core
Supports simple JP-QL queries
Support for Neo4J is a WIP
Let’s map then!
First approach: Hibernate OGM
Reuses Hibernate Core
Supports simple JP-QL queries
Support for Neo4J is a WIP
Lowest Common Denominator
Let’s map then!
Second approach: Tinkerpop Frames
Multi-graph DB support (Blueprints interface)
REST support with Tinkerpop REXSTER
Querying with Gremlin
Let’s map then!
Third approach: Spring Data Neo4J
Spring / Spring Data philosophy
Templates
Entities, “magic” repositories, @Transactional
Cypher support
Multi-store support
Spring Data
History ~2010
Rod Johnson,
(was) VMWare
Emil Eifrem,
Neo Technology
Spring Data
Familiar model for Spring apps
Thin common layer
Embraces diversity MongoDB
Redis
Neo4J
ElasticSearch…
Current version 2.3.1.RELEASE
vanilla Neo4J “repositories”
@Repository
public class BranchRepository {
private final GraphDatabaseService graphDB;
public Relationship createBranch(Node project,
Node commit,
Map<String,?> properties) {
try (Transaction tx = graphDB.beginTx()) {
Relationship relationship = project.createRelationshipTo(
commit,
DynamicRelationshipType.name("HAS_BRANCH")
);
for (Entry<String,?> entry:properties.entrySet()) {
relationship.setProperty(entry.getKey(), entry.getValue());
}
tx.success();
return relationship;
}
}
vanilla Neo4J “repositories”
@Repository
public class BranchRepository {
private final GraphDatabaseService graphDB;
public Relationship createBranch(Node project,
Node commit,
Map<String,?> properties) {
try (Transaction tx = graphDB.beginTx()) {
Relationship relationship = project.createRelationshipTo(
commit,
DynamicRelationshipType.name("HAS_BRANCH")
);
for (Entry<String,?> entry:properties.entrySet()) {
relationship.setProperty(entry.getKey(), entry.getValue());
}
tx.success();
return relationship;
}
}
vanilla Neo4J “repositories”
@Repository
public class BranchRepository {
private final GraphDatabaseService graphDB;
public Relationship createBranch(Node project,
Node commit,
Map<String,?> properties) {
try (Transaction tx = graphDB.beginTx()) {
Relationship relationship = project.createRelationshipTo(
commit,
DynamicRelationshipType.name("HAS_BRANCH")
);
for (Entry<String,?> entry:properties.entrySet()) {
relationship.setProperty(entry.getKey(), entry.getValue());
}
tx.success();
return relationship;
}
}
Spring Data Neo4J repositories
public interface BranchRepository
extends GraphRepository<Branch> {
}
Spring Data Neo4J repositories
What’s behind GraphRepository
Spring Data Commons - Repository
Marker interface, automatic discovery
Spring Data Commons - CRUDRepository
Create/Read/Update/Delete “boilerplate” operations
Spring Data Commons - PagingAndSortingRepository
Pagination/sorting facilities
Spring Data Neo4J - IndexRepository
Abstracts Neo4J Lucene capabilities
Spring Data Neo4J - TraversalRepository
Encapsulate Neo4J traversals
Spring Data Neo4J repositories
Write less, do more
public interface BranchRepository extends GraphRepository<Branch> {
Iterable<Branch> findByNameLike(String name);
@Query("MATCH (project:PROJECT)-[b:HAS_BRANCH]->(commit:COMMIT)
RETURN b")
Page<Branch> lookMaIveGotPages();
Branch findByNameAndCommitIdentifierLike(String name, String
commit);
}
Spring Data Neo4J repositories
Cypher DSL via CypherDSLRepository
Execute query = start(lookup("company", "Company", "name", param("name"))).
match(path().from("company").in("WORKS_AT").to("person")).
returns(identifier("person"));
Page<Person> result = repo.query(
query , map("name","Neo4j"), new PageRequest(1,10)
);
Spring Data Neo4J entities
Nodes
@NodeEntity
public class Person {
@GraphId
private Long id;
@Indexed(indexName="people-search", type=FULLTEXT)
private String name;
@RelatedTo(type="OWNS", enforceTargetType=true)
private Car car;
@RelatedToVia(type="FRIEND_OF", direction=Direction.INCOMING)
private Iterable<Friendship> friendships;
@GraphTraversal(traversal = PeopleTraversalBuilder.class,
elementClass = Person.class, params = "persons")
private Iterable<Person> people;
}
Spring Data Neo4J entities
Relationships
@RelationshipEntity(type="FRIEND_OF")
public class Friendship {
@StartNode
private Person person;
@EndNode
private Dog humansBestFriend;
@GraphProperty /* optional here ;-) */
private Date since;
/**
* moaaaaar properties
*/
}
Spring Data Neo4J
template
Pre-shaved yaks!
public class PersonRepositoryImpl extends CustomPersonRepository {
@Autowired /* [SPRING ANNOTATION] */
private Neo4jTemplate template;
public Iterable<Person> findAllByNameCustom(String name) {
Index<Node> personFulltextIndex =
template.getIndex("people-search", Person.class);
personFulltextIndex.query("name", format("*%s*", name));
// [...]
}
}
and moaaar: createNode, projectTo...
And so much more...
Geospatial queries
Cross-store support
Dynamic relationships
“Advanced” mapping
<dependency>
<groupId>org.springframework.
data</groupId>
<artifactId>spring-data-neo4j</artifactId>
<version>2.3.1.RELEASE</version>
</dependency>
And so much more...
Geospatial queries
Cross-store support
QueryDSL integration
“Advanced” mapping
<dependency>
<groupId>org.springframework.
data</groupId>
<artifactId>spring-data-neo4j</artifactId>
<version>2.3.1.RELEASE</version>
</dependency>
Going further
Experiment
http://projects.spring.io/spring-data-neo4j/
Discuss
https://groups.google.com/forum/#!forum/neo4jfr
Share
http://www.meetup.com/graphdb-france/
Calendar
Conference
October / http://tinyurl.com/soft-shake-neo4j
Training
http://www.lateral-thoughts.com/formation-neo4j
BBL : just ping me!
http://www.brownbaglunch.fr/baggers.html#Florent_Biville
?
A general introduction to Spring Data / Neo4J

More Related Content

What's hot

Apache Spark GraphX & GraphFrame Synthetic ID Fraud Use Case
Apache Spark GraphX & GraphFrame Synthetic ID Fraud Use CaseApache Spark GraphX & GraphFrame Synthetic ID Fraud Use Case
Apache Spark GraphX & GraphFrame Synthetic ID Fraud Use CaseMo Patel
 
Congressional PageRank: Graph Analytics of US Congress With Neo4j
Congressional PageRank: Graph Analytics of US Congress With Neo4jCongressional PageRank: Graph Analytics of US Congress With Neo4j
Congressional PageRank: Graph Analytics of US Congress With Neo4jWilliam Lyon
 
Neo4j-Databridge: Enterprise-scale ETL for Neo4j
Neo4j-Databridge: Enterprise-scale ETL for Neo4jNeo4j-Databridge: Enterprise-scale ETL for Neo4j
Neo4j-Databridge: Enterprise-scale ETL for Neo4jGraphAware
 
Evolution of the Graph Schema
Evolution of the Graph SchemaEvolution of the Graph Schema
Evolution of the Graph SchemaJoshua Shinavier
 
All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...
All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...
All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...GreeceJS
 
Neo4j + MongoDB. Neo4j Doc Manager for Mongo Connector - GraphConnect SF 2015
Neo4j + MongoDB. Neo4j Doc Manager for Mongo Connector - GraphConnect SF 2015Neo4j + MongoDB. Neo4j Doc Manager for Mongo Connector - GraphConnect SF 2015
Neo4j + MongoDB. Neo4j Doc Manager for Mongo Connector - GraphConnect SF 2015William Lyon
 
GraphX: Graph analytics for insights about developer communities
GraphX: Graph analytics for insights about developer communitiesGraphX: Graph analytics for insights about developer communities
GraphX: Graph analytics for insights about developer communitiesPaco Nathan
 
Interpreting Relational Schema to Graphs
Interpreting Relational Schema to GraphsInterpreting Relational Schema to Graphs
Interpreting Relational Schema to GraphsNeo4j
 
Signals from outer space
Signals from outer spaceSignals from outer space
Signals from outer spaceGraphAware
 
Why is JSON-LD Important to Businesses - Franz Inc
Why is JSON-LD Important to Businesses - Franz IncWhy is JSON-LD Important to Businesses - Franz Inc
Why is JSON-LD Important to Businesses - Franz IncFranz Inc. - AllegroGraph
 
Arabidopsis Information Portal, Developer Workshop 2014, Introduction
Arabidopsis Information Portal, Developer Workshop 2014, IntroductionArabidopsis Information Portal, Developer Workshop 2014, Introduction
Arabidopsis Information Portal, Developer Workshop 2014, IntroductionJasonRafeMiller
 
Extending Spark Graph for the Enterprise with Morpheus and Neo4j
Extending Spark Graph for the Enterprise with Morpheus and Neo4jExtending Spark Graph for the Enterprise with Morpheus and Neo4j
Extending Spark Graph for the Enterprise with Morpheus and Neo4jDatabricks
 
Gradoop: Scalable Graph Analytics with Apache Flink @ Flink & Neo4j Meetup Be...
Gradoop: Scalable Graph Analytics with Apache Flink @ Flink & Neo4j Meetup Be...Gradoop: Scalable Graph Analytics with Apache Flink @ Flink & Neo4j Meetup Be...
Gradoop: Scalable Graph Analytics with Apache Flink @ Flink & Neo4j Meetup Be...Martin Junghanns
 
Apache Spark GraphX highlights.
Apache Spark GraphX highlights. Apache Spark GraphX highlights.
Apache Spark GraphX highlights. Doug Needham
 
OrientDB & Node.js Overview - JS.Everywhere() KW
OrientDB & Node.js Overview - JS.Everywhere() KWOrientDB & Node.js Overview - JS.Everywhere() KW
OrientDB & Node.js Overview - JS.Everywhere() KWgmccarvell
 
OrientDB: Unlock the Value of Document Data Relationships
OrientDB: Unlock the Value of Document Data RelationshipsOrientDB: Unlock the Value of Document Data Relationships
OrientDB: Unlock the Value of Document Data RelationshipsFabrizio Fortino
 
A Deep Dive Implementing xAPI in Learning Games
A Deep Dive Implementing xAPI in Learning GamesA Deep Dive Implementing xAPI in Learning Games
A Deep Dive Implementing xAPI in Learning GamesGBLxAPI
 
Graphs are everywhere! Distributed graph computing with Spark GraphX
Graphs are everywhere! Distributed graph computing with Spark GraphXGraphs are everywhere! Distributed graph computing with Spark GraphX
Graphs are everywhere! Distributed graph computing with Spark GraphXAndrea Iacono
 
Large Scale Graph Analytics with RDF and LPG Parallel Processing
Large Scale Graph Analytics with RDF and LPG Parallel ProcessingLarge Scale Graph Analytics with RDF and LPG Parallel Processing
Large Scale Graph Analytics with RDF and LPG Parallel ProcessingCambridge Semantics
 

What's hot (20)

Apache Spark GraphX & GraphFrame Synthetic ID Fraud Use Case
Apache Spark GraphX & GraphFrame Synthetic ID Fraud Use CaseApache Spark GraphX & GraphFrame Synthetic ID Fraud Use Case
Apache Spark GraphX & GraphFrame Synthetic ID Fraud Use Case
 
Congressional PageRank: Graph Analytics of US Congress With Neo4j
Congressional PageRank: Graph Analytics of US Congress With Neo4jCongressional PageRank: Graph Analytics of US Congress With Neo4j
Congressional PageRank: Graph Analytics of US Congress With Neo4j
 
Neo4j-Databridge: Enterprise-scale ETL for Neo4j
Neo4j-Databridge: Enterprise-scale ETL for Neo4jNeo4j-Databridge: Enterprise-scale ETL for Neo4j
Neo4j-Databridge: Enterprise-scale ETL for Neo4j
 
Evolution of the Graph Schema
Evolution of the Graph SchemaEvolution of the Graph Schema
Evolution of the Graph Schema
 
All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...
All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...
All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...
 
Power of Polyglot Search
Power of Polyglot SearchPower of Polyglot Search
Power of Polyglot Search
 
Neo4j + MongoDB. Neo4j Doc Manager for Mongo Connector - GraphConnect SF 2015
Neo4j + MongoDB. Neo4j Doc Manager for Mongo Connector - GraphConnect SF 2015Neo4j + MongoDB. Neo4j Doc Manager for Mongo Connector - GraphConnect SF 2015
Neo4j + MongoDB. Neo4j Doc Manager for Mongo Connector - GraphConnect SF 2015
 
GraphX: Graph analytics for insights about developer communities
GraphX: Graph analytics for insights about developer communitiesGraphX: Graph analytics for insights about developer communities
GraphX: Graph analytics for insights about developer communities
 
Interpreting Relational Schema to Graphs
Interpreting Relational Schema to GraphsInterpreting Relational Schema to Graphs
Interpreting Relational Schema to Graphs
 
Signals from outer space
Signals from outer spaceSignals from outer space
Signals from outer space
 
Why is JSON-LD Important to Businesses - Franz Inc
Why is JSON-LD Important to Businesses - Franz IncWhy is JSON-LD Important to Businesses - Franz Inc
Why is JSON-LD Important to Businesses - Franz Inc
 
Arabidopsis Information Portal, Developer Workshop 2014, Introduction
Arabidopsis Information Portal, Developer Workshop 2014, IntroductionArabidopsis Information Portal, Developer Workshop 2014, Introduction
Arabidopsis Information Portal, Developer Workshop 2014, Introduction
 
Extending Spark Graph for the Enterprise with Morpheus and Neo4j
Extending Spark Graph for the Enterprise with Morpheus and Neo4jExtending Spark Graph for the Enterprise with Morpheus and Neo4j
Extending Spark Graph for the Enterprise with Morpheus and Neo4j
 
Gradoop: Scalable Graph Analytics with Apache Flink @ Flink & Neo4j Meetup Be...
Gradoop: Scalable Graph Analytics with Apache Flink @ Flink & Neo4j Meetup Be...Gradoop: Scalable Graph Analytics with Apache Flink @ Flink & Neo4j Meetup Be...
Gradoop: Scalable Graph Analytics with Apache Flink @ Flink & Neo4j Meetup Be...
 
Apache Spark GraphX highlights.
Apache Spark GraphX highlights. Apache Spark GraphX highlights.
Apache Spark GraphX highlights.
 
OrientDB & Node.js Overview - JS.Everywhere() KW
OrientDB & Node.js Overview - JS.Everywhere() KWOrientDB & Node.js Overview - JS.Everywhere() KW
OrientDB & Node.js Overview - JS.Everywhere() KW
 
OrientDB: Unlock the Value of Document Data Relationships
OrientDB: Unlock the Value of Document Data RelationshipsOrientDB: Unlock the Value of Document Data Relationships
OrientDB: Unlock the Value of Document Data Relationships
 
A Deep Dive Implementing xAPI in Learning Games
A Deep Dive Implementing xAPI in Learning GamesA Deep Dive Implementing xAPI in Learning Games
A Deep Dive Implementing xAPI in Learning Games
 
Graphs are everywhere! Distributed graph computing with Spark GraphX
Graphs are everywhere! Distributed graph computing with Spark GraphXGraphs are everywhere! Distributed graph computing with Spark GraphX
Graphs are everywhere! Distributed graph computing with Spark GraphX
 
Large Scale Graph Analytics with RDF and LPG Parallel Processing
Large Scale Graph Analytics with RDF and LPG Parallel ProcessingLarge Scale Graph Analytics with RDF and LPG Parallel Processing
Large Scale Graph Analytics with RDF and LPG Parallel Processing
 

Viewers also liked

Hands on Neo4J - Duchess France/Zenexity - 25/09/2013
Hands on Neo4J - Duchess France/Zenexity - 25/09/2013Hands on Neo4J - Duchess France/Zenexity - 25/09/2013
Hands on Neo4J - Duchess France/Zenexity - 25/09/2013Florent Biville
 
Soft Shake Event / A soft introduction to Neo4J
Soft Shake Event / A soft introduction to Neo4JSoft Shake Event / A soft introduction to Neo4J
Soft Shake Event / A soft introduction to Neo4JFlorent Biville
 
DevFest Istanbul - a free guided tour of Neo4J
DevFest Istanbul - a free guided tour of Neo4JDevFest Istanbul - a free guided tour of Neo4J
DevFest Istanbul - a free guided tour of Neo4JFlorent Biville
 
Why Neo4J is awesome in 5 slides
Why Neo4J is awesome in 5 slidesWhy Neo4J is awesome in 5 slides
Why Neo4J is awesome in 5 slidesFlorent Biville
 
[FR] Introduction à Spring Data Neo4j 3.x
[FR] Introduction à Spring Data Neo4j 3.x[FR] Introduction à Spring Data Neo4j 3.x
[FR] Introduction à Spring Data Neo4j 3.xFlorent Biville
 
Titan and Cassandra at WellAware
Titan and Cassandra at WellAwareTitan and Cassandra at WellAware
Titan and Cassandra at WellAwaretwilmes
 
Combine Spring Data Neo4j and Spring Boot to quickl
Combine Spring Data Neo4j and Spring Boot to quicklCombine Spring Data Neo4j and Spring Boot to quickl
Combine Spring Data Neo4j and Spring Boot to quicklNeo4j
 
(R)évolutionnez vos bases de données avec Liquibase
(R)évolutionnez vos bases de données avec Liquibase(R)évolutionnez vos bases de données avec Liquibase
(R)évolutionnez vos bases de données avec LiquibaseFlorent Biville
 

Viewers also liked (10)

Hands on Neo4J - Duchess France/Zenexity - 25/09/2013
Hands on Neo4J - Duchess France/Zenexity - 25/09/2013Hands on Neo4J - Duchess France/Zenexity - 25/09/2013
Hands on Neo4J - Duchess France/Zenexity - 25/09/2013
 
Soft Shake Event / A soft introduction to Neo4J
Soft Shake Event / A soft introduction to Neo4JSoft Shake Event / A soft introduction to Neo4J
Soft Shake Event / A soft introduction to Neo4J
 
DevFest Istanbul - a free guided tour of Neo4J
DevFest Istanbul - a free guided tour of Neo4JDevFest Istanbul - a free guided tour of Neo4J
DevFest Istanbul - a free guided tour of Neo4J
 
Why Neo4J is awesome in 5 slides
Why Neo4J is awesome in 5 slidesWhy Neo4J is awesome in 5 slides
Why Neo4J is awesome in 5 slides
 
[FR] Introduction à Spring Data Neo4j 3.x
[FR] Introduction à Spring Data Neo4j 3.x[FR] Introduction à Spring Data Neo4j 3.x
[FR] Introduction à Spring Data Neo4j 3.x
 
Titan and Cassandra at WellAware
Titan and Cassandra at WellAwareTitan and Cassandra at WellAware
Titan and Cassandra at WellAware
 
Combine Spring Data Neo4j and Spring Boot to quickl
Combine Spring Data Neo4j and Spring Boot to quicklCombine Spring Data Neo4j and Spring Boot to quickl
Combine Spring Data Neo4j and Spring Boot to quickl
 
Recolytic
RecolyticRecolytic
Recolytic
 
Liquibase en action
Liquibase en actionLiquibase en action
Liquibase en action
 
(R)évolutionnez vos bases de données avec Liquibase
(R)évolutionnez vos bases de données avec Liquibase(R)évolutionnez vos bases de données avec Liquibase
(R)évolutionnez vos bases de données avec Liquibase
 

Similar to A general introduction to Spring Data / Neo4J

MuseoTorino, first italian project using a GraphDB, RDFa, Linked Open Data
MuseoTorino, first italian project using a GraphDB, RDFa, Linked Open DataMuseoTorino, first italian project using a GraphDB, RDFa, Linked Open Data
MuseoTorino, first italian project using a GraphDB, RDFa, Linked Open Data21Style
 
Presenting Your Digital Research
Presenting Your Digital ResearchPresenting Your Digital Research
Presenting Your Digital ResearchShawn Day
 
Watching Pigs Fly with the Netflix Hadoop Toolkit (Hadoop Summit 2013)
Watching Pigs Fly with the Netflix Hadoop Toolkit (Hadoop Summit 2013)Watching Pigs Fly with the Netflix Hadoop Toolkit (Hadoop Summit 2013)
Watching Pigs Fly with the Netflix Hadoop Toolkit (Hadoop Summit 2013)Jeff Magnusson
 
Python business intelligence (PyData 2012 talk)
Python business intelligence (PyData 2012 talk)Python business intelligence (PyData 2012 talk)
Python business intelligence (PyData 2012 talk)Stefan Urbanek
 
Polyglot Persistence with MongoDB and Neo4j
Polyglot Persistence with MongoDB and Neo4jPolyglot Persistence with MongoDB and Neo4j
Polyglot Persistence with MongoDB and Neo4jCorie Pollock
 
Knowledge Graphs - Journey to the Connected Enterprise - Data Strategy and An...
Knowledge Graphs - Journey to the Connected Enterprise - Data Strategy and An...Knowledge Graphs - Journey to the Connected Enterprise - Data Strategy and An...
Knowledge Graphs - Journey to the Connected Enterprise - Data Strategy and An...Benjamin Nussbaum
 
Neo4j Database and Graph Platform Overview
Neo4j Database and Graph Platform OverviewNeo4j Database and Graph Platform Overview
Neo4j Database and Graph Platform OverviewNeo4j
 
2017-01-08-scaling tribalknowledge
2017-01-08-scaling tribalknowledge2017-01-08-scaling tribalknowledge
2017-01-08-scaling tribalknowledgeChristopher Williams
 
Monitoring Big Data Systems Done "The Simple Way" - Codemotion Milan 2017 - D...
Monitoring Big Data Systems Done "The Simple Way" - Codemotion Milan 2017 - D...Monitoring Big Data Systems Done "The Simple Way" - Codemotion Milan 2017 - D...
Monitoring Big Data Systems Done "The Simple Way" - Codemotion Milan 2017 - D...Demi Ben-Ari
 
Demi Ben-Ari - Monitoring Big Data Systems Done "The Simple Way" - Codemotion...
Demi Ben-Ari - Monitoring Big Data Systems Done "The Simple Way" - Codemotion...Demi Ben-Ari - Monitoring Big Data Systems Done "The Simple Way" - Codemotion...
Demi Ben-Ari - Monitoring Big Data Systems Done "The Simple Way" - Codemotion...Codemotion
 
Sem tech 2011 v8
Sem tech 2011 v8Sem tech 2011 v8
Sem tech 2011 v8dallemang
 
The Perfect Fit: Scalable Graph for Big Data
The Perfect Fit: Scalable Graph for Big DataThe Perfect Fit: Scalable Graph for Big Data
The Perfect Fit: Scalable Graph for Big DataInside Analysis
 
SQL to NoSQL: Top 6 Questions
SQL to NoSQL: Top 6 QuestionsSQL to NoSQL: Top 6 Questions
SQL to NoSQL: Top 6 QuestionsMike Broberg
 
Building and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache AirflowBuilding and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache AirflowKaxil Naik
 
Nodes2020 | Graph of enterprise_metadata | NEO4J Conference
Nodes2020 | Graph of enterprise_metadata | NEO4J ConferenceNodes2020 | Graph of enterprise_metadata | NEO4J Conference
Nodes2020 | Graph of enterprise_metadata | NEO4J ConferenceDeepak Chandramouli
 
Real world functional reactive programming
Real world functional reactive programmingReal world functional reactive programming
Real world functional reactive programmingEric Polerecky
 
How Graph Databases used in Police Department?
How Graph Databases used in Police Department?How Graph Databases used in Police Department?
How Graph Databases used in Police Department?Samet KILICTAS
 
aRangodb, un package per l'utilizzo di ArangoDB con R
aRangodb, un package per l'utilizzo di ArangoDB con RaRangodb, un package per l'utilizzo di ArangoDB con R
aRangodb, un package per l'utilizzo di ArangoDB con RGraphRM
 

Similar to A general introduction to Spring Data / Neo4J (20)

MuseoTorino, first italian project using a GraphDB, RDFa, Linked Open Data
MuseoTorino, first italian project using a GraphDB, RDFa, Linked Open DataMuseoTorino, first italian project using a GraphDB, RDFa, Linked Open Data
MuseoTorino, first italian project using a GraphDB, RDFa, Linked Open Data
 
Neo4j in Depth
Neo4j in DepthNeo4j in Depth
Neo4j in Depth
 
Presenting Your Digital Research
Presenting Your Digital ResearchPresenting Your Digital Research
Presenting Your Digital Research
 
Watching Pigs Fly with the Netflix Hadoop Toolkit (Hadoop Summit 2013)
Watching Pigs Fly with the Netflix Hadoop Toolkit (Hadoop Summit 2013)Watching Pigs Fly with the Netflix Hadoop Toolkit (Hadoop Summit 2013)
Watching Pigs Fly with the Netflix Hadoop Toolkit (Hadoop Summit 2013)
 
Python business intelligence (PyData 2012 talk)
Python business intelligence (PyData 2012 talk)Python business intelligence (PyData 2012 talk)
Python business intelligence (PyData 2012 talk)
 
Polyglot Persistence with MongoDB and Neo4j
Polyglot Persistence with MongoDB and Neo4jPolyglot Persistence with MongoDB and Neo4j
Polyglot Persistence with MongoDB and Neo4j
 
Knowledge Graphs - Journey to the Connected Enterprise - Data Strategy and An...
Knowledge Graphs - Journey to the Connected Enterprise - Data Strategy and An...Knowledge Graphs - Journey to the Connected Enterprise - Data Strategy and An...
Knowledge Graphs - Journey to the Connected Enterprise - Data Strategy and An...
 
Neo4j Database and Graph Platform Overview
Neo4j Database and Graph Platform OverviewNeo4j Database and Graph Platform Overview
Neo4j Database and Graph Platform Overview
 
2017-01-08-scaling tribalknowledge
2017-01-08-scaling tribalknowledge2017-01-08-scaling tribalknowledge
2017-01-08-scaling tribalknowledge
 
Monitoring Big Data Systems Done "The Simple Way" - Codemotion Milan 2017 - D...
Monitoring Big Data Systems Done "The Simple Way" - Codemotion Milan 2017 - D...Monitoring Big Data Systems Done "The Simple Way" - Codemotion Milan 2017 - D...
Monitoring Big Data Systems Done "The Simple Way" - Codemotion Milan 2017 - D...
 
Demi Ben-Ari - Monitoring Big Data Systems Done "The Simple Way" - Codemotion...
Demi Ben-Ari - Monitoring Big Data Systems Done "The Simple Way" - Codemotion...Demi Ben-Ari - Monitoring Big Data Systems Done "The Simple Way" - Codemotion...
Demi Ben-Ari - Monitoring Big Data Systems Done "The Simple Way" - Codemotion...
 
Sem tech 2011 v8
Sem tech 2011 v8Sem tech 2011 v8
Sem tech 2011 v8
 
The Perfect Fit: Scalable Graph for Big Data
The Perfect Fit: Scalable Graph for Big DataThe Perfect Fit: Scalable Graph for Big Data
The Perfect Fit: Scalable Graph for Big Data
 
SQL to NoSQL: Top 6 Questions
SQL to NoSQL: Top 6 QuestionsSQL to NoSQL: Top 6 Questions
SQL to NoSQL: Top 6 Questions
 
Ontologies & linked open data
Ontologies & linked open dataOntologies & linked open data
Ontologies & linked open data
 
Building and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache AirflowBuilding and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache Airflow
 
Nodes2020 | Graph of enterprise_metadata | NEO4J Conference
Nodes2020 | Graph of enterprise_metadata | NEO4J ConferenceNodes2020 | Graph of enterprise_metadata | NEO4J Conference
Nodes2020 | Graph of enterprise_metadata | NEO4J Conference
 
Real world functional reactive programming
Real world functional reactive programmingReal world functional reactive programming
Real world functional reactive programming
 
How Graph Databases used in Police Department?
How Graph Databases used in Police Department?How Graph Databases used in Police Department?
How Graph Databases used in Police Department?
 
aRangodb, un package per l'utilizzo di ArangoDB con R
aRangodb, un package per l'utilizzo di ArangoDB con RaRangodb, un package per l'utilizzo di ArangoDB con R
aRangodb, un package per l'utilizzo di ArangoDB con R
 

Recently uploaded

Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxDavid Michel
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe中 央社
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandIES VE
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimaginedpanagenda
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfFIDO Alliance
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfFIDO Alliance
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGDSC PJATK
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlPeter Udo Diehl
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...marcuskenyatta275
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsStefano
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...FIDO Alliance
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfUK Journal
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeCzechDreamin
 
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPTiSEO AI
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessUXDXConf
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceSamy Fodil
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Julian Hyde
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Patrick Viafore
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaCzechDreamin
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfFIDO Alliance
 

Recently uploaded (20)

Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 

A general introduction to Spring Data / Neo4J

  • 1.
  • 4. On one side: graph databases! Flock DB
  • 5. On one side: graph databases! Flock DB VERY DYNAM IC LANDSCAPE
  • 6. On the other side: the enterprise
  • 7. On the other side: the enterprise LIVE LONG AND PROSPER
  • 8. The Enterprise Architecture ● Entities ● DAO ● Service ● Controllers
  • 9. The Enterprise Architecture ● Entities ● DAO ● Service ● Controllers ?
  • 10. featuring an Oh Real Monster!
  • 11. Object-Relational Mapping Applies only to Relational DBMS Lowest common denominator 80% easy 20% … painful
  • 12. Java and ORMs Java Persistence API JSR 220 - JSR 317 Main implementors ● EclipseLink ● Apache OpenJPA ● Hibernate @Entity @Table(name = "channels") public class Channel { @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "id", nullable = false) private long id; @Column(name = "title", nullable = false, unique = true) private String title = ""; @Column(name = "description", nullable = false) private String description = ""; // [...] }
  • 13. Java and ORMs Java Persistence API JSR 220 - JSR 317 Main implementors ● EclipseLink ● Apache OpenJPA ● Hibernate @Repository public class CastRepository implements /.../ { @PersistenceContext private EntityManager entityManager; @Override @Transactional public void delete(final Cast cast) { entityManager.remove(cast); } @Override @Transactional(readOnly = true) public Cast findById(final long id) { checkArgument(id >= 0); return entityManager.find(Cast.class, id); } }
  • 14. Java and ORMs: the good parts Familiar programming model ● @Transactional [SPRING] ● @Entity, @Table... ● @Repository [SPRING]
  • 15. Java and ORMs: the bad parts Defines its own universe see JPA entity lifecycle ;-( Relation-Objects = 2 <> paradigms! 1+n query problem inheritance strategies SQL knowledge needed -> abstraction leak
  • 16. What model REALLY is relational? :)
  • 17. Why does Neo4J kick ass? cuz... Graph = generic Data Structure ...and powerful ;-) Natural fit with objects Frictionless mapping!
  • 18. Mapping with Neo4J?! BUT No predefined schema Labeled nodes can be very <> Same with relationships
  • 19. Schema-optionality = a problem? see the awesome GraphGist challenge!
  • 20. Schema-optionality = a problem? Typical apps do not handle gazillion of entities More like a finite number
  • 21. Let’s map then! First approach: Hibernate OGM Reuses Hibernate Core Supports simple JP-QL queries Support for Neo4J is a WIP
  • 22. Let’s map then! First approach: Hibernate OGM Reuses Hibernate Core Supports simple JP-QL queries Support for Neo4J is a WIP Lowest Common Denominator
  • 23. Let’s map then! Second approach: Tinkerpop Frames Multi-graph DB support (Blueprints interface) REST support with Tinkerpop REXSTER Querying with Gremlin
  • 24. Let’s map then! Third approach: Spring Data Neo4J Spring / Spring Data philosophy Templates Entities, “magic” repositories, @Transactional Cypher support Multi-store support
  • 25. Spring Data History ~2010 Rod Johnson, (was) VMWare Emil Eifrem, Neo Technology
  • 26. Spring Data Familiar model for Spring apps Thin common layer Embraces diversity MongoDB Redis Neo4J ElasticSearch… Current version 2.3.1.RELEASE
  • 27. vanilla Neo4J “repositories” @Repository public class BranchRepository { private final GraphDatabaseService graphDB; public Relationship createBranch(Node project, Node commit, Map<String,?> properties) { try (Transaction tx = graphDB.beginTx()) { Relationship relationship = project.createRelationshipTo( commit, DynamicRelationshipType.name("HAS_BRANCH") ); for (Entry<String,?> entry:properties.entrySet()) { relationship.setProperty(entry.getKey(), entry.getValue()); } tx.success(); return relationship; } }
  • 28. vanilla Neo4J “repositories” @Repository public class BranchRepository { private final GraphDatabaseService graphDB; public Relationship createBranch(Node project, Node commit, Map<String,?> properties) { try (Transaction tx = graphDB.beginTx()) { Relationship relationship = project.createRelationshipTo( commit, DynamicRelationshipType.name("HAS_BRANCH") ); for (Entry<String,?> entry:properties.entrySet()) { relationship.setProperty(entry.getKey(), entry.getValue()); } tx.success(); return relationship; } }
  • 29. vanilla Neo4J “repositories” @Repository public class BranchRepository { private final GraphDatabaseService graphDB; public Relationship createBranch(Node project, Node commit, Map<String,?> properties) { try (Transaction tx = graphDB.beginTx()) { Relationship relationship = project.createRelationshipTo( commit, DynamicRelationshipType.name("HAS_BRANCH") ); for (Entry<String,?> entry:properties.entrySet()) { relationship.setProperty(entry.getKey(), entry.getValue()); } tx.success(); return relationship; } }
  • 30. Spring Data Neo4J repositories public interface BranchRepository extends GraphRepository<Branch> { }
  • 31. Spring Data Neo4J repositories What’s behind GraphRepository Spring Data Commons - Repository Marker interface, automatic discovery Spring Data Commons - CRUDRepository Create/Read/Update/Delete “boilerplate” operations Spring Data Commons - PagingAndSortingRepository Pagination/sorting facilities Spring Data Neo4J - IndexRepository Abstracts Neo4J Lucene capabilities Spring Data Neo4J - TraversalRepository Encapsulate Neo4J traversals
  • 32. Spring Data Neo4J repositories Write less, do more public interface BranchRepository extends GraphRepository<Branch> { Iterable<Branch> findByNameLike(String name); @Query("MATCH (project:PROJECT)-[b:HAS_BRANCH]->(commit:COMMIT) RETURN b") Page<Branch> lookMaIveGotPages(); Branch findByNameAndCommitIdentifierLike(String name, String commit); }
  • 33. Spring Data Neo4J repositories Cypher DSL via CypherDSLRepository Execute query = start(lookup("company", "Company", "name", param("name"))). match(path().from("company").in("WORKS_AT").to("person")). returns(identifier("person")); Page<Person> result = repo.query( query , map("name","Neo4j"), new PageRequest(1,10) );
  • 34. Spring Data Neo4J entities Nodes @NodeEntity public class Person { @GraphId private Long id; @Indexed(indexName="people-search", type=FULLTEXT) private String name; @RelatedTo(type="OWNS", enforceTargetType=true) private Car car; @RelatedToVia(type="FRIEND_OF", direction=Direction.INCOMING) private Iterable<Friendship> friendships; @GraphTraversal(traversal = PeopleTraversalBuilder.class, elementClass = Person.class, params = "persons") private Iterable<Person> people; }
  • 35. Spring Data Neo4J entities Relationships @RelationshipEntity(type="FRIEND_OF") public class Friendship { @StartNode private Person person; @EndNode private Dog humansBestFriend; @GraphProperty /* optional here ;-) */ private Date since; /** * moaaaaar properties */ }
  • 36. Spring Data Neo4J template Pre-shaved yaks! public class PersonRepositoryImpl extends CustomPersonRepository { @Autowired /* [SPRING ANNOTATION] */ private Neo4jTemplate template; public Iterable<Person> findAllByNameCustom(String name) { Index<Node> personFulltextIndex = template.getIndex("people-search", Person.class); personFulltextIndex.query("name", format("*%s*", name)); // [...] } } and moaaar: createNode, projectTo...
  • 37. And so much more... Geospatial queries Cross-store support Dynamic relationships “Advanced” mapping <dependency> <groupId>org.springframework. data</groupId> <artifactId>spring-data-neo4j</artifactId> <version>2.3.1.RELEASE</version> </dependency>
  • 38. And so much more... Geospatial queries Cross-store support QueryDSL integration “Advanced” mapping <dependency> <groupId>org.springframework. data</groupId> <artifactId>spring-data-neo4j</artifactId> <version>2.3.1.RELEASE</version> </dependency>
  • 41. ?