重命名现有的边关系? [英] Renaming existing edge relationships?

查看:58
本文介绍了重命名现有的边关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种简单的方法可以更新所有现有边缘关系的名称?

Is there a simple way to update the name of all of a type of existing edge relationships?

alter class EDGE_NAME name NEW_EDGE_NAME

更新基边类的名称,但不影响任何现有关系.

updates the name of the base edge class, but doesn't affect any existing relationships.

即:

create class Person extends V
create class Car extends V
create class OWNS extends E

create vertex Person set name="Bob"
create vertex Car set name="Jeep"

create edge OWNS from (select from Person where name="Bob") to (select from Car where name="Jeep")
alter class OWNS name DRIVES

除了删除旧的边类型并创建一个新的边类型之外什么都不做,不影响现有的关系(Bob 仍然拥有一辆吉普车,但 OWNS 不存在)

does nothing but delete the old edge type and create a new edge type, leaving the existing relationship unaffected (Bob still OWNS a Jeep, yet OWNS doesn't exist)

如果存在数以千计的这种关系,我们应该怎么做?

What are we supposed to do if thousands of these relationships exist?

推荐答案

您应该使用以下命令重命名属性,这些命令将复制到新名称并删除之前的输入和输出方向的名称:

You should rename attributes with the following commands that copy to the new name and drop the previous ones for both in and out directions:

UPDATE V SET out_DRIVES = out_OWNS where out_OWNS is not null
UPDATE V SET in_DRIVES = in_OWNS where in_OWNS is not null
UPDATE V REMOVE out_OWNS where out_OWNS is not null
UPDATE V REMOVE in_OWNS where in_OWNS is not null

这篇关于重命名现有的边关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