Safe Haskell | None |
---|
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.
- data Graph
- type LabelSet = HS.HashSet Label
- empty :: Graph
- addNode :: Node -> Graph -> Graph
- hasNode :: NodeIdentifier a => a -> Graph -> Bool
- deleteNode :: NodeIdentifier a => a -> Graph -> Graph
- getNodes :: Graph -> [Node]
- getNode :: NodeIdentifier a => a -> Graph -> Maybe Node
- getNodeFrom :: NodeIdentifier a => a -> Graph -> Maybe [Relationship]
- getNodeTo :: NodeIdentifier a => a -> Graph -> Maybe [Relationship]
- getRelationships :: Graph -> [Relationship]
- hasRelationship :: RelIdentifier a => a -> Graph -> Bool
- addRelationship :: Relationship -> Graph -> Graph
- deleteRelationship :: RelIdentifier a => a -> Graph -> Graph
- getRelationshipNodeFrom :: Relationship -> Graph -> Maybe Node
- getRelationshipNodeTo :: Relationship -> Graph -> Maybe Node
- getRelationship :: RelIdentifier a => a -> Graph -> Maybe Relationship
- getOrphansFrom :: Graph -> [Relationship]
- getOrphansTo :: Graph -> [Relationship]
- cleanOrphanRelationships :: Graph -> Graph
- setProperties :: EntityIdentifier a => a -> Properties -> Graph -> Graph
- setProperty :: EntityIdentifier a => a -> Text -> PropertyValue -> Graph -> Graph
- deleteProperties :: EntityIdentifier a => a -> Graph -> Graph
- deleteProperty :: EntityIdentifier a => a -> Text -> Graph -> Graph
- setNodeLabels :: NodeIdentifier a => a -> [Label] -> Graph -> Graph
- addNodeLabel :: NodeIdentifier a => a -> Label -> Graph -> Graph
- getNodeLabels :: NodeIdentifier a => a -> Graph -> LabelSet
- deleteNodeLabel :: NodeIdentifier a => a -> Label -> Graph -> Graph
- addCypher :: Response -> Graph -> Graph
- nodeFilter :: (Node -> Bool) -> Graph -> Graph
- relationshipFilter :: (Relationship -> Bool) -> Graph -> Graph
- union :: Graph -> Graph -> Graph
- difference :: Graph -> Graph -> Graph
- intersection :: Graph -> Graph -> Graph
General objects
Handling nodes in the graph object
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
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