Deletion operation deletes the nodes and edges that meet the filtering rules in the current GraphSet. Caution should be exercised when deleting data using sophisticated filters, as the deletion is irreversible. When deleting nodes, edges that are end pointed at those nodes will also be deleted by the system.
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 the previous chapter.
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 type)
// 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.