天天看點

CALL apoc.cypher.doIt建立動态節點的時候怎麼指定多個标簽?

下面的建立節點執行個體,請教一下CALL apoc.cypher.doIt如何建立多個标簽?現在的方式是隻能指定一個标簽!

UNWIND 
[{name:"sdasdsad234fdgsasdfas33",properties:{born:1978},labels:"ables213"},{name:"ssds12ad23489gsasdfas33",properties:{born:1978,sex:"男性",age:22},labels:"label31"}] AS row
CALL apoc.cypher.doIt('MERGE (n:`' + row.labels + '` {name: {name}}) SET n += {properties}', {properties: row.properties, name: row.name}) YIELD value
RETURN 1           

解決方案一:

寫在set裡面,set n += {properties},n:human

解決方案讨論:

@zhoujieren64 用參數的形式傳遞怎麼寫呢?

例如這個會報錯:

UNWIND 
[{name:"sdasdsad234fdgsasdfas33",properties:{born:1978},labels:"ables213",labelTest:"test"},{name:"ssds12ad23489gsasdfas33",properties:{born:1978,sex:"男性",age:22},labels:"label31",labelTest:"test"}] AS row
CALL apoc.cypher.doIt('MERGE (n:`' + row.labels + '` {name: {name}}) SET n += {properties},n:{labelTest}', {properties: row.properties, name: row.name,labelTest:row.labelTest}) YIELD value
RETURN 1           

原文位址:http://neo4j.com.cn/topic/5c4e7ea5cd4dafa110f1c6f1