updated reference docs
This commit is contained in:
@@ -14,12 +14,12 @@
|
||||
</para>
|
||||
<para>
|
||||
The AspectJ pointcut language can be intimidating, but a developer using Spring Data Neo4j will not have
|
||||
to deal with that. Users don't have care about to hooking into a framework mechanism, or having to extend
|
||||
to deal with that. Users don't have care about hooking into a framework mechanism, or having to extend
|
||||
a framework superclass.
|
||||
</para>
|
||||
<para>
|
||||
AspectJ uses a declarative approach, defining concrete advice, which is just pieces of code that contain
|
||||
the implementation of the concern. AspectJ advice can for instance be applied before, after, or instead
|
||||
AspectJ uses a declarative approach, defining concrete "advice", which is just pieces of code that contain
|
||||
the implementation of the "concern", as it is called. AspectJ advice can for instance be applied before, after, or instead
|
||||
of a method or constructor call. It can also be applied on variable and field access. This is declared
|
||||
using AspectJ's expressive pointcut language, able to express any place within a code structure or flow.
|
||||
AspectJ is also able to introduce new methods, fields, annotations, interfaces, and superclasses to
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
The Neo4j Server has two built-in extension mechanisms. It is possible to extend existing URI endpoints
|
||||
like the graph database, nodes, or relationships, adding new URIs or methods to those. This is achieved
|
||||
by writing a <ulink url="http://docs.neo4j.org/chunked/milestone/server-plugins.html">server plugin</ulink>.
|
||||
This plugin type has some restrictions though.
|
||||
This plugin type has some restrictions however.
|
||||
</para>
|
||||
<para>
|
||||
For complete freedom in the implementation, an
|
||||
@@ -55,7 +55,7 @@
|
||||
]]></programlisting>
|
||||
</example>
|
||||
|
||||
Now, your resources can require the spring-beans they need, annotated with <code>@Context</code> like this:
|
||||
Now, your resources can require the Spring beans they need, annotated with <code>@Context</code> like this:
|
||||
<example>
|
||||
<title>Jersey resource</title>
|
||||
<programlisting language="java"><![CDATA[@Path( "/path" )
|
||||
@@ -88,7 +88,7 @@ public void foo( @Context WorldRepository repo ) {
|
||||
</note>
|
||||
<para>
|
||||
Please also keep in mind that performing graph operations via the REST-API is about one order of
|
||||
magnitude slower than location operations. Try to use the Neo4j Cypher query language,
|
||||
magnitude slower than local operations. Try to use the Neo4j Cypher query language,
|
||||
server-side traversals (<code>RestTraversal</code>) or Gremlin expressions whenever possible for retrieving large sets of data.
|
||||
Future versions of Spring Data Neo4j will use the more performant batching as well as a binary protocol.
|
||||
</para>
|
||||
@@ -119,7 +119,7 @@ public void foo( @Context WorldRepository repo ) {
|
||||
</para>
|
||||
<para>
|
||||
The remote REST implementation works for both the Neo4jTemplate as well as the GraphEntities. For traversals
|
||||
and cypher-graph-queries it is sensible to forward those to the remote and execute them there instead of
|
||||
and Cypher graph queries it is sensible to forward those to the remote endpoint and execute them there instead of
|
||||
walking the graph over the wire. RestGraphDatabase already supports that by providing methods that forward
|
||||
to the remote instance. (e.g. <code>queryEngineFor(), index() and createTraversalDescription()</code>).
|
||||
Please use those methods when interacting with a remote server for optimal performance.
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<para>
|
||||
<ulink url="http://neo4j.org/">Neo4j</ulink> is a NOSQL graph database. It is a fully transactional database
|
||||
(ACID) that stores data structured as graphs. A graph consists of nodes, connected by relationships.
|
||||
Inspired by the structure of the human brain, it allows for high query performance on complex data,
|
||||
Inspired by the structure of the human mind, it allows for high query performance on complex data,
|
||||
while remaining intuitive and simple for the developer.
|
||||
</para>
|
||||
<para>
|
||||
@@ -159,13 +159,13 @@ for (Node foundNode : nodeIndex.get("property","value")) {
|
||||
Neo4j provides a graph query language called
|
||||
<ulink url="http://docs.neo4j.org/chunked/milestone/cypher-query-lang.html">"Cypher"</ulink> which draws from many
|
||||
sources. It resembles SQL but with an iconic representation of patterns in the graph (concepts drawn from SPARQL).
|
||||
Cypher was written in Scala to leverage the high expressiveness for lazy sequence operations of the language and the
|
||||
The Cypher execution engine was written in Scala to leverage the high expressiveness for lazy sequence operations of the language and the
|
||||
parser combinator library.
|
||||
</para>
|
||||
<para>
|
||||
Cypher queries always begin with a <code>start</code> set of nodes. Those can be either expressed by their
|
||||
id's or by a index lookup expression. Those start-nodes are then related to other nodes in the
|
||||
<code>match</code> clause. Start and match clause can introduce new identifiers for nodes and
|
||||
<code>match</code> clause. Start and match clauses can introduce new identifiers for nodes and
|
||||
relationships. In the <code>where</code> clause additional filtering of the result set is applied by evaluating
|
||||
expressions. The <code>return</code> clause defines which part of the query result will be available.
|
||||
Aggregation also happens in the return clause by using aggregation functions on some of the values.
|
||||
@@ -173,7 +173,7 @@ for (Node foundNode : nodeIndex.get("property","value")) {
|
||||
restrict the result set to a certain window.
|
||||
</para>
|
||||
<para>
|
||||
Cypher can be executed on an embedded graph db using <code>ExecutionEngine</code> and
|
||||
Cypher can be executed on an embedded graph db using an <code>ExecutionEngine</code> and
|
||||
<code>CypherParser</code>. This is encapsulated in Spring Data Neo4j with
|
||||
<code>CypherQueryEngine</code>. The Neo4j-REST-Server comes with a Cypher-Plugin that is accessible remotely and is
|
||||
available in the Spring Data Neo4j REST-Binding.
|
||||
@@ -211,11 +211,11 @@ start user=node:User(login='micha') match user-[:FRIEND]-()-[r,:RATED]->movie
|
||||
<title>Gremlin a Graph Traversal DSL</title>
|
||||
<para>
|
||||
Gremlin is an expressive Groovy DSL developed by <ulink url="http://markorodriguez.com">Marko Rodriguez</ulink>
|
||||
as part of the <ulink url="http://tinkerpop.com">tinkerpop</ulink> stack. It builds on top of a pipe implementation
|
||||
as part of the <ulink url="http://tinkerpop.com">Tinkerpop</ulink> stack. It builds on top of a pipe implementation
|
||||
(Blueprints Pipes) that uses connected operations to traverse a graph. Gremlin has a concise syntax but is
|
||||
turing complete.
|
||||
Turing complete.
|
||||
</para>
|
||||
<para>Gremlin can be executed by including the tinkerpop and blueprints dependencies and then requesting a <code>ScriptEngine</code>
|
||||
<para>Gremlin can be executed by including the Tinkerpop and Blueprints dependencies and then requesting a <code>ScriptEngine</code>
|
||||
of type "gremlin" from the <code>javax.Script*</code> facilities. In Spring Data Neo4j this is encapsulated in
|
||||
<code>GremlinQueryEngine</code>. The Neo4j-REST-Server also comes with a Gremlin-Plugin that is accessible remotely and is
|
||||
available in the Spring Data Neo4j REST-Binding.
|
||||
|
||||
@@ -73,9 +73,9 @@
|
||||
|
||||
<para>
|
||||
Spring Data Commons provides a very powerful repository infrastructure that is also leveraged in Spring Data Neo4j.
|
||||
Those repositories consist only of a composition of interfaces that declare the available functionality in the
|
||||
each repository. The implementation-details of commonly used persistence methods are handled by the library.
|
||||
At least for typical CRUD, Index- and Query-operatoins that is very convenient.
|
||||
Those repositories consist only of a composition of interfaces that declare the available functionality in
|
||||
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"/>).
|
||||
</para>
|
||||
@@ -86,25 +86,25 @@
|
||||
</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 set of those operations
|
||||
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"/>.
|
||||
</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" />Neo4j-API. Then you can start using virtual, computed fields
|
||||
to your entities <xref linkend="reference:programming-model:projection"/> .
|
||||
Those are explained in the <xref linkend="neo4j" />Neo4j-API. Then you can start using virtual, computed fields
|
||||
in your entities <xref linkend="reference:programming-model:projection"/> .
|
||||
</para>
|
||||
<para>
|
||||
If you like the Active-Record approach that uses persistence methods mixed into the domain classes, you would
|
||||
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
|
||||
domain objects by Spring Data Neo4j Aspects. <!-- TODO Mixins--> Those allow you to manage the entity lifecycles as
|
||||
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 an fully ACID, enterprise grade database, it uses Java transactions (and internally even a 2 phase commit protocol) to guarantee the
|
||||
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"/>)
|
||||
</para>
|
||||
<para>
|
||||
@@ -116,14 +116,14 @@
|
||||
(<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 explicitely
|
||||
For the simple mapping this is not neccessary as domain objects are detached by default and have to be explicitly
|
||||
reattached to the graph to store the changes.
|
||||
</para>
|
||||
<para>
|
||||
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.
|
||||
(<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
|
||||
@@ -131,24 +131,24 @@
|
||||
(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
|
||||
and dependencies for AspectJ, which can be alleviated by using different build systems like gradle or ant/ivy. The Spring configuration
|
||||
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
|
||||
and dependencies for AspectJ, which can be alleviated by using different build systems like Gradle or Ant/Ivy. The Spring configuration
|
||||
itself boils down to two lines of <code><spring-neo4j></code> namespace setup. (see <xref linkend="setup"/>)
|
||||
</para>
|
||||
<para>
|
||||
In a poliglot 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
|
||||
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"/>.
|
||||
</para>
|
||||
<para>
|
||||
The performance implications of using Spring Data Neo4j are detailed in <xref linkend="reference:performance"/>.
|
||||
This chapter also discusses which usecases should not be handled with Spring Data Neo4j.
|
||||
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,
|
||||
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"/>.
|
||||
</para>
|
||||
<para>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<para>
|
||||
To use the advanced, AspectJ based mapping, please add <code>spring-data-neo4j-aspects</code> as a dependency
|
||||
and set up the AspectJ integration in Maven or other build tools as explained in <xref linkend="setup"/>.
|
||||
Some hints your IDE setup are described below.
|
||||
Some hints for your IDE setup are described below.
|
||||
</para>
|
||||
<section>
|
||||
<title>AspectJ IDE support</title>
|
||||
@@ -41,7 +41,7 @@
|
||||
</para>
|
||||
<para>
|
||||
IDE's not providing the full AJ support might mark parts of your code as errors.
|
||||
You should rely on your build-system and test to verify the correctness of the code. You might also have
|
||||
You should rely on your build-system and tests to verify the correctness of the code. You might also have
|
||||
your Entities (or their interfaces) implement the <code>NodeBacked</code> and <code>RelationshipBacked</code>
|
||||
interfaces directly to benefit from completion support and error checking.
|
||||
</para>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<section id="reference:programming-model:lifecycle">
|
||||
<title>Detached node entities</title>
|
||||
<para>
|
||||
Node entities can be in two different persistence state: attached or detached. By default, newly created node
|
||||
Node entities can be in two different persistence states: attached or detached. By default, newly created node
|
||||
entities are in the detached state. When <code>persist()</code> is called on the entity, it becomes
|
||||
attached to the graph, and its properties and relationships are stores in the database. If
|
||||
<code>persist()</code> is not called within a transaction, it automatically creates an implicit
|
||||
@@ -87,10 +87,10 @@ movie.setTopActor(actor);
|
||||
POJO as the underlying backing node handles the read-through transparently. If multiple
|
||||
object instances that point to the same node are persisted, the ordering is not important
|
||||
as long as they contain distinct changes. For concurrent changes a concurrent modification
|
||||
exception is thrown (subject to be parametrizable in the future).
|
||||
exception is thrown (subject to be parameterized in the future).
|
||||
</para>
|
||||
<para>
|
||||
If the relationships form a cycle, then the entities will first all be assigned a node in
|
||||
If the relationships form a cycle, then the entities will first of all be assigned a node in
|
||||
the database, and then the relationships will be created. The cascading of <code>persist()</code>
|
||||
is however only cascaded to related entity fields that have been modified.
|
||||
</para>
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
<section id="reference:mapping">
|
||||
<title>Object Graph Mapping</title>
|
||||
<para>
|
||||
Up until recently Spring Data Neo4j supported the only more advanced and flexible AspectJ based mapping approach, see <xref linkend="reference:aspectj" />.
|
||||
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 supported us in adding 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 different behaviour.
|
||||
Both versions work with the same annotations and provide similar API's, but different behaviour.
|
||||
</para>
|
||||
<para>
|
||||
Reflection and Annotation-based metadata is collected about persistent entities in the <code>Neo4jMappingContext</code>
|
||||
|
||||
@@ -48,10 +48,6 @@ public class Movie {
|
||||
custom conversion factory that comes with converters for <code>Enum</code>s and <code>Date</code>s.
|
||||
Transient fields are not persisted.
|
||||
</para>
|
||||
<para>
|
||||
Currently there is no support for handling arbitrary collections of primitive or convertable values.
|
||||
Support for this will be added by the 1.1. release.
|
||||
</para>
|
||||
<para>
|
||||
This annotation is typically used with cross-store persistence. When a node entity is configured
|
||||
as partial, then all fields that should be persisted to the graph must be explicitly annotated
|
||||
@@ -78,8 +74,8 @@ public class Movie {
|
||||
Spring Data Neo4j aspects. It provides dynamic fields which, when accessed, return the values
|
||||
selected by the provided query language expression. The provided query must contain a placeholder named <code>{self}</code>
|
||||
for the id of the current entity. For instance <code>start n=({self}) match n-[:FRIEND]->friend return friend</code>.
|
||||
Graph queries can return variable number of entities. That's why annotation can be put onto fields
|
||||
with a single value, an Iterable of a concrete type or an Iterable of <code>Map<String,Object></code>.
|
||||
Graph queries can return variable number of entities. That's why annotations can be put onto fields
|
||||
with a single value, an Iterable of a concrete type or an Iterable of type <code>Map<String,Object></code>.
|
||||
Additional parameters are taken from the params attribute of the <code>@Query</code> annotation.
|
||||
The tuples form key-value pairs that are provided to the query at execution time.
|
||||
</para>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
doesn't support mixins one would put the sum of all of those into the entity class and thereby making it
|
||||
very big, brittle and hard to understand. Being able to take a basic order and project it to a different
|
||||
(not related in the inheritance hierarchy or even an interface) order type that is valid in the current
|
||||
context and only offers the attributes and methods needed here would be very benefitial.
|
||||
context and only offers the attributes and methods needed here would be very beneficial.
|
||||
</para>
|
||||
<para>Spring Data Neo4j offers initial support for projecting node and relationship entities to different target
|
||||
types. All instances of this projected entity share the same backing node or relationship, so data changes are
|
||||
@@ -33,7 +33,7 @@ class Trainee {
|
||||
Set<Training> trainings;
|
||||
}
|
||||
|
||||
for (Person person : graphRepository.findAllByProperyValue("occupation","developer")) {
|
||||
for (Person person : graphRepository.findAllByPropertyValue("occupation","developer")) {
|
||||
Developer developer = person.projectTo(Developer.class);
|
||||
if (developer.isJavaDeveloper()) {
|
||||
trainInSpringData(developer.projectTo(Trainee.class));
|
||||
|
||||
@@ -71,9 +71,9 @@ public class Actor {
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
When you use an Interface as target type for the <code>Set</code> and/or as <code>elementClass</code>
|
||||
When you use an interface as target type for the <code>Set</code> and/or as <code>elementClass</code>
|
||||
please make sure that it implements <code>NodeBacked</code> either by extending that Super-Interface manually
|
||||
or by annotating the Interface with <code>@NodeEntity</code> too.
|
||||
or by annotating the interface with <code>@NodeEntity</code> too.
|
||||
</para>
|
||||
<para>
|
||||
By setting direction to <code>BOTH</code>, relationships are created in the outgoing direction, but when the
|
||||
|
||||
@@ -128,13 +128,13 @@
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Cypher-Queries</title>
|
||||
<title>Cypher queries</title>
|
||||
<section>
|
||||
<title>Annotated Queries</title>
|
||||
<title>Annotated queries</title>
|
||||
<para>
|
||||
Queries for the cypher graph-query language can be supplied with the <code>@Query</code> annotation.
|
||||
Queries using the Cypher graph query language can be supplied with the <code>@Query</code> annotation.
|
||||
That means every method annotated with <code>@Query("start n=(%node) match (n)-->(m) return m")</code>
|
||||
will use the query string. The named parameter <code>%node</code> will be replaced by the actual method parameters.
|
||||
will use the supplied query string. The named parameter <code>%node</code> will be replaced by the actual method parameters.
|
||||
Node and Relationship-Entities are resolved to their respective id's and all other parameters are
|
||||
replaced directly (i.e. Strings, Longs, etc). There is special support for the <code>Sort</code> and <code>Pageable</code>
|
||||
parameters from Spring Data Commons, which are supported to add programmatic paging and sorting (alternatively
|
||||
@@ -146,7 +146,7 @@
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Named Queries</title>
|
||||
<title>Named queries</title>
|
||||
<para>Spring Data Neo4j also supports the notion of named queries which are externalized in property-config-files
|
||||
(<code>META-INF/neo4j-named-queries.properties</code>). Those files have the format:
|
||||
<code>Entity.finderName=query</code> (e.g. <code>Person.findBoss=start p=({p_person}) match (p)<-[:BOSS]-(boss) return boss</code>).
|
||||
@@ -162,28 +162,28 @@
|
||||
</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Cypher Examples</title>
|
||||
<title>Cypher examples</title>
|
||||
<para>There is a <ulink url="http://neo4j.vidcaster.com/U2Y/introduction-to-cypher">screencast</ulink> available showing many features of the query language.
|
||||
The following examples are taken from the cineasts dataset of the tutorial section.
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><code>start n=(0) return n</code></term>
|
||||
<term><code>start n=node(0) return n</code></term>
|
||||
<listitem><para>returns the node with id 0</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><code>start movie=(Movie,title,'Matrix') return movie</code></term>
|
||||
<listitem><para>returns the nodes which are indexed as 'Matrix'</para></listitem>
|
||||
<term><code>start movie=node:Movie(title='Matrix') return movie</code></term>
|
||||
<listitem><para>returns the nodes which are indexed with title equal to 'Matrix'</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><code>start movie=(Movie,title,'Matrix') match (movie)<-[:ACTS_IN]-(actor) return actor.name</code></term>
|
||||
<listitem><para>returns the names of the actors that have a ACTS_IN relationship to the movie node for matrix</para></listitem>
|
||||
<term><code>start movie=node:Movie(title='Matrix') match (movie)<-[:ACTS_IN]-(actor) return actor.name</code></term>
|
||||
<listitem><para>returns the names of the actors that have a ACTS_IN relationship to the movie node for 'Matrix'</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><code>start movie=(Movie,title,'Matrix') match (movie)<-[r,:RATED]-(user) where r.stars > 3 return user.name, r.stars, r.comment</code></term>
|
||||
<listitem><para>returns users names and their ratings (>3) of the movie matrix</para></listitem>
|
||||
<term><code>start movie=node:Movie(title='Matrix') match (movie)<-[r:RATED]-(user) where r.stars > 3 return user.name, r.stars, r.comment</code></term>
|
||||
<listitem><para>returns users names and their ratings (>3) of the movie titled 'Matrix'</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><code>start user=(User,login,'micha') match (user)-[:FRIEND]-(friend)-[r,:RATED]->(movie) return movie.title, AVG(r.stars), count(*) order by AVG(r.stars) desc, count(*) desc</code></term>
|
||||
<term><code>start user=node:User(login='micha') match (user)-[:FRIEND]-(friend)-[r:RATED]->(movie) return movie.title, AVG(r.stars), COUNT(*) order by AVG(r.stars) desc, COUNT(*) desc</code></term>
|
||||
<listitem><para>returns the movies rate by the friends of the user 'micha', aggregated by movie.title, with averaged ratings and rating-counts sorted by both</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
@@ -268,7 +268,7 @@ Person michael = personRepository.save(new Person("Michael",36));
|
||||
|
||||
Person dave=personRepository.findOne(123);
|
||||
|
||||
Iterable<Person> devs = personRepository.findAllByProperyValue("occupation","developer");
|
||||
Iterable<Person> devs = personRepository.findAllByPropertyValue("occupation","developer");
|
||||
|
||||
Iterable<Person> aTeam = graphRepository.findAllByQuery( "name","A*");
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
</para>
|
||||
<para>
|
||||
The simple object graph mapping comes into play whenever an entity is constructed from a node or relationship.
|
||||
That could be explicitely like during the lookup or create operations of the repositories and the
|
||||
<code>Neo4jTemplate</code> but also implicitely while executing
|
||||
This could be done explicitly like during the lookup or create operations of the repositories and the
|
||||
<code>Neo4jTemplate</code> but also implicitly while executing
|
||||
any graph operation that returns nodes or relationships and expecting mapped entities to be returned.
|
||||
</para>
|
||||
<para>
|
||||
@@ -23,7 +23,7 @@
|
||||
We try to avoid loading the whole graph into memory by not following relationships eagerly. A dedicated
|
||||
<code>@Fetch</code> annotation controls instead if related entities are loaded or not.
|
||||
Whenever an entity is not fully loaded, then only its id is stored. Those
|
||||
entities or collections of entities can then later be loaded explictely using the <code>template.fetch()</code> operation.
|
||||
entities or collections of entities can then later be loaded explicitly using the <code>template.fetch()</code> operation.
|
||||
</para>
|
||||
<para>
|
||||
The additional fetch information is stored in a <code>MappingPolicy</code> which can be retrieved via the <code>Neo4jTemplate</code>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<para>
|
||||
<code>SpatialRepository</code> is a dedicated Repository for spatial queries.
|
||||
Spring Data Neo4j provides an optional dependency to <code>neo4j-spatial</code> which is an advanced library
|
||||
for gis operations. So if you include the maven dependency in your <code>pom.xml</code>, Neo4j-Spatial and
|
||||
for GIS operations. So if you include the maven dependency in your <code>pom.xml</code>, Neo4j-Spatial and
|
||||
the required <code>SPATIAL</code> index provider is available.
|
||||
</para>
|
||||
<para>
|
||||
@@ -21,7 +21,7 @@
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
For having your entities available for spatial index queries, please include a String property containing
|
||||
To have your entities available for spatial index queries, please include a String property containing
|
||||
a "well known text", location string.
|
||||
WKT is the <ulink url="http://en.wikipedia.org/wiki/Well-known_text">Well Known Text Spatial Format</ulink>
|
||||
eg. <code>POINT( LON LAT ) or POLYGON (( LON1 LAT1 LON2 LAT2 LON3 LAT3 LON1 LAT1 ))</code>
|
||||
|
||||
@@ -12,14 +12,14 @@
|
||||
<!--<ulink url="http://spring.neo4j.org/examples">Spring Data Neo4j examples</ulink>.-->
|
||||
</para>
|
||||
<para>
|
||||
Spring Data Neo4j projects can be built using maven, we also added means to build them with gradle and ant/ivy.
|
||||
Spring Data Neo4j projects can be built using Maven. There are also means to build them with Gradle or Ant/Ivy.
|
||||
</para>
|
||||
|
||||
<section>
|
||||
<title>Dependencies for Spring Data Neo4j POJO Mapping</title>
|
||||
<para>
|
||||
For the POJO mapping it is enough to add the <code>org.springframework.data:spring-data-neo4j:2.0.0.RC1</code> dependency
|
||||
to your project. If you want to use the cypher query language please add <code>org.neo4j:neo4j-cypher:1.5</code>
|
||||
to your project. If you want to use the Cypher query language please add <code>org.neo4j:neo4j-cypher:1.5</code>
|
||||
</para>
|
||||
<example>
|
||||
<title>Maven dependencies for Spring Data Neo4j</title>
|
||||
@@ -36,8 +36,8 @@
|
||||
<section>
|
||||
<title>Gradle configuration for AspectJ Mapping</title>
|
||||
<para>
|
||||
The necessary build plugin to build Spring Data Neo4j projects with gradle is available as part of the
|
||||
Spring Data Neo4j distribution or on github which makes the usage as easy as:
|
||||
The necessary build plugin to build Spring Data Neo4j projects with Gradle is available as part of the
|
||||
Spring Data Neo4j distribution or on Github which makes the usage as easy as:
|
||||
</para>
|
||||
<example>
|
||||
<title>Gradle Build Configuration</title>
|
||||
@@ -62,7 +62,7 @@ repositories {
|
||||
}]]></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
The actual springdataneo4j.gradle is very simple just decorating the javac tasks with the iajc ant task.
|
||||
The actual springdataneo4j.gradle file is very simple, just decorating the javac tasks with the iajc ant task.
|
||||
</para>
|
||||
</section>
|
||||
<section>
|
||||
@@ -93,8 +93,8 @@ repositories {
|
||||
<section>
|
||||
<title>Maven configuration</title>
|
||||
<para>
|
||||
Spring Data Neo4j projects are easiest to build with Apache Maven. The core dependencies is Spring
|
||||
Data Neo4j which comes with transitive dependencies to Spring Data Commons, parts of the Spring Framework, and the Neo4j graph database.
|
||||
Spring Data Neo4j projects are easiest to build with Apache Maven. The core dependency is Spring
|
||||
Data Neo4j, which comes with transitive dependencies to Spring Data Commons, parts of the Spring Framework, and the Neo4j graph database.
|
||||
</para>
|
||||
|
||||
<section>
|
||||
|
||||
Reference in New Issue
Block a user