artistic spring data neo4j 3.x with spring boot and van gogh
DESCRIPTION
Speakers: Michael Hunger, Lorenzo Speranzoni - Neo technology Data / Integration Track This session will show, how easy it is to get started with Spring Data Neo4j using Spring Boot. After a quick introduction of the concepts behind the Neo4j NoSQL graph database and its Spring Data integration library, we will discuss the general approach used in Spring Data Neo4j and highlight the exciting, new features of the new 3.x releases which now works with the most recent Neo4j 2.x versions. During the session we'll demonstrate the development steps of an exciting and unusual application - tracking an famous' artists journey connecting him to the places, paintings, people and other aspects that influenced him. Having this data in a graph allows us to find new insights and conclusions as well as quickly adding different aspects to it. This application will use Spring Boot and Spring Data Neo4j to get started quickly. We import the data, look at it as a graph visualization and then build a web-application using Spring Boot's supporting infrastructure. As a final step we show how evolving this application from being a just Neo4j client application to a REST extension of the Neo4j server requires only a few steps and can leverage Spring Data REST to provide the neccessary endpoints for consumersTRANSCRIPT
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
ARTISTIC SPRING DATA NEO4J 3.xWITH SPRING BOOT AND VAN GOGH
By Michael Hunger, Lorenzo Speranzoni
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
LET'S SAY HI
2
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
3
MICHAEL HUNGER @mesirii
Developer Evangelist Neo4j since 2011
LOVES HELPING PEOPLE BY
● Writing
● Speaking
● Coding
LET'S SAY HI
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
4
LORENZO SPERANZONI @inserpio
FOUNDER, CEO @
LARUS BUSINESS AUTOMATION
● Micro company based in VENICE● 1st NEO4J Solution Partner for the ITALIAN market
LOVES CODING, TEACHING
CYCLING & ART
LET'S SAY HI
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
CASE STUDY(NEO4J)-[:LOVES]-(:ART)
5
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
6
The fundamental aspect of Vincent Van Gogh's artwork was his continuous research for colors. By modeling his journey as an artist in a graph database, we are able to make new inferences on different artists, cities, climates and other nodes that influenced the development ofVincent Van Gogh as an artist.
This case study wants to demonstrate the potential of a graph database to provide new insights in art and culture.
(Neo4j)-[:LOVES]-(art)MODELING VAN GOGH'S JOURNEYIN A NEO4J GRAPH DATABASE
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
POLYGLOTPERSISTENCE
7
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
“I'm confident to say that if you're starting a new strategic enterprise application you should no longer be assuming that your persistence should be relational. The relational option might be the right one - but you should seriously look at other alternatives.
One of the interesting consequences of this is that we are gearing up for a shift to polyglot persistence where any decent sized enterprise will have a variety of different data storage technologies for different kinds of data.”
MARTIN FOWLER, Chief Scientist at ThoughtWorks
IT ALL STARTED WITHPOLYGLOT PERSISTENCE
8
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
DENORMALISEAggregated Data Model
NORMALISEConnected Data Model
KEY-VALUERiak, Redis
WIDE-COLUMNCassandra
DOCUMENTMongoDB, Couchbase
GRAPHNeo4j
NO-SQL
Today, we want to talk about Neo4j as a Graph Database
NO-SQL CATEGORIES
9
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
GRAPHDATABASES
10
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
“Most NO-SQL databases — whether key-value-, document- or column-oriented — store sets of disconnected documents/values/columns. This makes it difficult to use them for connected data and graphs.
One well-known strategy for adding relationships to such stores is to embed an aggregate’s identifier inside the field belonging to another aggregate — effectively introducing foreign keys. But this requires joining aggregates at the application level, which quickly becomes prohibitively expensive.”
JIM WEBBER, IAN ROBINSON - “Graph Databases”, O'REILLY
LACK OF RELATIONSHIPSAGGREGATED NO-SQL DATABASES LACK RELATIONSHIPS
11
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
“For several decades, developers have tried to accommodate connected, semi-structured datasets inside relational databases. But whereas relational databases were initially designed to codify paper forms and tabular structures — something they do exceedingly well — they struggle when attempting to model the ad hoc, exceptional relationships that crop up in the real world.
Ironically, relational databases deal poorly with relationships. Relationships do exist in the vernacular of relational databases, but only as a means of joining tables.”
JIM WEBBER, IAN ROBINSON - “Graph Databases”, O'REILLY
LACK OF RELATIONSHIPSRELATIONAL DATABASES ALSO LACK RELATIONSHIPS
12
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
“While other databases struggle to represent and manage relationships in a good way, graph databases center around relationship management. This provides you the flexibility to view your data in any number of views and utilize all use-cases without having to optimize for only a few upfront. Being a first level citizens relationships are stored, managed and traversed efficiently.”
In a graph database relationships are used inherently to capture the richness of your domain model. They provide ways to structure and connect your entities.”
GRAPH DATABASES VALUE RELATIONSHIPSAS FIRST LEVEL CONCEPTS
EMBRACE RELATIONSHIPS
13
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
• Scalable NOSQL Databases
• Flexible, Rich Domains
• Adapt to Your Data and Use-Cases
• Schema Free
• Transactional – ACID
• Fast JOIN Operations
• Support Complex Queries
GRAPH DATABASES
14
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
Gartner, for example, identifies five graphs in the world of business:
● Social● Intent● Consumption● Interest● Mobile
“the ability to leverage these graphs provides a sustainable competitive advantage”
Gartner
WHAT ARE GRAPHS GOOD FOR?
15
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
GRAPH DATABASEMANY VERTICALS AND USE-CASES
16
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
Forrester Research:
“25% of all businesses will use graph databases by 2017”
TechRadar(TM): Enterprise DBMS, Q1 2014. Forrester Research. 2-13-14
GRAPH DATABASE
17
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
NODES
RELATIONSHIPS
WHAT IS A GRAPH?A SET OF NODES AND THE RELATIONS THAT CONNECT THEM
18
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
A property graph has the following characteristics:
● It contains nodes and relationships
● Nodes are labeled entities
● Nodes have properties (key-value pairs)
● Relationships are named and directed
● Relationships can also contain properties
PROPERTY GRAPHTHE MOST POPULAR VARIANT OF GRAPH MODEL
19
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
CONSIDER A RELATIONALDATABASE
20
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
Van Gogh
Zundert
Auvers-sur-Oise
DIED INRELATIONSHIPS
NODES
BORN IN
WHEN WE'RE TALKING ABOUTA PROPERTY GRAPH!
21
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
MODELINGWITH GRAPH
22
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
● Graphs are whiteboard friendly
● You model your Domain by making sure your model contains all the entities and relationships to support your use-cases
● Evolve incrementally as needed
MODELING WITH GRAPHSWHY?
23
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
MODELING WITH GRAPHS1. WHITEBOARD
24
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
Zundert Auvers-sur-Oise
Post-ImpressionismBELONGS TO
DIED IN
BO
RN
IN
Van Gogh
MODELING WITH GRAPHS2. PRETTY UP
25
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
Zundert Auvers-sur-Oise
Post-ImpressionismBELONGS TO
DIED IN
BO
RN
IN
Van Gogh
MODELING WITH GRAPHS2. PRETTY UP
26
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
CREATE (art_movement:ART_MOVEMENT)<-[:BELONGS_TO]-(artist:ARTIST {last_name: 'Van Gogh'})
CREATE (artist)-[:BORN_IN]->(city:CITY {name: 'Zundert'})
CREATE (artist)-[:DIED_IN]->(city:CITY {name: 'Auvers-sur-Oise'})
MODELING WITH GRAPHS3. AND IN THE DATABASE
A GRAPH DATABASE
IS EMERGING!
27
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
WHAT IS
?
28
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
● PROPERTY GRAPH MODEL● QUERY ENGINE● DATABASE
○ JVM BASED○ EMBEDDED and SERVER○ ACID○ BILLIONS of ENTITIES○ CLUSTERED
NEO4JIS A GRAPH DATABASE
29
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
u NODES
v RELATIONSHIPS (named & directed)
w PROPERTIES (key/value pairs)
CITY
CITY
ARTIST
x LABELSNEO4JPROPERTY GRAPH MODEL
30
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
● EMBRACE RELATIONSHIPS: graph databases are the best way to represent and query connected data
● It's the first database to give you NO-SQL SCALABILITY
● as well as TRANSACTION INTEGRITY
● First-class JAVA SUPPORT
NEO4JSTRENGHTS
31
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
“Graph databases address one of the great macroscopic business trends of today: leveraging complex and dynamic relationships in highly connected data to generate insight and competitive advantage.
For data of any significant size or value, graph databases are the best way to represent and query connected data. Connected data is data whose interpretation and value requires us first to understand the ways in which its constituent elements are related.”
JIM WEBBER, IAN ROBINSON - “Graph Databases”, O'REILLY
NEO4JSTRENGHTS
32
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
“Corporations today are facing an explosion in data growth. Up until now, NO-SQL databases handling big data have not provided the key elements that enterprises expect in a database. Neo4j is the first database to give you the scalability of NO-SQL, as well as the transactional integrity that enterprises expect.
Neo Technology provides the flexibility and scalability of a NO-SQL database, while supporting key elements imperative to the enterprise: transactions, true durability and first-class Java support.”
EMIL EIFREM, CEO of Neo Technology
NEO4JSTRENGHTS
33
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
CYPHERQUERY
LANGUAGE
34
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
● Cypher is an expressive, compact, easy graph database query language
● Cypher has a close affinity with our habit of representing graphs using diagrams: that makes it ideal for programatically describing graphs in a precise fashion
CYPHER QUERY LANGUAGEWHY?
35
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
Equivalent ASCII art representation in Cypher:
(lorenzo:PERSON)-[:LOVES]->(van_gogh:ARTIST)
PERSON ARTIST
CYPHER QUERY LANGUAGEHOW IT WORKS?
36
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
Cypher enables a user to ask the database to find data that matches a specific pattern:
we ask the database to “find things like this” and the way we describe what “things like this” look like is to draw them, using ASCII art
CYPHER QUERY LANGUAGEHOW IT WORKS?
37
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
Cypher is composed of clauses (like most query languages): the simplest queries consist of a MATCH clause followed by a RETURN clause
CYPHER QUERY LANGUAGESTATEMENTS
MATCH (artist:ARTIST {last_name: 'Van Gogh'})RETURN artist
38
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
CYPHER QUERY LANGUAGE“MATCH” CLAUSE
This is the specification by example part.
Using ASCII characters to represent nodes and relationships, we draw the data we’re interested in.
MATCH (artist:ARTIST {last_name: 'Van Gogh'})- [:MOVED_TO*]->(stage:STAGE),
(stage)-[:IN]->(city:CITY)RETURN artist, stage, city
39
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
CYPHER QUERY LANGUAGE“RETURN” CLAUSE
MATCH (artist:ARTIST {last_name: 'Van Gogh'})- [:MOVED_TO*]->(stage:STAGE),
(stage)-[:IN]->(city:CITY)RETURN artist, stage, city
This clause specifies which expressions based on nodes, relationships and properties in the matched data should be returned to the client.
40
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
CYPHER QUERY LANGUAGERETRIEVING THE VAN GOGH'S JOURNEY FROM NEO4J
CITY CITY CITY
CITY
CITYCITYSTAGE
STAGE
STAGESTAGESTAGE
STAGE
ARTIST
MATCH (artist:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(stage:STAGE), (stage)-[:IN]->(city:CITY)
RETURN artist, stage, city
41
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
● WHERE● CREATE and MERGE● DELETE and REMOVE● SET● FOREACH● UNION● WITH● LOAD CSV
CYPHER QUERY LANGUAGEOTHER CLAUSES
42
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
MY DATA SOURCE
The Vincent Van Gogh Gallery has a complete list of his paintings
[ http://www.vggallery.com ]
43
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
FIRST NODESThe root node is of course Vincent Van Gogh himself:
CREATE (a:ARTIST {first_name: 'Vincent', second_name: 'Willem', last_name: 'Van Gogh', born: 18530330, died: 18900729})
// Born in ZUNDERT, dead in AUVERS-SUR-OISE
CREATE (c:CITY {name: 'Zundert', province: 'North Brabant', country: 'Netherlands', latitude: 51.466667, longitude: 4.666667})CREATE (c:CITY {name: 'Auvers-sur-Oise', region: 'Île-de-France', country: 'France', latitude: 49.0725, longitude: 2.175})
MATCH (a:ARTIST {last_name: 'Van Gogh'}), (c:CITY {name: 'Zundert'}) CREATE (a)-[:BORN_IN]->(c)MATCH (a:ARTIST {last_name: 'Van Gogh'}), (c:CITY {name: 'Auvers-sur-Oise'}) CREATE (a)-[:DIED_IN]->(c)
// Belongs to the POST-IMPRESSIONISM movement
CREATE (m:ART_MOVEMENT {name: 'Post-Impressionism', wikipedia: 'http://en.wikipedia.org/wiki/Post-Impressionism'})
MATCH (a:ARTIST {last_name: 'Van Gogh'}), (m:ART_MOVEMENT {name: 'Post-Impressionism'})CREATE (a)-[:BELONGS_TO]->(m)
44
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
VAN GOGH's GRAPH IS EMERGING!
MATCH (art_movement:ART_MOVEMENT)<-[:BELONGS_TO]-(artist:ARTIST {last_name: 'Van Gogh'}), (artist)-[r]->(city:CITY)RETURN artist, art_movement, city
45
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
VAN GOGH's JOURNEY(1st STAGE)
In December 1883, Van Gogh began his journey by moving to Neuen, North Brabant, The Netherlands. He lived there until November 1885:
// Creating 1st STAGE in Neuen
CREATE (:CITY {name: 'Neuen', province: 'North Brabant', country: 'Netherland', latitude: 51.473333, longitude: 5.546667})
MATCH (van_gogh:ARTIST {last_name: 'Van Gogh'}), (neuen:CITY{name: 'Neuen'})CREATE (van_gogh)-[:MOVED_TO]->(:STAGE {from: 188312, to: 188511})-[:IN]->(neuen)
46
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
VAN GOGH's JOURNEY (OTHER STAGES)
● In December 1885, Van Gogh moved to Antwerp, Belgium, where he lived until February 1886
● Van Gogh lived in Paris, France from March 1886 to February 1888
● Then he moved to Arles, France in February 1888 and stayed there until May 1889
● Then he moved to Saint-Rémy de Provence, France in May 1889 and stayed there until May 1890
● Van Gogh ended his trip, and also his life by committing suicide, in Auvers-sur-Oise, France where he had lived from May to July 1890
47
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
SHOWING VAN GOGH'S JOURNEY
MATCH (artist:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(stage:STAGE)-[:IN]->(city:CITY)WITH artist, stage, cityMATCH (artist)-[:BELONGS_TO]->(art_movement:ART_MOVEMENT)RETURN artist, art_movement, stage, city
48
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
VAN GOGH's ARTWORKSIn Neuen, Van Gogh completed what is generally considered his first major work, THE POTATO EATERS, the culmination of several years work painting peasant character studies:
CREATE (:ARTWORK {title: 'The Potato Eaters I', type: 'oil on canvas', year: 1885, month: 4, thumbnail: 'http://www.vggallery.com/painting/f_0082.jpg'})
MATCH (van_gogh:ARTIST {last_name: 'Van Gogh'}), (the_potato_eaters:ARTWORK {title: 'The Potato Eaters I'})CREATE (the_potato_eaters)-[:AUTHOR]->(van_gogh)
MATCH (a:ARTWORK {title: 'The Potato Eaters I'})CREATE (a)-[:IS_A]->(v:VISUAL_ART {name: 'painting', wikipedia: 'http://en.wikipedia.org/wiki/Visual_arts#Painting'})
MATCH (:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(neuen_stage:STAGE)-[:IN]->(:CITY {name: 'Neuen'}), (the_potato_eaters:ARTWORK {title: 'The Potato Eaters I'})CREATE (neuen_stage)-[:WHERE_REALIZED]->(the_potato_eaters)
49
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
VAN GOGH's ARTWORKS
MATCH (artist:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(stage:STAGE)-[:IN]->(city:CITY)OPTIONAL MATCH (stage)-[:REALIZED]->(artwork:ARTWORK)-[:IS_A]->(visual_art:VISUAL_ART)RETURN artist, stage, city, artwork, visual_art
50
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
MUSEUMS HOSTING HIS ART
MATCH (artist:ARTIST {last_name: 'Van Gogh'})<-[:AUTHOR]-(artwork:ARTWORK)-[:OFFICIAL_LOCATION]->(museum), (museum:MUSEUM)-[:LOCATED_IN]->(city:CITY {country: 'Netherlands'})RETURN artist, artwork, museum, city
51
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
ADDING SOCIAL
MATCH (city:CITY {country: 'Italy'})<-[:LIVES_IN]-(:PERSON)-[like:LIKES|POSTED]->(sth_he_or_she_likes)RETURN person, city, like, sth_he_or_she_likes
52
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
VAN GOGH'S GRAPH DATABASE
53
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
SPRING DATA NEO4J 3.x
54
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
55
● Spring Data Evans Release was last week
● Includes Spring Data Neo4j 3.2.GA
SPRING DATAINTRODUCTION
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
● Spring Data Neo4J offers advanced features to map annotated entity classes to the Neo4j Graph Database.
● The template programming model is equivalent to well known Spring templates and builds the basis for interaction with the graph and is also used for the advanced repository support.
● Spring Data Neo4j is part of the Spring Data project which aims to provide convenient support for NoSQL databases.
SPRING DATA NEO4J 3.xINTRODUCTION
56
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
57
● Easy access to NoSQL databases for Spring developers
● Consistent APIs and concepts configuration, repositories,object-mapping don't hide power of each database
● Shared common infrastructure
● Support for several NOSQL approaches(Neo4j, MongoDB, Redis, Hadoop, …)
http://projects.spring.io/spring-data
SPRING DATAINTRODUCTION
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
58
● Uses annotations to define graph entities● Entity state backed by graph database● Object Graph Mapping● SD-Repositories support● Template, Config, Lifecycle● Neo4j Server Support
http://projects.spring.io/spring-data-neo4j
SPRING DATA NEO4J 3.xINTRODUCTION
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
We can choose between 3 different options to interact with NEO4J:
● JAVA NEO4J CORE API
● NEO4J REST API
● OBJECT GRAPH MAPPING
SPRING DATA NEO4J 3.xPROGRAMMING MODEL
59
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
60
In addition to the Advanced Object Graph Mapping using AspectJ, SDN also supports a simple mode that converts graph data into domain objects and vice versa.
It doesn't require any additional set up: all you have to do is simply provide the package that contains you beans.
SPRING DATA NEO4J 3.xPROGRAMMING MODEL
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
61
● @NodeEntity : used to identify entity classes;
● @TypeAlias : used to create labels on nodes;
● @Indexed : used to create indexes;
● @RelatedTo : used to find connected entities.
● @RelationshipEntity : represents relationships as Domain Objects
SPRING DATA NEO4J 3.xANNOTATIONS
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
62
SDN exposes two interfaces, we can extend:
● GraphRepository : CRUD, INDEX- AND QUERY-OPERATIONS
● SpatialRepository : GEOSPATIAL QUERIES
SPRING DATA NEO4J 3.xREPOSITORIES
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
63
● Spring Data Commons repository infrastructure is also available in Spring Data Neo4j
● Repositories consist only of interfaces that specify available functionality, while implementation details of commonly used persistence methods are handled by the library
● This is particularly valid for CRUD, index-, spatial- and query-operations.
SPRING DATA NEO4J 3.xREPOSITORIES
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
64
Some of the exposed methods:
public T findOne(ID paramID);
public EndResult<T> findAll();
public Page<T> findAll(Pageable paramPageable);
public EndResult<T> query(String query, Map<String, Object> params);
public <S extends T> S save(S paramS);
public void delete(T paramT);
SPRING DATA NEO4J 3.xGraphRepository INTERFACE
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
65
Some of the exposed methods:
public EndResult<T> findWithinBoundingBox(String indexName, Box box);
public EndResult<T> findWithinDistance(String indexName, Circle circle);
public EndResult<T> findWithinShape(String indexName, Shape shape);
SPRING DATA NEO4J 3.xSpatialRepository INTERFACE
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
VAN GOGH'SARTWORKS RADAR
66
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
67
THIS EXAMPLE WANTS TO DEMONSTRATE HOW WE CAN BUILD A GEOGRAPHICAL SEARCH ENGINE TO LOOK FOR MUSEUMS HOSTING MASTERPIECES BY VINCENT VAN GOGH WITH SPRING DATA NEO4J
SPRING DATA NEO4J 3.xFINDING VAN GOGH'S ARTWORKS WITH NEO4J SPATIAL AND SPRING DATA NEO4J 3.x
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
68
DOMAIN MODEL
SPRING DATA NEO4J 3.xFINDING VAN GOGH'S ARTWORKS WITH NEO4J SPATIAL AND SPRING DATA NEO4J 3.x
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
69
TECHNICAL STACK
● Spring Boot● Spring Data Neo4j 3.x● Neo4j Spatial Plug-in● OpenStreetMap on MapQuest● Cloud Foundry
SPRING DATA NEO4J 3.xFINDING VAN GOGH'S ARTWORKS WITH NEO4J SPATIAL AND SPRING DATA NEO4J 3.x
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
AP
PLI
CA
TIO
N S
ER
VE
R
JVM
70
neo4art
SpringREST-fulServices
PRESENTATIONLOGIC
Spring MVC
BUSINESSLOGIC
@Service
PERSISTENCELOGIC
Spring Data Neo4j CYPHER QUERIES
VIA REPOSITORY CLASSES
SERVICESMV
C
SPRING DATA NEO4J 3.xEMBEDDED VERSION
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
71
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.1.6.RELEASE</version>
</parent>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
SPRING DATA NEO4J 3.xSPRING-BOOT DEPENDENCIES
IT'S EASY WITHSPRING-BOOT!
neo4art example
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
72
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-spatial</artifactId>
</dependency>
SPRING DATA NEO4J 3.xSPRING-DATA-NEO4J DEPENDENCIES
neo4art example
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
73
@EnableAutoConfiguration
@ComponentScan(basePackages = {"it.inserpio.neo4art.service.impl","it.inserpio.neo4art.controller"})
@Import(MyNeo4jConfiguration.class)
public class ArtworkApplication {
public static void main(String[] args) throws IOException {
SpringApplication.run(ArtworkApplication.class, args);
}
}
SPRING DATA NEO4J 3.xCONFIGURATION
IT'S EASY WITHSPRING-BOOT!
neo4art example
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
74
@Configuration
@EnableNeo4jRepositories(basePackages = "it.inserpio.neo4art.repository")
@EnableTransactionManagement
public class MyNeo4jConfiguration extends Neo4jConfiguration {
public static final String PATH = System.getProperty("user.home") + "/neo4art/graph.db";
public MyNeo4jConfiguration() {
setBasePackage("it.inserpio.neo4art.domain");
}
@Bean
public GraphDatabaseService graphDatabaseService() {
return new GraphDatabaseFactory().newEmbeddedDatabase(PATH);
}
}
SPRING DATA NEO4J 3.xCONFIGURATION
neo4art example
IT'S EASY WITHSPRING-BOOT!
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
We can choose between 3 different options to interact with NEO4J:
● JAVA NEO4J CORE API
● NEO4J REST API
● OBJECT GRAPH MAPPING
SPRING DATA NEO4J 3.xPROGRAMMING MODEL
75
LET'S FOCUS ONTHAT OPTION
(as the 2 other ones area bit more “classical”)
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
76
@NodeEntity
@TypeAlias("MUSEUM")
public class Museum extends AbstractEntity {
@Indexed(unique=true)
private String name;
private String address, director, wikipedia, website;
private Double latitude, longitude;
@Indexed(indexName="museumLocation", indexType=IndexType.POINT)
private String wkt;
@RelatedTo(type = OFFICIAL_LOCATION, direction = Direction.INCOMING, elementClass = Artwork.class)
private Set<Artwork> artworks;
SPRING DATA NEO4J 3.xANNOTATIONS
neo4art example
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
77
@Transactional
public interface MuseumRepository extends GraphRepository<Museum>, SpatialRepository<Museum>
{
public static final String MUSEUM_GEOSPATIAL_INDEX = "museumLocation";
@Query("MATCH (m:MUSEUM) WHERE m.name={name} RETURN distinct(m) as museum")
Museum findMuseumByName(@Param("name") String name);
@Query("MATCH (a:ARTIST)<-[:AUTHOR]-(p:ARTWORK)-[:OFFICIAL_LOCATION]->(m:MUSEUM)
WHERE id(a)={artistId} RETURN distinct(m) as museum")
List<Museum> findMuseumByArtist(@Param("artistId") long artistId);
}
SPRING DATA NEO4J 3.xREPOSITORIES
neo4art example
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
78
@Transactional
@SuppressWarnings("unchecked")
public List<Museum> getMuseumsWithinDistance(double lon, double lat, double distanceInKm)
{
Circle circle = new Circle(new Point(lon, lat), new Distance(distanceInKm, Metrics.KILOMETERS));
return IteratorUtils.toList(
this.museumRepository.findWithinDistance(MuseumRepository.MUSEUM_GEOSPATIAL_INDEX,
circle).as(List.class));
}
SPRING DATA NEO4J 3.xGEO-SPATIAL SERVICE
neo4art example
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
AP
PLI
CA
TIO
N S
ER
VE
R
JVM
79
neo4art
SpringREST-fulServices
PRESENTATIONLOGIC
Spring MVC
BUSINESSLOGIC
@Service
PERSISTENCELOGIC
Spring Data Neo4j CYPHER QUERIES
VIA REPOSITORY CLASSES
SPRING DATA NEO4J 3.xSERVER VERSION + EXTENSION
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
PaaS CLO
UD
FO
UN
DR
Y
80
neo4art
http://neo4art.cfapps.io/artworksRadar
neo4
art
serv
er
ext
ens
ion
JerseyResources
PRESENTATIONLOGIC
Spring MVC
BUSINESSLOGIC
@Service
PERSISTENCELOGIC
Spring Data Neo4j
SPRING DATA NEO4J 3.x
SpringRESTClient
MV
C +
SE
RV
ICE
S
SERVER VERSION + EXTENSION
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
81
● Wanted to use cloud hosting for Neo4j-Server
● SDN operations over the wire are not yet optimized
● We want to be close to the metal - the database
● SDN was build for embedded Neo4j
● Server extensions expose domain specific HTTP-Endpoints & Protocols
● Move the persistence Spring Data Neo4j module into a server-extension
SPRING DATA NEO4J 3.xWHY SERVER EXTENSIONS?
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
82
CONFIGURATION FILE
/META-INF
/services
/org.neo4j.server.plugins.PluginLifecycle
it.inserpio.neo4art.server.config.Neo4ArtPluginInitializer
SPRING DATA NEO4J 3.xNEO4J SERVER EXTENSION
neo4art example
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
83
PLUGIN INITIALIZER
public class Neo4ArtPluginInitializer extends SpringPluginInitializer {
public Neo4ArtPluginInitializer() {
super(new String[] { "META-INF/spring/application-context.xml" },
expose("neo4jTemplate", Neo4jTemplate.class),
expose("museumEntityService", MuseumService.class),
expose("museumRepository", MuseumRepository.class),
expose("artworkRepository", ArtworkRepository.class));
}
}
SPRING DATA NEO4J 3.xNEO4J SERVER EXTENSION
neo4art example
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
84
JERSEY-RESOURCES
import javax.ws.rs.*;
@GET
@Path("/lon/{lon}/lat/{lat}/distanceInKm/{distanceInKm}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Transactional
public Response getMuseumsWithinDistance(
@PathParam("lon") double lon,@PathParam("lat") double lat,@PathParam("distanceInKm") double km) {
List<Museum> museumList = this.museumService.getMuseumsWithinDistance(lon, lat, km);
return Response.ok(new GenericEntity<List<Museum>>(museumList) {}).build();
}
SPRING DATA NEO4J 3.xNEO4J SERVER EXTENSION
neo4art example
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
85
DEPLOYING
neo4j-community-2.1.4/
bin/
conf/
data/
graph.db/
lib/
plugins/
system/
SPRING DATA NEO4J 3.xNEO4J SERVER EXTENSION
JUST PUT YOURSERVER EXTENSION
JAR + DEPENDENCIESHERE
neo4art example
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
86
ENABLING THE EXTENSION neo4j-server.properties
neo4j-community-2.1.4/
bin/
conf/
neo4j-server.properties
data/
graph.db/
lib/
plugins/
system/
SPRING DATA NEO4J 3.xNEO4J SERVER EXTENSION
neo4art example
ADD THIS LINE TO THE NEO4J CONFIGURATION FILE:
org.neo4j.server.thirdparty_jaxrs_classes=it.inserpio.neo4art=/neo4art
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
87
CURL THE EXTENSION
curl http://localhost:7474/neo4art/museums/lon/-96.8040343/lat/32.7748846/distanceInKm/100.0
[{
"id":1010,
"name":"Dallas Museum of Art",
"address":"1717 N. Harwood, Dallas, TX Woodall Rodgers Freeway, Dallas, Texas, USA",
"wikipedia":"http://en.wikipedia.org/wiki/Dallas_Museum_of_Art",
"website":"http://www.dallasmuseumofart.org/",
"latitude":32.787222,
"longitude":-96.800833,
}]
SPRING DATA NEO4J 3.xNEO4J SERVER EXTENSION
neo4art example
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
SDN.next()
88
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
89
LOOKING AHEADWE WORK WITH PARTNERS AT MAINTAINING SDN 3.x
● Keep development in sync with the other Spring Data projects
● Update to latest versions of Neo4j
● Bug-Fixes and solving issues
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
90
LOOKING AHEADEFFORT TO BUILD A NEW VERSION OF SDN BASED ON CYPHER
● Cypher will be the de-factor API for Neo4j
● Embedded and Remote
● Expressive language for simple and complex CRUD operations
● Mapping of query results into object networks
● Transaction Handling
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
91
LOOKING AHEADTECHNICAL ASPECTS OF SDN.next
● Based on Neo4j-JDBC driver
– Transparent remote + embedded access
● Concise Java-Object Graph Mapping using Cypher
– Simple CRUD
– Complex Result Mapping
● Transactions via JDBC (DatasourceTM)
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
92
LOOKING AHEADINTEGRATION OF SPRING DATA NEO4J
● Neo4jTemplate will integrate with JDBC-Driver
● Mapping information from SDN will configure the OGM
● Spring Config
● Spring Data Repositories
● No different mapping modes
● Integration with Conversion services and lifecycle methods
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
93
LOOKING AHEADWHAT DO WE EXPECT FROM THAT NEW VERSION?
● Consistent, fast performance
● Will get faster with Cypher and Neo4j
● Minimal overhead
● Transactions over the wire
● Much simpler codebase, simpler configuration, easier to maintain
● Plain Java OGM for other environments
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
94
LOOKING AHEADSDN.next ARCHITECTURE
Spr
ing
Dat
a
Pur
e Ja
va
Pure Java OGM
Mapping
CRUD
Cypher Result
Mapping
Spring DataIntegration
Spring Data Neo4j
Neo4j JDBC Driver
Cypher remote + embedded
Transactions
JDBC-API
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
Q&A
95
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
96
SPRING DATA NEO4JBOOKS
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
WHEATFIELD WITH CROWS, 1890 – VINCENT VAN GOGH
97
SPRING DATA NEO4J
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under aCreative Commons Attr ibution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/
98
JOIN US ATGraphConnect 2014
Oct 22, SFO
LEARN MORE ABOUTNEO4J
graphacademy.com
COME TOOUR BOOTH
@neo4j | watch.neo4j.org
LEARN MORE. STAY CONNECTED.