我想找IBM的CEO。对此的 MQL 查询是什么?
问问题
276 次
1 回答
1
此搜索的 MQL 如下所示。
这个特定的实例可能比必要的更复杂,因为我最初是从 Freebase 交互式搜索生成的,然后手动添加/改进了过滤器。
我用各种公司名称验证了它并取得了相对的成功,即它的工作原理是在 Freebase 中正确编码了基础数据(一些公司丢失,一些公司的领导数据不完整等)
这个查询有一些技巧:
- fitler中的公司名称需要与Freebase 中记录
u0
的公司名称精确匹配。您可以使用谓词而不是谓词,但这可能会引入许多不相关的命中。例如,您需要使用“IBM”、“Apple Inc.”、“General Motors”而不是这些名称的常见替代品(“International Business Machines”、“Apple”、“GM”...”)contains
equal
- 关于领导角色的
u1
过滤器以广泛的谓词表达,因为不幸的是,这些角色的命名相对宽松,有重复(例如可能是或),而且 CEO 的角色通常与其他公司角色相结合,例如主席 [董事会] 和/或总裁等。我通过首先查找(在 Freebase 中)包含“CEO”或“首席执行官”的领导角色实例来手动选择此列表。One of
CEO
Chief Executive Officer
u2
过滤器表示日期应该为to
空,仅选择当前在职的人,而不是前任 CEO(希望 Freebase 记录其任期的结束日期)。
根据您的应用程序,您可能需要测试查询是否返回一条且恰好一条记录,如果没有则相应地进行调整。
Freebase MQL 编辑器是一种方便的工具测试和编辑这种查询。
[
{
"from": null,
"id": null,
"limit": 20,
"organization": {
"id": null,
"name": null,
"optional": true
},
"person": {
"id": null,
"name": null,
"optional": true
},
"role": {
"id": null,
"name": null,
"optional": true
},
"s0:type": [
{
"id": "/organization/leadership",
"link": [
{
"timestamp": [
{
"optional": true,
"type": "/type/datetime",
"value": null
}
],
"type": "/type/link"
}
],
"type": "/type/type"
}
],
"sort": "s0:type.link.timestamp.value",
"title": null,
"to": null,
"type": "/organization/leadership",
"u0:organization": [
{
"id": null,
"name": "IBM",
"type": "/organization/organization"
}
],
"u1:role": [
{
"id": null,
"name|=": ["Chief Executive Officer", "President and CEO", "Chairman and CEO", "Interim CEO", "Interim Chief Executive Officer", "Founder and CEO", "Chairman, President and CEO", "Managing Director and CEO", "Executive Vice President and Chief Operating Officer", "Co-Founder, Chairman and Chief Executive Officer"],
"type": "/organization/role"
}
],
"u2:to": [
{
"value": null,
"optional": "forbidden"
}
]
}
]
样品退货(专门针对“IBM”)
{
"code": "/api/status/ok",
"result": [{
"from": "2012-01-01",
"id": "/m/09t7b08",
"organization": {
"id": "/en/ibm",
"name": "IBM"
},
"person": {
"id": "/en/virginia_m_rometty",
"name": "Virginia M. Rometty"
},
"role": {
"id": "/en/chairman_president_and_ceo",
"name": "Chairman, President and CEO"
},
"s0:type": [{
"id": "/organization/leadership",
"link": [{
"timestamp": [{
"type": "/type/datetime",
"value": "2010-01-23T08:02:57.0006Z"
}],
"type": "/type/link"
}],
"type": "/type/type"
}],
"title": "Chairman, President and CEO",
"to": null,
"type": "/organization/leadership",
"u0:organization": [{
"id": "/en/ibm",
"name": "IBM",
"type": "/organization/organization"
}],
"u1:role": [{
"id": "/en/chairman_president_and_ceo",
"type": "/organization/role"
}],
"u2:to": []
}
于 2013-02-16T20:09:31.620 回答