Issue
I am trying to match a graph object which has a code property of such "code": ["DAF AR Index"]
.
The query match (n:GenericProduct {code:["DAF AR Index"]}) return n;
works as expected and the object is returned, but I have been unable to match the object either using CONTAINS
or a regular expression. To match a single opening bracket, I have tried
match (n:GenericProduct)
where n.code =~ '\[.*'
return n;
the same expression with double backslashes - n.code =~ '\\[.*'
, and finally with
match (n:GenericProduct)
where n.code contains '['
return n;
but so far without success. Any advice on how to proceed would be appreciated. Thanks in advance.
Solution
There are two ways you can find nodes that have a specific property stored as a list:
Using APOC procedures:
MATCH (n:GenericProduct)
WHERE apoc.meta.cypher.type(n.code) = "LIST OF STRING"
RETURN n
Or using a "hacky" cypher:
MATCH (n:GenericProduct)
WHERE size(n.code + 11) = size(n.code) + 1
RETURN n
Answered By - Tomaž Bratanič Answer Checked By - Gilberto Lyons (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.