Safe Haskell | None |
---|---|
Language | Haskell98 |
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 = HashSet Label
- empty :: Graph
- addNode :: Node -> Graph -> Graph
- addNamedNode :: String -> 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
- getNamedNode :: String -> 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
- addNamedRelationship :: String -> 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
- getNamedRelationship :: String -> 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 -> Bool Source
Whether a node is present in the graph
deleteNode :: NodeIdentifier a => a -> Graph -> Graph Source
Delete a node from 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 -> Bool Source
Whether a relationship is present in the graph
addRelationship :: Relationship -> Graph -> Graph Source
Add a relationship to the graph
addNamedRelationship :: String -> Relationship -> Graph -> Graph Source
Add a relationship to the graph with an identified
deleteRelationship :: RelIdentifier a => a -> Graph -> Graph Source
Delete a relationship from the graph
getRelationshipNodeFrom :: Relationship -> Graph -> Maybe Node Source
Get the "node from" from a relationship
getRelationshipNodeTo :: Relationship -> Graph -> Maybe Node Source
Get the "node to" from a relationship
getRelationship :: RelIdentifier a => a -> Graph -> Maybe Relationship Source
Get a relationship in the graph
getNamedRelationship :: String -> Graph -> Maybe Relationship Source
Get a relationship by name in the graph, if any
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 -> Graph Source
Remove all relationships with a missing node
Handling properties
setProperties :: EntityIdentifier a => a -> Properties -> Graph -> Graph Source
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 -> Graph Source
Set a property of a node or relationship in the graph, if not present it won't do anything
deleteProperties :: EntityIdentifier a => a -> Graph -> Graph Source
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 -> Graph Source
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 -> Graph Source
Set what labels a node has
addNodeLabel :: NodeIdentifier a => a -> Label -> Graph -> Graph Source
Add a label to a node
getNodeLabels :: NodeIdentifier a => a -> Graph -> LabelSet Source
Get the labels of a node
deleteNodeLabel :: NodeIdentifier a => a -> Label -> Graph -> Graph Source
Remove a label from a node
Handling Cypher results
addCypher :: Response -> Graph -> Graph Source
Feed a cypher result (from the old API) into a graph (looks for nodes and relationships and inserts them)
Graph filtering functions
relationshipFilter :: (Relationship -> Bool) -> Graph -> Graph Source
Filter the relationships of a graph
Graph operations
union :: Graph -> Graph -> Graph Source
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 -> Graph Source
Remove the nodes and relationships in the first graph that appear in the second
intersection :: Graph -> Graph -> Graph Source
Have a graph that only has nodes and relationships that are present in both