Safe Haskell | None |
---|---|
Language | Haskell98 |
Database.Neo4j.Batch
- type Batch a = State BatchState a
- runBatch :: Batch a -> Neo4j Graph
- newtype BatchFuture a = BatchFuture Int
- class NodeBatchIdentifier a
- class RelBatchIdentifier a
- class BatchEntity a
- createNode :: Properties -> Batch (BatchFuture Node)
- createNamedNode :: String -> Properties -> Batch (BatchFuture Node)
- getNode :: NodeBatchIdentifier a => a -> Batch (BatchFuture Node)
- getNamedNode :: NodeBatchIdentifier a => String -> a -> Batch (BatchFuture Node)
- deleteNode :: NodeBatchIdentifier a => a -> Batch (BatchFuture ())
- createRelationship :: (NodeBatchIdentifier a, NodeBatchIdentifier b) => RelationshipType -> Properties -> a -> b -> Batch (BatchFuture Relationship)
- createNamedRelationship :: (NodeBatchIdentifier a, NodeBatchIdentifier b) => String -> RelationshipType -> Properties -> a -> b -> Batch (BatchFuture Relationship)
- getRelationship :: RelBatchIdentifier r => r -> Batch (BatchFuture Relationship)
- getNamedRelationship :: RelBatchIdentifier r => String -> r -> Batch (BatchFuture Relationship)
- getRelationshipFrom :: Relationship -> Batch (BatchFuture Node)
- getRelationshipTo :: Relationship -> Batch (BatchFuture Node)
- deleteRelationship :: RelBatchIdentifier r => r -> Batch (BatchFuture ())
- getRelationships :: NodeBatchIdentifier n => n -> Direction -> [RelationshipType] -> Batch (BatchFuture [Relationship])
- setProperties :: BatchEntity a => a -> Properties -> Batch (BatchFuture ())
- setProperty :: BatchEntity a => a -> Text -> PropertyValue -> Batch (BatchFuture ())
- deleteProperties :: BatchEntity a => a -> Batch (BatchFuture ())
- deleteProperty :: BatchEntity a => a -> Text -> Batch (BatchFuture ())
- getLabels :: NodeBatchIdentifier a => a -> Batch (BatchFuture [Label])
- getNodesByLabelAndProperty :: Label -> Maybe (Text, PropertyValue) -> Batch (BatchFuture [Node])
- addLabels :: NodeBatchIdentifier a => [Label] -> a -> Batch (BatchFuture ())
- changeLabels :: NodeBatchIdentifier a => [Label] -> a -> Batch (BatchFuture ())
- removeLabel :: NodeBatchIdentifier a => Label -> a -> Batch (BatchFuture ())
Usage
With batch mode you can issue several commands to Neo4j at once. In order to issue batches you must use the Batch monad, parameters in batch mode can be actual entities already obtained by issuing regular commands or previous batch commands, or even batch futures, that is you can refer to entities created in the same batch, for instance:
withConnection "127.0.0.1" 7474 $ do g <- B.runBatch $ do neo <- B.createNode M.empty cypher <- B.createNode M.empty B.createRelationship "KNOWS" M.empty neo cypher ...
Batch commands return a Database.Neo4j.Graph object that holds all the information about relationships, nodes and their labels that can be inferred from running a batch command.
General
newtype BatchFuture a Source #
Constructors
BatchFuture Int |
class NodeBatchIdentifier a Source #
Minimal complete definition
getNodeBatchId
class RelBatchIdentifier a Source #
Minimal complete definition
getRelBatchId
class BatchEntity a Source #
Minimal complete definition
getEntityBatchId
Nodes
createNode :: Properties -> Batch (BatchFuture Node) Source #
Batch operation to create a node
createNamedNode :: String -> Properties -> Batch (BatchFuture Node) Source #
Batch operation to create a node and assign it a name to easily retrieve it from the resulting graph of the batch
getNode :: NodeBatchIdentifier a => a -> Batch (BatchFuture Node) Source #
Batch operation to get a node from the DB
getNamedNode :: NodeBatchIdentifier a => String -> a -> Batch (BatchFuture Node) Source #
Batch operation to get a node from the DB and assign it a name
deleteNode :: NodeBatchIdentifier a => a -> Batch (BatchFuture ()) Source #
Batch operation to delete a node
Relationships
createRelationship :: (NodeBatchIdentifier a, NodeBatchIdentifier b) => RelationshipType -> Properties -> a -> b -> Batch (BatchFuture Relationship) Source #
Create a new relationship with a type and a set of properties
createNamedRelationship :: (NodeBatchIdentifier a, NodeBatchIdentifier b) => String -> RelationshipType -> Properties -> a -> b -> Batch (BatchFuture Relationship) Source #
Create a new relationship with a type and a set of properties and assign it an identifier
getRelationship :: RelBatchIdentifier r => r -> Batch (BatchFuture Relationship) Source #
Refresh a relationship entity with the contents in the DB
getNamedRelationship :: RelBatchIdentifier r => String -> r -> Batch (BatchFuture Relationship) Source #
Refresh a relationship entity with the contents in the DB and assign it an identifier
getRelationshipFrom :: Relationship -> Batch (BatchFuture Node) Source #
Get the "node from" from a relationship from the DB
getRelationshipTo :: Relationship -> Batch (BatchFuture Node) Source #
Get the "node to" from a relationship from the DB
deleteRelationship :: RelBatchIdentifier r => r -> Batch (BatchFuture ()) Source #
Delete a relationship
getRelationships :: NodeBatchIdentifier n => n -> Direction -> [RelationshipType] -> Batch (BatchFuture [Relationship]) Source #
Get all relationships for a node
Properties
setProperties :: BatchEntity a => a -> Properties -> Batch (BatchFuture ()) Source #
Set all relationship/node properties
setProperty :: BatchEntity a => a -> Text -> PropertyValue -> Batch (BatchFuture ()) Source #
Set a relationship/node property
deleteProperties :: BatchEntity a => a -> Batch (BatchFuture ()) Source #
Delete all relationship/node properties
deleteProperty :: BatchEntity a => a -> Text -> Batch (BatchFuture ()) Source #
Delete a relationship/node property
Labels
getLabels :: NodeBatchIdentifier a => a -> Batch (BatchFuture [Label]) Source #
Retrieve all labels for a node, if the node doesn't exist already it will raise an exception | Raises Neo4jNoEntityException if the node doesn't exist
getNodesByLabelAndProperty :: Label -> Maybe (Text, PropertyValue) -> Batch (BatchFuture [Node]) Source #
Get all nodes using a label and a property
addLabels :: NodeBatchIdentifier a => [Label] -> a -> Batch (BatchFuture ()) Source #
Add labels to a node | Raises Neo4jNoEntityException if the node doesn't exist
changeLabels :: NodeBatchIdentifier a => [Label] -> a -> Batch (BatchFuture ()) Source #
Change node labels | Raises Neo4jNoEntityException if the node doesn't exist
removeLabel :: NodeBatchIdentifier a => Label -> a -> Batch (BatchFuture ()) Source #
Remove a label for a node | Raises Neo4jNoEntityException if the node doesn't exist