SlideShare uma empresa Scribd logo
1 de 117
Introduction to
      Spring Data Neo4j

Michael Hunger
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:
    • NOSQL ?
    • Enterprise ?
    • Rich Domain ?
What‘s up?

๏ NOSQL overview
๏ Spring Data overview
๏ Networks are everywhere
๏ Graph Databases
๏ Neo4j introduction
๏ Spring Data Neo4j introduction




                                   3
NOSQL overview




                 4
What does NOSQL stand for?
What does NOSQL stand for?

   It’s not “No to SQL”
What does NOSQL stand for?

   It’s not “No to SQL”
                          It’s not “Never SQL”
What does NOSQL stand for?

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


         It’s “Not        Only SQL”
What does NOSQL stand for?

   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.
Why NOSQL now?
We have observed four trends:


๏ 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
NOSQL categories

We see four main categories in the NOSQL space:
NOSQL categories

We see four main categories in the NOSQL space:

    Key-Value
           •Redis
           •Riak
            •Voldemort
NOSQL categories

We see four main categories in the NOSQL space:

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

We see four main categories in the NOSQL space:

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



   Document

              •MongoDB
              •CouchDB
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
Scaling to size vs. Scaling to complexity
     Size
        Key-Value stores

                     Bigtable clones
                                   Document databases
                                                        Graph databases




                                                                  Complexity

                                                                          8
Scaling to size vs. Scaling to complexity
     Size
        Key-Value stores

                     Bigtable clones
                                   Document databases
                                                        Graph databases

                                                                 Billions of nodes
                                                                 and relationships




                                                                  Complexity

                                                                          8
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
Spring Data overview
What is Spring Data


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

   • Non-relational databases
   • MapReduce
   • Grails NOSQL support
   • Cross-store persistence
   • Object Persistence Mapping Infrastructure
   • Generic Repository Infrastructure
   • upcoming Spring Roo add-ons
                                                             10
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
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 graph applications
๏ Cross-store persistence: Extend existing JPA application with
    NOSQL persistence
๏ Spring Roo support: Add graph persistence with Roo add-on
Graphs are
everywhere




             13
Even in the Matrix
                           - everything is a grpah
      Google Image Search: „graph OR network“




                                            14
Graphs Everywhere

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


๏ the 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
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
Categories ?


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


                                              18
Fowler & Christakis „Connected“




                                  19
New York Times R&D „Cascade“




                               20
Deb Roy - MIT & Bluefin Labs


                    „Birth of a Word“ TED Talk

                    Researches Social Reactions
                    to (Media) Events




                                                  21
Neo4j introduction
What is Neo4j?
                 data model
What is Neo4j?
                      data model




           A Graph Database
What is Neo4j?
                      data model




           A Graph Database
What is Neo4j?
                      data model




           A Graph Database
What is Neo4j?
                          data model




               A Graph Database




        Node                           Node
What is Neo4j?
                                    data model




               A Graph Database




                   Typed relationship
        Node                                     Node
What is Neo4j?
                                     data model




                A Graph Database




         Node       Typed relationship
                                                  Node
       key: value      key: value
For example
For example




   name: Oliver
For example




   name: Oliver   name: Michael
For example




                  WORKS_WITH
                  project: spring-data
   name: Oliver                          name: Michael
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
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
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
Best NOSQL Database for Spring ?
Why ? Explain !
•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+ hops per ms
•24/7 production since 2003
•Integrated indexing
•Plenthora of language bindings
Whiteboard friendly
Whiteboard friendly



                            Ally’s
                            Blog

                       NS
                   W
                  O



        Allison
Whiteboard friendly

         Blog
         Post     BEL
                        ON
                          GS
                            _TO


                                  Ally’s
                                  Blog
         WROTE




                                           BE
                                             LO
                                               NG
                        NS




                                                 S_
                    W
                   O




                                                   OT
                                                   Blog
        Allison               WROTE               Post 2
Whiteboard friendly

         Blog
         Post     BEL
                        ON
                          GS
                            _TO


                                  Ally’s
                                  Blog
         WROTE




                                           BE
                                             LO
                                               NG
                        NS




                                                 S_
                    W
                   O




                                                    T  O
                                                     Blog
        Allison               WROTE                 Post 2     CO
                                                                 MM
                                                                      EN
                                                                        T_


                                                          OR
                                                                          FO
                                                                            R
                                                COMMENT_F
                                                                                Comment


                                           Comment
Whiteboard friendly

         Blog
         Post     BEL
                        ON
                          GS
                            _TO


                                  Ally’s
                                  Blog
         WROTE




                                           BE
                                             LO
                                               NG
                        NS




                                                 S_
                    W
                   O




                                                    T  O
                                                     Blog
        Allison               WROTE                 Post 2     CO
                                                                 MM
                                                                      EN
                                                                        T_


                                                          OR
                                                                          FO
                                                                            R
                                                COMMENT_F
                                                                                Comment


                                           Comment
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());
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();
}
Traversal framework
Traversal framework
Example: a dependency graph




      A




            B
                              D
  C
Traversal framework
Example: a dependency graph

Query: Find all dependencies of A, transitively



       A




              B
                                                  D
  C
Traversal framework
Example: a dependency graph

Query: Find all dependencies of A, transitively



       A




              B
                                                  D
  C
Traversal framework
Example: a dependency graph

Query: Find all dependencies of A, transitively



       A




              B
                                                  D
  C
Traversal framework
Example: a dependency graph

Query: Find all dependencies of A, transitively



       A




              B
                                                  D
  C
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);
 }
So how do I find a node
to traverse from?




                     ?
So how do I find a node
to traverse from?

                               g!
                             in
                        ex
                   i nd
            i ng
       us
 B y                                ?
So how do I find a node
to traverse from?

                               g!
                             in
                        ex
                   i nd
            i ng
       us
 B y                            name: David
                                              ?
So how do I find a node
to traverse from?

                               g!
                             in
                        ex
                   i nd
            i ng
       us
 B y                            name: David
                                                ?
                                              David
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
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]-()-[:knows]-foaf
   WHERE foaf.age > 18
   RETURN foaf

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




                                                              30
Cypher Query Language                 (E
                                         xp
๏ Declarative query language        en      er
                                       ta      im
   • Describe what you want, not how l)
   • Based on pattern matching
๏ Examples:
  START david=node:people(name=”David M”)   # index lookup
  MATCH david-[:knows]-()-[:knows]-foaf
  WHERE foaf.age > 18
  RETURN foaf

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




                                                             30
Beyond basics
๏ 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
   • Provides fault tolerance and horizontal scaling of reads
                                                                31
Spring Data Neo4j
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
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 POJO entities
 ๏ Entity state backed by graph database
 ๏ Two modes of Object Graph Mapping
    • Spring Data Mapping
    • seamless object mapping leverages AspectJ
 ๏ Spring Roo add-on available
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
                                                                       35
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 );
    }
}
Spring Data Neo4j domain class
@NodeEntity
public class Actor {

