SlideShare a Scribd company logo
GraphAware
TM
Building High Performance Applications

with Spring Data Neo4j 4
Vince Bickers, GraphAware
graphaware.com
@graph_aware
Agenda
● A bit about Neo4j and the Spring Data project
● A brief history of SDN
● SDN 4: Spring Data + Standalone Java OGM
● Conference Demo
o Data model
o Code
o Live demo!
● Roadmap
● Q & A
Neo4j is a Graph Database
•Nodes & Edges (Relationships)
•Index-free adjacency means super-fast traversals
•Embedded Client and Remote Server
•Schema-flexible!
•Cypher Query Language
When worlds collide…
The impedance mismatch


Spring Data
•Most active Spring Project
•Consistent APIs to access both RDBMS and NoSQL stores
•JPA, Neo4j, MongoDB, Redis, CouchBase…
•Convenient abstractions for Spring developers
Quick History of SD-Neo4j
● SDN 0.x - Rod and Emil wrote it, started Spring Data efforts
● SDN 1.x - Embedded Neo4j, Object Mapping, Templates
● SDN 2.x - Neo4j Server, SD-Repositories
● SDN 3.x - Neo4j 2.x with Label + Schema Index Support, etc.
Now… Spring Data Neo4j 4.0
● New and Shiny!
o Complete rewrite
o Neo4j Server only (for now, at least)
o Sympathetic to typical business use cases
o And … not just for Spring developers!
Spring Data Neo4j 4 - Progress
● Development started Sep 2014
● Milestone 1 released end Mar 2015
● RC1 end-May 2015
● GA … mid-June 2015

Spring Data + Separate OGM
● Standalone Java OGM
● Spring+
o Template methods
o Transactions
o Repositories
o Queries
o Exception Translation
o Conversion Services
Approach
● Constraint: Cypher over HTTP
● Solution: Focus on performance!
Core OGM - Features
● "Vampire" Metadata scanning (no reflection!)
● Optional annotations
● Mapping contexts scoped to “conversational” lifetimes:
o Application,
o HTTP session,
o HTTP request, etc.
● "Smart" object-mapping
● Variable-depth persistence
Variable-depth persistence
If you're interested in loading this...
...you're often really interested in this
Variable-depth persistence
If your domain objects are connected….





















…you should be able to save them all at once - from any object.
Conference Application
Spring Data Neo4j 4.0
Spring Boot
Angular.js

Application architecture
Straightforward Spring Boot application:
● RESTControllers
● … depending on Services
● …... depending on Spring Repositories
● to persist POJO Entity classes

Entities and Relationships
Entities (Labels)
● Speaker
● Conference
● Track
● Talk (Session)
● Timeslot

Relationships
● PRESENTS
● REGISTERED_FOR
● IN_TRACK
● HAS_TRACK
● AT_TIMESLOT
Conference Graph Model
Speaker
Conference
Track
Session
Timeslot
PRESENTS
REGISTERED_FORHAS_TRACK
IN_TRACKAT_TIME_SLOT
Preparing the data - CQL
create (conference:Conference {name : 'GraphConnect 2015'})
create (track1:Track {name : 'Technical Track'})
create (track2:Track {name : 'Business Track'})
create (track3:Track {name : 'Practitioner Track'})
create (track4:Track {name : 'Beginner Track'})
create (conference)<-[:REGISTERED_FOR]-(long:Speaker {name : 'Josh Long'})
create (conference)<-[:REGISTERED_FOR]-(gonzalez:Speaker {name : 'Ignasi Gonzalez'})
create (conference)<-[:REGISTERED_FOR]-(lopez:Speaker {name : 'Ivan Lopez'})
create (conference)<-[:REGISTERED_FOR]-(rodriguez:Speaker {name : 'Anton Rodriguez'})
…etc
All the data loaded…
Configuration: Spring Boot
@SpringBootApplication
@Import(PersistenceConfig.class)
public class ConferenceApplication {
public static void main(String[] args) {
SpringApplication app = new SpringApplication(ConferenceApplication.class);
app.setShowBanner(false);
app.run(args);
}
}
Configuration: Persistence
@Configuration

