SlideShare a Scribd company logo
1 of 107
Download to read offline
Webinar
               Introduction to
            Spring Data Neo4j 2.0
     Michael Hunger, Neo Technology


Thursday, March 15, 12
Me & You ?


        ๏ Me: Michael Hunger, Neo Technology
                 • passionate software developer / Neo4j German Division
                 • Spring Data Neo4j Project Lead
                 • Neo4j Cloud Hosting
                 • michael.hunger@neotechnology.com / @mesirii
        ๏ You:
                 • Java & Spring !
                 • Enterprise ?
                 • Rich Domain ?
                 • NOSQL ?
Thursday, March 15, 12
About the Webinar


        ๏ Covers Spring Data Neo4j only
        ๏ too much content anyway
        ๏ so it will be just a whirlwind tour

        ๏ no detailed introductions to NOSQL and Neo4j in particular
        ๏ for those go to http://neo4j.org

        ๏ Q&A at the end
        ๏ all your questions will be answered in a follow up blog post,
                    don‘t hesitate to ask
Thursday, March 15, 12
What‘s up?




                         ๏ Spring Data overview
                         ๏ Networks are everywhere
                         ๏ Neo4j introduction
                         ๏ Spring Data Neo4j introduction



                                                            4

Thursday, March 15, 12
Spring Data




                         5

Thursday, March 15, 12
What is NOSQL?




Thursday, March 15, 12
What is NOSQL?

                  It’s not “No to SQL”




Thursday, March 15, 12
What is NOSQL?

                  It’s not “No to SQL”
                                         It’s not “Never SQL”




Thursday, March 15, 12
What is NOSQL?

                  It’s not “No to SQL”
                                          It’s not “Never SQL”


                         It’s “Not       Only SQL”




Thursday, March 15, 12
What is NOSQL?

                  It’s not “No to SQL”
                                             It’s not “Never SQL”


                         It’s “Not       Only SQL”
                   NOSQL no-seek-wool n. Describes ongoing
                   trend where developers increasingly opt for
                   non-relational databases to help solve their
                   problems, in an effort to use the right tool for
                   the right job.



Thursday, March 15, 12
NOSQL categories

      We see four main categories in the NOSQL space:




Thursday, March 15, 12
NOSQL categories

      We see four main categories in the NOSQL space:

                Key-Value
                       •Redis
                       •Riak
                         •Voldemort




Thursday, March 15, 12
NOSQL categories

      We see four main categories in the NOSQL space:

                                       Column-family/
                Key-Value
                                       BigTable
                       •Redis
                       •Riak                     •Cassandra
                         •Voldemort              •HBase




Thursday, March 15, 12
NOSQL categories

      We see four main categories in the NOSQL space:

                                       Column-family/
                Key-Value
                                       BigTable
                       •Redis
                       •Riak                     •Cassandra
                         •Voldemort              •HBase



               Document

                           •MongoDB
                           •CouchDB




Thursday, March 15, 12
NOSQL categories

      We see four main categories in the NOSQL space:

                                       Column-family/
                Key-Value
                                       BigTable
                       •Redis
                       •Riak                     •Cassandra
                         •Voldemort              •HBase



               Document                 Graph
                                                  •Neo4j
                           •MongoDB
                                                  •InfiniteGraph
                           •CouchDB
                                                  •OrientDB
                                                  •DEX


Thursday, March 15, 12
Scaling to size vs. Scaling to complexity

                         Size
                            Key-Value stores

                                         Bigtable clones
                                                       Document databases
                                                                            Graph databases




                                                                                      Complexity

                                                                                              8

Thursday, March 15, 12
Scaling to size vs. Scaling to complexity

                         Size
                            Key-Value stores

                                         Bigtable clones
                                                       Document databases
                                                                            Graph databases

                                                                                     Billions of nodes
                                                                                     and relationships




                                                                                      Complexity

                                                                                              8

Thursday, March 15, 12
Scaling to size vs. Scaling to complexity

                         Size
                            Key-Value stores

                                         Bigtable clones
                                                       Document databases
                                                                            Graph databases

                                                                                     Billions of nodes
                                                                                     and relationships




                                               > 90% of use cases
                                                                                      Complexity

                                                                                              8

Thursday, March 15, 12
Why NOSQL now?
     We have observed four trends since the 90‘s:


       ๏ Trend 1: Size of data is growing
       ๏ Trend 2: Data is increasingly connected
       ๏ Trend 3: Data is increasingly semi-structured
       ๏ Trend 4: Change in architecture




Thursday, March 15, 12
What is Spring Data?


        ๏ VMWare/SpringSource initiative to give Spring developers easy
                    access to the emerging world of NOSQL, including:

                 • Non-relational databases
                 • Grails NOSQL support
                 • Cross-store persistence
                 • Object Persistence Mapping Infrastructure
                 • Generic Repository Infrastructure
                 • upcoming Spring Roo add-ons
                                                                        10

Thursday, March 15, 12
Spring Data projects
        ๏ Code is in SpringSource git repository:
                         • http://springsource.org/spring-data
                         • https://github.com/SpringSource/spring-data-*
        ๏ Includes:
                 • data-commons
                 • spring-data-graph-neo4j
                 • spring-data-{redis,riak}
                 • spring-data-mongo
                 • spring-data-jdbc
                 • spring-data-jpa
Thursday, March 15, 12
Spring Data Neo4j


        ๏ Focus on Spring Data Neo4j
        ๏ VMWare is collaborating with Neo Technology, the company behind
                   the Neo4j graph database.


        ๏ Improved programming model: Annotation-based
                   programming model for applications with rich domain models
        ๏ Cross-store persistence: Extend existing JPA application with
                   NOSQL persistence
        ๏ Spring Roo support: Add graph persistence with Roo add-on


Thursday, March 15, 12
Graphs are
      everywhere




                         13

Thursday, March 15, 12
Even in the Matrix
                   - everything is a graph

                         Google Image Search: „graph OR network“




                                                               14

Thursday, March 15, 12
Graphs Everywhere

        ๏ Relationships in
                 • Politics, Economics, History, Science,Transportation
        ๏ Biology, Chemistry, Physics, Sociology
                 • Body, Ecosphere, Reaction, Interactions
        ๏ Internet / IT
                 • Hardware, Software, Interaction
        ๏ Social Networks
                 • Family, Friends
                 • Work, Communities
                 • Neighbours, Cities, Society
Thursday, March 15, 12
                                                                          15
Good Relationships


        ๏ World is rich, messy and related data
        ๏ Relationships are as least as important as the things they connect
        ๏ Graphs = Whole > Sum of all parts
        ๏ Complex interactions
        ๏ Always changing, change of structures as well

        ๏ Graph => Relationships are part of the data
        ๏ RDBMS => Relationships part of the fixed schema

                                                                       16

Thursday, March 15, 12
Questions and Answers


        ๏ Complex Questions
        ๏ Answers lie between the lines (things)
        ๏ Locality of the information
        ๏ Global searches / operations very expensive
        ๏ Constant query time, regardless of data volume




                                                           17

Thursday, March 15, 12
Categories ?


        ๏ Categories == Classes, Trees ?
        ๏ What if more than one category fits?
        ๏ Tags
        ๏ Categories via relationships like „IS_A“
        ๏ Any number, easy to change
        ๏ „Virtual“ Relationships - Traversals
        ๏ Category dynamically derived from queries


                                                      18

Thursday, March 15, 12
Neo4j introduction


Thursday, March 15, 12
What is Neo4j?
                         data model




Thursday, March 15, 12
What is Neo4j?
                                    data model




                         A Graph Database




Thursday, March 15, 12
What is Neo4j?
                                    data model




                         A Graph Database




Thursday, March 15, 12
What is Neo4j?
                                    data model




                         A Graph Database




Thursday, March 15, 12
What is Neo4j?
                                           data model




                                A Graph Database




                         Node                           Node




Thursday, March 15, 12
What is Neo4j?
                                                     data model




                                A Graph Database




                                    Typed relationship
                         Node                                     Node




Thursday, March 15, 12
What is Neo4j?
                                                       data model




                                  A Graph Database




                           Node       Typed relationship
                                                                    Node
                         key: value      key: value




Thursday, March 15, 12
For example




Thursday, March 15, 12
For example




                    name: Oliver




Thursday, March 15, 12
For example




                    name: Oliver   name: Michael




Thursday, March 15, 12
For example




                                   WORKS_WITH
                                   project: spring-data
                    name: Oliver                          name: Michael




Thursday, March 15, 12
For example




                                         WORKS_WITH
                                         project: spring-data
                    name: Oliver                                name: Michael
                             EM
                              PL




                                                                   LIVES_IN
                                 OY
                                    E
                                   D_
                                    BY




                                                                city: Dresden
                               company: VMware                  country: DE




Thursday, March 15, 12
For example
                                                  name: Rod

                                                                      KN
                                           S                            OW
                                      OW                                     S
                                    KN



                                               WORKS_WITH
                                               project: spring-data
                    name: Oliver                                                 name: Michael
                             EM
                              PL




                                                                                    LIVES_IN
                                 OY
                                    E
                                   D_
                                    BY




                                                                                 city: Dresden
                               company: VMware                                   country: DE




Thursday, March 15, 12
For example
                                                  name: Rod

                                                                      KN
                                           S                            OW
                                      OW                                     S
                                    KN



                                               WORKS_WITH
                                               project: spring-data
                    name: Oliver                                                 name: Michael
                             EM
                              PL




                                                                                    LIVES_IN
                    S




                                 OY
                LIKE




                                    E
                                   D_
                                    BY




                                                                                 city: Dresden
     food: Chinese
                               company: VMware                                   country: DE




Thursday, March 15, 12
Facts about Neo4j

     •Written in Java
     •Embeddable or standalone Server
     •Schema-free - perfect for rich domains
     •Fully transactional (ACID)
     •Persistent to custom on-disk file structure
     •Traversal speeds of 1,000,000+ hops per second
     •Integrated indexing
     •Plenthora of language bindings
     •24/7 production since 2003



Thursday, March 15, 12
Show me some code, please

        GraphDatabaseService graphDb =
           new EmbeddedGraphDatabase(“var/neo4j”);

        Node david = graphDb.createNode();
        Node andreas = graphDb.createNode();

        david.setProperty(“name”, “David Montag”);
        andreas.setProperty(“name”, “Andreas Kollegger”);

        Relationship presentedWith = david.createRelationshipTo(
          andreas, PresentationTypes.PRESENTED_WITH);
        presentedWith.setProperty(“date”, System.currentTimeMillis());




Thursday, March 15, 12
Show me some code, please

        GraphDatabaseService graphDb =
           new EmbeddedGraphDatabase(“var/neo4j”);
        Transaction tx = graphDb.beginTx();
        try {
          Node david = graphDb.createNode();
          Node andreas = graphDb.createNode();

             david.setProperty(“name”, “David Montag”);
             andreas.setProperty(“name”, “Andreas Kollegger”);

          Relationship presentedWith = david.createRelationshipTo(
            andreas, PresentationTypes.PRESENTED_WITH);
          presentedWith.setProperty(“date”, System.currentTimeMillis());
          tx.success();
        } finally {
          tx.finish();
        }




Thursday, March 15, 12
Traversal framework




Thursday, March 15, 12
Traversal framework
     Example: a dependency graph




                         A




                             B
                                   D
           C




Thursday, March 15, 12
Traversal framework
     Example: a dependency graph

     Query: Find all dependencies of A, transitively



                         A




                             B
                                                       D
           C




Thursday, March 15, 12
Traversal framework
     Example: a dependency graph

     Query: Find all dependencies of A, transitively



                         A




                             B
                                                       D
           C




Thursday, March 15, 12
Traversal framework
     Example: a dependency graph

     Query: Find all dependencies of A, transitively



                         A




                             B
                                                       D
           C




Thursday, March 15, 12
Traversal framework
     Example: a dependency graph

     Query: Find all dependencies of A, transitively



                         A




                             B
                                                       D
           C




Thursday, March 15, 12
Traversal framework
     Example: a dependency graph

     Query: Find all dependencies of A, transitively                  A




                                                                          B
                                                                              D
                                                                  C




         TraversalDescription desc = Traversal.description()
             .relationships(ExampleTypes.DEPENDS_ON, Direction.OUTGOING);

         Node a = ...;

         for (Node dependency : desc.traverse(a).nodes()) {
           print(dependency);
         }




Thursday, March 15, 12
So how do I find a node
    to traverse from?




                         ?




Thursday, March 15, 12
So how do I find a node
    to traverse from?

                                       g!
                                     in
                                ex
                           i nd
                    i ng
               us
         B y                                ?




Thursday, March 15, 12
So how do I find a node
    to traverse from?

                                       g!
                                     in
                                ex
                           i nd
                    i ng
               us
         B y                            name: David
                                                      ?