    @Indexed
    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
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

                                                           Old
      }                                  ndNode() ) );
   return movies;
 }
                                                    class)
 @RelatedTo(type="ACTS_ IN", elementClass = Movie.
                           ;
 private Set<Movie> movies

 public Iterable<Movie> ge
                           tMovies() {
                                                             New
   return movies;
 }
Defining entity classes
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
Defining entity classes
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
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;
   }



                                                               41
Fields in node entities (@NodeEntity)
• Fields of types that represent a node (@NodeEntity)




                                                        42
Fields in node entities (@NodeEntity)
• Fields of types that represent a node (@NodeEntity)
 @NodeEntity
 public class Movie {}


 @NodeEntity
 public class Person {
   private Movie favoriteMovie;
 }




                                                        42
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;
 }
                                                                   42
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;
  }




                                                       43
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                   44
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;
  }
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”);
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);
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

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




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




                                                                        49
Spring-Data-Mapping
 ๏ Based on Spring-Data-Commons infrastructure
    • Extract Mapping Meta Information
      ‣Neo4jPersistentEntity, Neo4jPersistentProperty
    • Entity-Converter Implementations for Object-Graph-Mapping
      ‣Type-resolution
      ‣Entity construction
      ‣Transfer properties
      ‣loaed for eagerly fetched relationships
    • Neo4j-Template for Graph-Interaction
                                                          50
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
                                                             51
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
    • ...
                                                                  52
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;
  }
}



                                                          53
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
   • Graph-Queries (Cypher, Gremlin)
   • derived Queries
   • Spatial Queries
๏ extensible via custom methods with provided implementations
                                                           54
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";
  }}
                                                                      55
Other repository query methods


Actor jeffGoldblum = actorRepo.findOne(42);


boolean actorExists = actorRepo.exists(42);


Iterable<Actor> actors = actorRepo.findAllByTraversal(movie,traversal);


Iterable<Actor> allActors = actorRepo.findAll();


long numberOfActors = actorRepo.count();


Page<Actor> actors = actorRepo.findAll(new PageRequest(page, PAGE_SIZE));


Iterable<Actor> actorsByNameAndAge = actorRepo.findAll(new Sort(„name“,“age“));
Repository-Query-Support
interface MovieRepository extends GraphRepository<Movie> {


    @Query("start m=({movie}) match m-[ACTS_IN]-actor return actor")
    Iterable<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)
    Iterable<Person> getActorsGremlin(@Param("movie") Movie m);
}




                                                                       57
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



                                             58
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)




                                                                         59
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



                                                                    60
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


                                                                       61
Cross-store persistence
A scenario...
You have a traditional web app using JPA to persist data to a relational
  database
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
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;
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;
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;
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;
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;
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;
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.




                                     67
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



                                                                                       68
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
                                                                     69
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
Cineasts.net




 Check Out: http://spring.neo4j.org/tutorial

Mais conteúdo relacionado

Mais procurados

The Future is Big Graphs: A Community View on Graph Processing Systems
The Future is Big Graphs: A Community View on Graph Processing SystemsThe Future is Big Graphs: A Community View on Graph Processing Systems
The Future is Big Graphs: A Community View on Graph Processing SystemsNeo4j
 
GraphTour 2020 - Neo4j Innovation Lab
GraphTour 2020 - Neo4j Innovation LabGraphTour 2020 - Neo4j Innovation Lab
GraphTour 2020 - Neo4j Innovation LabNeo4j
 
Graph database Use Cases
Graph database Use CasesGraph database Use Cases
Graph database Use CasesMax De Marzi
 
Graphs for Enterprise Architects
Graphs for Enterprise ArchitectsGraphs for Enterprise Architects
Graphs for Enterprise ArchitectsNeo4j
 
Einführung in Neo4j
Einführung in Neo4jEinführung in Neo4j
Einführung in Neo4jNeo4j
 
Building a Knowledge Graph using NLP and Ontologies
Building a Knowledge Graph using NLP and OntologiesBuilding a Knowledge Graph using NLP and Ontologies
Building a Knowledge Graph using NLP and OntologiesNeo4j
 
Graph database & neo4j
Graph database & neo4jGraph database & neo4j
Graph database & neo4jSandip Jadhav
 
RDBMS to Graph Webinar
RDBMS to Graph WebinarRDBMS to Graph Webinar
RDBMS to Graph WebinarNeo4j
 
GraphDay Stockholm - Graphs in the Real World: Top Use Cases for Graph Databases
GraphDay Stockholm - Graphs in the Real World: Top Use Cases for Graph DatabasesGraphDay Stockholm - Graphs in the Real World: Top Use Cases for Graph Databases
GraphDay Stockholm - Graphs in the Real World: Top Use Cases for Graph DatabasesNeo4j
 
Neo4j Graph Data Science - Webinar
Neo4j Graph Data Science - WebinarNeo4j Graph Data Science - Webinar
Neo4j Graph Data Science - WebinarNeo4j
 
Transforming Visibility & Automation: The Actioning Knowledge Graph
Transforming Visibility & Automation: The Actioning Knowledge GraphTransforming Visibility & Automation: The Actioning Knowledge Graph
Transforming Visibility & Automation: The Actioning Knowledge GraphNeo4j
 
Neo4j Innovation Lab – Bringing the Best of Data Science and Design Thinking ...
Neo4j Innovation Lab – Bringing the Best of Data Science and Design Thinking ...Neo4j Innovation Lab – Bringing the Best of Data Science and Design Thinking ...
Neo4j Innovation Lab – Bringing the Best of Data Science and Design Thinking ...Neo4j
 
Emil Eifrem Keynote - GraphConnect Europe 2017
Emil Eifrem Keynote - GraphConnect Europe 2017Emil Eifrem Keynote - GraphConnect Europe 2017
Emil Eifrem Keynote - GraphConnect Europe 2017Neo4j
 
Einstieg in Neo4j Graph Data Science
Einstieg in Neo4j Graph Data ScienceEinstieg in Neo4j Graph Data Science
Einstieg in Neo4j Graph Data ScienceNeo4j
 
Introduction to the graph technologies landscape
Introduction to the graph technologies landscapeIntroduction to the graph technologies landscape
Introduction to the graph technologies landscapeLinkurious
 
Graph technology meetup slides
Graph technology meetup slidesGraph technology meetup slides
Graph technology meetup slidesSean Mulvehill
 
Neo4j GraphDay Seattle- Sept19- neo4j basic training
Neo4j GraphDay Seattle- Sept19- neo4j basic trainingNeo4j GraphDay Seattle- Sept19- neo4j basic training
Neo4j GraphDay Seattle- Sept19- neo4j basic trainingNeo4j
 
