SlideShare a Scribd company logo
1 of 119
Spring Data Neo4j
                                                          Michael Hunger - @mesirii
                                                          Emil Eifrem - @emileifrem

                                                                      Neo Technology
                                                                          #neo4j
© 2012 SpringOne 2GX. All rights reserved. Do not distribute without permission.
Twitter example


          To become part of todays
               Twitter-Graph
Twitter example


        To become part of todays
             Twitter-Graph
    please tweet with #s2gx #neo4j
Twitter example


        To become part of todays
             Twitter-Graph
    please tweet with #s2gx #neo4j
                  ✓your   attendance
                  ✓questions

                  ✓remarks

                  ✓....
Agenda


     1. Connected Data, Graph Databases and Neo4j
     2. Spring Data Neo4j
     3. Twitter-Graph - Sample App
     4. Summary
     5. Q & A
The Evolution of Web Search




 4
The Evolution of Web Search
     Pre-1999
     WWW Indexing




 4
The Evolution of Web Search
     Pre-1999       1999 - 2012
     WWW Indexing    Google Invents
                       PageRank




 4
The Evolution of Web Search
     Pre-1999       1999 - 2012           2012-?
     WWW Indexing    Google Invents   Google Launches the
                       PageRank        Knowledge Graph




 4
The Evolution of Web Search
     Pre-1999       1999 - 2012           2012-?
     WWW Indexing    Google Invents   Google Launches the
                       PageRank        Knowledge Graph




     Atomic Data
 4
The Evolution of Web Search
     Pre-1999       1999 - 2012           2012-?
     WWW Indexing    Google Invents   Google Launches the
                       PageRank        Knowledge Graph




                        Simple
     Atomic Data
                    Connected Data
 4
The Evolution of Web Search
     Pre-1999       1999 - 2012           2012-?
     WWW Indexing    Google Invents   Google Launches the
                       PageRank        Knowledge Graph




                        Simple             Rich
     Atomic Data
                    Connected Data     Connected Data
 4
The Evolution of Online Job Search




 5
The Evolution of Online Job Search
       2010-11
      Resume Scoring




      Atomic Data
 5
The Evolution of Online Job Search
       2010-11             2011-12
      Resume Scoring     Social Job Search




      Atomic Data       Connected Data
 5
The Evolution of Web Browsing




 6
The Evolution of Web Browsing
         Pre-2012
        Explicit Browsing




         Atomic Data
 6
The Evolution of Web Browsing
         Pre-2012               2012+
        Explicit Browsing   Connected Browsing




                                   ?
         Atomic Data        Connected Data
 6
Other Markets In Evolution
      Core Industries               Finance &   Datacom /
                        Web / ISV
       & Use Cases:                 Insurance    Telecom


     Network /Cloud
         Mgmt



          MDM



          Social



           Geo


 7
Other Markets In Evolution
Core Industries             Finance & Datacom /               Life      Media &   Education,   Government,
                  Web / ISV                     Logistics                                       Aerospace,
 & Use Cases:               Insurance Telecom               Sciences   Publishing Not-for-      Gaming, ...
                                                                                    Profit
 Network /
Cloud Mgmt

    MDM


    Social


     Geo

Resource Auth
  & Access
   Control
 Content
Management

Recommend-
   ations

Data Center
Management

   Fraud
Detection, ...
    7
Everyone talks about graphs




     4
Everyone talks about graphs




   Facebook Open Graph




      4
Everyone talks about graphs




   Facebook Open Graph




      4
Graph Databases
Connected data in a relational database




 10
Connected data in a relational database




 10
Connected data in a relational database




            foo

 10
Connected data in a relational database




            foo                bar

 10
Connected data in a relational database




            foo     foo_bar    bar

 10
Connected data in a relational database




            foo     foo_bar    bar

 10
Connected data in a relational database




            foo     foo_bar    bar

 10
Connected data in a relational database




 10
Connected data in a relational database




 10
Connected data in a relational database




 10
Connected data in a relational database




 10
Connected data in a relational database




 10
Connected data in a relational database




 10
The Property Graph model




 11
The Property Graph model


                                         Em                                       Joh
                                              il                                      a   n
                               knows                                     knows
                  Alli                                         Tob                                    Lar
                         son                                       ias           knows                   s
                                                       knows
                                       And                                       And                  knows
                  knows                      rea                                       rés
                                                   s
                                                       knows             knows                knows
                  Pet                                          Miic
                                                               Mc                knows                 Ian
                     er                knows                        a
                                                                    a
                               knows                   knows
                                        De                                       Mic
                                           lia                                      h   ael




 11
The Property Graph model


                                         Em                                       Joh
                                              il                                      a   n
                               knows                                     knows
                  Alli                                         Tob                                    Lar
                         son                                       ias           knows                   s
         Nodes                         And
                                                       knows
                                                                                 And                  knows
                  knows                      rea                                       rés
                                                   s
                                                       knows             knows                knows
                  Pet                                          Miic
                                                               Mc                knows                 Ian
                     er                knows                        a
                                                                    a
                               knows                   knows
                                        De                                       Mic
                                           lia                                      h   ael




 11
The Property Graph model


                                                Em                                       Joh
                                                     il                                      a   n
                                      knows                                     knows
                         Alli                                         Tob                                    Lar
                                son                                       ias           knows                   s
         Nodes                                And
                                                              knows
                                                                                        And                  knows
                         knows                      rea                                       rés
                                                          s
                                                              knows             knows                knows
                         Pet                                          Miic
                                                                      Mc                knows                 Ian
                            er                knows                        a
                                                                           a
                                      knows                   knows
                                               De                                       Mic
                                                  lia                                      h   ael
         Relationships




 11
