haskell-neo4j-client-0.3.0.5: A Haskell neo4j client

Safe HaskellNone

Database.Neo4j.Batch

Contents

Synopsis

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

type Batch a = State BatchState aSource

Nodes

createNode :: Properties -> Batch (BatchFuture Node)Source

Batch operation to create a node

getNode :: NodeBatchIdentifier a => a -> Batch (BatchFuture Node)Source

Batch operation to get a node from the DB

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

getRelationship :: RelBatchIdentifier r => r -> Batch (BatchFuture Relationship)Source

Refresh a relationship entity with the contents in the DB

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