How do You Graph
How do You GraphHow do You Graph
How do You GraphBen Krug
 
Graphs for AI & ML, Jim Webber, Neo4j
Graphs for AI & ML, Jim Webber, Neo4jGraphs for AI & ML, Jim Webber, Neo4j
Graphs for AI & ML, Jim Webber, Neo4jNeo4j
 
Democratizing Data at Airbnb
Democratizing Data at AirbnbDemocratizing Data at Airbnb
Democratizing Data at AirbnbNeo4j
 

Mais procurados (20)

The Future is Big Graphs: A Community View on Graph Processing Systems
The Future is Big Graphs: A Community View on Graph Processing SystemsThe Future is Big Graphs: A Community View on Graph Processing Systems
The Future is Big Graphs: A Community View on Graph Processing Systems
 
GraphTour 2020 - Neo4j Innovation Lab
GraphTour 2020 - Neo4j Innovation LabGraphTour 2020 - Neo4j Innovation Lab
GraphTour 2020 - Neo4j Innovation Lab
 
Graph database Use Cases
Graph database Use CasesGraph database Use Cases
Graph database Use Cases
 
Graphs for Enterprise Architects
Graphs for Enterprise ArchitectsGraphs for Enterprise Architects
Graphs for Enterprise Architects
 
Einführung in Neo4j
Einführung in Neo4jEinführung in Neo4j
Einführung in Neo4j
 
Building a Knowledge Graph using NLP and Ontologies
Building a Knowledge Graph using NLP and OntologiesBuilding a Knowledge Graph using NLP and Ontologies
Building a Knowledge Graph using NLP and Ontologies
 
Graph database & neo4j
Graph database & neo4jGraph database & neo4j
Graph database & neo4j
 
RDBMS to Graph Webinar
RDBMS to Graph WebinarRDBMS to Graph Webinar
RDBMS to Graph Webinar
 
GraphDay Stockholm - Graphs in the Real World: Top Use Cases for Graph Databases
GraphDay Stockholm - Graphs in the Real World: Top Use Cases for Graph DatabasesGraphDay Stockholm - Graphs in the Real World: Top Use Cases for Graph Databases
GraphDay Stockholm - Graphs in the Real World: Top Use Cases for Graph Databases
 
Neo4j Graph Data Science - Webinar
Neo4j Graph Data Science - WebinarNeo4j Graph Data Science - Webinar
Neo4j Graph Data Science - Webinar
 
Transforming Visibility & Automation: The Actioning Knowledge Graph
Transforming Visibility & Automation: The Actioning Knowledge GraphTransforming Visibility & Automation: The Actioning Knowledge Graph
Transforming Visibility & Automation: The Actioning Knowledge Graph
 
Neo4j Innovation Lab – Bringing the Best of Data Science and Design Thinking ...
Neo4j Innovation Lab – Bringing the Best of Data Science and Design Thinking ...Neo4j Innovation Lab – Bringing the Best of Data Science and Design Thinking ...
Neo4j Innovation Lab – Bringing the Best of Data Science and Design Thinking ...
 
Emil Eifrem Keynote - GraphConnect Europe 2017
Emil Eifrem Keynote - GraphConnect Europe 2017Emil Eifrem Keynote - GraphConnect Europe 2017
Emil Eifrem Keynote - GraphConnect Europe 2017
 
Einstieg in Neo4j Graph Data Science
Einstieg in Neo4j Graph Data ScienceEinstieg in Neo4j Graph Data Science
Einstieg in Neo4j Graph Data Science
 
Introduction to the graph technologies landscape
Introduction to the graph technologies landscapeIntroduction to the graph technologies landscape
Introduction to the graph technologies landscape
 
Graph technology meetup slides
Graph technology meetup slidesGraph technology meetup slides
Graph technology meetup slides
 
Neo4j GraphDay Seattle- Sept19- neo4j basic training
Neo4j GraphDay Seattle- Sept19- neo4j basic trainingNeo4j GraphDay Seattle- Sept19- neo4j basic training
Neo4j GraphDay Seattle- Sept19- neo4j basic training
 
How do You Graph
How do You GraphHow do You Graph
How do You Graph
 
Graphs for AI & ML, Jim Webber, Neo4j
Graphs for AI & ML, Jim Webber, Neo4jGraphs for AI & ML, Jim Webber, Neo4j
Graphs for AI & ML, Jim Webber, Neo4j
 
Democratizing Data at Airbnb
Democratizing Data at AirbnbDemocratizing Data at Airbnb
Democratizing Data at Airbnb
 

Destaque

Intro to Spring Data Neo4j
Intro to Spring Data Neo4jIntro to Spring Data Neo4j
Intro to Spring Data Neo4jjexp
 
New Neo4j Auto HA Cluster
New Neo4j Auto HA ClusterNew Neo4j Auto HA Cluster
New Neo4j Auto HA Clusterjexp
 
Class graph neo4j and software metrics
Class graph neo4j and software metricsClass graph neo4j and software metrics
Class graph neo4j and software metricsjexp
 
Spring Data Neo4j Intro SpringOne 2012
Spring Data Neo4j Intro SpringOne 2012Spring Data Neo4j Intro SpringOne 2012
Spring Data Neo4j Intro SpringOne 2012jexp
 
My sql explain & select
My sql explain & selectMy sql explain & select
My sql explain & selectMing-Ying Wu
 
Persistência com JPA e Hibernate
Persistência com JPA e HibernatePersistência com JPA e Hibernate
Persistência com JPA e HibernateFernando Oliveira
 
JPQL/ JPA Activity 2
JPQL/ JPA Activity 2JPQL/ JPA Activity 2
JPQL/ JPA Activity 2SFI
 
JPQL/ JPA Activity 1
JPQL/ JPA Activity 1JPQL/ JPA Activity 1
JPQL/ JPA Activity 1SFI
 
FinelyMe-JustFit Intro
FinelyMe-JustFit IntroFinelyMe-JustFit Intro
FinelyMe-JustFit IntroCheng Ta Yeh
 
JPQL/ JPA Activity 3
JPQL/ JPA  Activity 3JPQL/ JPA  Activity 3
JPQL/ JPA Activity 3SFI
 
Git rerere
Git rerereGit rerere
Git rerereSean Lee
 
Using the latest Java Persistence API 2 Features - Tech Days 2010 India
Using the latest Java Persistence API 2 Features - Tech Days 2010 IndiaUsing the latest Java Persistence API 2 Features - Tech Days 2010 India
Using the latest Java Persistence API 2 Features - Tech Days 2010 IndiaArun Gupta
 
Introduction to Webpack - Ordina JWorks - CC JS & Web
Introduction to Webpack - Ordina JWorks - CC JS & WebIntroduction to Webpack - Ordina JWorks - CC JS & Web
Introduction to Webpack - Ordina JWorks - CC JS & WebJWORKS powered by Ordina
 
