fix docbook references
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<chapter id="reference:aspectj-details">
|
||||
<chapter id="reference_aspectj-details">
|
||||
<title>AspectJ details</title>
|
||||
<para>
|
||||
The advanced mapping mode of Spring Data Neo4j relies heavily on AspectJ. AspectJ is a Java implementation
|
||||
@@ -29,7 +29,7 @@
|
||||
Spring Data Neo4j uses a mix of these mechanisms internally. First, when encountering the
|
||||
<code>@NodeEntity</code> or <code>@RelationshipEntity</code> annotations it introduces a new interface
|
||||
<code>NodeBacked</code> or <code>RelationshipBacked</code> to the annotated class. Secondly, it introduces
|
||||
fields and methods to the annotated class. See <xref linkend="reference:programming-model:introduced-methods"/>
|
||||
fields and methods to the annotated class. See <xref linkend="reference_programming-model_introduced-methods"/>
|
||||
for more information on the methods introduced.
|
||||
</para>
|
||||
<para>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<chapter id="reference:cross-store">
|
||||
<chapter id="reference_cross-store">
|
||||
<title>Cross-store persistence</title>
|
||||
<para>
|
||||
The Spring Data Neo4j project support cross-store persistence for the advanced mapping mode,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<chapter id="reference:heroku">
|
||||
<chapter id="reference_heroku">
|
||||
<title>Heroku: Seeding the Cloud</title>
|
||||
<para>
|
||||
Deploying your application into the cloud is a great way to scale from from "wouldn't it be cool if.." to
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<chapter id="reference:neo4j-server">
|
||||
<chapter id="reference_neo4j-server">
|
||||
<title>Neo4j Server</title>
|
||||
<para>
|
||||
Neo4j is not only available in embedded mode. It can also be installed and run as a stand-alone server
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<chapter id="reference:performance">
|
||||
<chapter id="reference_performance">
|
||||
<title>Performance considerations</title>
|
||||
<para>
|
||||
Although adding layers of abstraction is a common pattern in software development, each of these layers
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE preface PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<preface id="reference:preface">
|
||||
<preface id="reference_preface">
|
||||
<title>Reference Documentation</title>
|
||||
<section>
|
||||
<title>Spring Data and Spring Data Neo4j</title>
|
||||
@@ -40,13 +40,13 @@
|
||||
<para>
|
||||
The explanation of Spring Data Neo4j's programming model starts with some underlying details.
|
||||
The basic internal workings of the two mapping modes are explained in the initial chapter.
|
||||
<xref linkend="reference:mapping"/> covers the simple mapping and
|
||||
<xref linkend="reference:aspectj"/> contains details about the advanced mapping.
|
||||
<xref linkend="reference_mapping"/> covers the simple mapping and
|
||||
<xref linkend="reference_aspectj"/> contains details about the advanced mapping.
|
||||
It also explains some of the common issues around AspectJ tooling with the current IDEs.
|
||||
</para>
|
||||
<para>
|
||||
To get started with a simple application, you need only your domain model and the annotations
|
||||
(see <xref linkend="reference:programming-model:annotations"/>) provided by the library. You use annotations to
|
||||
(see <xref linkend="reference_programming-model_annotations"/>) provided by the library. You use annotations to
|
||||
mark domain objects to be reflected by nodes and relationships of the graph database. For individual fields the
|
||||
annotations allow you to declare how they should be processed and mapped to the graph. For property fields and
|
||||
references to other entities this is straightforward.
|
||||
@@ -57,17 +57,17 @@
|
||||
</para>
|
||||
<para>
|
||||
Relationships between entities are first class citizens in a graph database and therefore worth a separate
|
||||
chapter (<xref linkend="reference:programming_model:relationships" />) describing their usage in Spring Data Neo4j.
|
||||
chapter (<xref linkend="reference_programming_model:relationships" />) describing their usage in Spring Data Neo4j.
|
||||
</para>
|
||||
<para>
|
||||
Indexing operations are useful for finding individual nodes and relationships in a graph. They can be used to
|
||||
start graph operations or to be processed in your application. Indexing in the plain Neo4j API is a bit more involved.
|
||||
Spring Data Neo4j maintains automatic indexes per entity class, with <code>@Indexed</code> annotations on relevant fields.
|
||||
(<xref linkend="reference:programming-model:indexing"/>)
|
||||
(<xref linkend="reference_programming-model_indexing"/>)
|
||||
</para>
|
||||
<para>
|
||||
Being a Spring Data library, Spring Data Neo4j offers a comprehensive Neo4j-Template
|
||||
(<xref linkend="reference:template"/>) for interacting with
|
||||
(<xref linkend="reference_template"/>) for interacting with
|
||||
the mapped entities and the Neo4j graph database. The operations provided by Spring Data Neo4j - Repositories
|
||||
per mapped entity class are based on the API offered by the Neo4j-Template. It also provides the operations of the Neo4j Core API
|
||||
in a more convenient way. Especially the querying (Indexes, Cypher, Gremlin and Traversals) and result conversion
|
||||
@@ -80,35 +80,35 @@
|
||||
each repository. The implementation details of commonly used persistence methods are handled by the library.
|
||||
At least for typical CRUD, index- and query-operations that is very convenient.
|
||||
The repositories are extensible by annotated, named or derived finder methods.
|
||||
For custom implementations of repository methods you are free to add your own code. (<xref linkend="reference:programming-model:repositories"/>).
|
||||
For custom implementations of repository methods you are free to add your own code. (<xref linkend="reference_programming-model_repositories"/>).
|
||||
</para>
|
||||
<para>
|
||||
To be able to leverage the schema-free nature of Neo4j it is possible to project any entity to any other entity type. That
|
||||
is useful as long as they share some properties (or relationships). The entities don't have to share any super-types
|
||||
or hierarchies. How that works is explained here: <xref linkend="reference:programming-model:projection"/>.
|
||||
or hierarchies. How that works is explained here: <xref linkend="reference_programming-model_projection"/>.
|
||||
</para>
|
||||
<para>
|
||||
Spring Data Neo4j also allows you to integrate with the powerful geospatial graph library Neo4j-Spatial that offers
|
||||
full support for working with any kind of geo-data. Spring Data Neo4j repositories expose a couple of those operations
|
||||
via bounding-box and near-location searches. <xref linkend="reference:spatial"/>.
|
||||
via bounding-box and near-location searches. <xref linkend="reference_spatial"/>.
|
||||
</para>
|
||||
<para>
|
||||
Using computed fields that are dynamically backed by graph operations is a bit more involved. First you should know
|
||||
about traversals, Cypher queries and Gremlin expressions.
|
||||
Those are explained in <xref linkend="neo4j" />. Then you can start using virtual, computed fields
|
||||
in your entities <xref linkend="reference:programming-model:projection"/> .
|
||||
in your entities <xref linkend="reference_programming-model_projection"/> .
|
||||
</para>
|
||||
<para>
|
||||
If you like the ActiveRecord approach that uses persistence methods mixed into the domain classes, you will
|
||||
want to look at the description of the additional
|
||||
entity methods (see <xref linkend="reference:programming-model:introduced-methods"/>) that are added to your
|
||||
entity methods (see <xref linkend="reference_programming-model_introduced-methods"/>) that are added to your
|
||||
domain objects by Spring Data Neo4j Aspects. <!-- TODO Mixins--> Those allow you to manage the entity lifecycle as
|
||||
well as to connect entities.
|
||||
Those methods also provide the means to execute the mentioned graph operations with your entity as a starting point.
|
||||
</para>
|
||||
<para>
|
||||
Neo4j is a fully ACID, enterprise grade database. It uses Java transactions, and internally a 2-phase commit protocol, to guarantee the
|
||||
safety of your data. The implications of that are described in the chapter around transactions. (<xref linkend="reference:programming-model:transactions"/>)
|
||||
safety of your data. The implications of that are described in the chapter around transactions. (<xref linkend="reference_programming-model_transactions"/>)
|
||||
</para>
|
||||
<para>
|
||||
The need of an active transaction for mutating the state of nodes or relationships implies that direct changes to
|
||||
@@ -116,7 +116,7 @@
|
||||
want to care about transactions and the open-session-in-view pattern is not widely used. Therefore Spring Data
|
||||
Neo4j's advanced mappings introduced an entity lifecyle and added support for detached entities which can be used for temporary
|
||||
domain objects that are not intended to be stored in the graph or which will be attached to the graph only later.
|
||||
(<xref linkend="reference:programming-model:lifecycle"/>)
|
||||
(<xref linkend="reference_programming-model_lifecycle"/>)
|
||||
</para>
|
||||
<para>
|
||||
For the simple mapping this is not neccessary as domain objects are detached by default and have to be explicitly
|
||||
@@ -126,12 +126,12 @@
|
||||
Unlike Neo4j which is a schema free database, Spring Data Neo4j works on Java domain objects. So it needs to store
|
||||
the type information in the graph to be able to reconstruct the entities when just nodes are retrieved. To
|
||||
achieve that it employs type-representation-strategies which are described in a separate chapter.
|
||||
(see <xref linkend="reference:programming-model:typerepresentationstrategy"/>)
|
||||
(see <xref linkend="reference_programming-model_typerepresentationstrategy"/>)
|
||||
</para>
|
||||
<para>
|
||||
Spring Data Neo4j offers basic support for bean property validation (JSR-303). Annotations from that JSR are recognized
|
||||
and evaluated whenever a property is set, or when a previously detached entity is persisted to the graph.
|
||||
(see <xref linkend="reference:programming-model:validation"/>)
|
||||
(see <xref linkend="reference_programming-model_validation"/>)
|
||||
</para>
|
||||
<para>
|
||||
Unfortunately the setup of Spring Data Neo4j advanced mapping mode is more involved than we'd like. That is partly due to the Maven setup
|
||||
@@ -139,23 +139,23 @@
|
||||
itself boils down to two lines of <code><spring-neo4j></code> namespace setup. (see <xref linkend="setup"/>)
|
||||
</para>
|
||||
<para>
|
||||
In a polyglot persistence context Spring Data Neo4j can also be used in a JPA environment to add graph features to your JPA entities. In the <xref linkend="reference:cross-store"/>
|
||||
In a polyglot persistence context Spring Data Neo4j can also be used in a JPA environment to add graph features to your JPA entities. In the <xref linkend="reference_cross-store"/>
|
||||
the slightly different behavior and setup of a Graph-JPA interaction are described.
|
||||
</para>
|
||||
<para>
|
||||
The provided samples, which are also publicly hosted on <ulink url="http://spring.neo4j.org/examples">Github</ulink>, are explained in
|
||||
<xref linkend="reference:samples"/>.
|
||||
<xref linkend="reference_samples"/>.
|
||||
</para>
|
||||
<para>
|
||||
The performance implications of using Spring Data Neo4j are detailed in <xref linkend="reference:performance"/>.
|
||||
The performance implications of using Spring Data Neo4j are detailed in <xref linkend="reference_performance"/>.
|
||||
This chapter also discusses which use cases should not be handled with Spring Data Neo4j.
|
||||
</para>
|
||||
<para>
|
||||
As AspectJ might not be well known to everyone, some of the core concepts of the aspect oriented,
|
||||
advanced mapping mode for Java are explained in <xref linkend="reference:aspectj-details"/>.
|
||||
advanced mapping mode for Java are explained in <xref linkend="reference_aspectj-details"/>.
|
||||
</para>
|
||||
<para>
|
||||
How to consume the REST-API of a Neo4j-Server is the topic of <xref linkend="reference:neo4j-server"/>.
|
||||
How to consume the REST-API of a Neo4j-Server is the topic of <xref linkend="reference_neo4j-server"/>.
|
||||
But Spring Data Neo4j can also
|
||||
be used to create custom Extensions for the Neo4j Server which would serve domain model abstractions
|
||||
to a suitable front-end. So instead of talking low level primitives to a database, the front-end or web-app
|
||||
@@ -165,7 +165,7 @@
|
||||
<note>
|
||||
<para>
|
||||
Please be aware that the advanced mapping mode of Spring Data Neo4j is based on AspectJ and uses some
|
||||
advanced features of that toolset. See the section on AspectJ (<xref linkend="reference:aspectj"/>) for
|
||||
advanced features of that toolset. See the section on AspectJ (<xref linkend="reference_aspectj"/>) for
|
||||
details if you run into any problems.
|
||||
</para>
|
||||
</note>
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<section id="reference:aspectj">
|
||||
<section id="reference_aspectj">
|
||||
<title>Advanced Mapping with AspectJ</title>
|
||||
<para>
|
||||
Behind the scenes, Spring Data Neo4j leverages <ulink url="http://www.eclipse.org/aspectj/">AspectJ</ulink>
|
||||
aspects to modify the behavior of annotated POJO entities
|
||||
(see <xref linkend="reference:aspectj-details"/>). Each node entity is backed by a graph node that holds its
|
||||
(see <xref linkend="reference_aspectj-details"/>). Each node entity is backed by a graph node that holds its
|
||||
properties and relationships to other entities. AspectJ is used for intercepting field access, so that
|
||||
Spring Data Neo4j can retrieve the appropriate information from the entity's backing node or relationship.
|
||||
</para>
|
||||
<para>
|
||||
The aspect introduces an internal field (<code>entityState</code>) and some public methods
|
||||
(see <xref linkend="reference:programming-model:introduced-methods"/>) to the entities, for instance
|
||||
(see <xref linkend="reference_programming-model_introduced-methods"/>) to the entities, for instance
|
||||
<code>entity.getPersistentState()</code> and <code>entity.relateTo</code>.
|
||||
It also introduces some methods for graph operations that start at the current entity.
|
||||
Introduced methods for <code>equals()</code> and <code>hashCode()</code> use the underlying node or relationship.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<section id="reference:programming-model:lifecycle">
|
||||
<section id="reference_programming-model_lifecycle">
|
||||
<title>Detached node entities in advanced mapping mode</title>
|
||||
<para>
|
||||
This section only applies to the advanced mapping (AspectJ-backed). The simple mapping always detaches entities on
|
||||
@@ -48,7 +48,7 @@ class Person {
|
||||
Person p = new Person("Michael").persist();
|
||||
]]></programlisting>
|
||||
</example>
|
||||
<section id="reference:programming-model:detached:relating">
|
||||
<section id="reference_programming-model_detached_relating">
|
||||
<title>Relating detached entities</title>
|
||||
<para>
|
||||
As mentioned above, an entity simply created with the <code>new</code> keyword starts out detached.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<section id="reference:programming-model:validation">
|
||||
<section id="reference_programming-model_validation">
|
||||
<title>Bean validation (JSR-303)</title>
|
||||
<para>
|
||||
Spring Data Neo4j supports property-based validation support. When a property is changed and persisted, it is
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<section id="reference:programming-model:conversion">
|
||||
<section id="reference_programming-model_conversion">
|
||||
<title>Conversion</title>
|
||||
<para>
|
||||
<code>Neo4jTemplate</code> has a generic convert method which might also use projection underneath.
|
||||
@@ -14,7 +14,7 @@
|
||||
It is also possible to provide a custom ResultConverter that additionally takes care of conversions.
|
||||
</para>
|
||||
|
||||
<section id="reference:programming-model:mapresult">
|
||||
<section id="reference_programming-model_mapresult">
|
||||
<title>Mapping Query Results</title>
|
||||
<para>
|
||||
For both queries executed via the result conversion DSL as well as repository methods, it is possible to specify
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<section id="reference:programming-model:indexing">
|
||||
<section id="reference_programming-model_indexing">
|
||||
<title>Indexing</title>
|
||||
|
||||
<para>
|
||||
@@ -43,7 +43,7 @@
|
||||
</para>
|
||||
<para>
|
||||
The indexes can be queried by using a repository (see
|
||||
<xref linkend="reference:programming-model:repositories" />).
|
||||
<xref linkend="reference_programming-model_repositories" />).
|
||||
The repository is an instance of
|
||||
<code>org.springframework.data.neo4j.repository.IndexRepository</code>.
|
||||
The methods <code>findByPropertyValue()</code> and <code>findAllByPropertyValue()</code> work on
|
||||
@@ -215,7 +215,7 @@ personFulltextIndex.query("{name:*cha*}");
|
||||
<para>
|
||||
For querying the index, the template offers query methods that take either the exact match
|
||||
parameters or a query object/expression, return the results as <code>Result</code> objects which
|
||||
can then be converted and projected further using the result-conversion-dsl (see <xref linkend="reference:template"/>).
|
||||
can then be converted and projected further using the result-conversion-dsl (see <xref linkend="reference_template"/>).
|
||||
</para>
|
||||
</section>
|
||||
<section>
|
||||
@@ -233,7 +233,7 @@ personFulltextIndex.query("{name:*cha*}");
|
||||
<title>Spatial Indexes</title>
|
||||
<para>
|
||||
Spring Data Neo4j offers limited support for spatial queries using the <code>neo4j-spatial</code> library. See the
|
||||
separate chapter <xref linkend="reference:spatial"/> for details.
|
||||
separate chapter <xref linkend="reference_spatial"/> for details.
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<section id="reference:programming-model:introduced-methods">
|
||||
<section id="reference_programming-model_introduced-methods">
|
||||
<title>Active Record Methods for Advanced Mapping Mode</title>
|
||||
<para>
|
||||
This chapter only applies to the advanced mapping. Currently the Aspects introduce the following
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<section id="reference:mapping">
|
||||
<section id="reference_mapping">
|
||||
<title>Object Graph Mapping</title>
|
||||
<para>
|
||||
Up until recently Spring Data Neo4j supported only the more advanced and flexible AspectJ based mapping approach, see <xref linkend="reference:aspectj" />.
|
||||
Feedback about issues with the AspectJ tooling and other implications persuaded us to add a simpler mapping (see <xref linkend="reference:simple-mapping" />) to Spring Data Neo4j.
|
||||
Up until recently Spring Data Neo4j supported only the more advanced and flexible AspectJ based mapping approach, see <xref linkend="reference_aspectj" />.
|
||||
Feedback about issues with the AspectJ tooling and other implications persuaded us to add a simpler mapping (see <xref linkend="reference_simple-mapping" />) to Spring Data Neo4j.
|
||||
Both versions work with the same annotations and provide similar API's, but differ in behaviour.
|
||||
</para>
|
||||
<para>
|
||||
@@ -30,7 +30,7 @@
|
||||
</para>
|
||||
<para>
|
||||
Otherwise the two approaches share much of the infrastructure. E.g. for creating new entity instances from
|
||||
type information store in the graph (<xref linkend="reference:programming-model:typerepresentationstrategy"/>),
|
||||
type information store in the graph (<xref linkend="reference_programming-model_typerepresentationstrategy"/>),
|
||||
the infrastructure for mapping individual fields to graph properties and relationships and everything related to
|
||||
indexing and querying. A certain part of that is also exposed via the Neo4jTemplate for direct use.
|
||||
</para>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<section id="reference:programming-model:annotations">
|
||||
<section id="reference_programming-model_annotations">
|
||||
<title>Defining node entities</title>
|
||||
<para>
|
||||
Node entities are declared using the <code>@NodeEntity</code> annotation. Relationship entities use
|
||||
@@ -22,7 +22,7 @@
|
||||
<para>
|
||||
If the <code>partial</code> attribute is set to true, this entity takes part in a cross-store setting,
|
||||
where the entity lives in both the graph database and a JPA data source. See
|
||||
<xref linkend="reference:cross-store"/> for more information.
|
||||
<xref linkend="reference_cross-store"/> for more information.
|
||||
</para>
|
||||
<para>
|
||||
Entity fields can be annotated with <code>@GraphProperty</code>, <code>@RelatedTo</code>,
|
||||
@@ -194,8 +194,8 @@ assertThat(studio.hashCode(), is(not(equalTo(sameStudio.hashCode())));
|
||||
indexing facilities. The resulting index can be used to later retrieve nodes or relationships
|
||||
that contain a certain property value, e.g. a name. Often an index is used to establish the start
|
||||
node for a traversal. Indexes are accessed by a repository for a particular node or relationship
|
||||
entity type. See <xref linkend="reference:programming-model:indexing"/> and
|
||||
<xref linkend="reference:programming-model:repositories"/> for more information.
|
||||
entity type. See <xref linkend="reference_programming-model_indexing"/> and
|
||||
<xref linkend="reference_programming-model_repositories"/> for more information.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
@@ -224,7 +224,7 @@ public class Group {
|
||||
</example>
|
||||
<note>
|
||||
<para>
|
||||
Please note that this annotation can also be used on repository methods. (<xref linkend="reference:programming-model:repositories"/>)
|
||||
Please note that this annotation can also be used on repository methods. (<xref linkend="reference_programming-model_repositories"/>)
|
||||
</para>
|
||||
</note>
|
||||
</section>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<section id="reference:programming-model:projection">
|
||||
<section id="reference_programming-model_projection">
|
||||
<title>Projecting entities</title>
|
||||
<para>
|
||||
As the underlying data model of a graph database doesn't imply and enforce strict type constraints like a
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<section id="reference:programming_model:relationships">
|
||||
<section id="reference_programming_model_relationships">
|
||||
<title>Relating node entities</title>
|
||||
<para>
|
||||
Since relationships are first-class citizens in Neo4j, associations between node entities are represented
|
||||
@@ -14,7 +14,7 @@
|
||||
As of Neo4j 1.4.M03, circular references are allowed. Spring Data Neo4j reflects this accordingly.
|
||||
</para>
|
||||
</note>
|
||||
<section id="reference:programming_model:relationships:relatedto">
|
||||
<section id="reference_programming_model_relationships_relatedto">
|
||||
<title>@RelatedTo: Connecting node entities</title>
|
||||
<para>
|
||||
Every field of a node entity that references one or more other node entities is backed by relationships
|
||||
@@ -126,7 +126,7 @@ public class Actor {
|
||||
via relationships, but it provides no way of accessing the relationships themselves.
|
||||
</para>
|
||||
<para>
|
||||
Relationship entities can be accessed via by @RelatedToVia-annotated (<xref linkend="reference:programming_model:relationships:relatedtovia"/>)
|
||||
Relationship entities can be accessed via by @RelatedToVia-annotated (<xref linkend="reference_programming_model:relationships:relatedtovia"/>)
|
||||
fields or methods like <code>entity.getRelationshipTo()</code>
|
||||
or <code>template|repository.getRelationship(s)Between()</code>.
|
||||
</para>
|
||||
@@ -134,7 +134,7 @@ public class Actor {
|
||||
Relationship entities either be instantiated directly and set or added to
|
||||
<code>@RelatedToVia</code>-annotated fields or created by the introduced
|
||||
<code>entity.relateTo(), template|repository.createRelationshipBetween()</code> methods
|
||||
(see alos <xref linkend="reference:programming-model:introduced-methods"/>)
|
||||
(see alos <xref linkend="reference_programming-model_introduced-methods"/>)
|
||||
</para>
|
||||
<para>
|
||||
Fields in relationship entities are, similarly to node entities, persisted as properties on
|
||||
@@ -169,7 +169,7 @@ public class Role {
|
||||
|
||||
</example>
|
||||
</section>
|
||||
<section id="reference:programming_model:relationships:relatedtovia">
|
||||
<section id="reference_programming_model_relationships_relatedtovia">
|
||||
<title>@RelatedToVia: Accessing relationship entities</title>
|
||||
<para>
|
||||
To provide easy programmatic access to the richer relationship entities of the data model,
|
||||
@@ -210,7 +210,7 @@ public class Friendship {
|
||||
|
||||
</example>
|
||||
</section>
|
||||
<section id="reference:programming_model:relationships:relationshiptypeprecedence">
|
||||
<section id="reference_programming_model_relationships_relationshiptypeprecedence">
|
||||
<title>Relationship Type Precedence</title>
|
||||
<para>In the example above we show how to specify a default relationship type, and how to provide the relationship
|
||||
type using an annotation property. Here is an example of using the @RelationshipType annotation on a member
|
||||
@@ -245,7 +245,7 @@ new Acquaintance(frankSinatra, carloGambino, "its_complicated")
|
||||
<listitem>Default</listitem>
|
||||
</orderedlist>
|
||||
</section>
|
||||
<section id="reference:programming_model:relationships:relationshiptypediscrimination">
|
||||
<section id="reference_programming_model_relationships_relationshiptypediscrimination">
|
||||
<title>Discriminating Relationships Based On End Node Type</title>
|
||||
<para>In some cases, you want to model two different aspects of a conceptual relationship using the same relationship type. Here is a canonical example:</para>
|
||||
<example>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<section id="reference:programming-model:repositories" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<section id="reference_programming-model_repositories" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<title>CRUD with repositories</title>
|
||||
<para>
|
||||
The repositories provided by Spring Data Neo4j build on the composable repository infrastructure
|
||||
@@ -23,7 +23,7 @@
|
||||
<para>
|
||||
With the <code>RelationshipOperationsRepository</code> it is possible to access, create and delete
|
||||
relationships between entitites or nodes.
|
||||
The <code>SpatialRepository</code> allows geographic searches (<xref linkend="reference:spatial"/>)
|
||||
The <code>SpatialRepository</code> allows geographic searches (<xref linkend="reference_spatial"/>)
|
||||
</para>
|
||||
<para>
|
||||
<code>GraphRepository</code> is a convenience repository interface, combining <code>CRUDRepository</code>,
|
||||
@@ -36,7 +36,7 @@
|
||||
<title>CRUDRepository</title>
|
||||
<para>
|
||||
<code>CRUDRepository</code> delegates to the configured <code>TypeRepresentationStrategy</code>
|
||||
(see <xref linkend="reference:programming-model:typerepresentationstrategy"/>)
|
||||
(see <xref linkend="reference_programming-model_typerepresentationstrategy"/>)
|
||||
for type based queries.
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
@@ -118,7 +118,7 @@
|
||||
|
||||
<section>
|
||||
<title>Query and Finder Methods</title>
|
||||
<section id="reference:programming-model:annotatedQueries">
|
||||
<section id="reference_programming-model_annotatedQueries">
|
||||
<title>Annotated queries</title>
|
||||
<para>
|
||||
Queries using the Cypher graph query language can be supplied with the <code>@Query</code> annotation.
|
||||
@@ -187,7 +187,7 @@
|
||||
</para>
|
||||
<example>
|
||||
<title>Examples of Cypher queries placed on repository methods with @Query where values are replaced with method parameters, as described
|
||||
in the <xref linkend="reference:programming-model:annotatedQueries" />) section.</title>
|
||||
in the <xref linkend="reference_programming-model_annotatedQueries" />) section.</title>
|
||||
<programlisting language="java"><![CDATA[
|
||||
public interface MovieRepository extends GraphRepository<Movie> {
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<section id="reference:simple-mapping">
|
||||
<section id="reference_simple-mapping">
|
||||
<title>Simple Object Graph Mapping</title>
|
||||
<para>
|
||||
In addition to the advanced object graph mapping using AspectJ, Spring Data Neo4j also supports a simpler mode
|
||||
that converts graph data into domain objects and vice versa. It does not require any additional set up and should
|
||||
work out of the box. The simple mapping approach uses the same annotations (<xref linked="reference:programming-model:annotations"/>)
|
||||
work out of the box. The simple mapping approach uses the same annotations (<xref linked="reference_programming-model_annotations"/>)
|
||||
as the advanced mapping to declare mapping meta-information.
|
||||
</para>
|
||||
<para>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<section id="reference:spatial">
|
||||
<section id="reference_spatial">
|
||||
<title>Geospatial Queries</title>
|
||||
<para>
|
||||
<code>SpatialRepository</code> is a dedicated Repository for spatial queries.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<section id="reference:template" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<section id="reference_template" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<title>Neo4jTemplate</title>
|
||||
<!-- todo make sure that all template methods are covered in this chapter -->
|
||||
@@ -8,7 +8,7 @@
|
||||
The <code>Neo4jTemplate</code> offers the convenient API of Spring templates for the Neo4j graph
|
||||
database. The Spring Data Neo4j Object Graph mapping builds upon the core functionality of the
|
||||
template to persist objects to the graph and load them in a variety of ways.
|
||||
The template handles the active mapping mode (<xref linkend="reference:mapping"/>) transparently.
|
||||
The template handles the active mapping mode (<xref linkend="reference_mapping"/>) transparently.
|
||||
</para>
|
||||
<para>
|
||||
Besides methods for creating, storing and deleting entities, nodes and relationships in the graph, <code>Neo4jTemplate</code>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<section id="reference:programming-model:transactions">
|
||||
<section id="reference_programming-model_transactions">
|
||||
<title>Transactions</title>
|
||||
<para>
|
||||
Neo4j is a transactional database, only allowing modifications to be performed within transaction
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<section id="reference:programming-model:typerepresentationstrategy">
|
||||
<section id="reference_programming-model_typerepresentationstrategy">
|
||||
<title>Entity type representation</title>
|
||||
<para>
|
||||
There are several ways to represent the Java type hierarchy of the data model in the graph. In general, for all
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<chapter id="reference:samples">
|
||||
<chapter id="reference_samples">
|
||||
<title>Sample code</title>
|
||||
|
||||
<section id="samples:introduction">
|
||||
<section id="samples_introduction">
|
||||
<title>Introduction</title>
|
||||
<para>
|
||||
Spring Data Neo4j comes with a number of sample applications. The source code of the samples can be found on
|
||||
@@ -13,7 +13,7 @@
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="samples:hello-worlds">
|
||||
<section id="samples_hello-worlds">
|
||||
<title>Hello Worlds sample application</title>
|
||||
<para>
|
||||
The Hello Worlds sample application is a simple console application. It creates some worlds
|
||||
@@ -38,7 +38,7 @@
|
||||
</mediaobject>
|
||||
</section>
|
||||
|
||||
<section id="samples:imdb">
|
||||
<section id="samples_imdb">
|
||||
<title>IMDB sample application</title>
|
||||
<para>
|
||||
The IMDB sample is a web application that imports datasets from the Internet Movie Database (IMDB)
|
||||
@@ -65,7 +65,7 @@
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="samples:myrestaurants-original">
|
||||
<section id="samples_myrestaurants-original">
|
||||
<title>MyRestaurants sample application</title>
|
||||
<para>
|
||||
Simple, JPA-based web application for managing users and restaurants, with the ability to add
|
||||
@@ -80,7 +80,7 @@
|
||||
</mediaobject>
|
||||
</section>
|
||||
|
||||
<section id="samples:myrestaurants-social">
|
||||
<section id="samples_myrestaurants-social">
|
||||
<title>MyRestaurant-Social sample application</title>
|
||||
<para>
|
||||
This application extends the MyRestaurants sample application, adding social networking
|
||||
@@ -102,7 +102,7 @@
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
</section>
|
||||
<section id="samples:cineasts">
|
||||
<section id="samples_cineasts">
|
||||
<title>Cineasts social movie database</title>
|
||||
<para>
|
||||
The cineasts.net application was introduced extensively in the first part of this guide, the
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
classes clean. Spring Data Neo4j promised to do the heavy lifting for us, so we continued investigating it.
|
||||
</para>
|
||||
<para>
|
||||
One of the more advanced mapping modes of Spring Data Neo4j depends heavily on AspectJ, see <xref linkend="reference:aspectj-details" />.
|
||||
One of the more advanced mapping modes of Spring Data Neo4j depends heavily on AspectJ, see <xref linkend="reference_aspectj-details" />.
|
||||
Via the SpringFramework we were already used to Aspects doing the work behind the scenes in lots of places, so
|
||||
we were not afraid.
|
||||
Some parts of our classes would get a bit of new behavior, but it would not be visible in our code.
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</para>
|
||||
<para>
|
||||
Spring Data Neo4j comes with two mapping modes. The more powerful one depends heavily on AspectJ,
|
||||
see <xref linkend="reference:aspectj-details" />, so we ignored it for the time being. The simple direct
|
||||
see <xref linkend="reference_aspectj-details" />, so we ignored it for the time being. The simple direct
|
||||
POJO-mapping copies the data out of the graph and into our entities. Good enough for a web-application like
|
||||
ours.
|
||||
</para>
|
||||
|
||||
Reference in New Issue
Block a user