From 6c1b5327139cf5eeaabb2c311f264266021e61ba Mon Sep 17 00:00:00 2001 From: David Montag Date: Fri, 8 Apr 2011 12:39:52 -0700 Subject: [PATCH 1/5] Edited indexing reference chapter --- .../reference/programming-model/indexing.xml | 175 +++++++++--------- .../programming-model/repositories.xml | 2 +- 2 files changed, 92 insertions(+), 85 deletions(-) diff --git a/src/docbkx/reference/programming-model/indexing.xml b/src/docbkx/reference/programming-model/indexing.xml index 79ed0c768..a405c5fd8 100644 --- a/src/docbkx/reference/programming-model/indexing.xml +++ b/src/docbkx/reference/programming-model/indexing.xml @@ -4,132 +4,139 @@ Indexing - The Neo4j graph database can use different index providers for exact lookups and fulltext searches. Lucene is - used as default index provider implementation. There is support for distinct indexes for nodes and relationships - which can be configured to be of fulltext or exact types. + The Neo4j graph database can use different so-called index providers for exact lookups and fulltext + searches. Lucene is the default index provider implementation. Each named index is configured to be + fulltext or exact.
- Exact and Numeric Index - - Using the standard Neo4j API, Nodes and Relationships and their indexed field-value combinations - have to be added manually to the appropriate index. When using Spring Data Graph, this task is simplified by - eased by applying an @Indexed annotation on entity fields. This will result in updates to the - index on every change. - - Numerical fields are indexed numerically so that they are available for range queries. - All other fields are indexed with their string representation. - - The @Indexed annotation can also set the - index-name to be used the default index name is the simple class name of the entity. So the same field names - from different classes don't end up in the same index by default. That would return different domain objects - for a single index query. - - - Query access to the index happens with the Node- and Relationship-Repostories that are created via an instance of - org.springframework.data.graph.neo4j.repository.DirectGraphRepositoryFactory. The methods - findByPropertyValue and findAllByPropertyValue work on the exact indexes and - return the first or all matches. To do range queries, use findAllByRange (please note that - currently both values are inclusive). - - Exact and numeric index + + When using the standard Neo4j API, nodes and relationships have to be manually indexed with + key-value pairs, typically being the property name and value. When using Spring Data Graph, + this task is simplified to just adding an @Indexed annotation on entity fields + by which the entity should be searchable. This will result in automatic updates of the index + every time an indexed field changes. + + + Numerical fields are indexed numerically so that they are available for range queries. All + other fields are indexed with their string representation. + + + The @Indexed annotation also provides the option of using a custom index. The default index + name is the simple class name of the entity, so that each class typically gets its own index. + It is recommended to not have two entity classes with the same class name, regardless of + package. + + + The indexes can be queried by using a repository (see ). + Typically, the repository is an instance of + org.springframework.data.graph.neo4j.repository.DirectGraphRepositoryFactory. + The methods findByPropertyValue() and findAllByPropertyValue() work on + the exact indexes and return the first or all matches. To do range queries, use + findAllByRange() (please note that currently both values are inclusive). + + + Indexing entities + graphRepository = graphRepositoryFactory.createGraphRepository(Person.class); -// exact graphRepository -Person mark = graphRepository.findByProperyValue("people","name","mark"); +// Exact match, in named index +Person mark = graphRepository.findByPropertyValue("people", "name", "mark"); -// numeric range queries -for (Person middleAgedDeveloper : graphRepository.findAllByRange( "age", 20, 40)) { +// Numeric range query, index name inferred automatically +for (Person middleAgedDeveloper : graphRepository.findAllByRange("age", 20, 40)) { Developer developer=middleAgedDeveloper.projectTo(Developer.class); } ]]> -
+ + +
- Fulltext Indexes + Fulltext indexes - Spring Data Graph also supports full-text indexes. By default indexed fields are stored in an exact-lookup - index. To have them analyzed and prepared for fulltext search, the @Indexed annotation has - the boolean fulltext attribute. Please note that fulltext-indexes require a separate index name - as the fulltext-configuration is stored in the index itself. + Spring Data Graph also supports fulltext indexes. By default, indexed fields are stored in + an exact lookup index. To have them analyzed and prepared for fulltext search, the + @Indexed annotation has the boolean fulltext attribute. + + Please note that fulltext indexes require a separate index name as the fulltext configuration + is stored in the index itself. - Access to the fulltext index is provided by the findAllByQuery method of the repositories. Wildcard - like * are allowed. Otherwise the fulltext querying rules of the underlying index provider apply. (In most - cases this will be lucene. + Access to the fulltext index is provided by the findAllByQuery() repository method. + Wildcards like * are allowed. Generally though, the fulltext querying rules of the + underlying index provider apply. See the + Lucene documentation for more + information on this. - + Fulltext indexing + graphRepository = graphRepositoryFactory.createGraphRepository(Person.class); -// exact graphRepository -Person mark = graphRepository.findAllByQuery("people-search","name","ma*"); +Person mark = graphRepository.findAllByQuery("people-search", "name", "ma*"); ]]> + + - - Please note that indexes are currently created on demand, so whenever an index that doesn't exist - is requested from a query or get operation it is created. This is subject to change but has currently - the implication that those indexes won't be configured as fulltext which causes subsequent fulltext- - updates to those indexes to fail. - + Please note that indexes are currently created on demand, so whenever an index that doesn't exist + is requested from a query or get operation it is created. This is subject to change but has + currently the implication that those indexes won't be configured as fulltext which causes + subsequent fulltext updates to those indexes to fail.
- Raw Index Access - The raw index for a domain class is also available from GraphDatabaseContext via the - getIndex method. The second parameter is optional and takes the index-name if it doesn't default - to the simple domain class name. It returns the Index implementation that is provided by Neo4j. + Manual index access + + The index for a domain class is also available from GraphDatabaseContext via + the getIndex() method. The second parameter is optional and takes the index name + if it should not be inferred from the class name. It returns the index implementation that is + provided by Neo4j. + + + Manual index usage personIndex=gdc.getIndex(Person.class,null); -personIndex.add(node,"name","Mark"); +// Default index +Index personIndex = gdc.getIndex(Person.class); +personIndex.query(new QueryContext(NumericRangeQuery.newÍntRange("age", 20, 40, true, true)) + .sort(new Sort(new SortField("age", SortField.INT, false)))); -Index namedPersonIndex=gdc.getIndex(Person.class,"people"); -namedPersonIndex.get("name","Mark"); +// Named index +Index namedPersonIndex = gdc.getIndex(Person.class, "people"); +namedPersonIndex.get("name", "Mark"); -// complex range & sort query -namedPersonIndex.query( new QueryContext( NumericRangeQuery.newÍntRange( "age", 20, 40, true, true ) ) - .sort( new Sort( new SortField( "age", SortField.INT, false ) ) ) ); - -// fulltext index -Index personFulltextIndex=gdc.getIndex(Person.class,"person-name",true); -namedPersonIndex.query("name","Ma*"); -namedPersonIndex.query("{name:Ma*}"); - - ]]> - - +// Fulltext index +Index personFulltextIndex = gdc.getIndex(Person.class, "person-name", true); +personFulltextIndex.query("name", "*cha*"); +personFulltextIndex.query("{name:*cha*}"); +]]> +
Indexing in Neo4jTemplate - Neo4jTemplate also offers index support, providing auto-indexing for fields at creation time of nodes and - relationships. There is an autoIndex method that can also add indexes for a set of fields in one - go. + Neo4jTemplate also offers index support, providing auto-indexing for fields at creation time. + There is an autoIndex method that can also add indexes for a set of fields in one go. - For querying the index, the template offers query-methods that take either the exact match parameters or a query - object / query expression and push the results wrapped uniformly as Paths to the supplied - PathMapper to be converted or collected. + For querying the index, the template offers query methods that take either the exact match + parameters or a query object/expression, and push the results wrapped uniformly as Paths to + the supplied PathMapper to be converted or collected.
diff --git a/src/docbkx/reference/programming-model/repositories.xml b/src/docbkx/reference/programming-model/repositories.xml index 1fb999be9..7f173bef8 100644 --- a/src/docbkx/reference/programming-model/repositories.xml +++ b/src/docbkx/reference/programming-model/repositories.xml @@ -1,6 +1,6 @@ -
+
GraphRepositories for basic CRUD and find-operations The repositories provided by Spring Data Graph build on the composable repository infrastructure contained From 7238ac8af2fca667ba925989482164afb878cacf Mon Sep 17 00:00:00 2001 From: David Montag Date: Fri, 8 Apr 2011 14:36:58 -0700 Subject: [PATCH 2/5] A bit of editing the repositories chapter --- .../programming-model/repositories.xml | 155 ++++++++++-------- 1 file changed, 83 insertions(+), 72 deletions(-) diff --git a/src/docbkx/reference/programming-model/repositories.xml b/src/docbkx/reference/programming-model/repositories.xml index 7f173bef8..3fbec2230 100644 --- a/src/docbkx/reference/programming-model/repositories.xml +++ b/src/docbkx/reference/programming-model/repositories.xml @@ -1,142 +1,154 @@
- GraphRepositories for basic CRUD and find-operations + CRUD with repositories - The repositories provided by Spring Data Graph build on the composable repository infrastructure contained + The repositories provided by Spring Data Graph build on the composable repository infrastructure in Spring Data Commons. - Those repositories allow the interface based composition of the final repository consisting of provided default + They allow for interface based composition of repositories consisting of provided default implementations for certain interfaces and additional custom implementations for other methods. - Spring Data Graph provides only the infrastructure and some default repository implementations so far. In future - releases support for finders derived from method names, named queries and annotated query methods will be added. + Spring Data Graph provides only the infrastructure and some default repository implementations + so far. Future releases will support finders derived from method names, named queries, and + annotated query methods. (e.g. - findByName(name), - @Query(name = "find-by-name-query") findByName(name), - @Query(query = "{name:%s}") findByName(name)) + findByName(name), + @Query(name="find-by-name-query") findByName(name), and + @Query(query="{name:%s}") findByName(name)) - Spring Data Graph comes with typed repository implementations that provide methods for - locating node and relationship entities. There are 3 types of basic repository interfaces and implementations. - One CRUD-Repository (CRUDGraphRepository<T>) that provides basic operations, a IndexQueryExecutor - that delegates to Neo4j's internal indexing subsystem for executing queries. And last but not least - a TraversalQueryExecutor that handles Neo4J Traversals. + + Spring Data Graph comes with typed repository implementations that provide methods for + locating node and relationship entities. There are 3 types of basic repository interfaces + and implementations. CRUDRepository provides basic operations, + IndexRepository and NamedIndexRepository delegate to Neo4j's internal + indexing subsystem for queries, and TraversalRepository handles Neo4j traversals. - CRUDGraphRepository delegates to the configured TypeRepresentationStrategy - () + CRUDRepository delegates to the configured TypeRepresentationStrategy + (see ) for type based queries. - loading an instance via the Neo4j node id - T findOne(id) + Load an instance via a Neo4j node id + T findOne(id) - checks for existence via the Neo4j node id - boolean exists(id) + Check for existence of a Neo4j node id + boolean exists(id) - iterating over all nodes of a node entity type - Iterable<T> findAll() (supported in future versions: Iterable<T> findAll(Sort) and Page<T> findAll(Pageable)) + Iterate over all nodes of a node entity type + Iterable<T> findAll() + (supported in future versions: + Iterable<T> findAll(Sort) and + Page<T> findAll(Pageable)) - counting the instances of a node entity type - Long count() + Count the instances of a node entity type + Long count() - saves the graph entities - T save(T) and Iterable<T> save(Iterable<T>) + Save a graph entity + T save(T) and Iterable<T> save(Iterable<T>) - deletes the graph entities - void delete(T), void; delete(Iterable<T>) and deleteAll() + Delete a graph entity + void delete(T), void; delete(Iterable<T>), + and deleteAll() - - - IndexQueryExecutor works with the indexing subsystem and provides methods to find entities by indexed properties, ranged queries of combination thereof. + + + IndexRepository works with the indexing subsystem and provides methods to find + entities by indexed properties, ranged queries, and combinations thereof. The index key is + the name of the indexed entity field, unless overridden in the @Indexed annotation. - iterating over all indexed instances with a certain property value - Iterable<T> findAllByPropertyValue(indexName, keyName, value) + Iterate over all indexed entity instances with a certain field value + Iterable<T> findAllByPropertyValue(key, value) - getting a single instance with a certain property value - T findByPropertyValue(indexName, keyName, value) + Get a single entity instance with a certain field value + T findByPropertyValue(key, value) - iterating over all indexed instances within a certain numerical range (inclusive) - Iterable<T> findAllByRange(indexName, keyName, from, to) + Iterate over all indexed entity instances with field values in a certain numerical range (inclusive) + Iterable<T> findAllByRange(key, from, to) - iterating over all indexed instances matching the given fulltext (or QueryContext query) - Iterable<T> findAllByQuery(indexName, keyName, queryOrQueryContext) + Iterate over all indexed entity instances with field values matching the given fulltext string or QueryContext query + Iterable<T> findAllByQuery(key, queryOrQueryContext) - - + + There is also a NamedIndexRepository with the same methods, but with an additional index + name parameter, making it possible to query any index. + - TraversalQueryExecutor works with the traversal framework. + TraversalRepository delegates to the Neo4j traversal framework. - iterating over a traversal result - Iterable<T> findAllByTraversal(startNode, traversalDescription) + Iterate over a traversal result + Iterable<T> findAllByTraversal(startEntity, traversalDescription) - The Repository instances are either created manually via a DirectGraphRepositoryFactory to be bound - o a concrete node or relationship entity class. + The Repository instances are either created manually via a + DirectGraphRepositoryFactory, bound to a concrete node or relationship entity class. The DirectGraphRepositoryFactory is configured in the Spring context and can be injected. - - Using GraphRepositories + + + Using GraphRepositories graphRepository = graphRepositoryFactory.createGraphRepository(Person.class); -Person michael = graphRepository.save(new Person("Michael",36)); +Person michael = graphRepository.save(new Person("Michael", 36)); -Person dave=graphRepository.findOne(123); +Person dave = graphRepository.findOne(123); Long numberOfPeople = graphRepository.count(); Person mark = graphRepository.findByPropertyValue("name", "mark"); -Iterable devs = graphRepository.findAllByProperyValue("occupation","developer"); +Iterable devs = graphRepository.findAllByProperyValue("occupation", "developer"); -Iterable middleAgedPeople = graphRepository.findAllByRange("age",20,40); +Iterable middleAgedPeople = graphRepository.findAllByRange("age", 20, 40); -Iterable aTeam = graphRepository.findAllByQuery("name","A*"); +Iterable aTeam = graphRepository.findAllByQuery("name", "A*"); Iterable davesFriends = graphRepository.findAllByTraversal(dave, Traversal.description().pruneAfterDepth(1) .relationships(KNOWS).filter(returnAllButStartNode())); ]]> - - +
- Composing Repositories - - The recommended way of providing repositories is to define a repository-interface per domain class and have the - mechanisms provided by the repository infrastructure automatically detect them and additional implementation - classes and create an injectable repository implementation to be used in services or other spring beans. + Composing repositories + + The recommended way of providing repositories is to define a repository interface per domain + class. The mechanisms provided by the repository infrastructure will automatically detect + them, along with additional implementation classes, and create an injectable repository + implementation to be used in services or other spring beans. + - Composing Repositories + Composing repositories , PersonRepositoryExtension { -} +public interface PersonRepository extends GraphRepository, PersonRepositoryExtension {} + // alternatively select some of the required repositories individually public interface PersonRepository extends CRUDGraphRepository, IndexQueryExecutor, - TraversalQueryExecutor, PersonRepositoryExtension { -} + TraversalQueryExecutor, PersonRepositoryExtension {} + // provide a custom extension if needed public interface PersonRepositoryExtension { Iterable findFriends(Person person); } -public class PersonRepositoryImpl implements PersonRepositoryExtension { +public class PersonRepositoryImpl implements PersonRepositoryExtension { // optionally inject default repository, or use DirectGraphRepositoryFactory @Autowired PersonRepository baseRepository; public Iterable findFriends(Person person) { @@ -151,18 +163,17 @@ public class PersonRepositoryImpl implements PersonRepositoryExtension { @Autowired PersonRepository personRepository; - Person michael = personRepository.save(new Person("Michael",36)); +Person michael = personRepository.save(new Person("Michael",36)); - Person dave=personRepository.findOne(123); +Person dave=personRepository.findOne(123); - Iterable devs = personRepository.findAllByProperyValue("occupation","developer"); +Iterable devs = personRepository.findAllByProperyValue("occupation","developer"); - Iterable aTeam = graphRepository.findAllByQuery( "name","A*"); +Iterable aTeam = graphRepository.findAllByQuery( "name","A*"); - Iterable friends = personRepository.findFriends(dave); - ]]> +Iterable friends = personRepository.findFriends(dave); +]]> -
\ No newline at end of file From 52b3064b169ba3d75c1d04a7536da48982f79307 Mon Sep 17 00:00:00 2001 From: David Montag Date: Fri, 8 Apr 2011 16:12:27 -0700 Subject: [PATCH 3/5] Edited transactions chapter of reference --- .../programming-model/transactions.xml | 138 ++++++++++-------- 1 file changed, 79 insertions(+), 59 deletions(-) diff --git a/src/docbkx/reference/programming-model/transactions.xml b/src/docbkx/reference/programming-model/transactions.xml index a6434dbb1..6ced9e2c7 100644 --- a/src/docbkx/reference/programming-model/transactions.xml +++ b/src/docbkx/reference/programming-model/transactions.xml @@ -3,91 +3,111 @@
Transactions in Spring Data Graph - Neo4j is a transactional datastore which only allows modifications within transaction boundaries and fullfills - the ACID properties. Reading from the store is also possible outside of transactions. + Neo4j is a transactional database, only allowing modifications to be performed within transaction + boundaries. Reading data does however not require transactions. - - Spring Data Graph integrates with transaction managers configured using Spring. The simplest scenario of - just running the graph database uses a SpringTransactionManager provided by the Neo4j kernel to be used - with Spring's JtaTransactionManager. - - Note: The explicit XML configuration given below is encoded in the Neo4jConfiguration - configuration bean that uses Spring's @Configuration functioanlity. This simplifies the configuration. - An example is shown further below. + + Spring Data Graph integrates with transaction managers configured using Spring. The simplest + scenario of just running the graph database uses a SpringTransactionManager provided by the + Neo4j kernel to be used with Spring's JtaTransactionManager. That is, configuring Spring to + use Neo4j's transaction manager. - + + The explicit XML configuration given below is encoded in the Neo4jConfiguration + configuration bean that uses Spring's @Configuration feature. This greatly + simplifies the configuration of Spring Data Graph. + + + + + Simple transaction manager configuration + - - - - - - - - - - + + + + + + + + + + ]]> + - For scenarios running multiple transactional resources there are two options. - First of all you can have Neo4j participate in the externally set up transaction manager using the new - SpringProvider by enabling the configuration parameter for your graph database. Either via the spring config - or the configuration file (neo4j.properties). + For scenarios with multiple transactional resources there are two options. The first option + is to have Neo4j participate in the externally configured transaction manager by using the + Spring support in Neo4j by enabling the configuration parameter for your graph database. + Neo4j will then use Spring's transaction manager instead of its own. - + Neo4j Spring integration + - - - + + + - - - - - - + + + + + + - ]]> +]]> + - You can configure a stock XA transaction manager to be used with Neo4j and the other resources (e.g. Atomikos, - JOTM, App-Server-TM). For a bit less secure but fast 1 phase commit best effort, use the implementation coming - with Spring Data Graph (ChainedTransactionManager). It takes a list of transaction-managers as - constructor params and will handle them in order for transaction start and commit (or rollback) in the reverse - order. + One can also configure a stock XA transaction manager (e.g. Atomikos, JOTM, App-Server-TM) to be + used with Neo4j and the other resources. For a bit less secure but fast 1 phase commit best effort, + use ChainedTransactionManager, which comes bundled with Spring Data Graph. It takes a + list of transaction managers as constructor params and will handle them in order for transaction + start and commit (or rollback) in the reverse order. - + ChainedTransactionManager example + + + + + + + + + + + + + + + + class="org.springframework.data.graph.neo4j.transaction.ChainedTransactionManager"> - - - - - - - - - - - - - - - + + + + ]]> + +
From c51060c16fa2a22f87b129e1fb01d81c0964dd28 Mon Sep 17 00:00:00 2001 From: David Montag Date: Fri, 8 Apr 2011 16:27:18 -0700 Subject: [PATCH 4/5] Shortened titles. ToC looks better now. --- src/docbkx/reference/cross-store.xml | 2 +- src/docbkx/reference/programming-model/aspectj.xml | 2 +- src/docbkx/reference/programming-model/attachdetach.xml | 2 +- .../reference/programming-model/beanvalidation.xml | 2 +- src/docbkx/reference/programming-model/indexing.xml | 2 +- .../reference/programming-model/introducedmethods.xml | 2 +- src/docbkx/reference/programming-model/node-entities.xml | 9 +++++---- .../reference/programming-model/programming-model.xml | 2 +- src/docbkx/reference/programming-model/projection.xml | 2 +- src/docbkx/reference/programming-model/relationships.xml | 9 +-------- src/docbkx/reference/programming-model/transactions.xml | 2 +- .../programming-model/typerepresentationstrategy.xml | 2 +- src/docbkx/reference/samples.xml | 2 +- src/docbkx/reference/setup.xml | 2 +- 14 files changed, 18 insertions(+), 24 deletions(-) diff --git a/src/docbkx/reference/cross-store.xml b/src/docbkx/reference/cross-store.xml index b346de1cc..fa7a37fa1 100644 --- a/src/docbkx/reference/cross-store.xml +++ b/src/docbkx/reference/cross-store.xml @@ -1,7 +1,7 @@ - Cross-store persistence with a graph database + Cross-store persistence The Spring Data Graph project support cross-store persistence which allows parts of the data mode to be stored in a traditional JPA datastore (RDBMS) and other parts of the data model (even partial entites, that is some properties or relationships) in a graph store. diff --git a/src/docbkx/reference/programming-model/aspectj.xml b/src/docbkx/reference/programming-model/aspectj.xml index facbdb39c..12c6f201a 100644 --- a/src/docbkx/reference/programming-model/aspectj.xml +++ b/src/docbkx/reference/programming-model/aspectj.xml @@ -1,7 +1,7 @@
- Overview of the AspectJ support + AspectJ support Behind the scenes, Spring Data Graph leverages AspectJ aspects to modify the behavior of simple annotated POJO entities diff --git a/src/docbkx/reference/programming-model/attachdetach.xml b/src/docbkx/reference/programming-model/attachdetach.xml index 439c0d828..dc52d1e41 100644 --- a/src/docbkx/reference/programming-model/attachdetach.xml +++ b/src/docbkx/reference/programming-model/attachdetach.xml @@ -1,7 +1,7 @@
- Session handling - attached and detached entities + Detached entities By default newly created node entities are in a detached state. When persist() is called on the entity it is attached to the graph store and its properties and relationships are persisted as well. Changing diff --git a/src/docbkx/reference/programming-model/beanvalidation.xml b/src/docbkx/reference/programming-model/beanvalidation.xml index c02a63e44..8ce969cbe 100644 --- a/src/docbkx/reference/programming-model/beanvalidation.xml +++ b/src/docbkx/reference/programming-model/beanvalidation.xml @@ -1,7 +1,7 @@
- Bean Validation - JSR-303 + Bean validation (JSR-303) Spring Data Graph supports property based validation support. So, whenever a property is changed, it is checked against the annotated constraints (.e.g @Min, @Max, @Size, etc). diff --git a/src/docbkx/reference/programming-model/indexing.xml b/src/docbkx/reference/programming-model/indexing.xml index a405c5fd8..8d10a60b7 100644 --- a/src/docbkx/reference/programming-model/indexing.xml +++ b/src/docbkx/reference/programming-model/indexing.xml @@ -1,6 +1,6 @@ -
+
Indexing diff --git a/src/docbkx/reference/programming-model/introducedmethods.xml b/src/docbkx/reference/programming-model/introducedmethods.xml index 18ea4dc33..84c061455 100644 --- a/src/docbkx/reference/programming-model/introducedmethods.xml +++ b/src/docbkx/reference/programming-model/introducedmethods.xml @@ -1,7 +1,7 @@
- Methods added to entity classes + Introduced methods The node and relationship aspects introduce (via AspectJ ITD - inter type declaration) several methods to the entities. diff --git a/src/docbkx/reference/programming-model/node-entities.xml b/src/docbkx/reference/programming-model/node-entities.xml index d6b5075a3..4b32cc494 100644 --- a/src/docbkx/reference/programming-model/node-entities.xml +++ b/src/docbkx/reference/programming-model/node-entities.xml @@ -1,9 +1,10 @@
- Annotations define POJO node entities - Entities are declared using the @NodeEntity annotation. - Relationship entities use the @RelationshipEntity annotation. + Defining node entities + + Node entities are declared using the @NodeEntity annotation. Relationship entities use + the @RelationshipEntity annotation.
@NodeEntity: The basic building block @@ -61,7 +62,7 @@ String title; Numerical values are indexed as such by default, allowing for range queries. Fulltext indexing is also possible by setting the fulltext attribute to true. For details see - the indexing section . + the indexing section .
diff --git a/src/docbkx/reference/programming-model/programming-model.xml b/src/docbkx/reference/programming-model/programming-model.xml index 5d3b09264..91377d676 100644 --- a/src/docbkx/reference/programming-model/programming-model.xml +++ b/src/docbkx/reference/programming-model/programming-model.xml @@ -1,7 +1,7 @@ - Programming model for Spring Data Graph + Programming model This chapter covers the fundamentals of the programming model behind Spring Data Graph. It discusses the AspectJ features used and the annotations provided by Spring Data Graph and how to use them. diff --git a/src/docbkx/reference/programming-model/projection.xml b/src/docbkx/reference/programming-model/projection.xml index ea061379f..07c1d6a2b 100644 --- a/src/docbkx/reference/programming-model/projection.xml +++ b/src/docbkx/reference/programming-model/projection.xml @@ -1,7 +1,7 @@
- Dynamic typing - Projection to unrelated, fitting types + Projecting entities As the underlying data model of a graph database doesn't imply and enforce strict type constraints like a relational model does, it offers much more flexibility on how to model your domain classes and which of diff --git a/src/docbkx/reference/programming-model/relationships.xml b/src/docbkx/reference/programming-model/relationships.xml index 7a4f01331..626821545 100644 --- a/src/docbkx/reference/programming-model/relationships.xml +++ b/src/docbkx/reference/programming-model/relationships.xml @@ -1,7 +1,7 @@
- Relationships relate node entities + Relating node entities Since relationships are first-class citizens in Neo4j, associations between node entities are represented by relationships. In general, relationships are categorized by a type, and start and end nodes (which @@ -9,13 +9,6 @@ Spring Data Graph has special support to represent Neo4j relationships as entities too, but it is often not needed. -
- @NodeEntity - - Any class annotated with @NodeEntity will be backed by a node in the graph. Its fields will, if their - types are supported, be persisted as properties to the node for each entity. - -
@RelatedTo: Connecting node entities diff --git a/src/docbkx/reference/programming-model/transactions.xml b/src/docbkx/reference/programming-model/transactions.xml index 6ced9e2c7..7a9d0da46 100644 --- a/src/docbkx/reference/programming-model/transactions.xml +++ b/src/docbkx/reference/programming-model/transactions.xml @@ -1,7 +1,7 @@
- Transactions in Spring Data Graph + Transactions Neo4j is a transactional database, only allowing modifications to be performed within transaction boundaries. Reading data does however not require transactions. diff --git a/src/docbkx/reference/programming-model/typerepresentationstrategy.xml b/src/docbkx/reference/programming-model/typerepresentationstrategy.xml index 1e37d1f2f..ce28c4304 100644 --- a/src/docbkx/reference/programming-model/typerepresentationstrategy.xml +++ b/src/docbkx/reference/programming-model/typerepresentationstrategy.xml @@ -1,7 +1,7 @@
- Storing type information in the graph + Entity types stored There are several ways to represent the Java type hierarchy of the data model in the graph. In general, for all node and relationship entities, type information is needed to perform certain repository operations. Some of diff --git a/src/docbkx/reference/samples.xml b/src/docbkx/reference/samples.xml index 25927e9cc..702ad69bf 100644 --- a/src/docbkx/reference/samples.xml +++ b/src/docbkx/reference/samples.xml @@ -2,7 +2,7 @@ - Samples + Sample code
Introduction diff --git a/src/docbkx/reference/setup.xml b/src/docbkx/reference/setup.xml index cd69e3639..92f9e16b2 100644 --- a/src/docbkx/reference/setup.xml +++ b/src/docbkx/reference/setup.xml @@ -1,7 +1,7 @@ - Setup required for Spring Data Graph + Environment setup To use Spring Data Graph in your application, some setup is required. For building the application the necessary Maven dependencies must be included and for the AspectJ weaving some extensions of the compile goal are necessary. This chapter also discusses the Spring configuration needed to set up Spring Data Graph. Examples for this setup can be found in the Spring Data Graph examples. From bb6a2fd6b98fb0304fe28c40073a2650f8d918b5 Mon Sep 17 00:00:00 2001 From: David Montag Date: Fri, 8 Apr 2011 16:48:47 -0700 Subject: [PATCH 5/5] Renamed aspectj intro section --- src/docbkx/index.xml | 2 +- .../reference/{aspectj-intro.xml => aspectj-details.xml} | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename src/docbkx/reference/{aspectj-intro.xml => aspectj-details.xml} (97%) diff --git a/src/docbkx/index.xml b/src/docbkx/index.xml index f2eb0ba79..83282056e 100644 --- a/src/docbkx/index.xml +++ b/src/docbkx/index.xml @@ -102,7 +102,7 @@ - + diff --git a/src/docbkx/reference/aspectj-intro.xml b/src/docbkx/reference/aspectj-details.xml similarity index 97% rename from src/docbkx/reference/aspectj-intro.xml rename to src/docbkx/reference/aspectj-details.xml index 787fd2910..8fcb0b1d2 100644 --- a/src/docbkx/reference/aspectj-intro.xml +++ b/src/docbkx/reference/aspectj-details.xml @@ -1,7 +1,7 @@ - - AspectJ introduction + + AspectJ details The object graph mapper of Spring Data Graph relies heavily on AspectJ. AspectJ is the Java implementation of the Aspect