Java Persistence 2.0
Java Persistence 2.0Java Persistence 2.0
Java Persistence 2.0GFU Cyrus AG
 
Lecture 9 - Java Persistence, JPA 2
Lecture 9 - Java Persistence, JPA 2Lecture 9 - Java Persistence, JPA 2
Lecture 9 - Java Persistence, JPA 2Fahad Golra
 
Lecture 6 Web Sockets
Lecture 6   Web SocketsLecture 6   Web Sockets
Lecture 6 Web SocketsFahad Golra
 

Destaque (20)

Intro to Spring Data Neo4j
Intro to Spring Data Neo4jIntro to Spring Data Neo4j
Intro to Spring Data Neo4j
 
New Neo4j Auto HA Cluster
New Neo4j Auto HA ClusterNew Neo4j Auto HA Cluster
New Neo4j Auto HA Cluster
 
Class graph neo4j and software metrics
Class graph neo4j and software metricsClass graph neo4j and software metrics
Class graph neo4j and software metrics
 
Spring Data Neo4j Intro SpringOne 2012
Spring Data Neo4j Intro SpringOne 2012Spring Data Neo4j Intro SpringOne 2012
Spring Data Neo4j Intro SpringOne 2012
 
My sql explain & select
My sql explain & selectMy sql explain & select
My sql explain & select
 
Working with jpa
Working with jpaWorking with jpa
Working with jpa
 
Persistência com JPA e Hibernate
Persistência com JPA e HibernatePersistência com JPA e Hibernate
Persistência com JPA e Hibernate
 
Integration testing - A&BP CC
Integration testing - A&BP CCIntegration testing - A&BP CC
Integration testing - A&BP CC
 
JPQL/ JPA Activity 2
JPQL/ JPA Activity 2JPQL/ JPA Activity 2
JPQL/ JPA Activity 2
 
JPQL/ JPA Activity 1
JPQL/ JPA Activity 1JPQL/ JPA Activity 1
JPQL/ JPA Activity 1
 
FinelyMe-JustFit Intro
FinelyMe-JustFit IntroFinelyMe-JustFit Intro
FinelyMe-JustFit Intro
 
JPQL/ JPA Activity 3
JPQL/ JPA  Activity 3JPQL/ JPA  Activity 3
JPQL/ JPA Activity 3
 
Taming NoSQL with Spring Data
Taming NoSQL with Spring DataTaming NoSQL with Spring Data
Taming NoSQL with Spring Data
 
Git rerere
Git rerereGit rerere
Git rerere
 
Using the latest Java Persistence API 2 Features - Tech Days 2010 India
Using the latest Java Persistence API 2 Features - Tech Days 2010 IndiaUsing the latest Java Persistence API 2 Features - Tech Days 2010 India
Using the latest Java Persistence API 2 Features - Tech Days 2010 India
 
Introduction to Webpack - Ordina JWorks - CC JS & Web
Introduction to Webpack - Ordina JWorks - CC JS & WebIntroduction to Webpack - Ordina JWorks - CC JS & Web
Introduction to Webpack - Ordina JWorks - CC JS & Web
 
Java Persistence 2.0
Java Persistence 2.0Java Persistence 2.0
Java Persistence 2.0
 
Programming 4 kids
Programming 4 kidsProgramming 4 kids
Programming 4 kids
 
Lecture 9 - Java Persistence, JPA 2
Lecture 9 - Java Persistence, JPA 2Lecture 9 - Java Persistence, JPA 2
Lecture 9 - Java Persistence, JPA 2
 
Lecture 6 Web Sockets
Lecture 6   Web SocketsLecture 6   Web Sockets
Lecture 6 Web Sockets
 

Semelhante a Spring Data Neo4j Intro SpringOne 2011

3/15 - Intro to Spring Data Neo4j
3/15 - Intro to Spring Data Neo4j3/15 - Intro to Spring Data Neo4j
3/15 - Intro to Spring Data Neo4jNeo4j
 
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
 
An Introduction to NOSQL, Graph Databases and Neo4j
An Introduction to NOSQL, Graph Databases and Neo4jAn Introduction to NOSQL, Graph Databases and Neo4j
An Introduction to NOSQL, Graph Databases and Neo4jDebanjan Mahata
 
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
 
No Sql Movement
No Sql MovementNo Sql Movement
No Sql MovementAjit Koti
 
An Introduction to Big Data, NoSQL and MongoDB
An Introduction to Big Data, NoSQL and MongoDBAn Introduction to Big Data, NoSQL and MongoDB
An Introduction to Big Data, NoSQL and MongoDBWilliam LaForest
 
GraphTalks Rome - Selecting the right Technology
GraphTalks Rome - Selecting the right TechnologyGraphTalks Rome - Selecting the right Technology
GraphTalks Rome - Selecting the right TechnologyNeo4j
 
Graph Database and Neo4j
Graph Database and Neo4jGraph Database and Neo4j
Graph Database and Neo4jSina Khorami
 
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
 
Polyglot Persistence with MongoDB and Neo4j
Polyglot Persistence with MongoDB and Neo4jPolyglot Persistence with MongoDB and Neo4j
Polyglot Persistence with MongoDB and Neo4jCorie Pollock
 
NOSQL Overview Lightning Talk (Scalability Geekcruise 2009)
NOSQL Overview Lightning Talk (Scalability Geekcruise 2009)NOSQL Overview Lightning Talk (Scalability Geekcruise 2009)
NOSQL Overview Lightning Talk (Scalability Geekcruise 2009)Emil Eifrem
 
Introduction to Graph Databases
Introduction to Graph DatabasesIntroduction to Graph Databases
Introduction to Graph DatabasesMax De Marzi
 
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
 
Selecting the right database type for your knowledge management needs.
Selecting the right database type for your knowledge management needs.Selecting the right database type for your knowledge management needs.
Selecting the right database type for your knowledge management needs.Synaptica, LLC
 
Intro to Graphs for Fedict
Intro to Graphs for FedictIntro to Graphs for Fedict
Intro to Graphs for FedictRik Van Bruggen
 

Semelhante a Spring Data Neo4j Intro SpringOne 2011 (20)

3/15 - Intro to Spring Data Neo4j
3/15 - Intro to Spring Data Neo4j3/15 - Intro to Spring Data Neo4j
3/15 - Intro to Spring Data Neo4j
 
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)
 
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)
 
Eifrem neo4j
Eifrem neo4jEifrem neo4j
Eifrem neo4j
 
An Introduction to NOSQL, Graph Databases and Neo4j
An Introduction to NOSQL, Graph Databases and Neo4jAn Introduction to NOSQL, Graph Databases and Neo4j
An Introduction to NOSQL, Graph Databases and Neo4j
 
Anti-social Databases
Anti-social DatabasesAnti-social Databases
Anti-social Databases
 
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)
 
