0

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 Answers2

2

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'.

jjaderberg
  • 9,844
  • 34
  • 34
1

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.

dev
  • 715
  • 5
  • 21
  • I think it would be nice to have this feature. Imagine yourself writing code and wanting to try a parameterized query with different arguments. You could copy&paste the very query string from your program and execute it in web admin testing with different arguments... – Klaus Baumgartner Dec 28 '13 at 19:55