Orientdb 简明教程
OrientDB - Delete Edge
Delete edge 命令用于删除数据库。这相当于删除命令,此外还检查并通过从“in”和“out”顶点属性中移除对边的所有交叉引用来维护与顶点的相关性。
Delete edge command is used to remove the database. This is equivalent of the delete command, with the addition of checking and maintaining consistency with vertices by removing all cross-references to the edge from both ‘in’ and ‘out’ vertex properties.
以下语句是删除边命令的基本语法。
The following statement is the basic syntax of Delete Edge command.
DELETE EDGE
( <rid>
|
[<rid> (, <rid>)*]
|
( [ FROM (<rid> | <select_statement> ) ] [ TO ( <rid> | <select_statement> ) ] )
|
[<class>]
(
[WHERE <conditions>]
[LIMIT <MaxRecords>]
[BATCH <batch-size>]
))
以下是上文中选项的详细信息。
Following are the details about the options in the above syntax.
FROM − 定义要删除的边的起始点顶点。
FROM − Defines the starting point vertex of the edge to delete.
To − 定义要删除的边的结束点顶点。
To − Defines the ending point vertex of the edge to delete.
WHERE − 定义筛选条件。
WHERE − Defines the filtering conditions.
LIMIT − 定义要删除的最大边数。
LIMIT − Defines the maximum number of edges to delete.
BATCH − 定义操作的块大小。
BATCH − Defines the block size for the operation.
Example
尝试以下示例以了解如何删除边。
Try the following examples to learn how to delete edges.
执行以下查询删除两个顶点(#11:2 和 #11:10)之间的边。但是有可能两个顶点之间存在一个或多个边。我们使用 date 属性来实现适当的功能。此查询将删除在“ 2015-01-15 ”及之后创建的边。
Execute the following query to delete the edge between two vertices (#11:2, #11:10). But there might be a chance that might exist one or more edges between two vertices. So that we are using the date property for proper functionality. This query will delete the edges which are created on '2015-01-15' and later.
orientdb {db = demo}> DELETE EDGE FROM #11:2 TO #11:10 WHERE date >= "2012-01-15"
如果成功执行了以上查询,您会获得以下输出。
If the above query is executed successfully, you will get the following output.
Delete record(s) '2' in 0.00200 sec(s)
执行以下查询以删除从顶点“#11:5”开始到顶点“#11:10”且与“class = Customer”相关的边。
Execute the following query to delete edges starting from the vertex ‘#11:5’ to the vertex ‘#11:10’ and which are related to ‘class = Customer’.
orientdb {db = demo}> DELETE EDGE FROM #11:5 TO #11:10 WHERE @class = 'Customer'
如果成功执行了以上查询,您会获得以下输出。
If the above query is executed successfully, you will get the following output.
Delete record(s) '2' in 0.00200 sec(s)