No Sql Movement
No Sql MovementNo Sql Movement
No Sql Movement
 
An Introduction to Big Data, NoSQL and MongoDB
An Introduction to Big Data, NoSQL and MongoDBAn Introduction to Big Data, NoSQL and MongoDB
An Introduction to Big Data, NoSQL and MongoDB
 
Grails goes Graph
Grails goes GraphGrails goes Graph
Grails goes Graph
 
GraphTalks Rome - Selecting the right Technology
GraphTalks Rome - Selecting the right TechnologyGraphTalks Rome - Selecting the right Technology
GraphTalks Rome - Selecting the right Technology
 
Graph Database and Neo4j
Graph Database and Neo4jGraph Database and Neo4j
Graph Database and Neo4j
 
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
 
Polyglot Persistence with MongoDB and Neo4j
Polyglot Persistence with MongoDB and Neo4jPolyglot Persistence with MongoDB and Neo4j
Polyglot Persistence with MongoDB and Neo4j
 
NOSQL Overview Lightning Talk (Scalability Geekcruise 2009)
NOSQL Overview Lightning Talk (Scalability Geekcruise 2009)NOSQL Overview Lightning Talk (Scalability Geekcruise 2009)
NOSQL Overview Lightning Talk (Scalability Geekcruise 2009)
 
Introduction to Graph Databases
Introduction to Graph DatabasesIntroduction to Graph Databases
Introduction to Graph Databases
 
Graph Databases
Graph DatabasesGraph Databases
Graph Databases
 
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
 
Selecting the right database type for your knowledge management needs.
Selecting the right database type for your knowledge management needs.Selecting the right database type for your knowledge management needs.
Selecting the right database type for your knowledge management needs.
 
Intro to Graphs for Fedict
Intro to Graphs for FedictIntro to Graphs for Fedict
Intro to Graphs for Fedict
 

Mais de jexp

Looming Marvelous - Virtual Threads in Java Javaland.pdf
Looming Marvelous - Virtual Threads in Java Javaland.pdfLooming Marvelous - Virtual Threads in Java Javaland.pdf
Looming Marvelous - Virtual Threads in Java Javaland.pdfjexp
 
Easing the daily grind with the awesome JDK command line tools
Easing the daily grind with the awesome JDK command line toolsEasing the daily grind with the awesome JDK command line tools
Easing the daily grind with the awesome JDK command line toolsjexp
 
Looming Marvelous - Virtual Threads in Java
Looming Marvelous - Virtual Threads in JavaLooming Marvelous - Virtual Threads in Java
Looming Marvelous - Virtual Threads in Javajexp
 
GraphConnect 2022 - Top 10 Cypher Tuning Tips & Tricks.pptx
GraphConnect 2022 - Top 10 Cypher Tuning Tips & Tricks.pptxGraphConnect 2022 - Top 10 Cypher Tuning Tips & Tricks.pptx
GraphConnect 2022 - Top 10 Cypher Tuning Tips & Tricks.pptxjexp
 
Neo4j Connector Apache Spark FiNCENFiles
Neo4j Connector Apache Spark FiNCENFilesNeo4j Connector Apache Spark FiNCENFiles
Neo4j Connector Apache Spark FiNCENFilesjexp
 
How Graphs Help Investigative Journalists to Connect the Dots
How Graphs Help Investigative Journalists to Connect the DotsHow Graphs Help Investigative Journalists to Connect the Dots
How Graphs Help Investigative Journalists to Connect the Dotsjexp
 
The Home Office. Does it really work?
The Home Office. Does it really work?The Home Office. Does it really work?
The Home Office. Does it really work?jexp
 
Polyglot Applications with GraalVM
Polyglot Applications with GraalVMPolyglot Applications with GraalVM
Polyglot Applications with GraalVMjexp
 
Neo4j Graph Streaming Services with Apache Kafka
Neo4j Graph Streaming Services with Apache KafkaNeo4j Graph Streaming Services with Apache Kafka
Neo4j Graph Streaming Services with Apache Kafkajexp
 
How Graph Databases efficiently store, manage and query connected data at s...
How Graph Databases efficiently  store, manage and query  connected data at s...How Graph Databases efficiently  store, manage and query  connected data at s...
How Graph Databases efficiently store, manage and query connected data at s...jexp
 
APOC Pearls - Whirlwind Tour Through the Neo4j APOC Procedures Library
APOC Pearls - Whirlwind Tour Through the Neo4j APOC Procedures LibraryAPOC Pearls - Whirlwind Tour Through the Neo4j APOC Procedures Library
APOC Pearls - Whirlwind Tour Through the Neo4j APOC Procedures Libraryjexp
 
Refactoring, 2nd Edition
Refactoring, 2nd EditionRefactoring, 2nd Edition
Refactoring, 2nd Editionjexp
 
New Features in Neo4j 3.4 / 3.3 - Graph Algorithms, Spatial, Date-Time & Visu...
New Features in Neo4j 3.4 / 3.3 - Graph Algorithms, Spatial, Date-Time & Visu...New Features in Neo4j 3.4 / 3.3 - Graph Algorithms, Spatial, Date-Time & Visu...
New Features in Neo4j 3.4 / 3.3 - Graph Algorithms, Spatial, Date-Time & Visu...jexp
 
GraphQL - The new "Lingua Franca" for API-Development
GraphQL - The new "Lingua Franca" for API-DevelopmentGraphQL - The new "Lingua Franca" for API-Development
GraphQL - The new "Lingua Franca" for API-Developmentjexp
 
A whirlwind tour of graph databases
A whirlwind tour of graph databasesA whirlwind tour of graph databases
A whirlwind tour of graph databasesjexp
 
Practical Graph Algorithms with Neo4j
Practical Graph Algorithms with Neo4jPractical Graph Algorithms with Neo4j
Practical Graph Algorithms with Neo4jjexp
 
A Game of Data and GraphQL
A Game of Data and GraphQLA Game of Data and GraphQL
A Game of Data and GraphQLjexp
 
Querying Graphs with GraphQL
Querying Graphs with GraphQLQuerying Graphs with GraphQL
Querying Graphs with GraphQLjexp
 
Graphs & Neo4j - Past Present Future
Graphs & Neo4j - Past Present FutureGraphs & Neo4j - Past Present Future
Graphs & Neo4j - Past Present Futurejexp
 
Intro to Cypher
Intro to CypherIntro to Cypher
Intro to Cypherjexp
 

Mais de jexp (20)

Looming Marvelous - Virtual Threads in Java Javaland.pdf
Looming Marvelous - Virtual Threads in Java Javaland.pdfLooming Marvelous - Virtual Threads in Java Javaland.pdf
Looming Marvelous - Virtual Threads in Java Javaland.pdf
 