The Property Graph model


                                                     E                                               Joh
                                                   Em mil                                Joh
                                                                                             a           a   n
                                                     il                                          n
                                          knows                                        knows
                                                                                   knows
                                        knows
                            AllAlliso
                               iso n                                   Tob Tobia            knows                    Lar    Lar
                                                                                                                               s
          Nodes                    n                                      ias    s      knows                           s
                                                                   knows
                                                                knows
                                              An And                                     And And        knows knows
                              knows
                            knows                  dre re                                   rés rés
                                                      as as
                                                          knows
                                                             knows                 knows
                                                                                       knows    knowsknows
                            Pet e
                              Pe t                                     Miic M
                                                                       M c Mi           knows                        Ian    Ian
                                 r er             knows
                                                     knows                 a ica
                                                                           a ca             knows
                                        knows
                                          knows                 knows
                                                                   knows
                                                  De D                                  Mi c  M
                                                    lia el                                  hae ich
                                                           ia                                  l ae
          Relationships                                                                                          l




              Properties (each a key+value)

       + Indexes (for easy look-ups)

 11
Whiteboard friendliness




4
Whiteboard friendliness


                              Peter
             Andreas




                                      Allison

                       Emil




4
Whiteboard friendliness


                                     Peter
             Andreas   knows


                  knows          knows
                                                 Allison
                                         knows
                          Emil




4
Whiteboard friendliness


                                     Peter
             Andreas   knows


                  knows          knows
                                                 Allison
                                         knows
                          Emil




4
Great! But what about performance?




 13
Great! But what about performance?




 13
Great! But what about performance?
• a sample social graph




 13
Great! But what about performance?
• a sample social graph
  –with ~1,000 persons




 13
Great! But what about performance?
• a sample social graph
  –with ~1,000 persons
• average 50 friends per person




 13
Great! But what about performance?
• a sample social graph
  –with ~1,000 persons
• average 50 friends per person
• pathExists(a,b) limited to depth 4




 13
Great! But what about performance?
• a sample social graph
   –with ~1,000 persons
• average 50 friends per person
• pathExists(a,b) limited to depth 4
• caches warmed up to eliminate disk I/O




 13
Great! But what about performance?
• a sample social graph
   –with ~1,000 persons
• average 50 friends per person
• pathExists(a,b) limited to depth 4
• caches warmed up to eliminate disk I/O
                            # persons               query time

      Relational database                1,000                   2000ms

      Neo4j                              1,000                    2ms

      Neo4j                             1,000,000


 13
Great! But what about performance?
• a sample social graph
   –with ~1,000 persons
• average 50 friends per person
• pathExists(a,b) limited to depth 4
• caches warmed up to eliminate disk I/O
                            # persons               query time

      Relational database                1,000                   2000ms

      Neo4j                              1,000                    2ms

      Neo4j                             1,000,000


 13
Great! But what about performance?
• a sample social graph
   –with ~1,000 persons
• average 50 friends per person
• pathExists(a,b) limited to depth 4
• caches warmed up to eliminate disk I/O
                            # persons               query time

      Relational database                1,000                   2000ms

      Neo4j                              1,000                    2ms

      Neo4j                             1,000,000


 13
Great! But what about performance?
• a sample social graph
   –with ~1,000 persons
• average 50 friends per person
• pathExists(a,b) limited to depth 4
• caches warmed up to eliminate disk I/O
                            # persons               query time

      Relational database                1,000                   2000ms

      Neo4j                              1,000                    2ms

      Neo4j                             1,000,000                 2ms


 14
How do I query this graph?

     // lookup starting point in an index
     START user=node:User(name
     start n=node:People(name ==‘Andreas’)
                                 ‘Andreas’)
     MATCH (user)-[:HAS_SENT]->(tweet)-[:TAGGED_BY]->(tag)
     RETURN tag




                        And
                              rea
                                    s
How do I query this graph?

     // lookup starting point in an index
     START user=node:User(name
     start n=node:People(name ==‘Andreas’)
                                 ‘Andreas’)
     MATCH (user)-[:HAS_SENT]->(tweet)-[:TAGGED_BY]->(tag)
     RETURN tag




                        And
                              rea
                                    s
4
(Neo4j) -[:IS_A]-> (Graph Database)




4
(Neo4j) -[:IS_A]-> (Graph Database)

     - A Graph Database:




4
(Neo4j) -[:IS_A]-> (Graph Database)

     - A Graph Database:
        - a schema-free Property Graph




4
(Neo4j) -[:IS_A]-> (Graph Database)

     - A Graph Database:
        - a schema-free Property Graph
        - perfect for complex, highly connected data




4
(Neo4j) -[:IS_A]-> (Graph Database)

     - A Graph Database:
        - a schema-free Property Graph
        - perfect for complex, highly connected data
     - A Graph Database:




4
(Neo4j) -[:IS_A]-> (Graph Database)

     - A Graph Database:
        - a schema-free Property Graph
        - perfect for complex, highly connected data
     - A Graph Database:
        - reliable with real ACID Transactions




