1

How to specify parameters in something like this - WHERE a.name IN ["Peter", "Tobias"]. I am trying to pass the collection after IN operator as a parameter in Cypher. I am using Cypher through REST API.

This is my example:

curl -X POST http://localhost:7474/db/data/ext/CypherPlugin/graphdb/execute_query -H "Content-Type: applicatio/json" --data-binary '{
    "query": "start ca=node:ca({search_ca_query}) MATCH ca_club-[:has]-ca WHERE (ca_club.CA_CLUB IN {CA_CLUB}) RETURN distinct ca.NUM_OFC_CA, ca.NME_CA, ca_club.CA_CLUB",
    "params": {
        "search_ca_query": "NUM_OFC_CA:(\"000333\", \"111033\", \"222197\")",
        "CA_CLUB": "[\"Driad\", \"No-Club\"]"
    }
}' 

I have also tried swapping square brackets in query, but even that didn't worked. (i.e. i am not getting any error but getting an empty list - "data" : [ ].

Any suggestions on how to do this?

4

1 回答 1

3

您的in参数需要是一个列表:

curl -X POST http://localhost:7474/db/data/ext/CypherPlugin/graphdb/execute_query -H "Content-Type: applicatio/json" --data-binary '{
    "query": "start ca=node:ca({search_ca_query}) MATCH ca_club-[:has]-ca WHERE (ca_club.CA_CLUB IN {CA_CLUB}) RETURN distinct ca.NUM_OFC_CA, ca.NME_CA, ca_club.CA_CLUB",
    "params": {
        "search_ca_query": "NUM_OFC_CA:(\"000333\", \"111033\", \"222197\")",
        "CA_CLUB": ["Driad", "No-Club"]
    }
}' 
于 2013-05-27T21:42:15.580 回答