I need to delete some node properties from my graph. Following the cypher guidelines I have tried the following:
START n=node(1)
DELETE n.property
RETURN n
I get an error message:
Expression `Property` yielded `true`. Don't know how to delete that.
I can replicate this on console.neo4j.org. How are you supposed to delete the property of a node?
Remove all properties REMOVE cannot be used to remove all existing properties from a node or relationship. Instead, using SET with = and an empty map as the right operand will clear all properties from the node or relationship.
Deleting Nodes and Relationships Deleting all nodes and relationships in a Neo4j database is very simple. Here is an example that does just that: MATCH (n) DETACH DELETE n; The DETACH keyword specifies to remove or “detach” all relationships from a particular node before deletion.
Deleting relationship is as simple as deleting nodes. Use the MATCH statement to match the relationships you want to delete. You can delete one or many relationships or all relationships by using one statement.
In Neo4j to delete a node or relations between nodes you have to use DELETE clause. To delete any node you need DELETE clause with the MATCH statement, the MATCH statement data will find the specific node and whichever node is matched with the statement that node will be vanished.
Neo4j Delete Node Last Updated : 23 Aug, 2019 In Neo4j to delete a node or relations between nodes you have to use DELETE clause. To delete any node you need DELETE clause with the MATCH statement, the MATCH statement data will find the specific node and whichever node is matched with the statement that node will be vanished.
The REMOVE clause is used to remove properties and labels from graph elements (Nodes or Relationships). The main difference between Neo4j CQL DELETE and REMOVE commands is −
On the right side of the page (perhaps after some loading time) you have a pull-down menu for choosing your Neo4j version.
Remember that you cannot delete a node without also deleting relationships that start or end on said node. Either explicitly delete the relationships, or use DETACH DELETE. 2. Delete single node To delete a node, use the DELETE clause. Table 1. Result 3. Delete all nodes and relationships
What version of Neo4j are you using? Since Neo4j 2.0 (I'm not sure what milestone exactly, tried it with M03), properties are not "deleted" anymore but "removed":
START n=node(1)
REMOVE n.property
RETURN n
Should work with Neo4j 2.x.
This is also reflected in the documentation. On the right side of the page (perhaps after some loading time) you have a pull-down menu for choosing your Neo4j version. When you go to the DELETE documentation and choose the 2.0.0-M03 milestone, you will notice that the "Delete a property" menu point disappears (link to the M03 documentation on DELETE: http://docs.neo4j.org/chunked/2.0.0-M03/query-delete.html).
Instead, the documentation for 2.0.0-M03 on REMOVE (here: http://docs.neo4j.org/chunked/2.0.0-M03/query-remove.html) does now list the "Remove a property" section.
Just another example.
For Neo4j 3.0, given a node with property keys, name and age, to delete the age property is also valid:
Create the node:
CREATE (n {name:'Andres', age:25}) return n
Delete the property key age:
MATCH (andres { name: 'Andres' }) REMOVE andres.age RETURN andres
From Neo4j 3.0 documentation https://neo4j.com/docs/developer-manual/current/cypher/#query-remove
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With