4
(Neo4j) -[:IS_A]-> (Graph Database)

     - A Graph Database:
        - a schema-free Property Graph
        - perfect for complex, highly connected data
     - A Graph Database:
        - reliable with real ACID Transactions
        - scalable: 34 billions nodes and relationships




4
(Neo4j) -[:IS_A]-> (Graph Database)

     - A Graph Database:
        - a schema-free Property Graph
        - perfect for complex, highly connected data
     - A Graph Database:
        - reliable with real ACID Transactions
        - scalable: 34 billions nodes and relationships
        - fast with millons traversals / second




4
(Neo4j) -[:IS_A]-> (Graph Database)

     - A Graph Database:
        - a schema-free Property Graph
        - perfect for complex, highly connected data
     - A Graph Database:
        -   reliable with real ACID Transactions
        -   scalable: 34 billions nodes and relationships
        -   fast with millons traversals / second
        -   Server with REST API, or Embeddable on the JVM



4
(Neo4j) -[:IS_A]-> (Graph Database)

     - A Graph Database:
        - a schema-free Property Graph
        - perfect for complex, highly connected data
     - A Graph Database:
        -   reliable with real ACID Transactions
        -   scalable: 34 billions nodes and relationships
        -   fast with millons traversals / second
        -   Server with REST API, or Embeddable on the JVM
        -   higher-performance with High-Availability (read scaling)


4
(Cypher) -[:IS_A]-> (Graph Query Language)
     ๏ Declarative query language
        • Describe what you want, not how
        • Based on pattern matching
     ๏ Example:

            START tag=node:Tag(tag=”s12gx”),   # index lookup
            MATCH sender-[:SENDER]->tweet-[:TAG]->tag
            WHERE new_friends.age > 18
            RETURN sender.name, count(*)
            ORDER BY count(*) DESC
            LIMIT 10




4
(Neo4j) -[:LOVES]-> (Our Customers)




 19
(Neo4j) -[:LOVES]-> (Our Customers)




 19
Spring Data Neo4j
Spring Data Neo4j

     ๏ Spring Data: VMWare/SpringSource initiative to give Spring
         developers easy access to the emerging world of NOSQL
     ๏ Spring Data Neo4j is the integration library for Neo4j
     ๏ Simple programming model:
         annotation-based programming for applications with rich domains
     ๏ Always possible to drop down to core Neo4j-API
     ๏ simple and powerful repository abstraction
     ๏ two mapping modes
     ๏ Neo4j-Server support
Spring Data Neo4j features
• Annotation-based programming model
• Spring Data Commons Repository support
• Neo4j Query 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
    22
