removed the 2 generated documentation snippets

This commit is contained in:
Michael Hunger
2013-02-11 15:30:16 +01:00
parent 8bda62389e
commit e8c2992f60
2 changed files with 94 additions and 2 deletions

View File

@@ -263,7 +263,55 @@ Iterable<Person> findByParentAgeAndMarried(int age, boolean married)
</example>
</para>
</section>
<xi:include href="../../snippets/SnippetRepositoryDerivedFinder.xml"/>
<section>
<title>Derived Finder Methods</title>
<para>
Use the meta information of your domain model classes to declare repository finders that navigate along relationships and compare properties. The path defined with the method name is used to create a Cypher query that is executed on the graph.
</para>
<example>
<title>Repository and usage of derived finder methods</title>
<programlisting language="java"><![CDATA[ @NodeEntity
public static class Person {
@GraphId Long id;
private String name;
private Group group;
private Person(){}
public Person(String name) {
this.name = name;
}
}
@NodeEntity
public static class Group {
@GraphId Long id;
private String title;
// incoming relationship for the person -> group
@RelatedTo(type = "group", direction = Direction.INCOMING)
private Set<Person> members=new HashSet<Person>();
private Group(){}
public Group(String title, Person...people) {
this.title = title;
members.addAll(asList(people));
}
}
public interface PersonRepository extends GraphRepository<Person> {
Iterable<Person> findByGroupTitle(String name);
}
@Autowired PersonRepository personRepository;
Person oliver=personRepository.save(new Person("Oliver"));
final Group springData = new Group("spring-data",oliver);
groupRepository.save(springData);
final Iterable<Person> members = personRepository.findByGroupTitle("spring-data");
assertThat(members.iterator().next().name, is(oliver.name));
]]></programlisting>
</example>
</section>
</section>
<section>

View File

@@ -16,7 +16,51 @@
DSL was added.
</para>
<xi:include href="../../snippets/SnippetNeo4jTemplateMethods.xml"/>
<section>
<title>Basic operations</title>
<para>
For direct retrieval of nodes and relationships, the <code>getReferenceNode()</code>,
<code>getNode()</code> and <code>getRelationship()</code> methods can be used.
</para>
<para>
There are methods (<code>createNode()</code> and <code>createRelationship()</code>) for creating nodes and
relationships that automatically set provided properties.
</para>
<example>
<title>Neo4j template</title>
<programlisting language="java"><![CDATA[Neo4jOperations neo = new Neo4jTemplate(graphDatabase);
Node mark = neo.createNode(map("name", "Mark"));
Node thomas = neo.createNode(map("name", "Thomas"));
neo.createRelationshipBetween(mark, thomas, "WORKS_WITH",
map("project", "spring-data"));
neo.index("devs", thomas, "name", "Thomas");
assertEquals( "Mark",
neo.query("start p=node({person}) match p<-[:WORKS_WITH]-other return other.name",
map("person", asList(thomas.getId()))).to(String.class).single());
// Gremlin
assertEquals(thomas, neo.execute("g.v(person).out('WORKS_WITH')",
map("person", mark.getId())).to(Node.class).single());
// Index lookup
assertEquals(thomas, neo.lookup("devs", "name", "Thomas").to(Node.class).single());
// Index lookup with Result Converter
assertEquals("Thomas", neo.lookup("devs", "name", "Thomas")
.to(String.class, new ResultConverter<PropertyContainer, String>() {
public String convert(PropertyContainer element, Class<String> type) {
return (String) element.getProperty("name");
}
}).single());
]]></programlisting>
</example>
</section>
<section>
<title>Core-Operations</title>
<para>