@EnableNeo4jRepositories(basepackages="app.conference.repository")

@EnableTransactionManagement
public class PersistenceConfig extends Neo4jConfiguration {
@Bean public Neo4jServer neo4jServer() {

return new RemoteServer("http://localhost:7474");

}
@Bean public SessionFactory getSessionFactory() {

return new SessionFactory("app.conference.domain");

}
@Bean @Scope(value="session", proxyMode=ScopedProxyMode.TARGET_CLASS)

public Session getSession() throws Exception {

return super.getSession();

}

}
Entities: Abstract Entity
@JsonIdentifyInfo(generator=JSOGGenerator.class)
public abstract class Entity {


@JsonProperty("id")

@GraphId

private Long id;
private String name;
}
Entities: Speaker


public class Speaker extends Entity {

@Relationship(type="PRESENTS")

private Set<Talk> talks;

}
Entities: Talk
@NodeEntity(label="Session")
public class Talk extends Entity {

@Relationship(type="AT_TIMESLOT")

private Timeslot timeslot;
@Relationship(type="IN_TRACK")

private Track track;
@Relationship(type="PRESENTS", direction=Relationship.INCOMING) 

private Set<Speaker> presenters;
}
Repositories
interface SpeakerRepository extends GraphRepository<Speaker> {


@Query("MATCH(s:Speaker)-[:PRESENTS]->() 

return s, count(*) as hits ORDER BY hits DESC")
Iterable<Map<String,Object>> speakersByNumberOfTalks();
}
Services - abstraction


public abstract class GenericCRUDService<T> implements Service<T> {
private static final int DEPTH_LIST = 0;

private static final int DEPTH_ENTITY = 1;
@Override

public Iterable<T> findAll() {

return getRepository().findAll(DEPTH_LIST);

}


@Override

public T find(Long id) {

return getRepository().findOne(id, DEPTH_ENTITY);

}
public abstract GraphRepository<T> getRepository();
}
Services - implementation
@Service
public class SpeakerService extends GenericCRUDService<Speaker> {
@Autowired

private SpeakerRepository repository;


@Override

public GraphRepository<Speaker> getRepository() {

return repository;

}
}
Controllers - abstraction
@RequestMapping(value = "/api")
public abstract class Controller<T> {
public Iterable<T> list() {

return getService().findAll();

}
public T create (T entity) {

return getService().createOrUpdate(entity);

}



// … more controller methods here
public abstract Service<T> getService();
}
Controllers - implementation
// controller methods get an @ResponseBody annotation by default, yay!
@RestController

public class TalkController extends Controller<Talk> {
@Autowired private TalkService service;
@RequestMapping(value="/talks", method = RequestMethod.GET)

public Iterable<Talk> list() {

return service.findAll();

}

}
Front end: Angular js
● Very simple CRUD application
● Loosely based on jHipster angular templates
● Each JSON entity (track, speaker, etc) fully supported by 5 files:
o config.js
o servicefactory.js
o controllers.js
o list.html
o detail.html
Demo
Conference Application
Where next?
Immediately after RC1:
● Project code split
● General release mid-June
● More features planned
o Dynamic Properties
o Support for Embedded Neo4j
o Versioning (MVCC)
o Automatic hooks to pre/post-save lifecycle events
o Binary protocol …etc.

Getting started
Neo4j: http://neo4j.com/download
SDN4 Conference Application: https://github.com/neo4j-examples/sdn4-
conference
Spring Data Neo4j (4)
Current Release: http://maven.springframework.org/milestone/org/springframework/
data/spring-data-neo4j/4.0.0.M1
Latest Build: http://repo.spring.io/libs-snapshot/org/springframework/data/spring-data-
neo4j/4.0.0.BUILD-SNAPSHOT
Code: https://github.com/spring-projects/spring-data-neo4j/tree/4.0
Documentation: http://docs.spring.io/spring-data/neo4j/docs/4.0.0.M1
GraphAware
TM
Getting help
Luanne Misquitta

Adam George

Vince Bickers

Want to track/raise an issue?
○ https://jira.spring.io/browse/DATAGRAPH


Got questions, or need some advice?
○ Check our blog:

http://graphaware.com/blog/
○ Stack Overflow is your friend
graphaware.com
@graph_aware

More Related Content

PDF
Spring Data Neo4j: Graph Power Your Enterprise Apps
PDF
Challenges in knowledge graph visualization
PDF
Knowledge graphs + Chatbots with Neo4j
PDF
Voice-driven Knowledge Graph Journey with Neo4j and Amazon Alexa
PDF
Combine Spring Data Neo4j and Spring Boot to quickl
PDF
Analyzing Blockchain Transactions in Apache Spark with Jiri Kremser
PDF
GraphConnect Europe 2016 - NoSQL Polyglot Persistence: Tools and Integrations...
PDF
Training Series: Build APIs with Neo4j GraphQL Library
Spring Data Neo4j: Graph Power Your Enterprise Apps
Challenges in knowledge graph visualization
Knowledge graphs + Chatbots with Neo4j
Voice-driven Knowledge Graph Journey with Neo4j and Amazon Alexa
Combine Spring Data Neo4j and Spring Boot to quickl
Analyzing Blockchain Transactions in Apache Spark with Jiri Kremser
GraphConnect Europe 2016 - NoSQL Polyglot Persistence: Tools and Integrations...
Training Series: Build APIs with Neo4j GraphQL Library

What's hot (20)

PPTX
Building Community APIs using GraphQL, Neo4j, and Kotlin
PDF
Practical Graph Algorithms with Neo4j
PDF
Graphs & Neo4j - Past Present Future
PDF
Full Stack Development with Neo4j and GraphQL
PDF
Building a Knowledge Graph using NLP and Ontologies
PPTX
GraphTour - Neo4j Platform Overview
PDF
Full Stack Graph in the Cloud
PDF
This Week in Neo4j - 24th November 2018
PDF
Neo4j-Databridge: Enterprise-scale ETL for Neo4j
PPTX
No Sql in Enterprise Java Applications
PDF
Data pipelines observability: OpenLineage & Marquez
PDF
Kubernetes Config Management Landscape
PPTX
Neo4j graph database
PPTX
Big Data-Driven Applications with Cassandra and Spark
PPTX
GraphTour - Closing Keynote
PDF
OrientDB - the 2nd generation of (Multi-Model) NoSQL - Devoxx Belgium 2015
PPTX
Querying Graphs with GraphQL
PDF
GraphTour - Albelli: Running Neo4j on a large scale image platform
PPTX
GraphTour - Neo4j Database Overview
PDF
Neo4j Introduction (for Techies)
Building Community APIs using GraphQL, Neo4j, and Kotlin
Practical Graph Algorithms with Neo4j
Graphs & Neo4j - Past Present Future
Full Stack Development with Neo4j and GraphQL
Building a Knowledge Graph using NLP and Ontologies
GraphTour - Neo4j Platform Overview
Full Stack Graph in the Cloud
This Week in Neo4j - 24th November 2018
Neo4j-Databridge: Enterprise-scale ETL for Neo4j
No Sql in Enterprise Java Applications
Data pipelines observability: OpenLineage & Marquez
Kubernetes Config Management Landscape
Neo4j graph database
Big Data-Driven Applications with Cassandra and Spark
GraphTour - Closing Keynote
OrientDB - the 2nd generation of (Multi-Model) NoSQL - Devoxx Belgium 2015
Querying Graphs with GraphQL
GraphTour - Albelli: Running Neo4j on a large scale image platform
GraphTour - Neo4j Database Overview
Neo4j Introduction (for Techies)
Ad

Viewers also liked (7)

PDF
Graph Database Prototyping made easy with Graphgen
PDF
2017-01-08-scaling tribalknowledge
PDF
Relevant Search Leveraging Knowledge Graphs with Neo4j
PDF
Power of Polyglot Search
PDF
Real-Time Recommendations and the Future of Search
PPTX
Chatbots and Voice Conversational Interfaces with Amazon Alexa, Neo4j and Gra...
PDF
Neo4j as a Key Player in Human Capital Management (HCM), GraphAware
Graph Database Prototyping made easy with Graphgen
2017-01-08-scaling tribalknowledge
Relevant Search Leveraging Knowledge Graphs with Neo4j
Power of Polyglot Search
Real-Time Recommendations and the Future of Search
Chatbots and Voice Conversational Interfaces with Amazon Alexa, Neo4j and Gra...
Neo4j as a Key Player in Human Capital Management (HCM), GraphAware
Ad

Similar to Webinar about Spring Data Neo4j 4 (20)

PPTX
How to use NoSQL in Enterprise Java Applications - NoSQL Roadshow Basel
PDF
Grails and Neo4j
PDF
GR8Conf 2011: Neo4j Plugin
PDF
Object Graph Mapping with Spring Data Neo4j 3 - Nicki Watt & Michael Hunger @...
PDF
A general introduction to Spring Data / Neo4J
PPTX
Neo4 + Grails
PPTX
Neo4j Training Introduction
PDF
Data access 2.0? Please welcome: Spring Data!
PDF
An introduction into Spring Data
PPTX
ExSchema
PPTX
Neo4J and Grails
PDF
Application Architecture Trends
ODP
Polyglot persistence with Spring Data
PDF
Polyglot Persistence with MongoDB and Neo4j
ODP
Spring Data in 10 minutes
PPTX
Building enterprise web applications with spring 3
PPT
Spring data presentation
PPTX
A whirlwind tour of graph databases
PDF
Neo4j spatial-nosql-frankfurt
PPTX
Neo4j Introduction at Imperial College London
How to use NoSQL in Enterprise Java Applications - NoSQL Roadshow Basel
Grails and Neo4j
GR8Conf 2011: Neo4j Plugin
Object Graph Mapping with Spring Data Neo4j 3 - Nicki Watt & Michael Hunger @...
A general introduction to Spring Data / Neo4J
Neo4 + Grails
Neo4j Training Introduction
Data access 2.0? Please welcome: Spring Data!
An introduction into Spring Data
ExSchema
Neo4J and Grails
Application Architecture Trends
Polyglot persistence with Spring Data
Polyglot Persistence with MongoDB and Neo4j
Spring Data in 10 minutes
Building enterprise web applications with spring 3
Spring data presentation
A whirlwind tour of graph databases
Neo4j spatial-nosql-frankfurt
Neo4j Introduction at Imperial College London

More from GraphAware (20)

PDF
Unparalleled Graph Database Scalability Delivered by Neo4j 4.0
PDF
Social media monitoring with ML-powered Knowledge Graph
PDF
To be or not to be.
PDF
It Depends (and why it's the most frequent answer to modelling questions)
PDF
How Boston Scientific Improves Manufacturing Quality Using Graph Analytics
PDF
When privacy matters! Chatbots in data-sensitive businesses
PDF
Graph-Powered Machine Learning
PDF
Signals from outer space
PDF
Neo4j-Databridge: Enterprise-scale ETL for Neo4j
PDF
Graph-Powered Machine Learning
PDF
(Big) Data Science
PDF
Modelling Data in Neo4j (plus a few tips)
PDF
Intro to Neo4j (CZ)
PDF
Modelling Data as Graphs (Neo4j)
PDF
GraphAware Framework Intro
PDF
Advanced Neo4j Use Cases with the GraphAware Framework
PDF
Recommendations with Neo4j (FOSDEM 2015)
PDF
Machine Learning Powered by Graphs - Alessandro Negro
PDF
Knowledge Graphs and Chatbots with Neo4j and IBM Watson - Christophe Willemsen
PDF
The power of polyglot searching
Unparalleled Graph Database Scalability Delivered by Neo4j 4.0
Social media monitoring with ML-powered Knowledge Graph
To be or not to be.
It Depends (and why it's the most frequent answer to modelling questions)
How Boston Scientific Improves Manufacturing Quality Using Graph Analytics
When privacy matters! Chatbots in data-sensitive businesses
Graph-Powered Machine Learning
Signals from outer space
Neo4j-Databridge: Enterprise-scale ETL for Neo4j
Graph-Powered Machine Learning
(Big) Data Science
Modelling Data in Neo4j (plus a few tips)
Intro to Neo4j (CZ)
Modelling Data as Graphs (Neo4j)
GraphAware Framework Intro
Advanced Neo4j Use Cases with the GraphAware Framework
Recommendations with Neo4j (FOSDEM 2015)
Machine Learning Powered by Graphs - Alessandro Negro
Knowledge Graphs and Chatbots with Neo4j and IBM Watson - Christophe Willemsen
The power of polyglot searching

Recently uploaded (20)

PPT
Introduction Database Management System for Course Database
PDF
How to Choose the Most Effective Social Media Agency in Bangalore.pdf
PPTX
What to Capture When It Breaks: 16 Artifacts That Reveal Root Causes
PDF
IEEE-CS Tech Predictions, SWEBOK and Quantum Software: Towards Q-SWEBOK
PDF
Exploring AI Agents in Process Industries
PDF
Microsoft Teams Essentials; The pricing and the versions_PDF.pdf
PDF
A REACT POMODORO TIMER WEB APPLICATION.pdf
PPTX
Benefits of DCCM for Genesys Contact Center
PPTX
10 Hidden App Development Costs That Can Sink Your Startup.pptx
PDF
Perfecting Gamer’s Experiences with Performance Testing for Gaming Applicatio...
PPTX
Lecture #1.ppt.pptx, Visuals Programming
PPTX
Presentation of Computer CLASS 2 .pptx
PPTX
Online Work Permit System for Fast Permit Processing
PDF
Best Smart Port Software of 2025 Why Envision Leads the Market.pdf
PDF
Community & News Update Q2 Meet Up 2025
DOCX
The Future of Smart Factories Why Embedded Analytics Leads the Way
PDF
Build Multi-agent using Agent Development Kit
PPTX
Odoo Consulting Services by CandidRoot Solutions
PDF
The Role of Automation and AI in EHS Management for Data Centers.pdf
PDF
Comprehensive Salesforce Implementation Services.pdf
Introduction Database Management System for Course Database
How to Choose the Most Effective Social Media Agency in Bangalore.pdf
What to Capture When It Breaks: 16 Artifacts That Reveal Root Causes
IEEE-CS Tech Predictions, SWEBOK and Quantum Software: Towards Q-SWEBOK
Exploring AI Agents in Process Industries
Microsoft Teams Essentials; The pricing and the versions_PDF.pdf
A REACT POMODORO TIMER WEB APPLICATION.pdf
Benefits of DCCM for Genesys Contact Center
10 Hidden App Development Costs That Can Sink Your Startup.pptx
Perfecting Gamer’s Experiences with Performance Testing for Gaming Applicatio...
Lecture #1.ppt.pptx, Visuals Programming
Presentation of Computer CLASS 2 .pptx
Online Work Permit System for Fast Permit Processing
Best Smart Port Software of 2025 Why Envision Leads the Market.pdf
Community & News Update Q2 Meet Up 2025
The Future of Smart Factories Why Embedded Analytics Leads the Way
Build Multi-agent using Agent Development Kit
Odoo Consulting Services by CandidRoot Solutions
The Role of Automation and AI in EHS Management for Data Centers.pdf
Comprehensive Salesforce Implementation Services.pdf

Webinar about Spring Data Neo4j 4

  • 1. GraphAware TM Building High Performance Applications
 with Spring Data Neo4j 4 Vince Bickers, GraphAware graphaware.com @graph_aware
  • 2. Agenda ● A bit about Neo4j and the Spring Data project ● A brief history of SDN ● SDN 4: Spring Data + Standalone Java OGM ● Conference Demo o Data model o Code o Live demo! ● Roadmap ● Q & A
  • 3. Neo4j is a Graph Database •Nodes & Edges (Relationships) •Index-free adjacency means super-fast traversals •Embedded Client and Remote Server •Schema-flexible! •Cypher Query Language
  • 4. When worlds collide… The impedance mismatch 

  • 5. Spring Data •Most active Spring Project •Consistent APIs to access both RDBMS and NoSQL stores •JPA, Neo4j, MongoDB, Redis, CouchBase… •Convenient abstractions for Spring developers
  • 6. Quick History of SD-Neo4j ● SDN 0.x - Rod and Emil wrote it, started Spring Data efforts ● SDN 1.x - Embedded Neo4j, Object Mapping, Templates ● SDN 2.x - Neo4j Server, SD-Repositories ● SDN 3.x - Neo4j 2.x with Label + Schema Index Support, etc.
  • 7. Now… Spring Data Neo4j 4.0 ● New and Shiny! o Complete rewrite o Neo4j Server only (for now, at least) o Sympathetic to typical business use cases o And … not just for Spring developers!
  • 8. Spring Data Neo4j 4 - Progress ● Development started Sep 2014 ● Milestone 1 released end Mar 2015 ● RC1 end-May 2015 ● GA … mid-June 2015

  • 9. Spring Data + Separate OGM ● Standalone Java OGM ● Spring+ o Template methods o Transactions o Repositories o Queries o Exception Translation o Conversion Services
  • 10. Approach ● Constraint: Cypher over HTTP ● Solution: Focus on performance!
  • 11. Core OGM - Features ● "Vampire" Metadata scanning (no reflection!) ● Optional annotations ● Mapping contexts scoped to “conversational” lifetimes: o Application, o HTTP session, o HTTP request, etc. ● "Smart" object-mapping ● Variable-depth persistence
  • 12. Variable-depth persistence If you're interested in loading this... ...you're often really interested in this
  • 13. Variable-depth persistence If your domain objects are connected….
 
 
 
 
 
 
 
 
 
 
 …you should be able to save them all at once - from any object.
  • 14. Conference Application Spring Data Neo4j 4.0 Spring Boot Angular.js

  • 15. Application architecture Straightforward Spring Boot application: ● RESTControllers ● … depending on Services ● …... depending on Spring Repositories ● to persist POJO Entity classes

  • 16. Entities and Relationships Entities (Labels) ● Speaker ● Conference ● Track ● Talk (Session) ● Timeslot
 Relationships ● PRESENTS ● REGISTERED_FOR ● IN_TRACK ● HAS_TRACK ● AT_TIMESLOT
  • 18. Preparing the data - CQL create (conference:Conference {name : 'GraphConnect 2015'}) create (track1:Track {name : 'Technical Track'}) create (track2:Track {name : 'Business Track'}) create (track3:Track {name : 'Practitioner Track'}) create (track4:Track {name : 'Beginner Track'}) create (conference)<-[:REGISTERED_FOR]-(long:Speaker {name : 'Josh Long'}) create (conference)<-[:REGISTERED_FOR]-(gonzalez:Speaker {name : 'Ignasi Gonzalez'}) create (conference)<-[:REGISTERED_FOR]-(lopez:Speaker {name : 'Ivan Lopez'}) create (conference)<-[:REGISTERED_FOR]-(rodriguez:Speaker {name : 'Anton Rodriguez'}) …etc
  • 19. All the data loaded…
  • 20. Configuration: Spring Boot @SpringBootApplication @Import(PersistenceConfig.class) public class ConferenceApplication { public static void main(String[] args) { SpringApplication app = new SpringApplication(ConferenceApplication.class); app.setShowBanner(false); app.run(args); } }
  • 21. Configuration: Persistence @Configuration
 @EnableNeo4jRepositories(basepackages="app.conference.repository")
 @EnableTransactionManagement public class PersistenceConfig extends Neo4jConfiguration { @Bean public Neo4jServer neo4jServer() {
 return new RemoteServer("http://localhost:7474");
 } @Bean public SessionFactory getSessionFactory() {
 return new SessionFactory("app.conference.domain");
 } @Bean @Scope(value="session", proxyMode=ScopedProxyMode.TARGET_CLASS)
 public Session getSession() throws Exception {
 return super.getSession();
 }
 }
  • 22. Entities: Abstract Entity @JsonIdentifyInfo(generator=JSOGGenerator.class) public abstract class Entity { 
 @JsonProperty("id")
 @GraphId
 private Long id; private String name; }
  • 23. Entities: Speaker 
 public class Speaker extends Entity {
 @Relationship(type="PRESENTS")
 private Set<Talk> talks;
 }
  • 24. Entities: Talk @NodeEntity(label="Session") public class Talk extends Entity {
 @Relationship(type="AT_TIMESLOT")
 private Timeslot timeslot; @Relationship(type="IN_TRACK")
 private Track track; @Relationship(type="PRESENTS", direction=Relationship.INCOMING) 
 private Set<Speaker> presenters; }
  • 25. Repositories interface SpeakerRepository extends GraphRepository<Speaker> { 
 @Query("MATCH(s:Speaker)-[:PRESENTS]->() 
 return s, count(*) as hits ORDER BY hits DESC") Iterable<Map<String,Object>> speakersByNumberOfTalks(); }
  • 26. Services - abstraction 
 public abstract class GenericCRUDService<T> implements Service<T> { private static final int DEPTH_LIST = 0;
 private static final int DEPTH_ENTITY = 1; @Override
 public Iterable<T> findAll() {
 return getRepository().findAll(DEPTH_LIST);
 } 
 @Override
 public T find(Long id) {
 return getRepository().findOne(id, DEPTH_ENTITY);
 } public abstract GraphRepository<T> getRepository(); }
  • 27. Services - implementation @Service public class SpeakerService extends GenericCRUDService<Speaker> { @Autowired
 private SpeakerRepository repository; 
 @Override
 public GraphRepository<Speaker> getRepository() {
 return repository;
 } }
  • 28. Controllers - abstraction @RequestMapping(value = "/api") public abstract class Controller<T> { public Iterable<T> list() {
 return getService().findAll();
 } public T create (T entity) {
 return getService().createOrUpdate(entity);
 }
 
 // … more controller methods here public abstract Service<T> getService(); }
  • 29. Controllers - implementation // controller methods get an @ResponseBody annotation by default, yay! @RestController
 public class TalkController extends Controller<Talk> { @Autowired private TalkService service; @RequestMapping(value="/talks", method = RequestMethod.GET)
 public Iterable<Talk> list() {
 return service.findAll();
 }
 }
  • 30. Front end: Angular js ● Very simple CRUD application ● Loosely based on jHipster angular templates ● Each JSON entity (track, speaker, etc) fully supported by 5 files: o config.js o servicefactory.js o controllers.js o list.html o detail.html
  • 32. Where next? Immediately after RC1: ● Project code split ● General release mid-June ● More features planned o Dynamic Properties o Support for Embedded Neo4j o Versioning (MVCC) o Automatic hooks to pre/post-save lifecycle events o Binary protocol …etc.

  • 33. Getting started Neo4j: http://neo4j.com/download SDN4 Conference Application: https://github.com/neo4j-examples/sdn4- conference Spring Data Neo4j (4) Current Release: http://maven.springframework.org/milestone/org/springframework/ data/spring-data-neo4j/4.0.0.M1 Latest Build: http://repo.spring.io/libs-snapshot/org/springframework/data/spring-data- neo4j/4.0.0.BUILD-SNAPSHOT Code: https://github.com/spring-projects/spring-data-neo4j/tree/4.0 Documentation: http://docs.spring.io/spring-data/neo4j/docs/4.0.0.M1
  • 34. GraphAware TM Getting help Luanne Misquitta
 Adam George
 Vince Bickers
 Want to track/raise an issue? ○ https://jira.spring.io/browse/DATAGRAPH 
 Got questions, or need some advice? ○ Check our blog:
 http://graphaware.com/blog/ ○ Stack Overflow is your friend graphaware.com @graph_aware