diff --git a/src/docbkx/reference/programming-model/annotations.xml b/src/docbkx/reference/programming-model/annotations.xml index 4f42f682c..7b1985e77 100644 --- a/src/docbkx/reference/programming-model/annotations.xml +++ b/src/docbkx/reference/programming-model/annotations.xml @@ -7,8 +7,9 @@ annotation.
- Entities with @NodeEntity - The @NodeEntity annotation is used to declare a POJO entity to be backed by a node in the + @NodeEntity: The basic building block + + The @NodeEntity annotation is used to declare a POJO entity to be backed by a node in the graph store. Simple fields on the entity are mapped by default to properties of the node. Object references to other NodeEntities (whether single or Collection) are mapped via relationships. If the annotation parameter useShortNames is set to false, the properties and relationship @@ -26,47 +27,20 @@ public class Movie { } ]]>
+
- RelationshipEntities with @RelationshipEntity - To access the rich data model of graph relationships, POJOs can also be annotated with - @RelationshipEntity. Relationship entities can't be instantiated directly but are rather accessed via - node entities, either by @RelatedToVia fields or by the relateTo or - getRelationshipTo methods. - Relationship entities may contain fields that are mapped to properties and two special fields that are - annotated with @StartNode and @EndNode which point to the start and end node entities respectively. These - fields are treated as read only fields. - - -
-
- Fields with @GraphProperty - It is not necessary to annotate fields as they are persisted by default; all fields that contain primitive - values are persisted directly to the graph. All fields - convertible to String using the Spring conversion services will be stored as a string. Transient fields are - not persisted. - This annotation is mainly used for cross-store persistence. - -
-
- Fields with @RelatedTo pointing to other NodeEntities + @RelatedTo: Connecting NodeEntities Relationships to other NodeEntities are mapped to graph relationships. Those can either be single - relationships (1:1) or multiple relationships (1:n). In most cases single relationships to other + relationships (1:1) or multiple relationships (1:N). In most cases single relationships to other node entities don't have to be annotated as Spring Data Graph can extract all necessary information from the field using reflection. In the case of multiple relationships, the elementClass parameter of @RelatedTo must be specified because of type erasure. The direction (default OUTGOING) and type (inferred from field name) parameters of the annotation are optional. - Relationships to single node entities are created when setting the field and deleted when setting it to + + Relationships to single node entities are created when setting the field and deleted when setting it to null. For multi-relationships the field provides a managed collection (Set) that handles addition and removal of node entities and reflects those in the graph relationships. @@ -87,9 +61,33 @@ public class Actor { } ]]>
+
- Fields with @RelatedToVia pointing to RelationshipEntities - To provide easy programmatic access to the richer relationship entities of the data model a different + @RelationshipEntity: Rich relationships + + To access the full data model of graph relationships, POJOs can also be annotated with + @RelationshipEntity. Relationship entities can't be instantiated directly but are rather accessed via + node entities, either by @RelatedToVia fields or by the relateTo or + getRelationshipTo methods. + Relationship entities may contain fields that are mapped to properties and two special fields that are + annotated with @StartNode and @EndNode which point to the start and end node entities respectively. These + fields are treated as read only fields. + + +
+ +
+ @RelatedToVia: Connecting NodeEntitites via RelationshipEntities + + To provide easy programmatic access to the richer relationship entities of the data model a different annotation @RelatedToVia can be declared on fields of Iterables of the relationship entity type. These Iterables then provide read only access to instances of the entity that backs the relationship of this relationship type. Those instances are initialized with the properties of the relationship and the start @@ -104,15 +102,16 @@ public class Actor { ]]>
- @StartNode + @StartNode: Starting NodeEntity of RelationshipEntity Annotation for the start node of a relationship entity, read only.
- @EndNode + @EndNode: Ending NodeEntity of RelationshipEntity Annotation for the end node of a relationship entity, read only.
+
- @Indexed + @Indexed: Making entities searchable by field value The @Indexed annotation can be declared on fields that are intended to be indexed by the Neo4j IndexManager, triggered by value modification. The resulting index can be used to later retrieve nodes or relationships that contain a certain property @@ -128,6 +127,7 @@ public class Actor { it defaults to the one configured with Neo4j ("node" and "relationship").
+
@GraphTraversal The @GraphTraversal annotation leverages the delegation infrastructure used by the Spring Data Graph @@ -138,4 +138,15 @@ public class Actor { elementClass attribute.
+ +
+ @GraphProperty: Cross-store persisted fields + It is not necessary to annotate fields as they are persisted by default; all fields that contain primitive + values are persisted directly to the graph. All fields + convertible to String using the Spring conversion services will be stored as a string. Transient fields are + not persisted. + This annotation is mainly used for cross-store persistence. + +
+ \ No newline at end of file