简体   繁体   中英

Neo4j remove/set label and property in the same query

Is it possible to remove or set a label and property in the same query, what are the rules?

MATCH (n { name: 'Peter' })
REMOVE n:German:Student n.address
RETURN n

or does it even cascade further

 MATCH (n { name: 'Peter' })
 REMOVE n:German:Student.address
 RETURN n

as well as

 MATCH (n { name: 'Peter' })
 REMOVE n.address:Student:German
 RETURN n

and

 MATCH (n { name: 'Peter' })
 REMOVE n.address.name.size
 RETURN n

The Set queries would look pretty much the same

You can have more than one REMOVE clause, so yes you can do both in one query, like this:

CREATE (f:Foo { bar: 1 });

MATCH (f:Foo) 
REMOVE f:Foo   /* Remove label */
REMOVE f.bar   /* Remove property */
RETURN f;      /* Return empty node */

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM