Command delete()
will delete existing nodes/edges based on Ultipa filter. Deleting a node will also delete the edges that start or end with it. Caution should be exercised when deleting data using sophisticated filters since the delete operation is irreversible.
Deletion operation will induce redundant data into the GraphSet and reduce the query efficiency. It is strongly suggested to be cleared on a regular basis, see command
compact()
in GraphSet | Schema | Property.
It is not suggested to execute deletion operation after streaming return of an algorithm, see details on
stream()
in document Ultipa Graph Analytics & Algorithms - Using Algorithms - Execution Method.
Syntax:
- Statement alias: supported (NODE or EDGE)
// To delete N nodes in the current graphset
delete().nodes(<filter>).limit(<N>)
// To delete N edges in the current graphset
delete().edges(<filter>).limit(<N>)
Example: Delete node ID = C003
delete().nodes({_id == "C003"})
Example: Delete edges that start from node C004
delete().edges({_from == "C004"})
Example: Delete 1,000 bank cards @cards under level 2 with balance of 0
delete().nodes({@card && level < 2 && balance == 0}).limit(1000)
Note: When the amount of data is too large for the memory to process, parameter limit()
can be used to set the maximum quantity to handle thus to process in batches.