public class CypherCRUD extends Object
A node is created using an EntityKey. A node is labeled with NodeLabel.ENTITY and with the value
returned by EntityKey.getTable(). The properties names and values of the node are the corresponding values of
EntityKey.getColumnNames() and EntityKey.getColumnValues()
A relationship is created using an AssociationKey and a RowKey. The type of a new relationship is the
value returned by AssociationKey.getCollectionRole(). The names and values of the properties of the
relationship are the corresponding RowKey.getColumnNames() and RowKey.getColumnValues().
This class must be thread-safe since it's used by the dialect as a reference.
| Constructor and Description |
|---|
CypherCRUD(org.neo4j.graphdb.GraphDatabaseService graphDb) |
| Modifier and Type | Method and Description |
|---|---|
org.neo4j.graphdb.Node |
createNodeUnlessExists(Key key,
NodeLabel label)
Find a node or create it if it doesn't exist.
|
org.neo4j.cypher.javacompat.ExecutionResult |
executeQuery(String query,
Map<String,Object> parameters) |
org.neo4j.graphdb.Node |
findNode(Key key)
Find the node representing the
Key. |
org.neo4j.graphdb.Node |
findNode(Key key,
NodeLabel label)
Find the node representing the entity key.
|
org.neo4j.graphdb.ResourceIterator<org.neo4j.graphdb.Node> |
findNodes(String tableName)
Query example:
|
org.neo4j.graphdb.Relationship |
findRelationship(AssociationKey associationKey,
RowKey rowKey)
Query example:
|
static org.neo4j.graphdb.RelationshipType |
relationshipType(AssociationKey associationKey)
Converts the association key into the type of the relationship.
|
void |
remove(AssociationKey associationKey)
Removes the relationship(s) representing the given association.
|
void |
remove(AssociationKey associationKey,
RowKey rowKey)
Removes the relationship representing the given association row.
|
void |
remove(EntityKey entityKey)
Remove the node and all the relationships connected to it.
|
public org.neo4j.graphdb.Relationship findRelationship(AssociationKey associationKey, RowKey rowKey)
MATCH (n) - [r:owners {`owner_id`: {0}} }] - ()
RETURN rassociationKey - identify the type of the relationshiprowKey - identify the relationshippublic org.neo4j.graphdb.Node findNode(Key key)
Key.
MATCH (n:Table {`id`: {0} })
key - representing the nodeNode or nullpublic org.neo4j.graphdb.Node findNode(Key key, NodeLabel label)
MATCH (n:ENTITY:Table {`id`: {0} })
key - representing the nodeNode or nullpublic void remove(EntityKey entityKey)
MATCH (n:ENTITY:Table {`id`: {0}})
OPTIONAL MATCH (n) - [r] - ()
DELETE r,nentityKey - of the entity to removepublic org.neo4j.graphdb.ResourceIterator<org.neo4j.graphdb.Node> findNodes(String tableName)
MATCH (n:`tableName`) RETURN n
ResourceIterator with the resultspublic org.neo4j.graphdb.Node createNodeUnlessExists(Key key, NodeLabel label)
MERGE (n:ENTITY:Table {`id`: {0} })
RETURN nkey - identify the type of the relationshippublic static org.neo4j.graphdb.RelationshipType relationshipType(AssociationKey associationKey)
associationKey - the identifier of the associationRelationshipTypepublic void remove(AssociationKey associationKey)
MATCH (n) - [r:collectionRole { 'associationKey_column_name': {0}}] - ()
DELETE r
MATCH (n) - [r:collectionRole { 'associationKey_column_name': {0}}] - (x:EMBEDDED)
DELETE r, x
public void remove(AssociationKey associationKey, RowKey rowKey)
MATCH (n) - [r:collectionRole { 'rowkey_column_name': {0}}] - ()
DELETE r
MATCH (n) - [r:collectionRole { 'rowkey_column_name': {0}}] - (x:EMBEDDED)
DELETE r, x
Copyright © 2010-2014 Hibernate. All Rights Reserved.