Delete Data
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.
Syntax:
- Command:
delete()
- Parameter: (see the table below)
- Statement Alias: Custom alias not supported
Parameter | Type | Specification | Description | Structure Type of Custom Alias |
---|---|---|---|---|
nodes() or edges() |
Filter | Mandatory | Filtering rules of nodes or edges | Not supported |
limit() |
Int | > 0 | The number of nodes or edges to be deleted | Not supported |
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.
// To delete nodes in the current graphset
delete().nodes(<filter>).limit(<N>)
// To delete 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.