can you just try to return {reltypes}
I think due to json parsing the nested collections in reltypes are turned
into lists which are not equal to the type that is created by the literal
syntax
could you try a list of maps instead ?
On Tue, Dec 2, 2014 at 11:18 AM, Tom Zeppenfeldt <[email protected]>
wrote:
> I have an problem , probably related to passing a nested collection as a
> parameter to a cypher query..
>
>
> In the browser, this works fine:
>
> MATCH n-[r]-m
> WHERE id(n) = 0
> WITH CASE WHEN startnode(r)=n THEN (CASE WHEN endnode(r)=n THEN 'SELF'
> ELSE 'OUT' END) ELSE 'IN' END as direction,type(r) as typer,m,r
> WITH [labels(m),typer,direction] AS reltype
> WHERE reltype IN
> *[[['Person'],'KNOWS','OUT'],[['Person'],'KNOWS','IN'],[['Prologram','User'],'KNOWS','IN']]*
> RETURN reltype,count(*)
>
> doing this using REST works fine too and also returns the expected result
>
> *query*
>
> {
> "query" : "MATCH n-[r]-m WHERE id(n) = 0 WITH CASE WHEN startnode(r)=n
> THEN (CASE WHEN endnode(r)=n THEN 'SELF' ELSE 'OUT' END) ELSE 'IN' END as
> direction,type(r) as typer,m,r WITH [labels(m),typer,direction] AS reltype
> WHERE reltype IN
> [[['Person'],'KNOWS','OUT'],[['Person'],'KNOWS','IN'],[['Prologram','User'],'KNOWS','IN']]
> RETURN reltype,count(*)"
> }
> }
>
> *result : *
>
>
> {
> "columns": [
> "reltype",
> "count(*)"
> ],
> "data": [
> [
> [
> [
> "Person"
> ],
> "KNOWS",
> "OUT"
> ],
> 2
> ],
> [
> [
> [
> "Prologram",
> "User"
> ],
> "KNOWS",
> "IN"
> ],
> 1
> ],
> [
> [
> [
> "Person"
> ],
> "KNOWS",
> "IN"
> ],
> 1
> ]
> ]
> }
>
> however: passing the collection as a parameter does not work:
>
> {
> "query" : "MATCH n-[r]-m WHERE id(n) = 0 WITH CASE WHEN startnode(r)=n
> THEN (CASE WHEN endnode(r)=n THEN 'SELF' ELSE 'OUT' END) ELSE 'IN' END as
> direction,type(r) as typer,m,r WITH [labels(m),typer,direction] AS reltype
> WHERE reltype IN {reltypes} RETURN reltype,count(*)",
> "params": {
> "reltypes":
> [[["Person"],"KNOWS","OUT"],[["Person"],"KNOWS","IN"],[["Prologram","User"],"KNOWS","IN"]]
> }
> }
>
> returns an empty result
>
> {
> "columns": [
> "reltype",
> "count(*)"
> ],
> "data": []
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.