Thursday, March 15, 12
So how do I find a node
    to traverse from?

                                       g!
                                     in
                                ex
                           i nd
                    i ng
               us
         B y                            name: David
                                                        ?
                                                      David




Thursday, March 15, 12
So how do I find a node
    to traverse from?

                                       g!    Andreas
                                     in
                                ex
                           i nd                                Michael

                    i ng
               us
         B y                            name: David
                                                         ?
                                                       David



                                        Ed

                                                               Allison




Thursday, March 15, 12
Cypher Query Language
        ๏ Declarative query language
                 • Describe what you want, not how
                 • Based on pattern matching
        ๏ Examples:
                START david=node:people(name=”David M”)   # index lookup
                MATCH david-[:knows]-friends-[:knows]-new_friends
                WHERE new_friends.age > 18
                RETURN new_friends

                START user=node(5, 15, 26, 28)   # node IDs
                MATCH user--friend
                RETURN user, COUNT(friend), SUM(friend.money)




                                                                           26

Thursday, March 15, 12
Beyond basics
        ๏ Traversal API / DSL
                 • Express powerful Graph Traversals succinctly
        ๏ Graph algorithm library
                 • Cheapest path (Dijkstra, A*)
                 • Shortest path
                 • Simple paths
                 • All paths
        ๏ REST API access to Neo4j Standalone Server
        ๏ High availability and online backups
                                                                  27

Thursday, March 15, 12
Spring Data Neo4j 2.0


Thursday, March 15, 12
Spring Framework Conveniences

        ๏ default enterprise development framework
        ๏ future Java Cloud stack
        ๏ POJO centric application design
        ๏ made AspectJ aspects socially acceptable (tx-config, @Configurable)
        ๏ Template programming model
        ๏ Inversion of Control / Dependency Injection
        ๏ Spring Java Config, configuration XML-namespaces
        ๏ lots of powerful libraries and library abstractions
        ๏ existing, well-known persistence framework for JDBC
        ๏ Spring Data project
Thursday, March 15, 12
Programming model overview

        ๏ SDN is the brain child of Rod Johnson and Emil Eifrém
                 • Wrote functional initial prototype
                 • Developed by Neo Technology and SpringSource teams
        ๏ Uses annotations to define graph entities
        ๏ Entity state backed by graph database
        ๏ Two modes of Object Graph Mapping
                 • POJO Graph Mapping
                 • seamless AspectJ backed Object Graph Mapping
        ๏ Spring Roo add-on available

Thursday, March 15, 12
Spring Data Neo4j features
        ๏ Annotation-based programming model
        ๏ Spring Data Commons Repository support
        ๏ Neo4j Query (Cypher, Gremlin) and Traversal support
                 • on dynamic fields and via repository methods
        ๏ Neo4j indexing support (includes fulltext and numeric range queries)
        ๏ Entity types stored in the graph database as well
        ๏ Dynamic type projection (duck typing)
        ๏ Cross-store support for partial JPA / graph entities
        ๏ Support for JSR-303 (bean validation)
        ๏ Support for the Neo4j Server (remote server and in server extension)
        ๏ Neo4jTemplate with exception translation, optional transaction management and
                    more
                                                                               31

Thursday, March 15, 12
Classic Neo4j domain class

          public class Actor {
              private final Node underlyingNode;

                 Actor( final Node node ) {
                     underlyingNode = node;
                 }

                 public Node getUnderlyingNode() {
                     return underlyingNode;
                 }

                 public final String getName() {
                     return (String) underlyingNode.getProperty( “name” );
                 }

                 public void setName( final String name ) {
                     underlyingNode.setProperty( “name”, name );
                 }
          }




Thursday, March 15, 12
Spring Data Neo4j domain class


       @NodeEntity
       public class Actor {
           @Indexed
           private String name;
       }




