haskell-neo4j-client-0.3.0.6: A Haskell neo4j client

Safe HaskellNone

Database.Neo4j.Graph

Contents

Description

Module to handle Graph objects. These have information about a group of nodes, relationships, and information about labels per node and nodes per label. Notice a graph can have relationships and at the same time not have some of the nodes of those relationships, see the section called handling orphaned relationships. This is so because commands in a batch might retrieve relationships but might not create or retrieve their respective nodes.

Synopsis

General objects

data Graph Source

Instances

Eq Graph 
Show Graph 

type LabelSet = HS.HashSet LabelSource

empty :: GraphSource

Create an empty graph

Handling nodes in the graph object

addNode :: Node -> Graph -> GraphSource

Add a node to the graph

hasNode :: NodeIdentifier a => a -> Graph -> BoolSource

Whether a node is present in the graph

deleteNode :: NodeIdentifier a => a -> Graph -> GraphSource

Delete a node from the graph

getNodes :: Graph -> [Node]Source

Get a list with all the nodes in the graph

getNode :: NodeIdentifier a => a -> Graph -> Maybe NodeSource

Get a node in the graph

getNodeFrom :: NodeIdentifier a => a -> Graph -> Maybe [Relationship]Source

Get outgoing relationships from a node

getNodeTo :: NodeIdentifier a => a -> Graph -> Maybe [Relationship]Source

Get incoming relationships from a node

Handling properties in the graph object

getRelationships :: Graph -> [Relationship]Source

Get a list with all the relationships in the graph

hasRelationship :: RelIdentifier a => a -> Graph -> BoolSource

Whether a relationship is present in the graph

addRelationship :: Relationship -> Graph -> GraphSource

Add a relationship to the graph

deleteRelationship :: RelIdentifier a => a -> Graph -> GraphSource

Delete a relationship from the graph

getRelationshipNodeFrom :: Relationship -> Graph -> Maybe NodeSource

Get the node from from a relationship

getRelationshipNodeTo :: Relationship -> Graph -> Maybe NodeSource

Get the node to from a relationship

getRelationship :: RelIdentifier a => a -> Graph -> Maybe RelationshipSource

Get a relationship in the graph

Handling orphaned relationships

getOrphansFrom :: Graph -> [Relationship]Source

Get relationships missing their from node

getOrphansTo :: Graph -> [Relationship]Source

Get relationships missing their to node

cleanOrphanRelationships :: Graph -> GraphSource

Remove all relationships with a missing node

Handling properties

setProperties :: EntityIdentifier a => a -> Properties -> Graph -> GraphSource

Set the properties of a node or relationship in the graph, if not present it won't do anything

setProperty :: EntityIdentifier a => a -> Text -> PropertyValue -> Graph -> GraphSource

Set a property of a node or relationship in the graph, if not present it won't do anything

deleteProperties :: EntityIdentifier a => a -> Graph -> GraphSource

Delete all the properties of a node or relationship, if the entity is not present it won't do anything

deleteProperty :: EntityIdentifier a => a -> Text -> Graph -> GraphSource

Delete a property of a node or relationship, if the entity is not present it won't do anything

Handling labels

setNodeLabels :: NodeIdentifier a => a -> [Label] -> Graph -> GraphSource

Set what labels a node has

addNodeLabel :: NodeIdentifier a => a -> Label -> Graph -> GraphSource

Add a label to a node

getNodeLabels :: NodeIdentifier a => a -> Graph -> LabelSetSource

Get the labels of a node

deleteNodeLabel :: NodeIdentifier a => a -> Label -> Graph -> GraphSource

Remove a label from a node

Handling Cypher results

addCypher :: Response -> Graph -> GraphSource

Feed a cypher result (from the old API) into a graph (looks for nodes and relationships and inserts them)

Graph filtering functions

nodeFilter :: (Node -> Bool) -> Graph -> GraphSource

Filter the nodes of a graph

relationshipFilter :: (Relationship -> Bool) -> Graph -> GraphSource

Filter the relationships of a graph

Graph operations

union :: Graph -> Graph -> GraphSource

Add two graphs resulting in a graph with all the nodes, labels and relationships of both | If a node/entity is present in both the second one will be chosen

difference :: Graph -> Graph -> GraphSource

Remove the nodes and relationships in the first graph that appear in the second

intersection :: Graph -> Graph -> GraphSource

Have a graph that only has nodes and relationships that are present in both