orientdb sql更新边缘?

问题描述 投票:1回答:2

我一直在乱用orientdb sql,我想知道是否有办法更新顶点的边缘,以及它上面的一些数据。

假设我有以下数据:顶点:人,房间边缘:内部(从人到房间)

就像是:

UPDATE Persons SET phone=000000, out_Inside=(
    select @rid from Rooms where room_id=5) where person_id=8

显然,上述方法不起作用。它抛出异常:

Error: java.lang.ClassCastException: com.orientechnologies.orient.core.id.ORecordId cannot be cast to com.orientechnologies.orient.core.db.record.ridbag.ORidBag

我试着查看github上的源代码,搜索包含1个项目的包的语法,但找不到任何内容(找到%,但这似乎是针对SQL的序列化否)。

(1)那有什么办法吗?如何更新连接?有没有办法,还是我被迫创造新的优势,并删除旧的?

(2)在写这篇文章的时候,我想到在这种情况下也许边缘不是可行的。也许我应该使用LINK代替。我不得不说我不确定何时使用它们,或者使用它们的含义是什么。我确实找到了这个:

https://groups.google.com/forum/#!topic/orient-database/xXlNNXHI1UE

来自Lvc @顶部的评论3,他说:

"The suggested way is to always create an edge for relationships"

此外,即使我应该使用链接,请回复(1)。无论如何,我很乐意知道答案。

附:在我的场景中,一个人只能在一个房间。这很可能在将来不会改变。显然,边缘的优点是,如果我想要改变它(无论多么不可能),它将非常容易。

Solution (partial)

(1)解决方案只是删除字段选择。感谢Lvca指出它!

(2) - 还不确定 -

sql hyperlink orientdb graph-databases
2个回答
2
投票

CREATE EDGEDELETE EDGE命令有这个目标:避免用户与底层结构作斗争。

但是如果你想这样做(有点“脏”),试试这个:

UPDATE Persons SET phone=000000, out_Inside=(
  select from Rooms where room_id=5) where person_id=8

0
投票
update EDGE Custom_Family_Of_Custom 
set survey_status = '%s', 
apply_source = '%s' 
where @rid in (
select level1_e.@rid from (
MATCH {class: Custom, as: custom, where: (custom_uuid = '%s')}.bothE('Custom_Family_Of_Custom') {as: level1_e} .bothV('Custom') {as: level1_v, where: (custom_uuid = '%s')} return level1_e
)
)

它运作良好

© www.soinside.com 2019 - 2024. All rights reserved.