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

Instances

Eq Graph Source # 

Methods

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

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

Show Graph Source # 

Methods

showsPrec :: Int -> Graph -> ShowS #

show :: Graph -> String #

showList :: [Graph] -> ShowS #

empty :: Graph Source #

Create an empty graph

Handling nodes in the graph object

addNode :: Node -> Graph -> Graph Source #

Add a node to the graph

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

Add a node to the graph with an identifier

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

getNodes :: Graph -> [Node] Source #

Get a list with all the nodes in the graph

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

Get a node in the graph

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

Get a node by name in the graph, if any

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

nodeFilter :: (Node -> Bool) -> Graph -> Graph Source #

Filter the nodes of a graph

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