Thursday, March 15, 12
What about relationships
        @NodeEntity
        class Actor {
          ...

            public Iterable
                            <Movie> getMovi
              final List<Movi               es() {
                              e> movies = new
              for ( Relations                  LinkedList<Movi
                              hip rel : under                  e>();
                RelTypes.ACTS_I               lyingNode.getRe
                                N, Direction.OU               lationships(
                  movies.add( new               TGOING ) ) {
                                   Movie( rel.getE
                }
             return movies;
                                                   ndNode() ) );
                                                                     Old
           }
                                                              class)
           @RelatedTo(type="ACTS_ IN", elementClass = Movie.
                                     ;
           private Set<Movie> movies

            public Iterable<Movie> ge
                                      tMovies() {
                                                                       New
              return movies;
            }



Thursday, March 15, 12
Defining entity classes




Thursday, March 15, 12
Defining entity classes

    • @NodeEntity
        • Represents a node in the graph
        • Fields saved as properties on node
        • References stored as relationships between nodes
        • Instantiated using Java ‘new’ keyword, like any POJO
        • Also returned by lookup mechanisms
        • Type information stored in the graph




Thursday, March 15, 12
Defining entity classes




Thursday, March 15, 12
Defining entity classes

    • @RelationshipEntity
        • Represents a relationship in the graph
        • Fields saved as properties on relationship
        • Special fields for start- and end-nodes
        • Only returned by lookup methods




Thursday, March 15, 12
Fields in node entities (@NodeEntity)


       • Primitive types and strings are directly persisted
       • For all other types, Spring conversion support can be used
             • Enum and Date conversion is provided out-of-the-box
       • Transient fields not persisted
               @NodeEntity
               public class Actor {
                 private String name;
                 private int age;
                 private HairColor hairColor;
                 private transient String nickname;
               }



                                                                      37

Thursday, March 15, 12
Fields in node entities (@NodeEntity)
      • Fields of types that represent a node (@NodeEntity)




                                                              38

Thursday, March 15, 12
Fields in node entities (@NodeEntity)
      • Fields of types that represent a node (@NodeEntity)
         @NodeEntity
         public class Movie {}


         @NodeEntity
         public class Person {
           private Movie favoriteMovie;
         }




                                                              38

Thursday, March 15, 12
Fields in node entities (@NodeEntity)
      • Fields of types that represent a node (@NodeEntity)
         @NodeEntity
         public class Movie {}


         @NodeEntity
         public class Person {
           private Movie favoriteMovie;
         }

         @NodeEntity
         public class Movie {
           private Actor topActor;
         }


         @NodeEntity
         public class Actor {
           // Mirrors topActor in Movie
           @RelatedTo(type = ”topActor”, direction = Direction.INCOMING)
           private Movie wasTopActorIn;
         }
                                                                           38

Thursday, March 15, 12
Fields in node entities (@NodeEntity)
       • Fields of collections of node entities: @RelatedTo
            @NodeEntity
            public class Movie {}


            @NodeEntity
            public class Actor {
              @RelatedTo(type = “ACTS_IN”)
              private Set<Movie> movies;
            }




                                                              39

Thursday, March 15, 12
Fields in node entities (@NodeEntity)


        ๏ Fields of collections of relationship entities: @RelatedToVia
              @RelationshipEntity
              public class Role {
                @StartNode private Actor actor;
                @EndNode private Movie movie;
                private String roleName;
              }


              @NodeEntity
              public class Actor {
                @RelatedToVia(type = “ACTS_IN”)
                private Iterable<Role> roles;
              }



        ๏ Read only view of relationship entities                   40

Thursday, March 15, 12
Fields in relationship entities
     (@RelationshipEntity)
       • Primitive and convertible types work just the same


       • @StartNode and @EndNode provide access to the start and
                   end node entities for the relationship entity
             @RelationshipEntity
             public class Role {
               @StartNode private Actor actor;
               @EndNode private Movie movie;
               private String title;
             }




Thursday, March 15, 12
Indexing

    By annotating an entity field with @Indexed it becomes searchable:
           @NodeEntity
           public class Actor {
             @Indexed private String name;
             @Indexed private HairColor hairColor;




    It can then be looked up:
           GraphRepository<Actor> actorRepo =
               template.repositoryFor(Actor.class);
           Actor kevin =
               actorRepo.findByPropertyValue(“name”, “Kevin Bacon”);
           Iterable<Actor> allBlondActors =
               actorRepo.findAllByPropertyValue(“hairColor”, “blond”);




Thursday, March 15, 12
Indexing
         @NodeEntity
         public class Actor {
           @Indexed(type = FULLTEXT)
           private String name;


      ๏ Index name defaults to domain class name
      ๏ Index key defaults to field name
      ๏ Fulltext and spatial index types
      ๏ Repository query methods for any Lucene query, including ranges:
           Iterable<Actor> allKevinsOlderThan32 =
               actorRepo.findAllByQuery(“name:Kevin* AND age>32”);
           Iterable<Actor> youngActors =
               actorRepo.findAllByRange(“age”, 3, 18);




Thursday, March 15, 12
Traversal
     @NodeEntity
     public class Actor {
       @GraphTraversal(
          traversalBuilder = CoactorsTraversalDescriptionBuilder.class)
       private Iterable<Actor> coactors;
     }


     public class CoactorsTraversalDescriptionBuilder implements
         FieldTraversalDescriptionBuilder {
       public TraversalDescription build(...) {
         return Traversal.description()
             .evaluator(Evaluators.atDepth(2))
             .relationships(RelTypes.ACTS_IN);
       }
     }



      Example for dynamic field computation

                                                                          44

Thursday, March 15, 12
Cypher query language
     @NodeEntity
     public class Actor {
       @Query(“START actor=node({self}) ” +
              “MATCH actor-[:ACTS_IN]->movie<-[:ACTS_IN]-coactor ” +
              “RETURN coactor”)
       private Iterable<Actor> coactors;
     }




     @NodeEntity
     public class User {
       @Query(“START actor=node({self}) ” +
              “MATCH actor-[:ACTS_IN]->movie<-[:ACTS_IN]-coactor ” +
              “RETURN movie.title, coactor.name”)
       private List<Map<String, Object>> movieCoactorPairs;
     }




                                                                       45

Thursday, March 15, 12
POJO-Mapping
        ๏ Based on Spring-Data-Commons infrastructure
                 • Extract Mapping Meta Information
                 • Entity-Converter for Object-Graph-Mapping
                         ‣Type-resolution
                         ‣Entity construction
                         ‣Transfer properties
                         ‣Load Cache
                         ‣Load Policies + recurse for eagerly fetched relationships
                 • Neo4j-Template for Graph-Interaction
                                                                                  46

Thursday, March 15, 12
AspectJ
        ๏ Introduces interface to entities:
                 • NodeBacked into @NodeEntity classes
                 • RelationshipBacked into @RelationshipEntity classes
        ๏ NodeBacked introduces methods such as:
                 • relateTo
                 • findByQuery
                 • findAllByTraversal
                 • ...
        ๏ going to be pulled out in separate Active-Record-Mixin
                                                                         47

Thursday, March 15, 12
AspectJ - Tooling
        ๏ IDE‘s
                 • latest versions of STS / Eclipse with current AJDT plugin
                 • IntelliJ IDEA 10.5 compile + run, some editor quirks
                         ‣full AspectJ support in IDEA 11


        ๏ Build Systems
                 • Maven
                 • Gradle
                 • Ant / Ivy
                 • ...
                                                                               48

Thursday, March 15, 12
AspectJ - NodeBacked.relateTo
     <T extends RelationshipBacked> T NodeBacked.relateTo(
         NodeBacked node,
         Class<T> relationshipEntityType,
         String relationshipType
     );


     usage:
     @NodeEntity
     public class Actor {
       public Role actsIn(Movie movie, String roleName) {
         Role role = relateTo(movie, Role.class, “ACTS_IN”);
         role.setName(roleName);
         return role;
       }
     }



                                                               49

Thursday, March 15, 12
Interface based Repositories
        ๏ based on Repository infrastructure in Spring Data Commons
        ๏ just define the interface and the namespace configuration
        ๏ provide out-of-the-box support for
                 • CRUD-Operations
                 • Index-Lookups
                 • Traversal-Execution
                 • Annotated Graph-Queries (Cypher, Gremlin)
                 • Derived Queries
                 • Spatial Queries
        ๏ extensible via custom methods with provided implementations
                                                                   50

Thursday, March 15, 12
Repositories
     interface MovieRepository extends GraphRepository<Movie> {
         Movie findById(String id);
         Page<Movie> findByTitle(String title, Pageable page);
     }


     <neo4j:repositories base-package=“com.example.repositories„/>


     @Controller
     public class MovieController {
       @Autowired MovieRepository moviesRepository;


         @RequestMapping(value = "/movies/{movieId}",...)
         public String show(Model model, @PathVariable String movieId) {
            Movie movie = moviesRepository.findByPropertyValue("id", movieId);
            Movie movie = moviesRepository.findById(movieId);
            model.addAttribute("movie", movie);
            return "/movies/show";
         }}
                                                                             51

Thursday, March 15, 12
Repository-Query-Support
     interface MovieRepository extends GraphRepository<Movie> {


           @Query("start m=({movie}) match m-[ACTS_IN]-actor return actor")
           List<Actor> getActorsCypher(@Param("movie") Movie m);


           @Query("start movie =({0}) match (movie)<-[role:ACTS_IN]-(actor)
                   return actor.name, role.title")
           Iterable<Map<String,Object>> getCast(Movie m);


           @Query(value = "g.v(movie).out('ACTS_IN')", type = QueryType.Gremlin)
           Set<Person> getActorsGremlin(@Param("movie") Movie m);


           Page<Person> findByTitleAndActorsName(String title, String name,
                                                 Pageable page);
     }




                                                                              52

Thursday, March 15, 12
Neo4j-Template (I)

        ๏ well known Spring Template Pattern
        ๏ Resource / Transaction Management
        ๏ Convenience Methods
        ๏ Nodes and Entities handling & conversion
        ๏ Fluent Query Result Handling
        ๏ Works also via REST with Neo4j-Server
        ๏ Exception Translation



                                                     53

Thursday, March 15, 12
Neo4j-Template (II)
 template.lookup("node", "name", "David")
    .to(String.class, new PropertyContainerNameConverter()).single()


 template.traverse(node, traversal)
    .to(Integer.class,new ResultConverter<Path,Integer>() {
         public Integer convert(Path path, Class<String> type) {
             return path.length();
         }})


 template.query("start movie=(Movies,title, {m}) match movie-->actor return actor",
                map("m","Matrix")).to(Actor.class)


 template.execute("g.v(ref).outE", map("ref",0)).to(Relationship.class)




                                                                          54

Thursday, March 15, 12
REST-Client-Support
               <bean id="restGraphDatabaseService"
                     class="org.sf.data.neo4j.rest.SpringRestGraphDatabase">
                    <constructor-arg value="http://localhost:7473/db/data" />
               </bean>


               <datagraph:config graphDatabaseService="restGraphDatabaseService"/>




        ๏ drop-in replacement for the embedded GraphDatabase
        ๏ works transparently with POJO-Entity-Mapping and
              Neo4j-Template



                                                                                55

Thursday, March 15, 12
REST-Server-Support
       public class HelloWorldInitializer extends SpringPluginInitializer {
           public HelloWorldInitializer() {
               super(new String[]{"spring/helloWorldServer-Context.xml"},
                     Pair.of("worldRepository", WorldRepository.class),
                     Pair.of("graphRepositoryFactory",
                                         GraphRepositoryFactory.class));
           }
       }




        ๏ integrate Spring Data Neo4j config with already running
              Graph-Database in Neo4j-Server
        ๏ expose Spring Beans as Jersey Injectables


                                                                              56

Thursday, March 15, 12
Cross-store persistence


Thursday, March 15, 12
A scenario...
     You have a traditional web app using JPA to persist data to a relational
       database




Thursday, March 15, 12
Option C: Introducing cross-store
    	

 persistence

        ๏ JPA data and NOSQL data can share a data model
        ๏ Could be the entire entity, or some fields of an entity
        ๏ We call this cross-store persistence
                 • One transaction managerdatabase the NOSQL database
                     with the JPA relational
                                             to coordinate


                 • AspectJ support to manage the NOSQL entities and fields



Thursday, March 15, 12
The JPA data model
                                 Restaurant                           UserAccount
                         @Entity                       @Entity
                         public class Restaurant {     @Table(name = "user_account")
                             @Id @GeneratedValue       public class UserAccount {
                             private Long id;              @Id @GeneratedValue
                             private String name;          private Long id;
                             private String city;          private String userName;
                             private String state;         private String firstName;
                             private String zipCode;       private String lastName;
                                                           @Temporal(TemporalType.TIMESTAMP)
                                                           private Date birthDate;
                                                           @ManyToMany(cascade = CascadeType.ALL)
                                                           private Set<Restaurant> favorites;




Thursday, March 15, 12
Adding to the data model

                                   Restaurant                              UserAccount
                          @Entity                           @Entity
                          @NodeEntity(partial = true)       @Table(name = "user_account")
                          public class Restaurant {         @NodeEntity(partial = true)
                            @Id @GeneratedValue             public class UserAccount {
                            private Long id;                  @Id @GeneratedValue
                            private String name;              private Long id;
                            private String city;              private String userName;
                            private String state;             private String firstName;
                            private String zipCode;           private String lastName;
                                                              @Temporal(TemporalType.TIMESTAMP)
                                                              private Date birthDate;
                                                              @ManyToMany(cascade = CascadeType.ALL)
                                Recommendation                private Set<Restaurant> favorites;

                         @RelationshipEntity                  @GraphProperty
                         public class Recommendation {        String nickname;
                           @StartNode                         @RelatedTo(type = "friends",
                           private UserAccount user;               elementClass = UserAccount.class)
                           @EndNode                           Set<UserAccount> friends;
                           private Restaurant restaurant;     @RelatedToVia(type = "recommends",
                           private int stars;                      elementClass = Recommendation.class)
                           private String comment;            Iterable<Recommendation> recommendations;




Thursday, March 15, 12
Adding to the data model

                                   Restaurant                              UserAccount
                          @Entity                           @Entity
                          @NodeEntity(partial = true)       @Table(name = "user_account")
                          public class Restaurant {         @NodeEntity(partial = true)
                            @Id @GeneratedValue             public class UserAccount {
                            private Long id;                  @Id @GeneratedValue
                            private String name;              private Long id;
                            private String city;              private String userName;
                            private String state;             private String firstName;
                            private String zipCode;           private String lastName;
                                                              @Temporal(TemporalType.TIMESTAMP)
                                                              private Date birthDate;
                                                              @ManyToMany(cascade = CascadeType.ALL)
                                Recommendation                private Set<Restaurant> favorites;

                         @RelationshipEntity                  @GraphProperty
                         public class Recommendation {        String nickname;
                           @StartNode                         @RelatedTo(type = "friends",
                           private UserAccount user;               elementClass = UserAccount.class)
                           @EndNode                           Set<UserAccount> friends;
                           private Restaurant restaurant;     @RelatedToVia(type = "recommends",
                           private int stars;                      elementClass = Recommendation.class)
                           private String comment;            Iterable<Recommendation> recommendations;




Thursday, March 15, 12
Adding to the data model

                                   Restaurant                              UserAccount
                          @Entity                           @Entity
                          @NodeEntity(partial = true)       @Table(name = "user_account")
                          public class Restaurant {         @NodeEntity(partial = true)
                            @Id @GeneratedValue             public class UserAccount {
                            private Long id;                  @Id @GeneratedValue
                            private String name;              private Long id;
                            private String city;              private String userName;
                            private String state;             private String firstName;
                            private String zipCode;           private String lastName;
                                                              @Temporal(TemporalType.TIMESTAMP)
                                                              private Date birthDate;
                                                              @ManyToMany(cascade = CascadeType.ALL)
                                Recommendation                private Set<Restaurant> favorites;

                         @RelationshipEntity                  @GraphProperty
                         public class Recommendation {        String nickname;
                           @StartNode                         @RelatedTo(type = "friends",
                           private UserAccount user;               elementClass = UserAccount.class)
                           @EndNode                           Set<UserAccount> friends;
                           private Restaurant restaurant;     @RelatedToVia(type = "recommends",
                           private int stars;                      elementClass = Recommendation.class)
                           private String comment;            Iterable<Recommendation> recommendations;




Thursday, March 15, 12
Adding to the data model

                                   Restaurant                              UserAccount
                          @Entity                           @Entity
                          @NodeEntity(partial = true)       @Table(name = "user_account")
                          public class Restaurant {         @NodeEntity(partial = true)
                            @Id @GeneratedValue             public class UserAccount {
                            private Long id;                  @Id @GeneratedValue
                            private String name;              private Long id;
                            private String city;              private String userName;
                            private String state;             private String firstName;
                            private String zipCode;           private String lastName;
                                                              @Temporal(TemporalType.TIMESTAMP)
                                                              private Date birthDate;
                                                              @ManyToMany(cascade = CascadeType.ALL)
                                Recommendation                private Set<Restaurant> favorites;

                         @RelationshipEntity                  @GraphProperty
                         public class Recommendation {        String nickname;
                           @StartNode                         @RelatedTo(type = "friends",
                           private UserAccount user;               elementClass = UserAccount.class)
                           @EndNode                           Set<UserAccount> friends;
                           private Restaurant restaurant;     @RelatedToVia(type = "recommends",
                           private int stars;                      elementClass = Recommendation.class)
                           private String comment;            Iterable<Recommendation> recommendations;




Thursday, March 15, 12
Adding to the data model

                                   Restaurant                              UserAccount
                          @Entity                           @Entity
                          @NodeEntity(partial = true)       @Table(name = "user_account")
                          public class Restaurant {         @NodeEntity(partial = true)
                            @Id @GeneratedValue             public class UserAccount {
                            private Long id;                  @Id @GeneratedValue
                            private String name;              private Long id;
                            private String city;              private String userName;
                            private String state;             private String firstName;
                            private String zipCode;           private String lastName;
                                                              @Temporal(TemporalType.TIMESTAMP)
                                                              private Date birthDate;
                                                              @ManyToMany(cascade = CascadeType.ALL)
                                Recommendation                private Set<Restaurant> favorites;

                         @RelationshipEntity                  @GraphProperty
                         public class Recommendation {        String nickname;
                           @StartNode                         @RelatedTo(type = "friends",
                           private UserAccount user;               elementClass = UserAccount.class)
                           @EndNode                           Set<UserAccount> friends;
                           private Restaurant restaurant;     @RelatedToVia(type = "recommends",
                           private int stars;                      elementClass = Recommendation.class)
                           private String comment;            Iterable<Recommendation> recommendations;




Thursday, March 15, 12
Spring Data Neo4j Roo add-on
       ๏ Roo adding support for non-JPA
                   persistence providers
       ๏ Spring Data Neo4j was the first
                   NOSQL persistence Roo
                   Add-On
       ๏ See the chapter on Spring Data
                   Neo4j in the latest O’Reilly
                   Roo book, Getting Started with
                   Roo.




                                                    62

Thursday, March 15, 12
Spring Data Neo4j Roo add-on

      roo> project --topLevelPackage org.neo4j.imdb
      roo> graph setup --provider NEO4J --databaseLocation target/imdb

      roo> graph entity --class ~.model.Movie
      roo> field string title
      roo> field number --fieldName year --type java.lang.Integer --permitReservedWords --primitive

      roo> graph entity --class ~.model.Actor
      roo> field string name

      roo> graph relationship --to Movie --from Actor --fieldName movies --type ACTS_IN
             --cardinality ONE_TO_MANY
      roo> graph relationship --via ~.model.Role --to Movie --from Actor --fieldName roles
             --type ACTS_IN --cardinality ONE_TO_MANY
      roo> graph relationship --from Movie --to Actor --type ACTS_IN --fieldName actors
             --direction INCOMING --cardinality MANY_TO_ONE
      roo> field string --fieldName title --class ~.model.Role

      roo> controller scaffold --class ~.web.ActorController --entity ~.model.Actor
      roo> controller scaffold --class ~.web.MovieController --entity ~.model.Movie



                                                                                             63

Thursday, March 15, 12
Spring Data Neo4j Guidebook
                              “Good Relationships”
         “I’m excited about Spring Data Neo4j.... Spring Data Neo4j makes working
         with Neo4j amazingly easy, and therefore has the potential to make you
         more successful as a developer.”
                                                       Rod Johnson, founder of Spring
        ๏ Spring Data Neo4j comes with a great Guide Book, featuring:
                 • Forewords by Rod Johnson and Emil Eifrem
                 • An easy to read, narrative tutorial walkthrough for cineasts.net
                 • A comprehensive reference for all the details
                 • Check it out here: http://spring.neo4j.org/guide
                                                                              64

Thursday, March 15, 12
The end (and the beginning!)
        ๏ See the Spring Data Neo4j site for more info:
                    http://spring.neo4j.org
        ๏ Check out the developer notes at GitHub:
                    http://spring.neo4j.org/notes
        ๏ Again, don’t miss our fantastic e-book on Spring Data Neo4j:
                    http://spring.neo4j.org/guide
        ๏ Spring Data Forum at
                    http://spring.neo4j.org/discussions
        ๏ All about Neo4j:
                    http://neo4j.org
        ๏ Neo4j videos and webinars:
                    http://video.neo4j.org


Thursday, March 15, 12
Cineasts.net




      Check Out: http://spring.neo4j.org/tutorial
Thursday, March 15, 12

More Related Content

What's hot

SQL? NoSQL? NewSQL?!? What’s a Java developer to do? - JDC2012 Cairo, Egypt
SQL? NoSQL? NewSQL?!? What’s a Java developer to do? - JDC2012 Cairo, EgyptSQL? NoSQL? NewSQL?!? What’s a Java developer to do? - JDC2012 Cairo, Egypt
SQL? NoSQL? NewSQL?!? What’s a Java developer to do? - JDC2012 Cairo, EgyptChris Richardson
 
Big Data Cloud Meetup - Jan 29 2013 - Mike Stonebraker & Scott Jarr of VoltDB
Big Data Cloud Meetup - Jan 29 2013 - Mike Stonebraker & Scott Jarr of VoltDBBig Data Cloud Meetup - Jan 29 2013 - Mike Stonebraker & Scott Jarr of VoltDB
Big Data Cloud Meetup - Jan 29 2013 - Mike Stonebraker & Scott Jarr of VoltDBBigDataCloud
 
Non relational databases-no sql
Non relational databases-no sqlNon relational databases-no sql
Non relational databases-no sqlRam kumar
 
NoSQL databases and managing big data
NoSQL databases and managing big dataNoSQL databases and managing big data
NoSQL databases and managing big dataSteven Francia
 
Semantic Technologies and Triplestores for Business Intelligence
Semantic Technologies and Triplestores for Business IntelligenceSemantic Technologies and Triplestores for Business Intelligence
Semantic Technologies and Triplestores for Business IntelligenceMarin Dimitrov
 
"Navigating the Database Universe" by Dr. Michael Stonebraker and Scott Jarr,...
"Navigating the Database Universe" by Dr. Michael Stonebraker and Scott Jarr,..."Navigating the Database Universe" by Dr. Michael Stonebraker and Scott Jarr,...
"Navigating the Database Universe" by Dr. Michael Stonebraker and Scott Jarr,...lisapaglia
 
Sharing data on the web (2013)
Sharing data on the web (2013)Sharing data on the web (2013)
Sharing data on the web (2013)3 Round Stones
 
Delivering the Data Factory, Data Reservoir and a Scalable Oracle Big Data Ar...
Delivering the Data Factory, Data Reservoir and a Scalable Oracle Big Data Ar...Delivering the Data Factory, Data Reservoir and a Scalable Oracle Big Data Ar...
Delivering the Data Factory, Data Reservoir and a Scalable Oracle Big Data Ar...Mark Rittman
 

What's hot (9)

SQL? NoSQL? NewSQL?!? What’s a Java developer to do? - JDC2012 Cairo, Egypt
SQL? NoSQL? NewSQL?!? What’s a Java developer to do? - JDC2012 Cairo, EgyptSQL? NoSQL? NewSQL?!? What’s a Java developer to do? - JDC2012 Cairo, Egypt
SQL? NoSQL? NewSQL?!? What’s a Java developer to do? - JDC2012 Cairo, Egypt
 
Big Data Cloud Meetup - Jan 29 2013 - Mike Stonebraker & Scott Jarr of VoltDB
Big Data Cloud Meetup - Jan 29 2013 - Mike Stonebraker & Scott Jarr of VoltDBBig Data Cloud Meetup - Jan 29 2013 - Mike Stonebraker & Scott Jarr of VoltDB
Big Data Cloud Meetup - Jan 29 2013 - Mike Stonebraker & Scott Jarr of VoltDB
 
Non relational databases-no sql
Non relational databases-no sqlNon relational databases-no sql
Non relational databases-no sql
 
NoSQL databases and managing big data
NoSQL databases and managing big dataNoSQL databases and managing big data
NoSQL databases and managing big data
 
Semantic Technologies and Triplestores for Business Intelligence
Semantic Technologies and Triplestores for Business IntelligenceSemantic Technologies and Triplestores for Business Intelligence
Semantic Technologies and Triplestores for Business Intelligence
 
Relational vs. Non-Relational
Relational vs. Non-RelationalRelational vs. Non-Relational
Relational vs. Non-Relational
 
"Navigating the Database Universe" by Dr. Michael Stonebraker and Scott Jarr,...
"Navigating the Database Universe" by Dr. Michael Stonebraker and Scott Jarr,..."Navigating the Database Universe" by Dr. Michael Stonebraker and Scott Jarr,...
"Navigating the Database Universe" by Dr. Michael Stonebraker and Scott Jarr,...
 
Sharing data on the web (2013)
Sharing data on the web (2013)Sharing data on the web (2013)
Sharing data on the web (2013)
 
Delivering the Data Factory, Data Reservoir and a Scalable Oracle Big Data Ar...
Delivering the Data Factory, Data Reservoir and a Scalable Oracle Big Data Ar...Delivering the Data Factory, Data Reservoir and a Scalable Oracle Big Data Ar...
Delivering the Data Factory, Data Reservoir and a Scalable Oracle Big Data Ar...
 

Viewers also liked

Modelling Data in Neo4j (plus a few tips)
Modelling Data in Neo4j (plus a few tips)Modelling Data in Neo4j (plus a few tips)
Modelling Data in Neo4j (plus a few tips)Michal Bachman
 
Neo4j Makes Graphs Easy
Neo4j Makes Graphs EasyNeo4j Makes Graphs Easy
Neo4j Makes Graphs EasyNeo4j
 
Neo4j Spatial at LocationDay 2013 in Malmö
Neo4j Spatial at LocationDay 2013 in MalmöNeo4j Spatial at LocationDay 2013 in Malmö
Neo4j Spatial at LocationDay 2013 in MalmöCraig Taverner
 
Neo4j Spatial - FooCafe September 2015
Neo4j Spatial - FooCafe September 2015Neo4j Spatial - FooCafe September 2015
Neo4j Spatial - FooCafe September 2015Craig Taverner
 
Relational to Graph - Import
Relational to Graph - ImportRelational to Graph - Import
Relational to Graph - ImportNeo4j
 
Managing Connected Big Data in Art with Neo4j Graph Database - Lorenzo Speran...
Managing Connected Big Data in Art with Neo4j Graph Database - Lorenzo Speran...Managing Connected Big Data in Art with Neo4j Graph Database - Lorenzo Speran...
Managing Connected Big Data in Art with Neo4j Graph Database - Lorenzo Speran...Codemotion
 
GraphDay Stockholm - Fraud Prevention
GraphDay Stockholm - Fraud PreventionGraphDay Stockholm - Fraud Prevention
GraphDay Stockholm - Fraud PreventionNeo4j
 
Converting Relational to Graph Databases
Converting Relational to Graph DatabasesConverting Relational to Graph Databases
Converting Relational to Graph DatabasesAntonio Maccioni
 
LEND360: "Identity Data for the Customer Lifecycle"
LEND360: "Identity Data for the Customer Lifecycle"LEND360: "Identity Data for the Customer Lifecycle"
LEND360: "Identity Data for the Customer Lifecycle"Whitepages Pro
 
Neo4j Solutions - Master Data Management
Neo4j Solutions - Master Data ManagementNeo4j Solutions - Master Data Management
Neo4j Solutions - Master Data ManagementCaserta
 
Big MDM Part 2: Using a Graph Database for MDM and Relationship Management
Big MDM Part 2: Using a Graph Database for MDM and Relationship ManagementBig MDM Part 2: Using a Graph Database for MDM and Relationship Management
Big MDM Part 2: Using a Graph Database for MDM and Relationship ManagementCaserta
 
faradays law and its applications ppt
faradays law and its applications pptfaradays law and its applications ppt
faradays law and its applications pptIndira Kundu
 

Viewers also liked (12)

Modelling Data in Neo4j (plus a few tips)
Modelling Data in Neo4j (plus a few tips)Modelling Data in Neo4j (plus a few tips)
Modelling Data in Neo4j (plus a few tips)
 
Neo4j Makes Graphs Easy
Neo4j Makes Graphs EasyNeo4j Makes Graphs Easy
Neo4j Makes Graphs Easy
 
Neo4j Spatial at LocationDay 2013 in Malmö
Neo4j Spatial at LocationDay 2013 in MalmöNeo4j Spatial at LocationDay 2013 in Malmö
Neo4j Spatial at LocationDay 2013 in Malmö
 
Neo4j Spatial - FooCafe September 2015
Neo4j Spatial - FooCafe September 2015Neo4j Spatial - FooCafe September 2015
Neo4j Spatial - FooCafe September 2015
 
Relational to Graph - Import
Relational to Graph - ImportRelational to Graph - Import
Relational to Graph - Import
 
Managing Connected Big Data in Art with Neo4j Graph Database - Lorenzo Speran...
Managing Connected Big Data in Art with Neo4j Graph Database - Lorenzo Speran...Managing Connected Big Data in Art with Neo4j Graph Database - Lorenzo Speran...
Managing Connected Big Data in Art with Neo4j Graph Database - Lorenzo Speran...
 
GraphDay Stockholm - Fraud Prevention
GraphDay Stockholm - Fraud PreventionGraphDay Stockholm - Fraud Prevention
GraphDay Stockholm - Fraud Prevention
 
Converting Relational to Graph Databases
Converting Relational to Graph DatabasesConverting Relational to Graph Databases
Converting Relational to Graph Databases
 
LEND360: "Identity Data for the Customer Lifecycle"
LEND360: "Identity Data for the Customer Lifecycle"LEND360: "Identity Data for the Customer Lifecycle"
LEND360: "Identity Data for the Customer Lifecycle"
 
Neo4j Solutions - Master Data Management
Neo4j Solutions - Master Data ManagementNeo4j Solutions - Master Data Management
Neo4j Solutions - Master Data Management
 
Big MDM Part 2: Using a Graph Database for MDM and Relationship Management
Big MDM Part 2: Using a Graph Database for MDM and Relationship ManagementBig MDM Part 2: Using a Graph Database for MDM and Relationship Management
Big MDM Part 2: Using a Graph Database for MDM and Relationship Management
 
faradays law and its applications ppt
faradays law and its applications pptfaradays law and its applications ppt
faradays law and its applications ppt
 

Similar to 3/15 - Intro to Spring Data Neo4j

Spring Data Neo4j Intro SpringOne 2011
Spring Data Neo4j Intro SpringOne 2011Spring Data Neo4j Intro SpringOne 2011
Spring Data Neo4j Intro SpringOne 2011jexp
 
No Sql Movement
No Sql MovementNo Sql Movement
No Sql MovementAjit Koti
 
NOSQL Databases types and Uses
NOSQL Databases types and UsesNOSQL Databases types and Uses
NOSQL Databases types and UsesSuvradeep Rudra
 
NOSQL Overview, Neo4j Intro And Production Example (QCon London 2010)
NOSQL Overview, Neo4j Intro And Production Example (QCon London 2010)NOSQL Overview, Neo4j Intro And Production Example (QCon London 2010)
NOSQL Overview, Neo4j Intro And Production Example (QCon London 2010)Emil Eifrem
 
NOSQL overview and intro to graph databases with Neo4j (Geeknight May 2010)
NOSQL overview and intro to graph databases with Neo4j (Geeknight May 2010)NOSQL overview and intro to graph databases with Neo4j (Geeknight May 2010)
NOSQL overview and intro to graph databases with Neo4j (Geeknight May 2010)Emil Eifrem
 
Morning with MongoDB Paris 2012 - Accueil et Introductions
Morning with MongoDB Paris 2012 - Accueil et IntroductionsMorning with MongoDB Paris 2012 - Accueil et Introductions
Morning with MongoDB Paris 2012 - Accueil et IntroductionsMongoDB
 
No SQL- The Future Of Data Storage
No SQL- The Future Of Data StorageNo SQL- The Future Of Data Storage
No SQL- The Future Of Data StorageBethmi Gunasekara
 
MySQL Cluster no PayPal
MySQL Cluster no PayPalMySQL Cluster no PayPal
MySQL Cluster no PayPalMySQL Brasil
 
Django and Neo4j - Domain modeling that kicks ass
Django and Neo4j - Domain modeling that kicks assDjango and Neo4j - Domain modeling that kicks ass
Django and Neo4j - Domain modeling that kicks assTobias Lindaaker
 
A NOSQL Overview And The Benefits Of Graph Databases (nosql east 2009)
A NOSQL Overview And The Benefits Of Graph Databases (nosql east 2009)A NOSQL Overview And The Benefits Of Graph Databases (nosql east 2009)
A NOSQL Overview And The Benefits Of Graph Databases (nosql east 2009)Emil Eifrem
 
Choosing the Right Big Data Tools for the Job - A Polyglot Approach
Choosing the Right Big Data Tools for the Job - A Polyglot ApproachChoosing the Right Big Data Tools for the Job - A Polyglot Approach
Choosing the Right Big Data Tools for the Job - A Polyglot ApproachDATAVERSITY
 
Gilbane Boston 2011 big data
Gilbane Boston 2011 big dataGilbane Boston 2011 big data
Gilbane Boston 2011 big dataPeter O'Kelly
 
Minnebar 2013 - Scaling with Cassandra
Minnebar 2013 - Scaling with CassandraMinnebar 2013 - Scaling with Cassandra
Minnebar 2013 - Scaling with CassandraJeff Bollinger
 
Intro to NoSQL and MongoDB
 Intro to NoSQL and MongoDB Intro to NoSQL and MongoDB
Intro to NoSQL and MongoDBMongoDB
 
Lunch & Learn Intro to Big Data
Lunch & Learn Intro to Big DataLunch & Learn Intro to Big Data
Lunch & Learn Intro to Big DataMelissa Hornbostel
 

Similar to 3/15 - Intro to Spring Data Neo4j (20)

Spring Data Neo4j Intro SpringOne 2011
Spring Data Neo4j Intro SpringOne 2011Spring Data Neo4j Intro SpringOne 2011
Spring Data Neo4j Intro SpringOne 2011
 
No Sql Movement
No Sql MovementNo Sql Movement
No Sql Movement
 
NOSQL Databases types and Uses
NOSQL Databases types and UsesNOSQL Databases types and Uses
NOSQL Databases types and Uses
 
NOSQL Overview, Neo4j Intro And Production Example (QCon London 2010)
NOSQL Overview, Neo4j Intro And Production Example (QCon London 2010)NOSQL Overview, Neo4j Intro And Production Example (QCon London 2010)
NOSQL Overview, Neo4j Intro And Production Example (QCon London 2010)
 
Anti-social Databases
Anti-social DatabasesAnti-social Databases
Anti-social Databases
 
NOSQL overview and intro to graph databases with Neo4j (Geeknight May 2010)
NOSQL overview and intro to graph databases with Neo4j (Geeknight May 2010)NOSQL overview and intro to graph databases with Neo4j (Geeknight May 2010)
NOSQL overview and intro to graph databases with Neo4j (Geeknight May 2010)
 
Introduction to NoSQL
Introduction to NoSQLIntroduction to NoSQL
Introduction to NoSQL
 
Morning with MongoDB Paris 2012 - Accueil et Introductions
Morning with MongoDB Paris 2012 - Accueil et IntroductionsMorning with MongoDB Paris 2012 - Accueil et Introductions
Morning with MongoDB Paris 2012 - Accueil et Introductions
 
No SQL- The Future Of Data Storage
No SQL- The Future Of Data StorageNo SQL- The Future Of Data Storage
No SQL- The Future Of Data Storage
 
MySQL Cluster no PayPal
MySQL Cluster no PayPalMySQL Cluster no PayPal
MySQL Cluster no PayPal
 
Django and Neo4j - Domain modeling that kicks ass
Django and Neo4j - Domain modeling that kicks assDjango and Neo4j - Domain modeling that kicks ass
Django and Neo4j - Domain modeling that kicks ass
 
A NOSQL Overview And The Benefits Of Graph Databases (nosql east 2009)
A NOSQL Overview And The Benefits Of Graph Databases (nosql east 2009)A NOSQL Overview And The Benefits Of Graph Databases (nosql east 2009)
A NOSQL Overview And The Benefits Of Graph Databases (nosql east 2009)
 
Know what is NOSQL
Know what is NOSQL Know what is NOSQL
Know what is NOSQL
 
Why nosql?
Why nosql?Why nosql?
Why nosql?
 
Choosing the Right Big Data Tools for the Job - A Polyglot Approach
Choosing the Right Big Data Tools for the Job - A Polyglot ApproachChoosing the Right Big Data Tools for the Job - A Polyglot Approach
Choosing the Right Big Data Tools for the Job - A Polyglot Approach
 
Gilbane Boston 2011 big data
Gilbane Boston 2011 big dataGilbane Boston 2011 big data
Gilbane Boston 2011 big data
 
Minnebar 2013 - Scaling with Cassandra
Minnebar 2013 - Scaling with CassandraMinnebar 2013 - Scaling with Cassandra
Minnebar 2013 - Scaling with Cassandra
 
No sql databases
No sql databasesNo sql databases
No sql databases
 
Intro to NoSQL and MongoDB
 Intro to NoSQL and MongoDB Intro to NoSQL and MongoDB
Intro to NoSQL and MongoDB
 
Lunch & Learn Intro to Big Data
Lunch & Learn Intro to Big DataLunch & Learn Intro to Big Data
Lunch & Learn Intro to Big Data
 

More from Neo4j

The five graphs of telecommunications may 22 2013 webinar final
The five graphs of telecommunications may 22 2013 webinar finalThe five graphs of telecommunications may 22 2013 webinar final
The five graphs of telecommunications may 22 2013 webinar finalNeo4j
 
The five graphs of telecommunications may 22 2013 webinar final
The five graphs of telecommunications may 22 2013 webinar finalThe five graphs of telecommunications may 22 2013 webinar final
The five graphs of telecommunications may 22 2013 webinar finalNeo4j
 
New opportunities for connected data
New opportunities for connected dataNew opportunities for connected data
New opportunities for connected dataNeo4j
 
0221 Cypher for SQL Professionals
0221 Cypher for SQL Professionals0221 Cypher for SQL Professionals
0221 Cypher for SQL ProfessionalsNeo4j
 
0207 - Visualizing Your Graph
0207 - Visualizing Your Graph0207 - Visualizing Your Graph
0207 - Visualizing Your GraphNeo4j
 
Intro to graph world
Intro to graph worldIntro to graph world
Intro to graph worldNeo4j
 

More from Neo4j (6)

The five graphs of telecommunications may 22 2013 webinar final
The five graphs of telecommunications may 22 2013 webinar finalThe five graphs of telecommunications may 22 2013 webinar final
The five graphs of telecommunications may 22 2013 webinar final
 
The five graphs of telecommunications may 22 2013 webinar final
The five graphs of telecommunications may 22 2013 webinar finalThe five graphs of telecommunications may 22 2013 webinar final
The five graphs of telecommunications may 22 2013 webinar final
 
New opportunities for connected data
New opportunities for connected dataNew opportunities for connected data
New opportunities for connected data
 
0221 Cypher for SQL Professionals
0221 Cypher for SQL Professionals0221 Cypher for SQL Professionals
0221 Cypher for SQL Professionals
 
0207 - Visualizing Your Graph
0207 - Visualizing Your Graph0207 - Visualizing Your Graph
0207 - Visualizing Your Graph
 
Intro to graph world
Intro to graph worldIntro to graph world
Intro to graph world
 

Recently uploaded

What-are-the-latest-modular-wardrobe-designs.pdf
What-are-the-latest-modular-wardrobe-designs.pdfWhat-are-the-latest-modular-wardrobe-designs.pdf
What-are-the-latest-modular-wardrobe-designs.pdfKams Designer Zone
 
Prestige Somerville Whitefield Bangalore E- Brochure.pdf
Prestige Somerville Whitefield Bangalore E- Brochure.pdfPrestige Somerville Whitefield Bangalore E- Brochure.pdf
Prestige Somerville Whitefield Bangalore E- Brochure.pdffaheemali990101
 
Anandtara Iris Residences Mundhwa Pune Brochure.pdf
Anandtara Iris Residences Mundhwa Pune Brochure.pdfAnandtara Iris Residences Mundhwa Pune Brochure.pdf
Anandtara Iris Residences Mundhwa Pune Brochure.pdfabbu831446
 
Experion Elements Sector 45 Noida_Brochure.pdf.pdf
Experion Elements Sector 45 Noida_Brochure.pdf.pdfExperion Elements Sector 45 Noida_Brochure.pdf.pdf
Experion Elements Sector 45 Noida_Brochure.pdf.pdfkratirudram
 
What is Affordable Housing? Bristol Civic Society April 2024
What is Affordable Housing? Bristol Civic Society April 2024What is Affordable Housing? Bristol Civic Society April 2024
What is Affordable Housing? Bristol Civic Society April 2024Paul Smith
 
LCAR Unit 20 - Appraising Real Estate - 14th Edition Revised
LCAR Unit 20 - Appraising Real Estate - 14th Edition RevisedLCAR Unit 20 - Appraising Real Estate - 14th Edition Revised
LCAR Unit 20 - Appraising Real Estate - 14th Edition RevisedTom Blefko
 
Maha Mauka Squarefeet Brochure |Maha Mauka Squarefeet PDF Brochure|
Maha Mauka Squarefeet Brochure |Maha Mauka Squarefeet PDF Brochure|Maha Mauka Squarefeet Brochure |Maha Mauka Squarefeet PDF Brochure|
Maha Mauka Squarefeet Brochure |Maha Mauka Squarefeet PDF Brochure|AkshayJoshi575980
 
Ajmera Prive at Juhu, Mumbai E-Brochure.pdf
Ajmera Prive at Juhu, Mumbai  E-Brochure.pdfAjmera Prive at Juhu, Mumbai  E-Brochure.pdf
Ajmera Prive at Juhu, Mumbai E-Brochure.pdfManishSaxena95
 
Listing Turkey Green life Istanbul Eyup Catalog
Listing Turkey Green life Istanbul Eyup CatalogListing Turkey Green life Istanbul Eyup Catalog
Listing Turkey Green life Istanbul Eyup CatalogListing Turkey
 
Ganga Fusion 85 Gurugram - PDF Download.pdf
Ganga Fusion 85 Gurugram - PDF Download.pdfGanga Fusion 85 Gurugram - PDF Download.pdf
Ganga Fusion 85 Gurugram - PDF Download.pdfanjalisaini334541
 
Kolte Patil Mirabilis at Horamavu Road, Bangalore E brochure.pdf
Kolte Patil Mirabilis at Horamavu Road, Bangalore E brochure.pdfKolte Patil Mirabilis at Horamavu Road, Bangalore E brochure.pdf
Kolte Patil Mirabilis at Horamavu Road, Bangalore E brochure.pdfAhanundefined
 
_Navigating Inflation's Influence on Commercial Real Estate (CRE) Investing I...
_Navigating Inflation's Influence on Commercial Real Estate (CRE) Investing I..._Navigating Inflation's Influence on Commercial Real Estate (CRE) Investing I...
_Navigating Inflation's Influence on Commercial Real Estate (CRE) Investing I...SyndicationPro, LLC
 
Mana Dale Kodathi, Sarjapur Road, Bangalore E-Brochure.pdf
Mana Dale Kodathi, Sarjapur Road, Bangalore E-Brochure.pdfMana Dale Kodathi, Sarjapur Road, Bangalore E-Brochure.pdf
Mana Dale Kodathi, Sarjapur Road, Bangalore E-Brochure.pdffaheemali990101
 
Prestige Rainbow Waters Raidurgam, Gachibowli Hyderabad E- Brochure.pdf
Prestige Rainbow Waters Raidurgam, Gachibowli Hyderabad E- Brochure.pdfPrestige Rainbow Waters Raidurgam, Gachibowli Hyderabad E- Brochure.pdf
Prestige Rainbow Waters Raidurgam, Gachibowli Hyderabad E- Brochure.pdffaheemali990101
 
Purva Park Hill Kanakapura Road Bangalore.pdf
Purva Park Hill  Kanakapura Road Bangalore.pdfPurva Park Hill  Kanakapura Road Bangalore.pdf
Purva Park Hill Kanakapura Road Bangalore.pdfashiyadav24
 
Mahindra Vista Kandivali East Mumbai Brochure.pdf
Mahindra Vista Kandivali East Mumbai Brochure.pdfMahindra Vista Kandivali East Mumbai Brochure.pdf
Mahindra Vista Kandivali East Mumbai Brochure.pdfPrachiRudram
 
LCAR Unit 21 - Closing the Real Estate Transaction - 14th Edition Revised
LCAR Unit 21 - Closing the Real Estate Transaction - 14th Edition RevisedLCAR Unit 21 - Closing the Real Estate Transaction - 14th Edition Revised
LCAR Unit 21 - Closing the Real Estate Transaction - 14th Edition RevisedTom Blefko
 
Radiance Majestic Valasaravakkam Chennai.pdf
Radiance Majestic Valasaravakkam Chennai.pdfRadiance Majestic Valasaravakkam Chennai.pdf
Radiance Majestic Valasaravakkam Chennai.pdfashiyadav24
 
Provident Solitaire Park Square Kanakapura Road, Bangalore E- Brochure.pdf
Provident Solitaire Park Square Kanakapura Road, Bangalore E- Brochure.pdfProvident Solitaire Park Square Kanakapura Road, Bangalore E- Brochure.pdf
Provident Solitaire Park Square Kanakapura Road, Bangalore E- Brochure.pdffaheemali990101
 
Clemson Engineering Consultant Dubai For Innovative and Sustainable Engineeri...
Clemson Engineering Consultant Dubai For Innovative and Sustainable Engineeri...Clemson Engineering Consultant Dubai For Innovative and Sustainable Engineeri...
Clemson Engineering Consultant Dubai For Innovative and Sustainable Engineeri...Clemson Engineering Consultant
 

Recently uploaded (20)

What-are-the-latest-modular-wardrobe-designs.pdf
What-are-the-latest-modular-wardrobe-designs.pdfWhat-are-the-latest-modular-wardrobe-designs.pdf
What-are-the-latest-modular-wardrobe-designs.pdf
 
Prestige Somerville Whitefield Bangalore E- Brochure.pdf
Prestige Somerville Whitefield Bangalore E- Brochure.pdfPrestige Somerville Whitefield Bangalore E- Brochure.pdf
Prestige Somerville Whitefield Bangalore E- Brochure.pdf
 
Anandtara Iris Residences Mundhwa Pune Brochure.pdf
Anandtara Iris Residences Mundhwa Pune Brochure.pdfAnandtara Iris Residences Mundhwa Pune Brochure.pdf
Anandtara Iris Residences Mundhwa Pune Brochure.pdf
 
Experion Elements Sector 45 Noida_Brochure.pdf.pdf
Experion Elements Sector 45 Noida_Brochure.pdf.pdfExperion Elements Sector 45 Noida_Brochure.pdf.pdf
Experion Elements Sector 45 Noida_Brochure.pdf.pdf
 
What is Affordable Housing? Bristol Civic Society April 2024
What is Affordable Housing? Bristol Civic Society April 2024What is Affordable Housing? Bristol Civic Society April 2024
What is Affordable Housing? Bristol Civic Society April 2024
 
LCAR Unit 20 - Appraising Real Estate - 14th Edition Revised
LCAR Unit 20 - Appraising Real Estate - 14th Edition RevisedLCAR Unit 20 - Appraising Real Estate - 14th Edition Revised
LCAR Unit 20 - Appraising Real Estate - 14th Edition Revised
 
Maha Mauka Squarefeet Brochure |Maha Mauka Squarefeet PDF Brochure|
Maha Mauka Squarefeet Brochure |Maha Mauka Squarefeet PDF Brochure|Maha Mauka Squarefeet Brochure |Maha Mauka Squarefeet PDF Brochure|
Maha Mauka Squarefeet Brochure |Maha Mauka Squarefeet PDF Brochure|
 
Ajmera Prive at Juhu, Mumbai E-Brochure.pdf
Ajmera Prive at Juhu, Mumbai  E-Brochure.pdfAjmera Prive at Juhu, Mumbai  E-Brochure.pdf
Ajmera Prive at Juhu, Mumbai E-Brochure.pdf
 
Listing Turkey Green life Istanbul Eyup Catalog
Listing Turkey Green life Istanbul Eyup CatalogListing Turkey Green life Istanbul Eyup Catalog
Listing Turkey Green life Istanbul Eyup Catalog
 
Ganga Fusion 85 Gurugram - PDF Download.pdf
Ganga Fusion 85 Gurugram - PDF Download.pdfGanga Fusion 85 Gurugram - PDF Download.pdf
Ganga Fusion 85 Gurugram - PDF Download.pdf
 
Kolte Patil Mirabilis at Horamavu Road, Bangalore E brochure.pdf
Kolte Patil Mirabilis at Horamavu Road, Bangalore E brochure.pdfKolte Patil Mirabilis at Horamavu Road, Bangalore E brochure.pdf
Kolte Patil Mirabilis at Horamavu Road, Bangalore E brochure.pdf
 
_Navigating Inflation's Influence on Commercial Real Estate (CRE) Investing I...
_Navigating Inflation's Influence on Commercial Real Estate (CRE) Investing I..._Navigating Inflation's Influence on Commercial Real Estate (CRE) Investing I...
_Navigating Inflation's Influence on Commercial Real Estate (CRE) Investing I...
 
Mana Dale Kodathi, Sarjapur Road, Bangalore E-Brochure.pdf
Mana Dale Kodathi, Sarjapur Road, Bangalore E-Brochure.pdfMana Dale Kodathi, Sarjapur Road, Bangalore E-Brochure.pdf
Mana Dale Kodathi, Sarjapur Road, Bangalore E-Brochure.pdf
 
Prestige Rainbow Waters Raidurgam, Gachibowli Hyderabad E- Brochure.pdf
Prestige Rainbow Waters Raidurgam, Gachibowli Hyderabad E- Brochure.pdfPrestige Rainbow Waters Raidurgam, Gachibowli Hyderabad E- Brochure.pdf
Prestige Rainbow Waters Raidurgam, Gachibowli Hyderabad E- Brochure.pdf
 
Purva Park Hill Kanakapura Road Bangalore.pdf
Purva Park Hill  Kanakapura Road Bangalore.pdfPurva Park Hill  Kanakapura Road Bangalore.pdf
Purva Park Hill Kanakapura Road Bangalore.pdf
 
Mahindra Vista Kandivali East Mumbai Brochure.pdf
Mahindra Vista Kandivali East Mumbai Brochure.pdfMahindra Vista Kandivali East Mumbai Brochure.pdf
Mahindra Vista Kandivali East Mumbai Brochure.pdf
 
LCAR Unit 21 - Closing the Real Estate Transaction - 14th Edition Revised
LCAR Unit 21 - Closing the Real Estate Transaction - 14th Edition RevisedLCAR Unit 21 - Closing the Real Estate Transaction - 14th Edition Revised
LCAR Unit 21 - Closing the Real Estate Transaction - 14th Edition Revised
 
Radiance Majestic Valasaravakkam Chennai.pdf
Radiance Majestic Valasaravakkam Chennai.pdfRadiance Majestic Valasaravakkam Chennai.pdf
Radiance Majestic Valasaravakkam Chennai.pdf
 
Provident Solitaire Park Square Kanakapura Road, Bangalore E- Brochure.pdf
Provident Solitaire Park Square Kanakapura Road, Bangalore E- Brochure.pdfProvident Solitaire Park Square Kanakapura Road, Bangalore E- Brochure.pdf
Provident Solitaire Park Square Kanakapura Road, Bangalore E- Brochure.pdf
 
Clemson Engineering Consultant Dubai For Innovative and Sustainable Engineeri...
Clemson Engineering Consultant Dubai For Innovative and Sustainable Engineeri...Clemson Engineering Consultant Dubai For Innovative and Sustainable Engineeri...
Clemson Engineering Consultant Dubai For Innovative and Sustainable Engineeri...
 

3/15 - Intro to Spring Data Neo4j

  • 1. Webinar Introduction to Spring Data Neo4j 2.0 Michael Hunger, Neo Technology Thursday, March 15, 12
  • 2. Me & You ? ๏ Me: Michael Hunger, Neo Technology • passionate software developer / Neo4j German Division • Spring Data Neo4j Project Lead • Neo4j Cloud Hosting • michael.hunger@neotechnology.com / @mesirii ๏ You: • Java & Spring ! • Enterprise ? • Rich Domain ? • NOSQL ? Thursday, March 15, 12
  • 3. About the Webinar ๏ Covers Spring Data Neo4j only ๏ too much content anyway ๏ so it will be just a whirlwind tour ๏ no detailed introductions to NOSQL and Neo4j in particular ๏ for those go to http://neo4j.org ๏ Q&A at the end ๏ all your questions will be answered in a follow up blog post, don‘t hesitate to ask Thursday, March 15, 12
  • 4. What‘s up? ๏ Spring Data overview ๏ Networks are everywhere ๏ Neo4j introduction ๏ Spring Data Neo4j introduction 4 Thursday, March 15, 12
  • 5. Spring Data 5 Thursday, March 15, 12
  • 7. What is NOSQL? It’s not “No to SQL” Thursday, March 15, 12
  • 8. What is NOSQL? It’s not “No to SQL” It’s not “Never SQL” Thursday, March 15, 12
  • 9. What is NOSQL? It’s not “No to SQL” It’s not “Never SQL” It’s “Not Only SQL” Thursday, March 15, 12
  • 10. What is NOSQL? It’s not “No to SQL” It’s not “Never SQL” It’s “Not Only SQL” NOSQL no-seek-wool n. Describes ongoing trend where developers increasingly opt for non-relational databases to help solve their problems, in an effort to use the right tool for the right job. Thursday, March 15, 12
  • 11. NOSQL categories We see four main categories in the NOSQL space: Thursday, March 15, 12
  • 12. NOSQL categories We see four main categories in the NOSQL space: Key-Value •Redis •Riak •Voldemort Thursday, March 15, 12
  • 13. NOSQL categories We see four main categories in the NOSQL space: Column-family/ Key-Value BigTable •Redis •Riak •Cassandra •Voldemort •HBase Thursday, March 15, 12
  • 14. NOSQL categories We see four main categories in the NOSQL space: Column-family/ Key-Value BigTable •Redis •Riak •Cassandra •Voldemort •HBase Document •MongoDB •CouchDB Thursday, March 15, 12
  • 15. NOSQL categories We see four main categories in the NOSQL space: Column-family/ Key-Value BigTable •Redis •Riak •Cassandra •Voldemort •HBase Document Graph •Neo4j •MongoDB •InfiniteGraph •CouchDB •OrientDB •DEX Thursday, March 15, 12
  • 16. Scaling to size vs. Scaling to complexity Size Key-Value stores Bigtable clones Document databases Graph databases Complexity 8 Thursday, March 15, 12
  • 17. Scaling to size vs. Scaling to complexity Size Key-Value stores Bigtable clones Document databases Graph databases Billions of nodes and relationships Complexity 8 Thursday, March 15, 12
  • 18. Scaling to size vs. Scaling to complexity Size Key-Value stores Bigtable clones Document databases Graph databases Billions of nodes and relationships > 90% of use cases Complexity 8 Thursday, March 15, 12
  • 19. Why NOSQL now? We have observed four trends since the 90‘s: ๏ Trend 1: Size of data is growing ๏ Trend 2: Data is increasingly connected ๏ Trend 3: Data is increasingly semi-structured ๏ Trend 4: Change in architecture Thursday, March 15, 12
  • 20. What is Spring Data? ๏ VMWare/SpringSource initiative to give Spring developers easy access to the emerging world of NOSQL, including: • Non-relational databases • Grails NOSQL support • Cross-store persistence • Object Persistence Mapping Infrastructure • Generic Repository Infrastructure • upcoming Spring Roo add-ons 10 Thursday, March 15, 12
  • 21. Spring Data projects ๏ Code is in SpringSource git repository: • http://springsource.org/spring-data • https://github.com/SpringSource/spring-data-* ๏ Includes: • data-commons • spring-data-graph-neo4j • spring-data-{redis,riak} • spring-data-mongo • spring-data-jdbc • spring-data-jpa Thursday, March 15, 12
  • 22. Spring Data Neo4j ๏ Focus on Spring Data Neo4j ๏ VMWare is collaborating with Neo Technology, the company behind the Neo4j graph database. ๏ Improved programming model: Annotation-based programming model for applications with rich domain models ๏ Cross-store persistence: Extend existing JPA application with NOSQL persistence ๏ Spring Roo support: Add graph persistence with Roo add-on Thursday, March 15, 12
  • 23. Graphs are everywhere 13 Thursday, March 15, 12
  • 24. Even in the Matrix - everything is a graph Google Image Search: „graph OR network“ 14 Thursday, March 15, 12
  • 25. Graphs Everywhere ๏ Relationships in • Politics, Economics, History, Science,Transportation ๏ Biology, Chemistry, Physics, Sociology • Body, Ecosphere, Reaction, Interactions ๏ Internet / IT • Hardware, Software, Interaction ๏ Social Networks • Family, Friends • Work, Communities • Neighbours, Cities, Society Thursday, March 15, 12 15
  • 26. Good Relationships ๏ World is rich, messy and related data ๏ Relationships are as least as important as the things they connect ๏ Graphs = Whole > Sum of all parts ๏ Complex interactions ๏ Always changing, change of structures as well ๏ Graph => Relationships are part of the data ๏ RDBMS => Relationships part of the fixed schema 16 Thursday, March 15, 12
  • 27. Questions and Answers ๏ Complex Questions ๏ Answers lie between the lines (things) ๏ Locality of the information ๏ Global searches / operations very expensive ๏ Constant query time, regardless of data volume 17 Thursday, March 15, 12
  • 28. Categories ? ๏ Categories == Classes, Trees ? ๏ What if more than one category fits? ๏ Tags ๏ Categories via relationships like „IS_A“ ๏ Any number, easy to change ๏ „Virtual“ Relationships - Traversals ๏ Category dynamically derived from queries 18 Thursday, March 15, 12
  • 30. What is Neo4j? data model Thursday, March 15, 12
  • 31. What is Neo4j? data model A Graph Database Thursday, March 15, 12
  • 32. What is Neo4j? data model A Graph Database Thursday, March 15, 12
  • 33. What is Neo4j? data model A Graph Database Thursday, March 15, 12
  • 34. What is Neo4j? data model A Graph Database Node Node Thursday, March 15, 12
  • 35. What is Neo4j? data model A Graph Database Typed relationship Node Node Thursday, March 15, 12
  • 36. What is Neo4j? data model A Graph Database Node Typed relationship Node key: value key: value Thursday, March 15, 12
  • 38. For example name: Oliver Thursday, March 15, 12
  • 39. For example name: Oliver name: Michael Thursday, March 15, 12
  • 40. For example WORKS_WITH project: spring-data name: Oliver name: Michael Thursday, March 15, 12
  • 41. For example WORKS_WITH project: spring-data name: Oliver name: Michael EM PL LIVES_IN OY E D_ BY city: Dresden company: VMware country: DE Thursday, March 15, 12
  • 42. For example name: Rod KN S OW OW S KN WORKS_WITH project: spring-data name: Oliver name: Michael EM PL LIVES_IN OY E D_ BY city: Dresden company: VMware country: DE Thursday, March 15, 12
  • 43. For example name: Rod KN S OW OW S KN WORKS_WITH project: spring-data name: Oliver name: Michael EM PL LIVES_IN S OY LIKE E D_ BY city: Dresden food: Chinese company: VMware country: DE Thursday, March 15, 12
  • 44. Facts about Neo4j •Written in Java •Embeddable or standalone Server •Schema-free - perfect for rich domains •Fully transactional (ACID) •Persistent to custom on-disk file structure •Traversal speeds of 1,000,000+ hops per second •Integrated indexing •Plenthora of language bindings •24/7 production since 2003 Thursday, March 15, 12
  • 45. Show me some code, please GraphDatabaseService graphDb = new EmbeddedGraphDatabase(“var/neo4j”); Node david = graphDb.createNode(); Node andreas = graphDb.createNode(); david.setProperty(“name”, “David Montag”); andreas.setProperty(“name”, “Andreas Kollegger”); Relationship presentedWith = david.createRelationshipTo( andreas, PresentationTypes.PRESENTED_WITH); presentedWith.setProperty(“date”, System.currentTimeMillis()); Thursday, March 15, 12
  • 46. Show me some code, please GraphDatabaseService graphDb = new EmbeddedGraphDatabase(“var/neo4j”); Transaction tx = graphDb.beginTx(); try { Node david = graphDb.createNode(); Node andreas = graphDb.createNode(); david.setProperty(“name”, “David Montag”); andreas.setProperty(“name”, “Andreas Kollegger”); Relationship presentedWith = david.createRelationshipTo( andreas, PresentationTypes.PRESENTED_WITH); presentedWith.setProperty(“date”, System.currentTimeMillis()); tx.success(); } finally { tx.finish(); } Thursday, March 15, 12
  • 48. Traversal framework Example: a dependency graph A B D C Thursday, March 15, 12
  • 49. Traversal framework Example: a dependency graph Query: Find all dependencies of A, transitively A B D C Thursday, March 15, 12
  • 50. Traversal framework Example: a dependency graph Query: Find all dependencies of A, transitively A B D C Thursday, March 15, 12
  • 51. Traversal framework Example: a dependency graph Query: Find all dependencies of A, transitively A B D C Thursday, March 15, 12
  • 52. Traversal framework Example: a dependency graph Query: Find all dependencies of A, transitively A B D C Thursday, March 15, 12
  • 53. Traversal framework Example: a dependency graph Query: Find all dependencies of A, transitively A B D C TraversalDescription desc = Traversal.description() .relationships(ExampleTypes.DEPENDS_ON, Direction.OUTGOING); Node a = ...; for (Node dependency : desc.traverse(a).nodes()) { print(dependency); } Thursday, March 15, 12
  • 54. So how do I find a node to traverse from? ? Thursday, March 15, 12
  • 55. So how do I find a node to traverse from? g! in ex i nd i ng us B y ? Thursday, March 15, 12
  • 56. So how do I find a node to traverse from? g! in ex i nd i ng us B y name: David ? Thursday, March 15, 12
  • 57. So how do I find a node to traverse from? g! in ex i nd i ng us B y name: David ? David Thursday, March 15, 12
  • 58. So how do I find a node to traverse from? g! Andreas in ex i nd Michael i ng us B y name: David ? David Ed Allison Thursday, March 15, 12
  • 59. Cypher Query Language ๏ Declarative query language • Describe what you want, not how • Based on pattern matching ๏ Examples: START david=node:people(name=”David M”) # index lookup MATCH david-[:knows]-friends-[:knows]-new_friends WHERE new_friends.age > 18 RETURN new_friends START user=node(5, 15, 26, 28) # node IDs MATCH user--friend RETURN user, COUNT(friend), SUM(friend.money) 26 Thursday, March 15, 12
  • 60. Beyond basics ๏ Traversal API / DSL • Express powerful Graph Traversals succinctly ๏ Graph algorithm library • Cheapest path (Dijkstra, A*) • Shortest path • Simple paths • All paths ๏ REST API access to Neo4j Standalone Server ๏ High availability and online backups 27 Thursday, March 15, 12
  • 61. Spring Data Neo4j 2.0 Thursday, March 15, 12
  • 62. Spring Framework Conveniences ๏ default enterprise development framework ๏ future Java Cloud stack ๏ POJO centric application design ๏ made AspectJ aspects socially acceptable (tx-config, @Configurable) ๏ Template programming model ๏ Inversion of Control / Dependency Injection ๏ Spring Java Config, configuration XML-namespaces ๏ lots of powerful libraries and library abstractions ๏ existing, well-known persistence framework for JDBC ๏ Spring Data project Thursday, March 15, 12
  • 63. Programming model overview ๏ SDN is the brain child of Rod Johnson and Emil Eifrém • Wrote functional initial prototype • Developed by Neo Technology and SpringSource teams ๏ Uses annotations to define graph entities ๏ Entity state backed by graph database ๏ Two modes of Object Graph Mapping • POJO Graph Mapping • seamless AspectJ backed Object Graph Mapping ๏ Spring Roo add-on available Thursday, March 15, 12
  • 64. Spring Data Neo4j features ๏ Annotation-based programming model ๏ Spring Data Commons Repository support ๏ Neo4j Query (Cypher, Gremlin) and Traversal support • on dynamic fields and via repository methods ๏ Neo4j indexing support (includes fulltext and numeric range queries) ๏ Entity types stored in the graph database as well ๏ Dynamic type projection (duck typing) ๏ Cross-store support for partial JPA / graph entities ๏ Support for JSR-303 (bean validation) ๏ Support for the Neo4j Server (remote server and in server extension) ๏ Neo4jTemplate with exception translation, optional transaction management and more 31 Thursday, March 15, 12
  • 65. Classic Neo4j domain class public class Actor { private final Node underlyingNode; Actor( final Node node ) { underlyingNode = node; } public Node getUnderlyingNode() { return underlyingNode; } public final String getName() { return (String) underlyingNode.getProperty( “name” ); } public void setName( final String name ) { underlyingNode.setProperty( “name”, name ); } } Thursday, March 15, 12
  • 66. Spring Data Neo4j domain class @NodeEntity public class Actor { @Indexed private String name; } Thursday, March 15, 12
  • 67. What about relationships @NodeEntity class Actor { ... public Iterable <Movie> getMovi final List<Movi es() { e> movies = new for ( Relations LinkedList<Movi hip rel : under e>(); RelTypes.ACTS_I lyingNode.getRe N, Direction.OU lationships( movies.add( new TGOING ) ) { Movie( rel.getE } return movies; ndNode() ) ); Old } class) @RelatedTo(type="ACTS_ IN", elementClass = Movie. ; private Set<Movie> movies public Iterable<Movie> ge tMovies() { New return movies; } Thursday, March 15, 12
  • 69. Defining entity classes • @NodeEntity • Represents a node in the graph • Fields saved as properties on node • References stored as relationships between nodes • Instantiated using Java ‘new’ keyword, like any POJO • Also returned by lookup mechanisms • Type information stored in the graph Thursday, March 15, 12
  • 71. Defining entity classes • @RelationshipEntity • Represents a relationship in the graph • Fields saved as properties on relationship • Special fields for start- and end-nodes • Only returned by lookup methods Thursday, March 15, 12
  • 72. Fields in node entities (@NodeEntity) • Primitive types and strings are directly persisted • For all other types, Spring conversion support can be used • Enum and Date conversion is provided out-of-the-box • Transient fields not persisted @NodeEntity public class Actor { private String name; private int age; private HairColor hairColor; private transient String nickname; } 37 Thursday, March 15, 12
  • 73. Fields in node entities (@NodeEntity) • Fields of types that represent a node (@NodeEntity) 38 Thursday, March 15, 12
  • 74. Fields in node entities (@NodeEntity) • Fields of types that represent a node (@NodeEntity) @NodeEntity public class Movie {} @NodeEntity public class Person { private Movie favoriteMovie; } 38 Thursday, March 15, 12
  • 75. Fields in node entities (@NodeEntity) • Fields of types that represent a node (@NodeEntity) @NodeEntity public class Movie {} @NodeEntity public class Person { private Movie favoriteMovie; } @NodeEntity public class Movie { private Actor topActor; } @NodeEntity public class Actor { // Mirrors topActor in Movie @RelatedTo(type = ”topActor”, direction = Direction.INCOMING) private Movie wasTopActorIn; } 38 Thursday, March 15, 12
  • 76. Fields in node entities (@NodeEntity) • Fields of collections of node entities: @RelatedTo @NodeEntity public class Movie {} @NodeEntity public class Actor { @RelatedTo(type = “ACTS_IN”) private Set<Movie> movies; } 39 Thursday, March 15, 12
  • 77. Fields in node entities (@NodeEntity) ๏ Fields of collections of relationship entities: @RelatedToVia @RelationshipEntity public class Role { @StartNode private Actor actor; @EndNode private Movie movie; private String roleName; } @NodeEntity public class Actor { @RelatedToVia(type = “ACTS_IN”) private Iterable<Role> roles; } ๏ Read only view of relationship entities 40 Thursday, March 15, 12
  • 78. Fields in relationship entities (@RelationshipEntity) • Primitive and convertible types work just the same • @StartNode and @EndNode provide access to the start and end node entities for the relationship entity @RelationshipEntity public class Role { @StartNode private Actor actor; @EndNode private Movie movie; private String title; } Thursday, March 15, 12
  • 79. Indexing By annotating an entity field with @Indexed it becomes searchable: @NodeEntity public class Actor { @Indexed private String name; @Indexed private HairColor hairColor; It can then be looked up: GraphRepository<Actor> actorRepo = template.repositoryFor(Actor.class); Actor kevin = actorRepo.findByPropertyValue(“name”, “Kevin Bacon”); Iterable<Actor> allBlondActors = actorRepo.findAllByPropertyValue(“hairColor”, “blond”); Thursday, March 15, 12
  • 80. Indexing @NodeEntity public class Actor { @Indexed(type = FULLTEXT) private String name; ๏ Index name defaults to domain class name ๏ Index key defaults to field name ๏ Fulltext and spatial index types ๏ Repository query methods for any Lucene query, including ranges: Iterable<Actor> allKevinsOlderThan32 = actorRepo.findAllByQuery(“name:Kevin* AND age>32”); Iterable<Actor> youngActors = actorRepo.findAllByRange(“age”, 3, 18); Thursday, March 15, 12
  • 81. Traversal @NodeEntity public class Actor { @GraphTraversal( traversalBuilder = CoactorsTraversalDescriptionBuilder.class) private Iterable<Actor> coactors; } public class CoactorsTraversalDescriptionBuilder implements FieldTraversalDescriptionBuilder { public TraversalDescription build(...) { return Traversal.description() .evaluator(Evaluators.atDepth(2)) .relationships(RelTypes.ACTS_IN); } } Example for dynamic field computation 44 Thursday, March 15, 12
  • 82. Cypher query language @NodeEntity public class Actor { @Query(“START actor=node({self}) ” + “MATCH actor-[:ACTS_IN]->movie<-[:ACTS_IN]-coactor ” + “RETURN coactor”) private Iterable<Actor> coactors; } @NodeEntity public class User { @Query(“START actor=node({self}) ” + “MATCH actor-[:ACTS_IN]->movie<-[:ACTS_IN]-coactor ” + “RETURN movie.title, coactor.name”) private List<Map<String, Object>> movieCoactorPairs; } 45 Thursday, March 15, 12
  • 83. POJO-Mapping ๏ Based on Spring-Data-Commons infrastructure • Extract Mapping Meta Information • Entity-Converter for Object-Graph-Mapping ‣Type-resolution ‣Entity construction ‣Transfer properties ‣Load Cache ‣Load Policies + recurse for eagerly fetched relationships • Neo4j-Template for Graph-Interaction 46 Thursday, March 15, 12
  • 84. AspectJ ๏ Introduces interface to entities: • NodeBacked into @NodeEntity classes • RelationshipBacked into @RelationshipEntity classes ๏ NodeBacked introduces methods such as: • relateTo • findByQuery • findAllByTraversal • ... ๏ going to be pulled out in separate Active-Record-Mixin 47 Thursday, March 15, 12
  • 85. AspectJ - Tooling ๏ IDE‘s • latest versions of STS / Eclipse with current AJDT plugin • IntelliJ IDEA 10.5 compile + run, some editor quirks ‣full AspectJ support in IDEA 11 ๏ Build Systems • Maven • Gradle • Ant / Ivy • ... 48 Thursday, March 15, 12
  • 86. AspectJ - NodeBacked.relateTo <T extends RelationshipBacked> T NodeBacked.relateTo( NodeBacked node, Class<T> relationshipEntityType, String relationshipType ); usage: @NodeEntity public class Actor { public Role actsIn(Movie movie, String roleName) { Role role = relateTo(movie, Role.class, “ACTS_IN”); role.setName(roleName); return role; } } 49 Thursday, March 15, 12
  • 87. Interface based Repositories ๏ based on Repository infrastructure in Spring Data Commons ๏ just define the interface and the namespace configuration ๏ provide out-of-the-box support for • CRUD-Operations • Index-Lookups • Traversal-Execution • Annotated Graph-Queries (Cypher, Gremlin) • Derived Queries • Spatial Queries ๏ extensible via custom methods with provided implementations 50 Thursday, March 15, 12
  • 88. Repositories interface MovieRepository extends GraphRepository<Movie> { Movie findById(String id); Page<Movie> findByTitle(String title, Pageable page); } <neo4j:repositories base-package=“com.example.repositories„/> @Controller public class MovieController { @Autowired MovieRepository moviesRepository; @RequestMapping(value = "/movies/{movieId}",...) public String show(Model model, @PathVariable String movieId) { Movie movie = moviesRepository.findByPropertyValue("id", movieId); Movie movie = moviesRepository.findById(movieId); model.addAttribute("movie", movie); return "/movies/show"; }} 51 Thursday, March 15, 12
  • 89. Repository-Query-Support interface MovieRepository extends GraphRepository<Movie> { @Query("start m=({movie}) match m-[ACTS_IN]-actor return actor") List<Actor> getActorsCypher(@Param("movie") Movie m); @Query("start movie =({0}) match (movie)<-[role:ACTS_IN]-(actor) return actor.name, role.title") Iterable<Map<String,Object>> getCast(Movie m); @Query(value = "g.v(movie).out('ACTS_IN')", type = QueryType.Gremlin) Set<Person> getActorsGremlin(@Param("movie") Movie m); Page<Person> findByTitleAndActorsName(String title, String name, Pageable page); } 52 Thursday, March 15, 12
  • 90. Neo4j-Template (I) ๏ well known Spring Template Pattern ๏ Resource / Transaction Management ๏ Convenience Methods ๏ Nodes and Entities handling & conversion ๏ Fluent Query Result Handling ๏ Works also via REST with Neo4j-Server ๏ Exception Translation 53 Thursday, March 15, 12
  • 91. Neo4j-Template (II) template.lookup("node", "name", "David") .to(String.class, new PropertyContainerNameConverter()).single() template.traverse(node, traversal) .to(Integer.class,new ResultConverter<Path,Integer>() { public Integer convert(Path path, Class<String> type) { return path.length(); }}) template.query("start movie=(Movies,title, {m}) match movie-->actor return actor", map("m","Matrix")).to(Actor.class) template.execute("g.v(ref).outE", map("ref",0)).to(Relationship.class) 54 Thursday, March 15, 12
  • 92. REST-Client-Support <bean id="restGraphDatabaseService" class="org.sf.data.neo4j.rest.SpringRestGraphDatabase"> <constructor-arg value="http://localhost:7473/db/data" /> </bean> <datagraph:config graphDatabaseService="restGraphDatabaseService"/> ๏ drop-in replacement for the embedded GraphDatabase ๏ works transparently with POJO-Entity-Mapping and Neo4j-Template 55 Thursday, March 15, 12
  • 93. REST-Server-Support public class HelloWorldInitializer extends SpringPluginInitializer { public HelloWorldInitializer() { super(new String[]{"spring/helloWorldServer-Context.xml"}, Pair.of("worldRepository", WorldRepository.class), Pair.of("graphRepositoryFactory", GraphRepositoryFactory.class)); } } ๏ integrate Spring Data Neo4j config with already running Graph-Database in Neo4j-Server ๏ expose Spring Beans as Jersey Injectables 56 Thursday, March 15, 12
  • 95. A scenario... You have a traditional web app using JPA to persist data to a relational database Thursday, March 15, 12
  • 96. Option C: Introducing cross-store persistence ๏ JPA data and NOSQL data can share a data model ๏ Could be the entire entity, or some fields of an entity ๏ We call this cross-store persistence • One transaction managerdatabase the NOSQL database with the JPA relational to coordinate • AspectJ support to manage the NOSQL entities and fields Thursday, March 15, 12
  • 97. The JPA data model Restaurant UserAccount @Entity @Entity public class Restaurant { @Table(name = "user_account") @Id @GeneratedValue public class UserAccount { private Long id; @Id @GeneratedValue private String name; private Long id; private String city; private String userName; private String state; private String firstName; private String zipCode; private String lastName; @Temporal(TemporalType.TIMESTAMP) private Date birthDate; @ManyToMany(cascade = CascadeType.ALL) private Set<Restaurant> favorites; Thursday, March 15, 12
  • 98. Adding to the data model Restaurant UserAccount @Entity @Entity @NodeEntity(partial = true) @Table(name = "user_account") public class Restaurant { @NodeEntity(partial = true) @Id @GeneratedValue public class UserAccount { private Long id; @Id @GeneratedValue private String name; private Long id; private String city; private String userName; private String state; private String firstName; private String zipCode; private String lastName; @Temporal(TemporalType.TIMESTAMP) private Date birthDate; @ManyToMany(cascade = CascadeType.ALL) Recommendation private Set<Restaurant> favorites; @RelationshipEntity @GraphProperty public class Recommendation { String nickname; @StartNode @RelatedTo(type = "friends", private UserAccount user; elementClass = UserAccount.class) @EndNode Set<UserAccount> friends; private Restaurant restaurant; @RelatedToVia(type = "recommends", private int stars; elementClass = Recommendation.class) private String comment; Iterable<Recommendation> recommendations; Thursday, March 15, 12
  • 99. Adding to the data model Restaurant UserAccount @Entity @Entity @NodeEntity(partial = true) @Table(name = "user_account") public class Restaurant { @NodeEntity(partial = true) @Id @GeneratedValue public class UserAccount { private Long id; @Id @GeneratedValue private String name; private Long id; private String city; private String userName; private String state; private String firstName; private String zipCode; private String lastName; @Temporal(TemporalType.TIMESTAMP) private Date birthDate; @ManyToMany(cascade = CascadeType.ALL) Recommendation private Set<Restaurant> favorites; @RelationshipEntity @GraphProperty public class Recommendation { String nickname; @StartNode @RelatedTo(type = "friends", private UserAccount user; elementClass = UserAccount.class) @EndNode Set<UserAccount> friends; private Restaurant restaurant; @RelatedToVia(type = "recommends", private int stars; elementClass = Recommendation.class) private String comment; Iterable<Recommendation> recommendations; Thursday, March 15, 12
  • 100. Adding to the data model Restaurant UserAccount @Entity @Entity @NodeEntity(partial = true) @Table(name = "user_account") public class Restaurant { @NodeEntity(partial = true) @Id @GeneratedValue public class UserAccount { private Long id; @Id @GeneratedValue private String name; private Long id; private String city; private String userName; private String state; private String firstName; private String zipCode; private String lastName; @Temporal(TemporalType.TIMESTAMP) private Date birthDate; @ManyToMany(cascade = CascadeType.ALL) Recommendation private Set<Restaurant> favorites; @RelationshipEntity @GraphProperty public class Recommendation { String nickname; @StartNode @RelatedTo(type = "friends", private UserAccount user; elementClass = UserAccount.class) @EndNode Set<UserAccount> friends; private Restaurant restaurant; @RelatedToVia(type = "recommends", private int stars; elementClass = Recommendation.class) private String comment; Iterable<Recommendation> recommendations; Thursday, March 15, 12
  • 101. Adding to the data model Restaurant UserAccount @Entity @Entity @NodeEntity(partial = true) @Table(name = "user_account") public class Restaurant { @NodeEntity(partial = true) @Id @GeneratedValue public class UserAccount { private Long id; @Id @GeneratedValue private String name; private Long id; private String city; private String userName; private String state; private String firstName; private String zipCode; private String lastName; @Temporal(TemporalType.TIMESTAMP) private Date birthDate; @ManyToMany(cascade = CascadeType.ALL) Recommendation private Set<Restaurant> favorites; @RelationshipEntity @GraphProperty public class Recommendation { String nickname; @StartNode @RelatedTo(type = "friends", private UserAccount user; elementClass = UserAccount.class) @EndNode Set<UserAccount> friends; private Restaurant restaurant; @RelatedToVia(type = "recommends", private int stars; elementClass = Recommendation.class) private String comment; Iterable<Recommendation> recommendations; Thursday, March 15, 12
  • 102. Adding to the data model Restaurant UserAccount @Entity @Entity @NodeEntity(partial = true) @Table(name = "user_account") public class Restaurant { @NodeEntity(partial = true) @Id @GeneratedValue public class UserAccount { private Long id; @Id @GeneratedValue private String name; private Long id; private String city; private String userName; private String state; private String firstName; private String zipCode; private String lastName; @Temporal(TemporalType.TIMESTAMP) private Date birthDate; @ManyToMany(cascade = CascadeType.ALL) Recommendation private Set<Restaurant> favorites; @RelationshipEntity @GraphProperty public class Recommendation { String nickname; @StartNode @RelatedTo(type = "friends", private UserAccount user; elementClass = UserAccount.class) @EndNode Set<UserAccount> friends; private Restaurant restaurant; @RelatedToVia(type = "recommends", private int stars; elementClass = Recommendation.class) private String comment; Iterable<Recommendation> recommendations; Thursday, March 15, 12
  • 103. Spring Data Neo4j Roo add-on ๏ Roo adding support for non-JPA persistence providers ๏ Spring Data Neo4j was the first NOSQL persistence Roo Add-On ๏ See the chapter on Spring Data Neo4j in the latest O’Reilly Roo book, Getting Started with Roo. 62 Thursday, March 15, 12
  • 104. Spring Data Neo4j Roo add-on roo> project --topLevelPackage org.neo4j.imdb roo> graph setup --provider NEO4J --databaseLocation target/imdb roo> graph entity --class ~.model.Movie roo> field string title roo> field number --fieldName year --type java.lang.Integer --permitReservedWords --primitive roo> graph entity --class ~.model.Actor roo> field string name roo> graph relationship --to Movie --from Actor --fieldName movies --type ACTS_IN --cardinality ONE_TO_MANY roo> graph relationship --via ~.model.Role --to Movie --from Actor --fieldName roles --type ACTS_IN --cardinality ONE_TO_MANY roo> graph relationship --from Movie --to Actor --type ACTS_IN --fieldName actors --direction INCOMING --cardinality MANY_TO_ONE roo> field string --fieldName title --class ~.model.Role roo> controller scaffold --class ~.web.ActorController --entity ~.model.Actor roo> controller scaffold --class ~.web.MovieController --entity ~.model.Movie 63 Thursday, March 15, 12
  • 105. Spring Data Neo4j Guidebook “Good Relationships” “I’m excited about Spring Data Neo4j.... Spring Data Neo4j makes working with Neo4j amazingly easy, and therefore has the potential to make you more successful as a developer.” Rod Johnson, founder of Spring ๏ Spring Data Neo4j comes with a great Guide Book, featuring: • Forewords by Rod Johnson and Emil Eifrem • An easy to read, narrative tutorial walkthrough for cineasts.net • A comprehensive reference for all the details • Check it out here: http://spring.neo4j.org/guide 64 Thursday, March 15, 12
  • 106. The end (and the beginning!) ๏ See the Spring Data Neo4j site for more info: http://spring.neo4j.org ๏ Check out the developer notes at GitHub: http://spring.neo4j.org/notes ๏ Again, don’t miss our fantastic e-book on Spring Data Neo4j: http://spring.neo4j.org/guide ๏ Spring Data Forum at http://spring.neo4j.org/discussions ๏ All about Neo4j: http://neo4j.org ๏ Neo4j videos and webinars: http://video.neo4j.org Thursday, March 15, 12
  • 107. Cineasts.net Check Out: http://spring.neo4j.org/tutorial Thursday, March 15, 12