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

Safe HaskellNone
LanguageHaskell98

Database.Neo4j.Cypher

Contents

Description

IMPORTANT! MODULE DEPRECATED, better use the code in this same library that uses the Neo4j transactional endpoint in Database.Neo4j.Transactional.Cypher Module to provide Cypher support. Currently we allow sending queries with parameters, the result is a collection of column headers and JSON data values, the Graph object has the function addCypher that tries to find nodes and relationships in a cypher query result and insert them in a Database.Neo4j.Graph object

import qualified Database.Neo4j.Cypher as C

withConnection host port $ do
   ...
   -- Run a cypher query with parameters
   res <- C.cypher "CREATE (n:Person { name : {name} }) RETURN n" M.fromList [("name", C.newparam ("Pep" :: T.Text))]

   -- Get all nodes and relationships that this query returned and insert them in a Graph object
   let graph = G.addCypher (C.fromSuccess res) G.empty

   -- Get the column headers
   let columnHeaders = C.cols $ C.fromSuccess res

   -- Get the rows of JSON values received
   let values = C.vals $ C.fromSuccess res

Synopsis

Types

data Response Source #

Type for a Cypher response with tuples containing column name and their values

Constructors

Response 

Fields

Instances

Eq Response Source # 
Show Response Source # 
FromJSON Response Source #

How to create a response object from a cypher JSON response

data ParamValue Source #

Value for a cypher parmeter value, might be a literal, a property map or a list of property maps

Instances

Eq ParamValue Source # 
Show ParamValue Source # 
ToJSON ParamValue Source #

Instance toJSON for param values so we can serialize them in queries

type Params = HashMap Text ParamValue Source #

We use hashmaps to represent Cypher parameters

Sending queries

cypher :: Text -> Params -> Neo4j (Either Text Response) Source #

Deprecated: Use Database.Neo4j.Transactional.Cypher instead

Run a cypher query

fromResult :: Response -> Either Text Response -> Response Source #

Deprecated: Use Database.Neo4j.Transactional.Cypher instead

Get the result of the response or a default value

fromSuccess :: Either Text Response -> Response Source #

Deprecated: Use Database.Neo4j.Transactional.Cypher instead

Get the result of the response or a default value

isSuccess :: Either Text Response -> Bool Source #

Deprecated: Use Database.Neo4j.Transactional.Cypher instead

True if the operation succeeded