Easing the daily grind with the awesome JDK command line tools
Easing the daily grind with the awesome JDK command line toolsEasing the daily grind with the awesome JDK command line tools
Easing the daily grind with the awesome JDK command line tools
 
Looming Marvelous - Virtual Threads in Java
Looming Marvelous - Virtual Threads in JavaLooming Marvelous - Virtual Threads in Java
Looming Marvelous - Virtual Threads in Java
 
GraphConnect 2022 - Top 10 Cypher Tuning Tips & Tricks.pptx
GraphConnect 2022 - Top 10 Cypher Tuning Tips & Tricks.pptxGraphConnect 2022 - Top 10 Cypher Tuning Tips & Tricks.pptx
GraphConnect 2022 - Top 10 Cypher Tuning Tips & Tricks.pptx
 
Neo4j Connector Apache Spark FiNCENFiles
Neo4j Connector Apache Spark FiNCENFilesNeo4j Connector Apache Spark FiNCENFiles
Neo4j Connector Apache Spark FiNCENFiles
 
How Graphs Help Investigative Journalists to Connect the Dots
How Graphs Help Investigative Journalists to Connect the DotsHow Graphs Help Investigative Journalists to Connect the Dots
How Graphs Help Investigative Journalists to Connect the Dots
 
The Home Office. Does it really work?
The Home Office. Does it really work?The Home Office. Does it really work?
The Home Office. Does it really work?
 
Polyglot Applications with GraalVM
Polyglot Applications with GraalVMPolyglot Applications with GraalVM
Polyglot Applications with GraalVM
 
Neo4j Graph Streaming Services with Apache Kafka
Neo4j Graph Streaming Services with Apache KafkaNeo4j Graph Streaming Services with Apache Kafka
Neo4j Graph Streaming Services with Apache Kafka
 
How Graph Databases efficiently store, manage and query connected data at s...
How Graph Databases efficiently  store, manage and query  connected data at s...How Graph Databases efficiently  store, manage and query  connected data at s...
How Graph Databases efficiently store, manage and query connected data at s...
 
APOC Pearls - Whirlwind Tour Through the Neo4j APOC Procedures Library
APOC Pearls - Whirlwind Tour Through the Neo4j APOC Procedures LibraryAPOC Pearls - Whirlwind Tour Through the Neo4j APOC Procedures Library
APOC Pearls - Whirlwind Tour Through the Neo4j APOC Procedures Library
 
Refactoring, 2nd Edition
Refactoring, 2nd EditionRefactoring, 2nd Edition
Refactoring, 2nd Edition
 
New Features in Neo4j 3.4 / 3.3 - Graph Algorithms, Spatial, Date-Time & Visu...
New Features in Neo4j 3.4 / 3.3 - Graph Algorithms, Spatial, Date-Time & Visu...New Features in Neo4j 3.4 / 3.3 - Graph Algorithms, Spatial, Date-Time & Visu...
New Features in Neo4j 3.4 / 3.3 - Graph Algorithms, Spatial, Date-Time & Visu...
 
GraphQL - The new "Lingua Franca" for API-Development
GraphQL - The new "Lingua Franca" for API-DevelopmentGraphQL - The new "Lingua Franca" for API-Development
GraphQL - The new "Lingua Franca" for API-Development
 
A whirlwind tour of graph databases
A whirlwind tour of graph databasesA whirlwind tour of graph databases
A whirlwind tour of graph databases
 
Practical Graph Algorithms with Neo4j
Practical Graph Algorithms with Neo4jPractical Graph Algorithms with Neo4j
Practical Graph Algorithms with Neo4j
 
A Game of Data and GraphQL
A Game of Data and GraphQLA Game of Data and GraphQL
A Game of Data and GraphQL
 
Querying Graphs with GraphQL
Querying Graphs with GraphQLQuerying Graphs with GraphQL
Querying Graphs with GraphQL
 
Graphs & Neo4j - Past Present Future
Graphs & Neo4j - Past Present FutureGraphs & Neo4j - Past Present Future
Graphs & Neo4j - Past Present Future
 
Intro to Cypher
Intro to CypherIntro to Cypher
Intro to Cypher
 

Último

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 

Último (20)

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 

