Re: [clojure-neo4j] How to Match by Label with {_variable}? re:necons tquery:

19 views
Skip to first unread message

Rohit Aggarwal

unread,
Oct 17, 2015, 9:15:31 AM10/17/15
to clojur...@googlegroups.com
Stefan's answer on SO is the correct one. You can't parameterize on the label. More about it here:

http://neo4j.com/docs/2.2.6/cypher-parameters.html

For matching by a label and a variable, you'll have to create something like this:
(cy/tquery conn "MATCH (n:Folder) WHERE n._nodeid = {_nodeid} RETURN n;" {:_nodeid _nodeid})
Hope this helps.

-Rohit

On Wed, Oct 14, 2015 at 12:34 AM, Ben McFerren <mcfe...@seasidesyndication.com> wrote:

I am trying to use clojure neocons to perform a cypher query where I need to use a variable placeholder for the label:

(def node-query "MATCH (n:{_nodetype})
                 RETURN n;")

I am getting an error when I add {_nodetype} but no error when I remove {_nodetype}

"Invalid input '{': expected whitespace or a label name (line 1, column 10 (offset: 9))\\n\\\"MATCH (n:{_nodetype})\\\"\\n ^\",\n \"exception\"...

Here is my call to tquery:

(cy/tquery conn node-query {:_nodeid _nodeid :_nodetype "Folder"})

What is the cypher / neocons syntax to MATCH by label with a variable?

I am very grateful for help you could suggest.


http://stackoverflow.com/questions/33111450/cyper-clojure-necons-tquery-how-to-match-by-label-with-variable

--
Documentation: http://clojureneo4j.info
Issues: https://github.com/michaelklishin/neocons/issues
 
More Clojure libraries: http://clojurewerkz.org
---
You received this message because you are subscribed to the Google Groups "clojure-neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure-neo4...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojure-neo4j.
For more options, visit https://groups.google.com/d/optout.

Michael Hunger

unread,
Oct 18, 2015, 2:35:50 AM10/18/15
to clojur...@googlegroups.com
But of course can replace it in clojure

Von meinem iPhone gesendet
Reply all
Reply to author
Forward
0 new messages