I use the spring data neo4j @query to add a label to a node, but there are some syntaxes. How can I transfer param correctly?
Such as:
@Query("MATCH (st) WHERE st.originId = $originId SET st:$label RETURN st")
public Node addLabel(String originId, String label);
@Query("MATCH (st) WHERE st.originId = $originId SET st:label RETURN st")
public Node addLabel(String originId, @Param("label") String label);
@Query("MATCH (st) WHERE st.originId = $originId SET st:$1 RETURN st")
public Node addLabel(String originId, String label);
All of the above statements have errors.The compiler told me there was an error in ':'.
So, What's the correct statements?
At the moment, cypher does not support assigning dynamic node labels. You will need to use the APOC library:
MATCH (st) WHERE st.originId = $originId
CALL apoc.create.addLabels( [st], [$label]) YIELD node
RETURN distinct 'done'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.