Orientdb &引用;值不是记录或记录id“;将批处理变量传递给“时”;set=";更新中
编辑:请参见底部,以在较小的统计/模式集上重现问题 我正在围绕OrientDB时间序列用例进行实验,并试图将两棵树的每一层链接起来。所以我做了这个sql批处理:Orientdb &引用;值不是记录或记录id“;将批处理变量传递给“时”;set=";更新中,orientdb,Orientdb,编辑:请参见底部,以在较小的统计/模式集上重现问题 我正在围绕OrientDB时间序列用例进行实验,并试图将两棵树的每一层链接起来。所以我做了这个sql批处理: let $w1 = select expand(W1[2406]) from #12:2; let $w2 = select expand(W1[2407]) from #12:2; let $d1 = select expand(D1[4]) from $w1; let $d2 = select expand(D1[0]) from
let $w1 = select expand(W1[2406]) from #12:2;
let $w2 = select expand(W1[2407]) from #12:2;
let $d1 = select expand(D1[4]) from $w1;
let $d2 = select expand(D1[0]) from $w2;
let $h1 = select expand(H1[23]) from $d1;
let $h2 = select expand(H1[0]) from $d2;
let $m1 = select expand(M1[59]) from $h1;
let $m2 = select expand(M1[0]) from $h2;
update $w1 set next = $w2;
update $w2 set previous = $w1;
update $d1 set next = $d2;
update $d2 set previous = $d1;
update $h1 set next = $h2;
update $h2 set previous = $h1;
update $m1 set next = $m2;
update $m2 set previous = $m1;
但是我在第一次更新时遇到了这个错误:
The field 'W1.next' has been declared as LINK but the value is not a record or a record-id
…我不明白,因为当我尝试:
return [$w1, $w2, $d1, $d2, $h1, $h2, $m1, $m2];
我得到了预期的记录
所以有两个问题:
Symbol{
W1 : LINKMAP W1
}
W1 {
next : LINK W1
previous : LINK W1
D1 : LINKMAP D1
}
D1 {
next : LINK D2
previous : LINK D2
H1 : LINKMAP H1
}
H1 [...]
M1 [...]
编辑:如何在较小的数据集上重现问题:
架构创建:
create class A extends V;
create class B extends V;
create property A.B LINKMAP B;
create property B.B LINK B;
注意:A.B是一个类似于B元素的数组,B.B是一个1到1链接
要插入的虚拟值:
insert into B CONTENT {}
insert into B CONTENT {}
现在,将两个假人的RID插入
select from B
现在插入以下两项(#13:0
和#13:1
,在我的情况下)
最后,尝试以下批次:
let $b1 = select expand(B[0]) from A;
let $b2 = select expand(B[1]) from A;
update $b1 SET B = $b2;
update $b2 SET B = $b1;
你看到错误了吗
字段“B.B”已声明为链接,但该值不是记录或记录id
但如果你这样做:
let $b1 = select expand(B[0]) from A;
let $b2 = select expand(B[1]) from A;
return $b1;
及
及
您可以看到它们不是集合,而是真正的记录
EDIT2 Isavio提供的解决方案有效,但我想知道为什么有效,因为在以前的结果中,它们似乎不是集合?
let $b1 = select expand(B[0]) from A;
let $b2 = select expand(B[1]) from A;
update $b1 SET B = $b2[0];
update $b2 SET B = $b1[0];
更新的结果可能是记录的集合吗?您可以尝试使用:
.....
update $w1 set next = $w2[0];
....
编辑
我认为使用LET总是会产生一个集合。嗨,你有一个简单的DB测试可以分享吗?嗯。。。是的,我想我可以给你一些东西扩展可以正常有效地工作,但我想知道为什么要验证答案;)(我的意思是,为什么
返回{'b1':$b1,'b2':$b2};
它不返回单例集合?
let $b1 = select expand(B[0]) from A;
let $b2 = select expand(B[1]) from A;
return {'b1': $b1, 'b2' : $b2};
let $b1 = select expand(B[0]) from A;
let $b2 = select expand(B[1]) from A;
update $b1 SET B = $b2[0];
update $b2 SET B = $b1[0];
.....
update $w1 set next = $w2[0];
....