rob2
( Rob)
1
Hi
can I use param for label and/or type?
:param NodeLabel => 'person';
:param RelType => 'has_mail';
MATCH (n1:$NodeLabel)-[r:$RelType]->(n2) RETURN r, n1, n2;
in the browser I get an error :
Neo.ClientError.Statement.SyntaxError: Invalid input '$': expected whitespace or a label name (line 1, column 11 (offset: 10))
"MATCH (n1:$NodeLabel)-[r:$RelType]->(n2) RETURN r, n1, n2"
Is there are trick?
thanks rob
cobra
(Cobra)
2
Hello @rob2
It is not possible to use a Label or a Type as a parameter in a MATCH clause.
Regards,
Cobra
rob2
( Rob)
3
Thanks - also not in a where statement i guess ... rob
cobra
(Cobra)
4
Sorry, it's not possible in a MATCH clause but there is a workaround for WHERE clauses:
MATCH (n1)-[r]->(n2)
WHERE $NodeLabel IN LABELS(n1) AND type(r) = $RelType
RETURN r, n1, n2;
Regards,
Cobra
rob2
( Rob)
5
merci I will give it a try!