public interface Neo4jOperations
Modifier and Type | Method and Description |
---|---|
<T> Result<T> |
convert(Iterable<T> iterable)
Converts the Iterable into a Result object for uniform handling.
|
<T> T |
convert(Object value,
Class<T> type)
Converts a single object according to the configured ResultConverter of the Neo4j-Template.
|
<T> long |
count(Class<T> entityClass)
Provies the instance count a given entity type using the typerepresentation strategy configured for this template.
|
org.neo4j.graphdb.Node |
createNode() |
org.neo4j.graphdb.Node |
createNode(Map<String,Object> properties)
Creates a node
|
<T> T |
createNodeAs(Class<T> target,
Map<String,Object> properties)
Creates a node mapped by the given entity class
|
org.neo4j.graphdb.Relationship |
createRelationshipBetween(org.neo4j.graphdb.Node startNode,
org.neo4j.graphdb.Node endNode,
String type,
Map<String,Object> properties)
Creates a relationship with the given initial properties.
|
<R> R |
createRelationshipBetween(Object start,
Object end,
Class<R> relationshipEntityClass,
String relationshipType,
boolean allowDuplicates)
Creates a single relationship entity between two node entities with the given relationship type projected to the provided
relationship entity class.
|
void |
delete(Object entity)
Removes the given node or relationship entity or node or relationship from the graph, the entity is first removed
from all indexes and then deleted.
|
void |
deleteRelationshipBetween(Object start,
Object end,
String type)
Removes the relationship of this type between the two node entities
|
<T> T |
exec(GraphCallback<T> callback)
Executes the callback in a NON-transactional context.
|
Result<Object> |
execute(String statement,
Map<String,Object> params)
Executes the given Gremlin statement and returns the result packaged as Result as Neo4j types, not
Gremlin types.
|
<T> T |
fetch(T value)
fully loades the single entity or collection thereof which has been loaded lazily (i.e. just with the id but w/o values)
|
<T> EndResult<T> |
findAll(Class<T> entityClass)
Provides all instances of a given entity type using the typerepresentation strategy configured for this template.
|
<T> T |
findOne(long id,
Class<T> type)
Retrieves a node or relationship and returns it mapped to the appropriate type
|
ResultConverter |
getDefaultConverter() |
GraphDatabase |
getGraphDatabase() |
<T extends org.neo4j.graphdb.PropertyContainer> |
getIndex(Class<?> indexedType,
String propertyName)
The index determined by the property of the indexed type is returned, so all the customization
via @Indexed annotations is taken into consideration.
|
<T extends org.neo4j.graphdb.PropertyContainer> |
getIndex(String indexName,
Class<?> indexedType)
Retrieves an existing index for the given class and/or name
|
MappingPolicy |
getMappingPolicy(Class<?> targetType) |
org.neo4j.graphdb.Node |
getNode(long id)
Delegates to the GraphDatabase
|
org.neo4j.graphdb.Node |
getOrCreateNode(String index,
String key,
Object value,
Map<String,Object> properties)
creates the node uniquely or returns an existing node with the same index-key-value combination.
|
org.neo4j.graphdb.Relationship |
getOrCreateRelationship(String indexName,
String key,
Object value,
org.neo4j.graphdb.Node startNode,
org.neo4j.graphdb.Node endNode,
String type,
Map<String,Object> properties)
Creates the relationship uniquely, uses the given index,key,value to achieve that.
|
<S extends org.neo4j.graphdb.PropertyContainer> |
getPersistentState(Object entity)
Returns the node or relationship that backs the given entity.
|
org.neo4j.graphdb.Node |
getReferenceNode()
Returns the reference node.
|
org.neo4j.graphdb.Relationship |
getRelationship(long id)
Delegates to the GraphDatabase
|
<R> R |
getRelationshipBetween(Object start,
Object end,
Class<R> relationshipEntityClass,
String relationshipType)
Retrieves a single relationship entity between two node entities with the given relationship type projected to the provided
relationship entity class
|
org.neo4j.graphdb.Relationship |
getRelationshipBetween(Object start,
Object end,
String relationshipType)
Retrieves a single relationship entity between two node entities.
|
<R> Iterable<R> |
getRelationshipsBetween(Object start,
Object end,
Class<R> relationshipEntityClass,
String relationshipType)
Retrieves all relationship entities between two node entities with the given relationship type projected to the provided
relationship entity class
|
Class<?> |
getStoredJavaType(Object entity) |
<T extends org.neo4j.graphdb.PropertyContainer> |
index(String indexName,
T element,
String field,
Object value)
Indexes the given field and value for the element.
|
<S extends org.neo4j.graphdb.PropertyContainer,T> |
load(S state,
Class<T> type)
loades the provided node or relationship to be used as an entity of the given type
|
<T extends org.neo4j.graphdb.PropertyContainer> |
lookup(Class<?> indexedType,
String propertyName,
Object value)
The value or query-object is looked up in the index indicated by the property of the indexed type, so all the customization
via @Indexed annotations is taken into consideration.
|
<T extends org.neo4j.graphdb.PropertyContainer> |
lookup(String indexName,
Object query)
The query is executed on the index returning the IndexHits wrapped in a Result to be converted
into Paths or Entities.
|
<T extends org.neo4j.graphdb.PropertyContainer> |
lookup(String indexName,
String field,
Object value)
The value is looked up in the Neo4j index returning the IndexHits wrapped in a Result to be converted
into Paths or Entities.
|
<T> T |
projectTo(Object entity,
Class<T> targetType)
Projects a node or relationship entity to a different type.
|
Result<Map<String,Object>> |
query(String statement,
Map<String,Object> params)
Runs the given cypher statement and packages the result in a Result, simple conversions via the
registered converter-factories are already executed via this method.
|
<T> QueryEngine<T> |
queryEngineFor(QueryType type)
Provides a cypher or gremlin query engine set up with a default entity converter.
|
<T> GraphRepository<T> |
repositoryFor(Class<T> clazz) |
<T> T |
save(T entity)
Stores the given entity in the graph, if the entity is already attached to the graph, the node is updated, otherwise
a new node is created.
|
org.neo4j.graphdb.traversal.TraversalDescription |
traversalDescription() |
Result<org.neo4j.graphdb.Path> |
traverse(org.neo4j.graphdb.Node startNode,
org.neo4j.graphdb.traversal.TraversalDescription traversal)
Traverses the graph starting at the given node with the provided traversal description.
|
Result<org.neo4j.graphdb.Path> |
traverse(Object start,
org.neo4j.graphdb.traversal.TraversalDescription traversal)
Traverses the graph starting at the given node entity with the provided traversal description.
|
<T> T exec(GraphCallback<T> callback)
T
- return typecallback
- for executing graph operations NON-transactionally, not nullDataAccessException
- subclasses<T> GraphRepository<T> repositoryFor(Class<T> clazz)
org.neo4j.graphdb.Node getReferenceNode()
org.neo4j.graphdb.Node getNode(long id)
id
- node idorg.neo4j.graphdb.NotFoundException
org.neo4j.graphdb.Node createNode(Map<String,Object> properties)
properties
- the properties that should be initially set on the nodeorg.neo4j.graphdb.Node createNode()
org.neo4j.graphdb.Node getOrCreateNode(String index, String key, Object value, Map<String,Object> properties)
<T> T createNodeAs(Class<T> target, Map<String,Object> properties)
target
- mapped entity class or Node.classproperties
- the properties that should be initially set on the nodeorg.neo4j.graphdb.Relationship getRelationship(long id)
id
- relationship idorg.neo4j.graphdb.NotFoundException
org.neo4j.graphdb.Relationship createRelationshipBetween(org.neo4j.graphdb.Node startNode, org.neo4j.graphdb.Node endNode, String type, Map<String,Object> properties)
org.neo4j.graphdb.Relationship getOrCreateRelationship(String indexName, String key, Object value, org.neo4j.graphdb.Node startNode, org.neo4j.graphdb.Node endNode, String type, Map<String,Object> properties)
<R> R getRelationshipBetween(Object start, Object end, Class<R> relationshipEntityClass, String relationshipType)
<R> Iterable<R> getRelationshipsBetween(Object start, Object end, Class<R> relationshipEntityClass, String relationshipType)
org.neo4j.graphdb.Relationship getRelationshipBetween(Object start, Object end, String relationshipType)
void deleteRelationshipBetween(Object start, Object end, String type)
<R> R createRelationshipBetween(Object start, Object end, Class<R> relationshipEntityClass, String relationshipType, boolean allowDuplicates)
<T extends org.neo4j.graphdb.PropertyContainer> org.neo4j.graphdb.index.Index<T> getIndex(String indexName, Class<?> indexedType)
indexName
- might be nullindexedType
- entity class, might be null<T extends org.neo4j.graphdb.PropertyContainer> org.neo4j.graphdb.index.Index<T> getIndex(Class<?> indexedType, String propertyName)
<T extends org.neo4j.graphdb.PropertyContainer> T index(String indexName, T element, String field, Object value)
T
- the provided element typeindexName
- Name of the index, will be checked against existing indexes according to the given element
assumes a "node" node index or "relationship" relationship index for a null valueelement
- node or relationship to indexfield
- field to indexvalue
- value to index<T extends org.neo4j.graphdb.PropertyContainer> Result<T> lookup(String indexName, String field, Object value)
<T extends org.neo4j.graphdb.PropertyContainer> Result<T> lookup(Class<?> indexedType, String propertyName, Object value)
<T extends org.neo4j.graphdb.PropertyContainer> Result<T> lookup(String indexName, Object query)
<T> QueryEngine<T> queryEngineFor(QueryType type)
Result<Map<String,Object>> query(String statement, Map<String,Object> params)
Result<Object> execute(String statement, Map<String,Object> params)
Result<org.neo4j.graphdb.Path> traverse(org.neo4j.graphdb.Node startNode, org.neo4j.graphdb.traversal.TraversalDescription traversal)
Result<org.neo4j.graphdb.Path> traverse(Object start, org.neo4j.graphdb.traversal.TraversalDescription traversal)
<T> Result<T> convert(Iterable<T> iterable)
<T> T convert(Object value, Class<T> type)
<T> T findOne(long id, Class<T> type)
<T> EndResult<T> findAll(Class<T> entityClass)
<T> long count(Class<T> entityClass)
<T> T projectTo(Object entity, Class<T> targetType)
<T> T save(T entity)
void delete(Object entity)
<S extends org.neo4j.graphdb.PropertyContainer> S getPersistentState(Object entity)
org.neo4j.graphdb.traversal.TraversalDescription traversalDescription()
GraphDatabase getGraphDatabase()
<T> T fetch(T value)
<S extends org.neo4j.graphdb.PropertyContainer,T> T load(S state, Class<T> type)
MappingPolicy getMappingPolicy(Class<?> targetType)
ResultConverter getDefaultConverter()
Copyright © 2012 SpringSource. All Rights Reserved.