Good Relationships

The Spring Data Neo4j Guide Book

Michael Hunger

2.1.0.RELEASE

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
Foreword by Emil Eifrem
About this guide book
1. The Spring Data Neo4j Project
2. Feedback
3. Format of the Book
4. Acknowledgements
I. Tutorial
1. Introducing our project
2. The Spring stack
2.1. Required setup
3. The domain model
4. Learning Neo4j
5. Spring Data Neo4j
6. Annotating the domain
7. Indexing
8. Repositories
9. Relationships
9.1. Creating relationships
9.2. Accessing related entities
9.3. Accessing the relationship entities
10. Get it running
10.1. Populating the database
10.2. Inspecting the datastore
10.2.1. Neoclipse visualization
10.2.2. The Neo4j Shell
11. Web views
11.1. Searching
11.2. Listing results
12. Adding social
12.1. Users
12.2. Ratings for movies
13. Adding Security
14. More UI
15. Importing Data
16. Recommendations
17. Neo4j Server
17.1. Getting Neo4j-Server
17.2. Other approaches
18. Conclusion
II. Reference Documentation
Reference Documentation
1. Spring Data and Spring Data Neo4j
2. Reference Documentation Overview
19. Introduction to Neo4j
19.1. What is a graph database?
19.2. About Neo4j
19.3. GraphDatabaseService
19.4. Creating nodes and relationships
19.5. Graph traversal
19.6. Indexing
19.7. Querying the Graph with Cypher
19.8. Gremlin - a Graph Traversal DSL
20. Programming model
20.1. Object Graph Mapping
20.2. Advanced Mapping with AspectJ
20.2.1. AspectJ IDE support
20.3. Simple Object Graph Mapping
20.4. Defining node entities
20.4.1. @NodeEntity: The basic building block
20.4.2. @GraphId: Neo4j -id field
20.4.2.1. Entity Equality
20.4.3. @GraphProperty: Optional annotation for property fields
20.4.4. @Indexed: Making entities searchable by field value
20.4.5. @Query: fields as query result views
20.4.6. @GraphTraversal: fields as traversal result views
20.5. Relating node entities
20.5.1. @RelatedTo: Connecting node entities
20.5.2. @RelationshipEntity: Rich relationships
20.5.3. @RelatedToVia: Accessing relationship entities
20.5.4. Relationship Type Precedence
20.5.5. Discriminating Relationships Based On End Node Type
20.6. Indexing
20.6.1. Exact and numeric index
20.6.2. Fulltext indexes
20.6.3. Unique indexes
20.6.4. Manual index access
20.6.5. Index queries in Neo4jTemplate
20.6.6. Neo4j Auto Indexes
20.6.7. Spatial Indexes
20.7. Neo4jTemplate
20.7.1. Basic operations
20.7.2. Core-Operations
20.7.3. Entity-Persistence
20.7.4. Result
20.7.5. Indexing
20.7.6. Graph traversal
20.7.7. Cypher Queries
20.7.8. Gremlin Scripts
20.7.9. Transactions
20.7.10. Neo4j REST Server
20.7.11. Lifecycle Events
20.8. CRUD with repositories
20.8.1. CRUDRepository
20.8.2. IndexRepository and NamedIndexRepository
20.8.3. TraversalRepository
20.8.4. Query and Finder Methods
20.8.4.1. Annotated queries
20.8.4.2. Named queries
20.8.4.3. Query results
20.8.4.4. Cypher examples
20.8.4.5. Queries derived from finder-method names
20.8.4.6. Derived Finder Methods
20.8.5. Cypher-DSL repository
20.8.6. Cypher-DSL and QueryDSL
20.8.7. Creating repositories
20.8.8. Composing repositories
20.9. Projecting entities
20.10. Geospatial Queries
20.11. Active Record Methods for Advanced Mapping Mode
20.12. Transactions
20.13. Detached node entities in advanced mapping mode
20.13.1. Relating detached entities
20.14. Entity type representation
20.15. Bean validation (JSR-303)
21. Environment setup
21.1. Dependencies for Spring Data Neo4j Simple Mapping
21.2. Gradle configuration for Advanced Mapping (AspectJ)
21.3. Ant/Ivy configuration for Advanced Mapping (AspectJ)
21.4. Maven configuration for Advanced Mapping
21.4.1. Repositories
21.4.2. Dependencies
21.4.3. Maven AspectJ build configuration
21.5. Spring configuration
21.5.1. XML namespace
21.5.2. Repository Configuration
21.5.3. Java-based bean configuration
22. Cross-store persistence
22.1. Partial entities
22.2. Cross-store annotations
22.2.1. @NodeEntity(partial = "true")
22.2.2. @GraphProperty
22.2.3. Example
22.3. Configuring cross-store persistence
23. Sample code
23.1. Introduction
23.2. Hello Worlds sample application
23.3. IMDB sample application
23.4. MyRestaurants sample application
23.5. MyRestaurant-Social sample application
23.6. Cineasts social movie database
24. Heroku: Seeding the Cloud
24.1. Create a Self-Hosted Web Application
24.2. Deploy to Heroku
25. Performance considerations
25.1. When to use Spring Data Neo4j
26. AspectJ details
27. Neo4j Server
27.1. Server Extension
27.2. Using Spring Data Neo4j as a REST client