Cypher - SET

向現有節點或關係添加新屬性

SET  <property-name-list>

//設置節點的屬性spa

match (u:User)
where u.id =1
set u.age =32,u.address='中國' 
it

//設置 關係屬性map

match (u:User)-[r]->(u1)
where u.id =1
set r.type='brand'
return r
標籤

//刪除屬性co

match (u:User)
where u.id = 1
set u.age = null
return u
block

//屬性複製return

match (u1:User),(u2:User)
where u1.id = 1 and u2.id = 2
set u2.address = u1.address
return u2
ab

// 從map 中添加屬性

match (u:User)
where u.id  =1
set u += {job:'cooking',gender:'man'}
return u

// 給節點設置標籤

match (u:User)
where u.id = 6
set u:Actor
return labels(u)

//

match (u:User)
where u.id = 6
set u:Actor:Leader
return labels(u)

//

match (n:User{id:1})-->(friend)
with n,count(friend) as friendCount
set n.friendCount = friendCount
return n.friendCount

//不能添加關係類型

match (u1:User)-[r:DIRECT]->(u2) where u1.id = 6 set r:NEWTYPE return type(r)

相關文章
相關標籤/搜索