我使用 try.zorba.io 我的代码(简化)是:
jsoniq version "1.0";
let $tweets :=
[
{
"id" : 1,
"user" : {
"id" : 1111,
"screen_name" : "Bobby"
}
},
{
"id" : 2,
"user" : {
"id" : 1111,
"screen_name" : "Bobby"
}
},
{
"id" : 3,
"user" : {
"id" : 2222,
"screen_name" : "Greg"
}
},
{
"id" : 4,
"user" : {
"id" : 3333,
"screen_name" : "Tom"
}
}
]
let $users :=
[
{
"screen_name" : "Julie",
"id" : 4444
}, {
"screen_name" : "Tom",
"id" : 3333
}, {
"screen_name" : "Greg",
"id" : 2222
}, {
"screen_name" : "Barb",
"id" : 5555
}, {
"screen_name" : "Bobby",
"id" : 1111
}, {
"screen_name" : "Yall",
"id" : 6666
}
]
我试图找出"screen_name"
所有$users
没有任何$tweets
. 我想我必须以empty(s)
某种方式使用该功能,但我不知道如何。这是我到目前为止的努力(但它不起作用,我的结果是空的):
for $t in members($tweets)
for $u in members($users)
for $r in members($users)
where $u."id" eq $t."user"."id"
where empty($r)
return $u."screen_name"
有什么建议吗?