haskell-neo4j-client-0.3.2.4: A Haskell neo4j client

Safe HaskellNone
LanguageHaskell98

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 #

Instances

Eq Graph # 

Methods

(==) :: Graph -> Graph -> Bool #

(/=) :: Graph -> Graph -> Bool #

Show Graph # 

Methods

showsPrec :: Int -> Graph -> ShowS #

show :: Graph -> String #

showList :: [Graph] -> ShowS #

empty :: Graph #

Create an empty graph

Handling nodes in the graph object

addNode :: Node -> Graph -> Graph #

Add a node to the graph

addNamedNode :: String -> Node -> Graph -> Graph #

Add a node to the graph with an identifier

hasNode :: NodeIdentifier a => a -> Graph -> Bool #

Whether a node is present in the graph

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

Delete a node from the graph

getNodes :: Graph -> [Node] #

Get a list with all the nodes in the graph

getNode :: NodeIdentifier a => a -> Graph -> Maybe Node #

Get a node in the graph

getNamedNode :: String -> Graph -> Maybe Node #

Get a node by name in the graph, if any

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

Get outgoing relationships from a node

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

Get incoming relationships from a node

Handling properties in the graph object

getRelationships :: Graph -> [Relationship] #

Get a list with all the relationships in the graph

hasRelationship :: RelIdentifier a => a -> Graph -> Bool #

Whether a relationship is present in the graph

addRelationship :: Relationship -> Graph -> Graph #

Add a relationship to the graph

addNamedRelationship :: String -> Relationship -> Graph -> Graph #

Add a relationship to the graph with an identified

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

Delete a relationship from the graph

getRelationshipNodeFrom :: Relationship -> Graph -> Maybe Node #

Get the "node from" from a relationship

getRelationshipNodeTo :: Relationship -> Graph -> Maybe Node #

Get the "node to" from a relationship

getRelationship :: RelIdentifier a => a -> Graph -> Maybe Relationship #

Get a relationship in the graph

getNamedRelationship :: String -> Graph -> Maybe Relationship #

Get a relationship by name in the graph, if any

Handling orphaned relationships

getOrphansFrom :: Graph -> [Relationship] #

Get relationships missing their "from" node

getOrphansTo :: Graph -> [Relationship] #

Get relationships missing their "to" node

cleanOrphanRelationships :: Graph -> Graph #

Remove all relationships with a missing node

Handling properties

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

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 #

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 #

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 #

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 #

Set what labels a node has

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

Add a label to a node

getNodeLabels :: NodeIdentifier a => a -> Graph -> LabelSet #

Get the labels of a node

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

Remove a label from a node

Handling Cypher results

addCypher :: Response -> Graph -> Graph #

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 -> Graph #

Filter the nodes of a graph

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

Filter the relationships of a graph

Graph operations

union :: Graph -> Graph -> Graph #

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 #

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

intersection :: Graph -> Graph -> Graph #

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