Spring Data Neo4j Intro SpringOne 2011

  • 1. Introduction to Spring Data Neo4j Michael Hunger
  • 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: • NOSQL ? • Enterprise ? • Rich Domain ?
  • 3. What‘s up? ๏ NOSQL overview ๏ Spring Data overview ๏ Networks are everywhere ๏ Graph Databases ๏ Neo4j introduction ๏ Spring Data Neo4j introduction 3
  • 5. What does NOSQL stand for?
  • 6. What does NOSQL stand for? It’s not “No to SQL”
  • 7. What does NOSQL stand for? It’s not “No to SQL” It’s not “Never SQL”
  • 8. What does NOSQL stand for? It’s not “No to SQL” It’s not “Never SQL” It’s “Not Only SQL”
  • 9. What does NOSQL stand for? 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.
  • 10. Why NOSQL now? We have observed four trends: ๏ 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
  • 11. NOSQL categories We see four main categories in the NOSQL space:
  • 12. NOSQL categories We see four main categories in the NOSQL space: Key-Value •Redis •Riak •Voldemort
  • 13. NOSQL categories We see four main categories in the NOSQL space: Column-family/ Key-Value BigTable •Redis •Riak •Cassandra •Voldemort •HBase
  • 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
  • 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
  • 16. Scaling to size vs. Scaling to complexity Size Key-Value stores Bigtable clones Document databases Graph databases Complexity 8
  • 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
  • 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
  • 20. What is Spring Data ๏ VMWare/SpringSource initiative to give Spring developers easy access to the emerging world of NOSQL, including: • Non-relational databases • MapReduce • Grails NOSQL support • Cross-store persistence • Object Persistence Mapping Infrastructure • Generic Repository Infrastructure • upcoming Spring Roo add-ons 10
  • 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
  • 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 graph applications ๏ Cross-store persistence: Extend existing JPA application with NOSQL persistence ๏ Spring Roo support: Add graph persistence with Roo add-on
  • 24. Even in the Matrix - everything is a grpah Google Image Search: „graph OR network“ 14
  • 25. Graphs Everywhere ๏ Relationships in • Politics, Economics, History, Science,Transportation ๏ Biology, Chemistry, Physics, Sociology • Body, Ecosphere, Reaction, Interactions ๏ Internet • Hardware, Software, Interaction ๏ Social Networks • Family, Friends • Work, Communities • Neighbours, Cities, Society 15
  • 26. Good Relationships ๏ the 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
  • 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
  • 28. Categories ? ๏ Categories == Classes, Trees ? ๏ What if more than one category fits? ๏ Tags ๏ Categories vi relationships like „IS_A“ ๏ any number, easy change ๏ „virtual“ Relationships - Traversals ๏ Category dynamically derived from queries 18
  • 29. Fowler & Christakis „Connected“ 19
  • 30. New York Times R&D „Cascade“ 20
  • 31. Deb Roy - MIT & Bluefin Labs „Birth of a Word“ TED Talk Researches Social Reactions to (Media) Events 21
  • 33. What is Neo4j? data model
  • 34. What is Neo4j? data model A Graph Database
  • 35. What is Neo4j? data model A Graph Database
  • 36. What is Neo4j? data model A Graph Database
  • 37. What is Neo4j? data model A Graph Database Node Node
  • 38. What is Neo4j? data model A Graph Database Typed relationship Node Node
  • 39. What is Neo4j? data model A Graph Database Node Typed relationship Node key: value key: value
  • 41. For example name: Oliver
  • 42. For example name: Oliver name: Michael
  • 43. For example WORKS_WITH project: spring-data name: Oliver name: Michael
  • 44. 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
  • 45. 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
  • 46. 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
  • 47. Best NOSQL Database for Spring ? Why ? Explain ! •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+ hops per ms •24/7 production since 2003 •Integrated indexing •Plenthora of language bindings
  • 49. Whiteboard friendly Ally’s Blog NS W O Allison
  • 50. Whiteboard friendly Blog Post BEL ON GS _TO Ally’s Blog WROTE BE LO NG NS S_ W O OT Blog Allison WROTE Post 2
  • 51. Whiteboard friendly Blog Post BEL ON GS _TO Ally’s Blog WROTE BE LO NG NS S_ W O T O Blog Allison WROTE Post 2 CO MM EN T_ OR FO R COMMENT_F Comment Comment
  • 52. Whiteboard friendly Blog Post BEL ON GS _TO Ally’s Blog WROTE BE LO NG NS S_ W O T O Blog Allison WROTE Post 2 CO MM EN T_ OR FO R COMMENT_F Comment Comment
  • 53. 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());
  • 54. 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(); }
  • 56. Traversal framework Example: a dependency graph A B D C
  • 57. Traversal framework Example: a dependency graph Query: Find all dependencies of A, transitively A B D C
  • 58. Traversal framework Example: a dependency graph Query: Find all dependencies of A, transitively A B D C
  • 59. Traversal framework Example: a dependency graph Query: Find all dependencies of A, transitively A B D C
  • 60. Traversal framework Example: a dependency graph Query: Find all dependencies of A, transitively A B D C
  • 61. 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); }
  • 62. So how do I find a node to traverse from? ?
  • 63. So how do I find a node to traverse from? g! in ex i nd i ng us B y ?
  • 64. So how do I find a node to traverse from? g! in ex i nd i ng us B y name: David ?
  • 65. So how do I find a node to traverse from? g! in ex i nd i ng us B y name: David ? David
  • 66. 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
  • 67. 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]-()-[:knows]-foaf WHERE foaf.age > 18 RETURN foaf START user=node(5, 15, 26, 28) # node IDs MATCH user--friend RETURN user, COUNT(friend), SUM(friend.money) 30
  • 68. Cypher Query Language (E xp ๏ Declarative query language en er ta im • Describe what you want, not how l) • Based on pattern matching ๏ Examples: START david=node:people(name=”David M”) # index lookup MATCH david-[:knows]-()-[:knows]-foaf WHERE foaf.age > 18 RETURN foaf START user=node(5, 15, 26, 28) # node IDs MATCH user--friend RETURN user, COUNT(friend), SUM(friend.money) 30
  • 69. Beyond basics ๏ 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 • Provides fault tolerance and horizontal scaling of reads 31
  • 71. 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
  • 72. 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 POJO entities ๏ Entity state backed by graph database ๏ Two modes of Object Graph Mapping • Spring Data Mapping • seamless object mapping leverages AspectJ ๏ Spring Roo add-on available
  • 73. 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 35
  • 74. 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 ); } }
  • 75. Spring Data Neo4j domain class @NodeEntity public class Actor { @Indexed private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } }
  • 76. 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 Old } ndNode() ) ); return movies; } class) @RelatedTo(type="ACTS_ IN", elementClass = Movie. ; private Set<Movie> movies public Iterable<Movie> ge tMovies() { New return movies; }
  • 78. 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
  • 80. 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
  • 81. 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; } 41
  • 82. Fields in node entities (@NodeEntity) • Fields of types that represent a node (@NodeEntity) 42
  • 83. Fields in node entities (@NodeEntity) • Fields of types that represent a node (@NodeEntity) @NodeEntity public class Movie {} @NodeEntity public class Person { private Movie favoriteMovie; } 42
  • 84. 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; } 42
  • 85. 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; } 43
  • 86. 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 44
  • 87. 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; }
  • 88. 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”);
  • 89. 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);
  • 90. 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 48
  • 91. Cypher query language @NodeEntity public class Actor { @Query(“START actor=({self}) ” + “MATCH (actor)-[:ACTS_IN]->(movie)<-[:ACTS_IN]-(coactor) ” + “RETURN coactor”) private Iterable<Actor> coactors; } @NodeEntity public class Actor { @Query(“START actor=({self}) ” + “MATCH (actor)-[:ACTS_IN]->(movie)<-[:ACTS_IN]-(coactor) ” + “RETURN movie.title, coactor.name”) private Iterable<Map<String, Object>> movieCoactorPairs; } 49
  • 92. Spring-Data-Mapping ๏ Based on Spring-Data-Commons infrastructure • Extract Mapping Meta Information ‣Neo4jPersistentEntity, Neo4jPersistentProperty • Entity-Converter Implementations for Object-Graph-Mapping ‣Type-resolution ‣Entity construction ‣Transfer properties ‣loaed for eagerly fetched relationships • Neo4j-Template for Graph-Interaction 50
  • 93. 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 51
  • 94. 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 • ... 52
  • 95. 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; } } 53
  • 96. 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 • Graph-Queries (Cypher, Gremlin) • derived Queries • Spatial Queries ๏ extensible via custom methods with provided implementations 54
  • 97. 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"; }} 55
  • 98. Other repository query methods Actor jeffGoldblum = actorRepo.findOne(42); boolean actorExists = actorRepo.exists(42); Iterable<Actor> actors = actorRepo.findAllByTraversal(movie,traversal); Iterable<Actor> allActors = actorRepo.findAll(); long numberOfActors = actorRepo.count(); Page<Actor> actors = actorRepo.findAll(new PageRequest(page, PAGE_SIZE)); Iterable<Actor> actorsByNameAndAge = actorRepo.findAll(new Sort(„name“,“age“));
  • 99. Repository-Query-Support interface MovieRepository extends GraphRepository<Movie> { @Query("start m=({movie}) match m-[ACTS_IN]-actor return actor") Iterable<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) Iterable<Person> getActorsGremlin(@Param("movie") Movie m); } 57
  • 100. 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 58
  • 101. 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) 59
  • 102. 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 60
  • 103. 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 61
  • 105. A scenario... You have a traditional web app using JPA to persist data to a relational database
  • 106. 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
  • 107. 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;
  • 108. 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;
  • 109. 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;
  • 110. 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;
  • 111. 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;
  • 112. 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;
  • 113. 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. 67
  • 114. 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 68
  • 115. 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 69
  • 116. 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
  • 117. Cineasts.net Check Out: http://spring.neo4j.org/tutorial

