如何反转 MQL 查询(对于 freebase)?
How to invert the MQL query (for freebase)?
我正在尝试列出特定 ID 的所有类型:
{
"id": "/en/sony",
"type": [{
"name": "Topic",
"id": null
}]
}
这个查询给我以下结果:
http://tinyurl.com/lubavey
{
"result": {
"type": [
{
"id": "/common/topic",
"name": "Topic"
},
{
"id": "/base/audiobase/topic",
"name": "Topic"
},
{
"id": "/base/fblinux/topic",
"name": "Topic"
},
{
"id": "/base/digitalcameras/topic",
"name": "Topic"
},
{
"id": "/base/popstra/topic",
"name": "Topic"
},
{
"id": "/base/televisions/topic",
"name": "Topic"
},
{
"id": "/base/ps3games/topic",
"name": "Topic"
},
{
"id": "/base/filmcameras/topic",
"name": "Topic"
},
{
"id": "/m/04mny2g",
"name": "Topic"
}
],
"id": "/en/sony"
}
}
我想要完全相反的结果。我想要所有没有名称为 "Topic" 的类型。
我怎样才能做到这一点?我尝试将 !
运算符与 MQL 参考指南中建议的 属性 name
一起使用,但它给了我错误:
"Can't use unqualified property names with ! reversing".
我应该怎么做才能消除 !
的错误并获得相反的查询结果?
试试 !=
:
{
"id": "/en/sony",
"type": [{
"name!=": "Topic",
"id": null
}]
}
The != operator says that the constrained property can be anything but
the specified value. (It does require that the property be something,
however: it does not match object for which the property is null.)
在此处阅读有关 !=
运算符的更多信息:http://wiki.freebase.com/wiki/MQL_operators#The_.22but_not.22_Operator_.21.3D
我正在尝试列出特定 ID 的所有类型:
{
"id": "/en/sony",
"type": [{
"name": "Topic",
"id": null
}]
}
这个查询给我以下结果: http://tinyurl.com/lubavey
{
"result": {
"type": [
{
"id": "/common/topic",
"name": "Topic"
},
{
"id": "/base/audiobase/topic",
"name": "Topic"
},
{
"id": "/base/fblinux/topic",
"name": "Topic"
},
{
"id": "/base/digitalcameras/topic",
"name": "Topic"
},
{
"id": "/base/popstra/topic",
"name": "Topic"
},
{
"id": "/base/televisions/topic",
"name": "Topic"
},
{
"id": "/base/ps3games/topic",
"name": "Topic"
},
{
"id": "/base/filmcameras/topic",
"name": "Topic"
},
{
"id": "/m/04mny2g",
"name": "Topic"
}
],
"id": "/en/sony"
}
}
我想要完全相反的结果。我想要所有没有名称为 "Topic" 的类型。
我怎样才能做到这一点?我尝试将 !
运算符与 MQL 参考指南中建议的 属性 name
一起使用,但它给了我错误:
"Can't use unqualified property names with ! reversing".
我应该怎么做才能消除 !
的错误并获得相反的查询结果?
试试 !=
:
{
"id": "/en/sony",
"type": [{
"name!=": "Topic",
"id": null
}]
}
The != operator says that the constrained property can be anything but the specified value. (It does require that the property be something, however: it does not match object for which the property is null.)
在此处阅读有关 !=
运算符的更多信息:http://wiki.freebase.com/wiki/MQL_operators#The_.22but_not.22_Operator_.21.3D