In Neo4J Web Admin - how do I provide arguments to a parameterized query?

141 views Asked by At

Say I want to parameterize this simple query: match (u) where u.username={uname} return u

(How) can I provide parameters when executing it in Neo4J web admin?

2

There are 2 answers

0
jjaderberg On

I don't know if you can do that in the cypher shell, but you can do a REST call.

POST /db/data/cypher
{
  "query": "match (u) where u.username={uname} return u",
  "params": {
    "uname": "user2739920"
  }
}

This will give you a REST response in JSON, which may or may not fit your requirement.

If you use 2.0 the method is :POST and the response is condensed, not 'pretty-printed'.

1
dev On

you need passing parameters when you have to use cypher queries in java and you pass it by appending queries.

e.g.

ExecutionResult result = _engine.execute(_query.toString(), _params);

_params is map where you put required values and in _query you write queries with variables in {}.

In web admin we run queries so I don't think it will be needed.Here you will have to hardcode the values.

If there is some special need and any how you have to do this please specify.