|
Spring Data Graph | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.data.neo4j.template.Neo4jTemplate
public class Neo4jTemplate
Constructor Summary | |
---|---|
Neo4jTemplate(GraphDatabase graphDatabase)
|
|
Neo4jTemplate(GraphDatabase graphDatabase,
PlatformTransactionManager transactionManager)
|
Method Summary | ||
---|---|---|
|
convert(Iterable<T> iterable)
Converts the Iterable into a QueryResult object for uniform handling. |
|
org.neo4j.graphdb.Node |
createNode(Map<String,Object> properties)
Transactionally creates the node, sets the properties (if any) and indexes the given fields (if any). |
|
org.neo4j.graphdb.Relationship |
createRelationship(org.neo4j.graphdb.Node startNode,
org.neo4j.graphdb.Node endNode,
org.neo4j.graphdb.RelationshipType relationshipType,
Map<String,Object> properties)
Transactionally creates the relationship, sets the properties (if any) and indexes the given fielss (if any) Two shortcut means of providing the properties (very short with static imports) template.createRelationship(from,to,TYPE, Property. |
|
|
exec(GraphCallback<T> callback)
Executes the callback in a NON-transactional context. |
|
QueryResult<Object> |
execute(String statement,
Map<String,Object> params)
Executes the given Gremlin statement and returns the result packaged as QueryResult as Neo4j types, not Gremlin types. |
|
org.neo4j.graphdb.Node |
getNode(long id)
Delegates to the GraphDatabase |
|
org.neo4j.graphdb.Node |
getReferenceNode()
Delegates to the GraphDatabase |
|
org.neo4j.graphdb.Relationship |
getRelationship(long id)
Delegates to the GraphDatabase |
|
|
index(String indexName,
T element,
String field,
Object value)
Indexes the given field and value for the element. |
|
|
lookup(String indexName,
Object query)
The query is executed on the index returning the IndexHits wrapped in a QueryResult to be converted into Paths or Entities. |
|
|
lookup(String indexName,
String field,
Object value)
The value is looked up in the Neo4j index returning the IndexHits wrapped in a QueryResult to be converted into Paths or Entities. |
|
QueryResult<Map<String,Object>> |
query(String statement,
Map<String,Object> params)
Runs the given cypher statement and packages the result in a QueryResult, simple conversions via the registered converter-factories are already executed via this method. |
|
DataAccessException |
translateExceptionIfPossible(RuntimeException ex)
|
|
QueryResult<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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Neo4jTemplate(GraphDatabase graphDatabase, PlatformTransactionManager transactionManager)
graphDatabase
- the neo4j graph databasetransactionManager
- if passed in, will be used to create implicit transactions whenever neededpublic Neo4jTemplate(GraphDatabase graphDatabase)
graphDatabase
- the neo4j graph databaseMethod Detail |
---|
public DataAccessException translateExceptionIfPossible(RuntimeException ex)
public <T> T exec(GraphCallback<T> callback)
Neo4jOperations
exec
in interface Neo4jOperations
T
- return typecallback
- for executing graph operations NON-transactionally, not null
public org.neo4j.graphdb.Node getReferenceNode()
Neo4jOperations
getReferenceNode
in interface Neo4jOperations
public org.neo4j.graphdb.Node createNode(Map<String,Object> properties)
Neo4jOperations
template.createNode(Property._("name","value"));
template.createNode(Property._("name","value","prop","anotherValue"));
createNode
in interface Neo4jOperations
properties
- properties to be set at node creation might be null
public org.neo4j.graphdb.Node getNode(long id)
Neo4jOperations
getNode
in interface Neo4jOperations
id
- node id
public org.neo4j.graphdb.Relationship getRelationship(long id)
Neo4jOperations
getRelationship
in interface Neo4jOperations
id
- relationship id
public <T extends org.neo4j.graphdb.PropertyContainer> T index(String indexName, T element, String field, Object value)
Neo4jOperations
index
in interface Neo4jOperations
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
public <T> QueryResult<T> convert(Iterable<T> iterable)
Neo4jOperations
convert
in interface Neo4jOperations
public org.neo4j.graphdb.Relationship createRelationship(org.neo4j.graphdb.Node startNode, org.neo4j.graphdb.Node endNode, org.neo4j.graphdb.RelationshipType relationshipType, Map<String,Object> properties)
Neo4jOperations
template.createRelationship(from,to,TYPE, Property._("name","value"));
template.createRelationship(from,to,TYPE, Property._("name","value","prop","anotherValue"));
createRelationship
in interface Neo4jOperations
startNode
- start-node of relationshipendNode
- end-node of relationshiprelationshipType
- relationship type, might by an enum implementing RelationshipType or a DynamicRelationshipType.withName("name")properties
- optional initial properties
public QueryResult<Map<String,Object>> query(String statement, Map<String,Object> params)
Neo4jOperations
query
in interface Neo4jOperations
public QueryResult<Object> execute(String statement, Map<String,Object> params)
Neo4jOperations
execute
in interface Neo4jOperations
public QueryResult<org.neo4j.graphdb.Path> traverse(org.neo4j.graphdb.Node startNode, org.neo4j.graphdb.traversal.TraversalDescription traversal)
Neo4jOperations
traverse
in interface Neo4jOperations
public <T extends org.neo4j.graphdb.PropertyContainer> QueryResult<T> lookup(String indexName, String field, Object value)
Neo4jOperations
lookup
in interface Neo4jOperations
public <T extends org.neo4j.graphdb.PropertyContainer> QueryResult<T> lookup(String indexName, Object query)
Neo4jOperations
lookup
in interface Neo4jOperations
|
Spring Data Graph | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |