The Spring Data Graph Guide Book

The Spring Data Graph Guide Book

Good Relationships The Spring Data Graph Guide Book 1.2.0.BUILD-SNAPSHOT Copyright © 2010 - 2011 Michael Hunger, David Montag Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically. Copyright 2010-2011 Neo Technology Foreword by Rod Johnson ........................................................................................................ v Foreword by Emil Eifrem ........................................................................................................ vi About this guide book ............................................................................................................ vii 1. The Spring Data Graph Project ................................................................................... vii 2. Feedback ................................................................................................................... vii 3. Format of the Book .................................................................................................... vii 4. Acknowledgements .................................................................................................... vii I. Tutorial ................................................................................................................................ 1 1. Introducing our project ................................................................................................. 2 2. The Spring stack .......................................................................................................... 3 2.1. Required setup .................................................................................................. 3 3. The domain model ....................................................................................................... 5 4. Learning Neo4j ............................................................................................................ 7 5. Spring Data Graph ....................................................................................................... 8 6. Annotating the domain ............................................................................................... 11 7. Indexing .................................................................................................................... 12 8. Repositories ............................................................................................................... 13 9. Relationships .............................................................................................................. 14 9.1. Creating relationships ...................................................................................... 14 9.2. Accessing related entities ................................................................................. 14 9.3. Accessing the relationship entities .................................................................... 15 10. Get it running .......................................................................................................... 16 10.1. Populating the database .................................................................................. 16 10.2. Inspecting the datastore .................................................................................. 17 10.2.1. Neoclipse visualization ........................................................................ 17 10.2.2. The Neo4j Shell .................................................................................. 18 11. Web views ............................................................................................................... 20 11.1. Searching ...................................................................................................... 20 11.2. Listing results ................................................................................................ 21 12. Adding social ........................................................................................................... 23 12.1. Users ............................................................................................................. 23 12.2. Ratings for movies ......................................................................................... 24 13. Adding Security ....................................................................................................... 25 14. More UI ................................................................................................................... 29 15. Importing Data ......................................................................................................... 32 16. Recommendations ..................................................................................................... 35 II. Reference Documentation .................................................................................................. 36 Reference Documentation ......................................................................................... xxxvii 1. Spring Data and Spring Data Graph ............................................................... xxxvii 2. Reference Documentation Overview .............................................................. xxxvii 17. Introduction to Neo4j ............................................................................................... 40 17.1. What is a graph database? .............................................................................. 40 17.2. About Neo4j .................................................................................................. 40 17.3. GraphDatabaseService .................................................................................... 40 17.4. Creating nodes and relationships ..................................................................... 41 17.5. Graph traversal .............................................................................................. 41 17.6. Indexing ........................................................................................................ 41 17.7. Querying with Cypher .................................................................................... 42 17.8. Gremlin a Graph Traversal DSL ..................................................................... 43 ii Spring Data Graph (1.2.0.BUILD-SNAPSHOT) Good Relationships 18. Programming model ................................................................................................. 44 18.1. AspectJ support ............................................................................................. 44 18.1.1. AspectJ IDE support ........................................................................... 44 18.2. Defining node entities .................................................................................... 45 18.2.1. @NodeEntity: The basic building block ................................................ 45 18.2.2. @GraphProperty: Optional annotation for property fields ....................... 45 18.2.3. @Indexed: Making entities searchable by field value ............................. 45 18.2.4. @Query: fields as query result views ................................................... 46 18.2.5. @GraphTraversal: fields as traversal result views .................................. 46 18.3. Relating node entities ..................................................................................... 46 18.3.1. @RelatedTo: Connecting node entities ................................................. 47 18.3.2. @RelationshipEntity: Rich relationships ............................................... 48 18.3.3. @RelatedToVia: Accessing relationship entities .................................... 49 18.4. Introduced methods ........................................................................................ 49 18.5. Indexing ........................................................................................................ 50 18.5.1. Exact and numeric index ..................................................................... 50 18.5.2. Fulltext indexes ................................................................................... 51 18.5.3. Manual index access ........................................................................... 51 18.5.4. Indexing in Neo4jTemplate .................................................................. 52 18.6. CRUD with repositories ................................................................................. 52 18.6.1. CRUDRepository ................................................................................ 52 18.6.2. IndexRepository and NamedIndexRepository ........................................ 53 18.6.3. TraversalRepository ............................................................................. 53 18.6.4. Cypher-Queries ................................................................................... 53 18.6.5. Creating repositories ............................................................................ 54 18.6.6. Composing repositories ....................................................................... 55 18.7. Transactions .................................................................................................. 56 18.8. Detached node entities ................................................................................... 58 18.8.1. Relating detached entities ...................................................................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    87 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us