Classic Neo4j domain class
 public class Tag {
     private final Node underlyingNode;

     Tag( 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 Tag {
       @GraphId private Long id;

       private String name;
   }
Spring Data Neo4j domain class


   @NodeEntity
   public class Tag {
       @GraphId private Long id;
       @Indexed(unique = true)
       private String name;
   }
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
Tweet domain class
    @NodeEntity
    public class Tweet {
    @GraphId private Long id;

    @Indexed(unique=true) Long tweetId;
    String text;

    @Fetch User sender; // eager loading

    @RelatedTo(type="TAGGED") Collection<Tag> tags;
    @RelatedTo(type="MENTIONS") Set<User> mentions;
    @RelatedTo(type="SOURCE") Tweet source;
    }
Interface based Repositories
• based on Repository infrastructure in Spring Data Commons
• just define the interface and the namespace configuration
• provide out-of-the-box support for
   –CRUD-Operations
   –Index-Lookups
   –Traversal-Execution
   –Annotated Graph-Queries (Cypher, Gremlin)
   –Derived Queries
   –Spatial Queries
• extensible via custom methods with provided implementations

 28
Repositories
interface TweetRepository extends GraphRepository<Tweet> {
    Tweet findByTweetId(String id);
    Collection<Tweet> findByTagsName(String name);
    @Query("start user=node({0}) match user<-[:SENDER]-tweet-[:TAGGED]->tag return distinct tag.name")
    Page<String> findUserTags(User user);
}

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




@Controller
public class TwitterController {
  @Autowired TweetRepository tweetRepository;

  @RequestMapping(value = "/tweet/{id}",...)
  public String show(Model model, @PathVariable String id) {
     Tweet tweet = tweetRepository.findByTweetId(id);
     model.addAttribute("tweet", tweet);
     return "/tweet/show";
  }}


   29
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



30
Neo4j-Server-Support
  <bean id="restGraphDatabaseService"
        class="org.sf.data.neo4j.rest.SpringRestGraphDatabase">
       <constructor-arg value="http://localhost:7473/db/data" />
  </bean>

  <neo4j:config graphDatabaseService="restGraphDatabaseService"/>




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


 31
Sample App

     -uses Spring Social (minimally)
     -Simple Domain: Tweets, Users, Tags
        -connected Entities
        -Repositories, Service
     -standalone App with
        -embedded Neo4j-Database
        -Neo4j-Server
Whiteboard friendly - Abstract




                      :Tweet



                                 :Tweet
Whiteboard friendly - Abstract


               :User




                    PO
                      ST
                        ED
                        :Tweet




            :User                :Tweet
                    POSTED
Whiteboard friendly - Abstract


               :User




                    PO
                      ST
                        ED
                          :Tweet


                               S
                           ION
                         NT
                       ME

            :User                  :Tweet
                    POSTED
Whiteboard friendly - Abstract


               :User




                    PO
                      ST
                        ED
                                        TAGGED
                                                        :Tag
                          :Tweet      TAGG
                                           ED


                                                 :Tag
                               S
                           ION                        ED
                         NT                          G
                       ME                           G

            :User                  :Tweet         TA

                    POSTED
Whiteboard friendly - Example




                   Attending the
                   #S2GX #SDN
                    session by
                      @mesirii



                            Looking forward to
                             my #SDN session
Whiteboard friendly - Example


         @peterneubauer




                   PO
                     ST
                       ED
                   Attending the
                   #S2GX #SDN
                    session by
                      @mesirii



                            Looking forward to
        @mesirii   POSTED
                             my #SDN session
Whiteboard friendly - Example


         @peterneubauer




                   PO
                     ST
                       ED
                   Attending the
                   #S2GX #SDN
                    session by
                      @mesirii

                            S
                        ION
                      NT
                    ME          Looking forward to
        @mesirii   POSTED
                                 my #SDN session
Whiteboard friendly - Example


         @peterneubauer




                   PO
                     ST
                       ED
                   Attending the
                                           TAGGED
                                                       #S2GX
                   #S2GX #SDN            TAGG
                    session by                ED

                      @mesirii
                                                     #SDN
                            S
                        ION                               ED
                      NT                                 G
                    ME          Looking forward to    TA
                                                        G

        @mesirii   POSTED
                                 my #SDN session
Twitter - Graph Data Model




4
Spring Data Neo4j - Sample Domain Class & Service




4
Neo4j - Sample Graph Query

    START tag1=node:Tag("tag:*obama*")
    > MATCH tag1<-[:TAG]-tweet-[:sender]->user,
            user<-[:sender]-tweet2-[:TAG]->tag2
    > WHERE tag2.tag =~ "(?i).*romney.*"
    > RETURN count(*) as cnt, tag1.tag,tag2.tag
                               +--------------------------------------+
    > ORDER BY count(*) DESC   | cnt | tag1.tag    | tag2.tag         |
    > LIMIT 10;                +--------------------------------------+
                                    | 440 | "obama"     | "voteromney"     |
                                    | 148 | "obama"     | "romneyryan2012" |
                                    | 65 | "obama"      | "romney"         |
                                    | 56 | "voteobama" | "romneyryan"      |
                                    | 42 | "voteobama" | "romney"          |
                                    +--------------------------------------+
                                    5 rows
                                    194 ms

4
Neo4j - Twitter Sample App




        Code
Hubway Data Challenge - Import
• Boston Bike Sharing Network
• Import using Spring Data Neo4j
• Visualization with Cypher & d3.js (Chord)




http://bit.ly/neo_hubway
 39
Cineasts.net - a social movie database




Check Out: http://spring.neo4j.org/tutorial
Spring Data Neo4j Guidebook
                       “Good Relationships”
“I’m excited about 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: http://bit.ly/sd-book
   -   Free e-book and printed
Spring Data Neo4j Guidebook
                       “Good Relationships”
“I’m excited about 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: http://bit.ly/sd-book
   -   Free e-book and printed
O‘Reilly Spring Data Book
    „Modern Data Access for Enterprise Java“

  • book by the Spring Data project leads
  • introduction to Spring Data & SD-repositories
  • covers all subprojects
  • available in O‘Reilly OFPS and O‘Reilly store (e-book)
  • http://bit.ly/sd-book
How do I get started?




4
How do I get started?

๏ Documentation




4
How do I get started?

๏ Documentation
    • http://spring.neo4j.org




4
How do I get started?

๏ Documentation
    • http://spring.neo4j.org
    • Dev-Notes




4
How do I get started?

๏ Documentation
    • http://spring.neo4j.org
    • Dev-Notes
    • Spring Data Book




4
How do I get started?

๏ Documentation
    • http://spring.neo4j.org
    • Dev-Notes
    • Spring Data Book
    • Good Relationships




4
How do I get started?

๏ Documentation
    • http://spring.neo4j.org
    • Dev-Notes
    • Spring Data Book
    • Good Relationships
๏ Get Neo4j




4
How do I get started?

๏ Documentation
    • http://spring.neo4j.org
    • Dev-Notes
    • Spring Data Book
    • Good Relationships
๏ Get Neo4j
    • http://neo4j.org/download




4
How do I get started?

๏ Documentation
     • http://spring.neo4j.org
     • Dev-Notes
     • Spring Data Book
     • Good Relationships
๏ Get Neo4j
     • http://neo4j.org/download
๏ Participate
     • http://neo4j.org/forums
     • http://spring.neo4j.org/discussions

4
How do I get started?

๏ Documentation
     • http://spring.neo4j.org
     • Dev-Notes
     • Spring Data Book
     • Good Relationships
๏ Get Neo4j
     • http://neo4j.org/download
๏ Participate
     • http://neo4j.org/forums
     • http://spring.neo4j.org/discussions
     • http://neo4j.meetup.com
4
How do I get started?

๏ Documentation
     • http://spring.neo4j.org
     • Dev-Notes
     • Spring Data Book
     • Good Relationships
๏ Get Neo4j
     • http://neo4j.org/download
๏ Participate
     • http://neo4j.org/forums
     • http://spring.neo4j.org/discussions
     • http://neo4j.meetup.com
     • a session like this one ;)
4
GraphConnect Nov 6th 2012 San Francisco



                                                            50%
                                                                    dis
             CONNECT    ABOUT   |   UPCOMING EVENTS   |                 cou
                                                          REGISTRATION | CONTACT
                                                                             nt a
                                                                                  t   our
                                                                                          boo
                                                                                             th
                WORLD’S LEADING GRAPH CONFERENCE
                                                           SAN FRANCISCO 2012




4
Thank you !
    Questions ?


4

More Related Content

Viewers also liked

Viewers also liked (6)

8. key value databases laboratory
8. key value databases laboratory 8. key value databases laboratory
8. key value databases laboratory
 
Non-Relational Databases & Key/Value Stores
Non-Relational Databases & Key/Value StoresNon-Relational Databases & Key/Value Stores
Non-Relational Databases & Key/Value Stores
 
Using Neo4j from Java
Using Neo4j from JavaUsing Neo4j from Java
Using Neo4j from Java
 
Neo4j Use Cases - Graphdatenbanken im Einsatz
Neo4j Use Cases - Graphdatenbanken im EinsatzNeo4j Use Cases - Graphdatenbanken im Einsatz
Neo4j Use Cases - Graphdatenbanken im Einsatz
 
7. Key-Value Databases: In Depth
7. Key-Value Databases: In Depth7. Key-Value Databases: In Depth
7. Key-Value Databases: In Depth
 
Importing Data into Neo4j quickly and easily - StackOverflow
Importing Data into Neo4j quickly and easily - StackOverflowImporting Data into Neo4j quickly and easily - StackOverflow
Importing Data into Neo4j quickly and easily - StackOverflow
 

More from jexp

Graphs & Neo4j - Past Present Future
Graphs & Neo4j - Past Present FutureGraphs & Neo4j - Past Present Future
Graphs & Neo4j - Past Present Future
jexp
 
Intro to Graphs and Neo4j
Intro to Graphs and Neo4jIntro to Graphs and Neo4j
Intro to Graphs and Neo4j
jexp
 

More from 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 Graphs and Neo4j
Intro to Graphs and Neo4jIntro to Graphs and Neo4j
Intro to Graphs and Neo4j
 

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 

Spring Data Neo4j Intro SpringOne 2012

  • 1. Spring Data Neo4j Michael Hunger - @mesirii Emil Eifrem - @emileifrem Neo Technology #neo4j © 2012 SpringOne 2GX. All rights reserved. Do not distribute without permission.
  • 2. Twitter example To become part of todays Twitter-Graph
  • 3. Twitter example To become part of todays Twitter-Graph please tweet with #s2gx #neo4j
  • 4. Twitter example To become part of todays Twitter-Graph please tweet with #s2gx #neo4j ✓your attendance ✓questions ✓remarks ✓....
  • 5. Agenda 1. Connected Data, Graph Databases and Neo4j 2. Spring Data Neo4j 3. Twitter-Graph - Sample App 4. Summary 5. Q & A
  • 6. The Evolution of Web Search 4
  • 7. The Evolution of Web Search Pre-1999 WWW Indexing 4
  • 8. The Evolution of Web Search Pre-1999 1999 - 2012 WWW Indexing Google Invents PageRank 4
  • 9. The Evolution of Web Search Pre-1999 1999 - 2012 2012-? WWW Indexing Google Invents Google Launches the PageRank Knowledge Graph 4
  • 10. The Evolution of Web Search Pre-1999 1999 - 2012 2012-? WWW Indexing Google Invents Google Launches the PageRank Knowledge Graph Atomic Data 4
  • 11. The Evolution of Web Search Pre-1999 1999 - 2012 2012-? WWW Indexing Google Invents Google Launches the PageRank Knowledge Graph Simple Atomic Data Connected Data 4
  • 12. The Evolution of Web Search Pre-1999 1999 - 2012 2012-? WWW Indexing Google Invents Google Launches the PageRank Knowledge Graph Simple Rich Atomic Data Connected Data Connected Data 4
  • 13. The Evolution of Online Job Search 5
  • 14. The Evolution of Online Job Search 2010-11 Resume Scoring Atomic Data 5
  • 15. The Evolution of Online Job Search 2010-11 2011-12 Resume Scoring Social Job Search Atomic Data Connected Data 5
  • 16. The Evolution of Web Browsing 6
  • 17. The Evolution of Web Browsing Pre-2012 Explicit Browsing Atomic Data 6
  • 18. The Evolution of Web Browsing Pre-2012 2012+ Explicit Browsing Connected Browsing ? Atomic Data Connected Data 6
  • 19. Other Markets In Evolution Core Industries Finance & Datacom / Web / ISV & Use Cases: Insurance Telecom Network /Cloud Mgmt MDM Social Geo 7
  • 20. Other Markets In Evolution Core Industries Finance & Datacom / Life Media & Education, Government, Web / ISV Logistics Aerospace, & Use Cases: Insurance Telecom Sciences Publishing Not-for- Gaming, ... Profit Network / Cloud Mgmt MDM Social Geo Resource Auth & Access Control Content Management Recommend- ations Data Center Management Fraud Detection, ... 7
  • 22. Everyone talks about graphs Facebook Open Graph 4
  • 23. Everyone talks about graphs Facebook Open Graph 4
  • 25. Connected data in a relational database 10
  • 26. Connected data in a relational database 10
  • 27. Connected data in a relational database foo 10
  • 28. Connected data in a relational database foo bar 10
  • 29. Connected data in a relational database foo foo_bar bar 10
  • 30. Connected data in a relational database foo foo_bar bar 10
  • 31. Connected data in a relational database foo foo_bar bar 10
  • 32. Connected data in a relational database 10
  • 33. Connected data in a relational database 10
  • 34. Connected data in a relational database 10
  • 35. Connected data in a relational database 10
  • 36. Connected data in a relational database 10
  • 37. Connected data in a relational database 10
  • 38. The Property Graph model 11
  • 39. The Property Graph model Em Joh il a n knows knows Alli Tob Lar son ias knows s knows And And knows knows rea rés s knows knows knows Pet Miic Mc knows Ian er knows a a knows knows De Mic lia h ael 11
  • 40. The Property Graph model Em Joh il a n knows knows Alli Tob Lar son ias knows s Nodes And knows And knows knows rea rés s knows knows knows Pet Miic Mc knows Ian er knows a a knows knows De Mic lia h ael 11
  • 41. The Property Graph model Em Joh il a n knows knows Alli Tob Lar son ias knows s Nodes And knows And knows knows rea rés s knows knows knows Pet Miic Mc knows Ian er knows a a knows knows De Mic lia h ael Relationships 11
  • 42. The Property Graph model E Joh Em mil Joh a a n il n knows knows knows knows AllAlliso iso n Tob Tobia knows Lar Lar s Nodes n ias s knows s knows knows An And And And knows knows knows knows dre re rés rés as as knows knows knows knows knowsknows Pet e Pe t Miic M M c Mi knows Ian Ian r er knows knows a ica a ca knows knows knows knows knows De D Mi c M lia el hae ich ia l ae Relationships l Properties (each a key+value) + Indexes (for easy look-ups) 11
  • 44. Whiteboard friendliness Peter Andreas Allison Emil 4
  • 45. Whiteboard friendliness Peter Andreas knows knows knows Allison knows Emil 4
  • 46. Whiteboard friendliness Peter Andreas knows knows knows Allison knows Emil 4
  • 47. Great! But what about performance? 13
  • 48. Great! But what about performance? 13
  • 49. Great! But what about performance? • a sample social graph 13
  • 50. Great! But what about performance? • a sample social graph –with ~1,000 persons 13
  • 51. Great! But what about performance? • a sample social graph –with ~1,000 persons • average 50 friends per person 13
  • 52. Great! But what about performance? • a sample social graph –with ~1,000 persons • average 50 friends per person • pathExists(a,b) limited to depth 4 13
  • 53. Great! But what about performance? • a sample social graph –with ~1,000 persons • average 50 friends per person • pathExists(a,b) limited to depth 4 • caches warmed up to eliminate disk I/O 13
  • 54. Great! But what about performance? • a sample social graph –with ~1,000 persons • average 50 friends per person • pathExists(a,b) limited to depth 4 • caches warmed up to eliminate disk I/O # persons query time Relational database 1,000 2000ms Neo4j 1,000 2ms Neo4j 1,000,000 13
  • 55. Great! But what about performance? • a sample social graph –with ~1,000 persons • average 50 friends per person • pathExists(a,b) limited to depth 4 • caches warmed up to eliminate disk I/O # persons query time Relational database 1,000 2000ms Neo4j 1,000 2ms Neo4j 1,000,000 13
  • 56. Great! But what about performance? • a sample social graph –with ~1,000 persons • average 50 friends per person • pathExists(a,b) limited to depth 4 • caches warmed up to eliminate disk I/O # persons query time Relational database 1,000 2000ms Neo4j 1,000 2ms Neo4j 1,000,000 13
  • 57. Great! But what about performance? • a sample social graph –with ~1,000 persons • average 50 friends per person • pathExists(a,b) limited to depth 4 • caches warmed up to eliminate disk I/O # persons query time Relational database 1,000 2000ms Neo4j 1,000 2ms Neo4j 1,000,000 2ms 14
  • 58. How do I query this graph? // lookup starting point in an index START user=node:User(name start n=node:People(name ==‘Andreas’) ‘Andreas’) MATCH (user)-[:HAS_SENT]->(tweet)-[:TAGGED_BY]->(tag) RETURN tag And rea s
  • 59. How do I query this graph? // lookup starting point in an index START user=node:User(name start n=node:People(name ==‘Andreas’) ‘Andreas’) MATCH (user)-[:HAS_SENT]->(tweet)-[:TAGGED_BY]->(tag) RETURN tag And rea s
  • 60. 4
  • 62. (Neo4j) -[:IS_A]-> (Graph Database) - A Graph Database: 4
  • 63. (Neo4j) -[:IS_A]-> (Graph Database) - A Graph Database: - a schema-free Property Graph 4
  • 64. (Neo4j) -[:IS_A]-> (Graph Database) - A Graph Database: - a schema-free Property Graph - perfect for complex, highly connected data 4
  • 65. (Neo4j) -[:IS_A]-> (Graph Database) - A Graph Database: - a schema-free Property Graph - perfect for complex, highly connected data - A Graph Database: 4
  • 66. (Neo4j) -[:IS_A]-> (Graph Database) - A Graph Database: - a schema-free Property Graph - perfect for complex, highly connected data - A Graph Database: - reliable with real ACID Transactions 4
  • 67. (Neo4j) -[:IS_A]-> (Graph Database) - A Graph Database: - a schema-free Property Graph - perfect for complex, highly connected data - A Graph Database: - reliable with real ACID Transactions - scalable: 34 billions nodes and relationships 4
  • 68. (Neo4j) -[:IS_A]-> (Graph Database) - A Graph Database: - a schema-free Property Graph - perfect for complex, highly connected data - A Graph Database: - reliable with real ACID Transactions - scalable: 34 billions nodes and relationships - fast with millons traversals / second 4
  • 69. (Neo4j) -[:IS_A]-> (Graph Database) - A Graph Database: - a schema-free Property Graph - perfect for complex, highly connected data - A Graph Database: - reliable with real ACID Transactions - scalable: 34 billions nodes and relationships - fast with millons traversals / second - Server with REST API, or Embeddable on the JVM 4
  • 70. (Neo4j) -[:IS_A]-> (Graph Database) - A Graph Database: - a schema-free Property Graph - perfect for complex, highly connected data - A Graph Database: - reliable with real ACID Transactions - scalable: 34 billions nodes and relationships - fast with millons traversals / second - Server with REST API, or Embeddable on the JVM - higher-performance with High-Availability (read scaling) 4
  • 71. (Cypher) -[:IS_A]-> (Graph Query Language) ๏ Declarative query language • Describe what you want, not how • Based on pattern matching ๏ Example: START tag=node:Tag(tag=”s12gx”), # index lookup MATCH sender-[:SENDER]->tweet-[:TAG]->tag WHERE new_friends.age > 18 RETURN sender.name, count(*) ORDER BY count(*) DESC LIMIT 10 4
  • 72. (Neo4j) -[:LOVES]-> (Our Customers) 19
  • 73. (Neo4j) -[:LOVES]-> (Our Customers) 19
  • 75. Spring Data Neo4j ๏ Spring Data: VMWare/SpringSource initiative to give Spring developers easy access to the emerging world of NOSQL ๏ Spring Data Neo4j is the integration library for Neo4j ๏ Simple programming model: annotation-based programming for applications with rich domains ๏ Always possible to drop down to core Neo4j-API ๏ simple and powerful repository abstraction ๏ two mapping modes ๏ Neo4j-Server support
  • 76. Spring Data Neo4j features • Annotation-based programming model • Spring Data Commons Repository support • Neo4j Query 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 22
  • 77. Classic Neo4j domain class public class Tag { private final Node underlyingNode; Tag( 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 ); } }
  • 78. Spring Data Neo4j domain class @NodeEntity public class Tag { @GraphId private Long id; private String name; }
  • 79. Spring Data Neo4j domain class @NodeEntity public class Tag { @GraphId private Long id; @Indexed(unique = true) private String name; }
  • 81. 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
  • 83. 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
  • 84. Tweet domain class @NodeEntity public class Tweet { @GraphId private Long id; @Indexed(unique=true) Long tweetId; String text; @Fetch User sender; // eager loading @RelatedTo(type="TAGGED") Collection<Tag> tags; @RelatedTo(type="MENTIONS") Set<User> mentions; @RelatedTo(type="SOURCE") Tweet source; }
  • 85. Interface based Repositories • based on Repository infrastructure in Spring Data Commons • just define the interface and the namespace configuration • provide out-of-the-box support for –CRUD-Operations –Index-Lookups –Traversal-Execution –Annotated Graph-Queries (Cypher, Gremlin) –Derived Queries –Spatial Queries • extensible via custom methods with provided implementations 28
  • 86. Repositories interface TweetRepository extends GraphRepository<Tweet> { Tweet findByTweetId(String id); Collection<Tweet> findByTagsName(String name); @Query("start user=node({0}) match user<-[:SENDER]-tweet-[:TAGGED]->tag return distinct tag.name") Page<String> findUserTags(User user); } <neo4j:repositories base-package=“com.example.repositories„/> @Controller public class TwitterController { @Autowired TweetRepository tweetRepository; @RequestMapping(value = "/tweet/{id}",...) public String show(Model model, @PathVariable String id) { Tweet tweet = tweetRepository.findByTweetId(id); model.addAttribute("tweet", tweet); return "/tweet/show"; }} 29
  • 87. 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 30
  • 88. Neo4j-Server-Support <bean id="restGraphDatabaseService" class="org.sf.data.neo4j.rest.SpringRestGraphDatabase"> <constructor-arg value="http://localhost:7473/db/data" /> </bean> <neo4j:config graphDatabaseService="restGraphDatabaseService"/> • drop-in replacement for the embedded GraphDatabase • works transparently with POJO-Entity-Mapping and Neo4j-Template 31
  • 89. Sample App -uses Spring Social (minimally) -Simple Domain: Tweets, Users, Tags -connected Entities -Repositories, Service -standalone App with -embedded Neo4j-Database -Neo4j-Server
  • 90. Whiteboard friendly - Abstract :Tweet :Tweet
  • 91. Whiteboard friendly - Abstract :User PO ST ED :Tweet :User :Tweet POSTED
  • 92. Whiteboard friendly - Abstract :User PO ST ED :Tweet S ION NT ME :User :Tweet POSTED
  • 93. Whiteboard friendly - Abstract :User PO ST ED TAGGED :Tag :Tweet TAGG ED :Tag S ION ED NT G ME G :User :Tweet TA POSTED
  • 94. Whiteboard friendly - Example Attending the #S2GX #SDN session by @mesirii Looking forward to my #SDN session
  • 95. Whiteboard friendly - Example @peterneubauer PO ST ED Attending the #S2GX #SDN session by @mesirii Looking forward to @mesirii POSTED my #SDN session
  • 96. Whiteboard friendly - Example @peterneubauer PO ST ED Attending the #S2GX #SDN session by @mesirii S ION NT ME Looking forward to @mesirii POSTED my #SDN session
  • 97. Whiteboard friendly - Example @peterneubauer PO ST ED Attending the TAGGED #S2GX #S2GX #SDN TAGG session by ED @mesirii #SDN S ION ED NT G ME Looking forward to TA G @mesirii POSTED my #SDN session
  • 98. Twitter - Graph Data Model 4
  • 99. Spring Data Neo4j - Sample Domain Class & Service 4
  • 100. Neo4j - Sample Graph Query START tag1=node:Tag("tag:*obama*") > MATCH tag1<-[:TAG]-tweet-[:sender]->user, user<-[:sender]-tweet2-[:TAG]->tag2 > WHERE tag2.tag =~ "(?i).*romney.*" > RETURN count(*) as cnt, tag1.tag,tag2.tag +--------------------------------------+ > ORDER BY count(*) DESC | cnt | tag1.tag | tag2.tag | > LIMIT 10; +--------------------------------------+ | 440 | "obama" | "voteromney" | | 148 | "obama" | "romneyryan2012" | | 65 | "obama" | "romney" | | 56 | "voteobama" | "romneyryan" | | 42 | "voteobama" | "romney" | +--------------------------------------+ 5 rows 194 ms 4
  • 101. Neo4j - Twitter Sample App Code
  • 102. Hubway Data Challenge - Import • Boston Bike Sharing Network • Import using Spring Data Neo4j • Visualization with Cypher & d3.js (Chord) http://bit.ly/neo_hubway 39
  • 103. Cineasts.net - a social movie database Check Out: http://spring.neo4j.org/tutorial
  • 104. Spring Data Neo4j Guidebook “Good Relationships” “I’m excited about 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: http://bit.ly/sd-book - Free e-book and printed
  • 105. Spring Data Neo4j Guidebook “Good Relationships” “I’m excited about 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: http://bit.ly/sd-book - Free e-book and printed
  • 106. O‘Reilly Spring Data Book „Modern Data Access for Enterprise Java“ • book by the Spring Data project leads • introduction to Spring Data & SD-repositories • covers all subprojects • available in O‘Reilly OFPS and O‘Reilly store (e-book) • http://bit.ly/sd-book
  • 107. How do I get started? 4
  • 108. How do I get started? ๏ Documentation 4
  • 109. How do I get started? ๏ Documentation • http://spring.neo4j.org 4
  • 110. How do I get started? ๏ Documentation • http://spring.neo4j.org • Dev-Notes 4
  • 111. How do I get started? ๏ Documentation • http://spring.neo4j.org • Dev-Notes • Spring Data Book 4
  • 112. How do I get started? ๏ Documentation • http://spring.neo4j.org • Dev-Notes • Spring Data Book • Good Relationships 4
  • 113. How do I get started? ๏ Documentation • http://spring.neo4j.org • Dev-Notes • Spring Data Book • Good Relationships ๏ Get Neo4j 4
  • 114. How do I get started? ๏ Documentation • http://spring.neo4j.org • Dev-Notes • Spring Data Book • Good Relationships ๏ Get Neo4j • http://neo4j.org/download 4
  • 115. How do I get started? ๏ Documentation • http://spring.neo4j.org • Dev-Notes • Spring Data Book • Good Relationships ๏ Get Neo4j • http://neo4j.org/download ๏ Participate • http://neo4j.org/forums • http://spring.neo4j.org/discussions 4
  • 116. How do I get started? ๏ Documentation • http://spring.neo4j.org • Dev-Notes • Spring Data Book • Good Relationships ๏ Get Neo4j • http://neo4j.org/download ๏ Participate • http://neo4j.org/forums • http://spring.neo4j.org/discussions • http://neo4j.meetup.com 4
  • 117. How do I get started? ๏ Documentation • http://spring.neo4j.org • Dev-Notes • Spring Data Book • Good Relationships ๏ Get Neo4j • http://neo4j.org/download ๏ Participate • http://neo4j.org/forums • http://spring.neo4j.org/discussions • http://neo4j.meetup.com • a session like this one ;) 4
  • 118. GraphConnect Nov 6th 2012 San Francisco 50% dis CONNECT ABOUT | UPCOMING EVENTS | cou REGISTRATION | CONTACT nt a t our boo th WORLD’S LEADING GRAPH CONFERENCE SAN FRANCISCO 2012 4
  • 119. Thank you ! Questions ? 4

Editor's Notes

  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. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \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. \n
  90. \n
  91. \n
  92. \n
  93. \n
  94. \n
  95. \n
  96. \n
  97. \n
  98. \n
  99. \n
  100. \n
  101. \n
  102. \n
  103. \n
  104. \n
  105. \n
  106. \n
  107. Neo4j Query and Traversal support on dynamic fields and via repository methods\nNeo4j indexing support (includes unique indexes, fulltext and numeric range queries)\nEntity types stored in the graph (index or category-nodes)\nDynamic type projection (duck typing)\nCross-store support for partial JPA / graph entities\nSupport for JSR-303 (bean validation)\nSupport for the Neo4j Server (remote server and in server extension)\nNeo4jTemplate with exception translation, optional transaction management and more\n
  108. \n
  109. Jumping right into code\n
  110. \n
  111. \n
  112. \n
  113. \n
  114. \n
  115. \n
  116. \n
  117. \n
  118. \n
  119. \n
  120. \n
  121. \n
  122. \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