Notas do Editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. social networks (our actions in them work life health)\nthe internet\nits hardware\nits software\nour interactions\nour body\nnature environment\npolitical economic networks\nzusammenhaenge\nhistory\nscience\nzeit gr&amp;#xFC;nen abgeordneter handy\n
  23. social networks (our actions in them work life health)\nthe internet\nits hardware\nits software\nour interactions\nour body\nnature environment\npolitical economic networks\nzusammenhaenge\nhistory\nscience\nzeit gr&amp;#xFC;nen abgeordneter handy\n
  24. messy world\nfast changing world\nbez um graph sind teil der daten\nim rdbms teil des starren schemas\nkomplexe zusammenhaenge\nkomplexe fragen\nimmer neue kategorien - rels\ndynamisch - traversals\ntags attribute\ntemporale attribute\ndyn sprachen besser geeignet \n
  25. messy world\nfast changing world\nbez um graph sind teil der daten\nim rdbms teil des starren schemas\nkomplexe zusammenhaenge\nkomplexe fragen\nimmer neue kategorien - rels\ndynamisch - traversals\ntags attribute\ntemporale attribute\ndyn sprachen besser geeignet \n
  26. messy world\nfast changing world\nbez um graph sind teil der daten\nim rdbms teil des starren schemas\nkomplexe zusammenhaenge\nkomplexe fragen\nimmer neue kategorien - rels\ndynamisch - traversals\ntags attribute\ntemporale attribute\ndyn sprachen besser geeignet \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. Neo4j is a graph database. \n\nNodes, rels, key-value props on nodes and rels.\n
  32. Neo4j is a graph database. \n\nNodes, rels, key-value props on nodes and rels.\n
  33. Neo4j is a graph database. \n\nNodes, rels, key-value props on nodes and rels.\n
  34. Neo4j is a graph database. \n\nNodes, rels, key-value props on nodes and rels.\n
  35. Neo4j is a graph database. \n\nNodes, rels, key-value props on nodes and rels.\n
  36. Neo4j is a graph database. \n\nNodes, rels, key-value props on nodes and rels.\n
  37. Neo4j is a graph database. \n\nNodes, rels, key-value props on nodes and rels.\n
  38. Neo4j is a graph database. \n\nNodes, rels, key-value props on nodes and rels.\n
  39. Neo4j is a graph database. \n\nNodes, rels, key-value props on nodes and rels.\n
  40. Neo4j is a graph database. \n\nNodes, rels, key-value props on nodes and rels.\n
  41. ... so like I&amp;#x2019;m a node, Thomas is a node, and there&amp;#x2019;s a PRESENTED_WITH relationship between us.\n
  42. ... so like I&amp;#x2019;m a node, Thomas is a node, and there&amp;#x2019;s a PRESENTED_WITH relationship between us.\n
  43. ... so like I&amp;#x2019;m a node, Thomas is a node, and there&amp;#x2019;s a PRESENTED_WITH relationship between us.\n
  44. ... so like I&amp;#x2019;m a node, Thomas is a node, and there&amp;#x2019;s a PRESENTED_WITH relationship between us.\n
  45. ... so like I&amp;#x2019;m a node, Thomas is a node, and there&amp;#x2019;s a PRESENTED_WITH relationship between us.\n
  46. ... so like I&amp;#x2019;m a node, Thomas is a node, and there&amp;#x2019;s a PRESENTED_WITH relationship between us.\n
  47. ... so like I&amp;#x2019;m a node, Thomas is a node, and there&amp;#x2019;s a PRESENTED_WITH relationship between us.\n
  48. schema-free evolve data separately\n
  49. evolve data separately\n
  50. evolve data separately\n
  51. evolve data separately\n
  52. evolve data separately\n
  53. evolve data separately\n
  54. evolve data separately\n
  55. evolve data separately\n
  56. evolve data separately\n
  57. evolve data separately\n
  58. evolve data separately\n
  59. evolve data separately\n
  60. evolve data separately\n
  61. evolve data separately\n
  62. evolve data separately\n
  63. evolve data separately\n
  64. evolve data separately\n
  65. evolve data separately\n
  66. evolve data separately\n
  67. evolve data separately\n
  68. evolve data separately\n
  69. evolve data separately\n
  70. evolve data separately\n
  71. evolve data separately\n
  72. evolve data separately\n
  73. evolve data separately\n
  74. evolve data separately\n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. \n
  86. \n
  87. \n
  88. \n
  89. Traversing is great, but it needs to start from somewhere. How do we find that place?\n
  90. Traversing is great, but it needs to start from somewhere. How do we find that place?\n
  91. Traversing is great, but it needs to start from somewhere. How do we find that place?\n
  92. Traversing is great, but it needs to start from somewhere. How do we find that place?\n
  93. Traversing is great, but it needs to start from somewhere. How do we find that place?\n
  94. Traversing is great, but it needs to start from somewhere. How do we find that place?\n
  95. Traversing is great, but it needs to start from somewhere. How do we find that place?\n
  96. Traversing is great, but it needs to start from somewhere. How do we find that place?\n
  97. \n
  98. \n
  99. \n
  100. No need for persistence contexts or entity managers.\n\n
  101. No need for persistence contexts or entity managers.\n\n
  102. \n
  103. Jumping right into code\n
  104. \n
  105. \n
  106. \n
  107. \n
  108. Anonymous relationships\n
  109. Anonymous relationships\n
  110. Anonymous relationships\n
  111. Anonymous relationships\n
  112. Anonymous relationships\n
  113. \n
  114. \n
  115. \n
  116. \n
  117. \n
  118. \n
  119. \n
  120. \n
  121. \n
  122. This does not apply to Neo4j.\nIn Neo4j, transactions MUST be used.\n
  123. \n
  124. \n
  125. \n
  126. \n
  127. \n
  128. \n
  129. \n
  130. \n
  131. \n
  132. \n
  133. \n
  134. \n
  135. \n
  136. \n
  137. \n
  138. \n
  139. \n
  140. \n
  141. \n
  142. \n
  143. \n
  144. \n
  145. \n
  146. \n
  147. \n
  148. \n
  149. \n
  150. \n
  151. \n
  152. \n
  153. \n
  154. \n
  155. \n
  156. \n
  157. \n
  158. \n
  159. \n
  160. \n
  161. \n
  162. \n
  163. \n