我要找IBM的首席执行官。对此的MQL查询是什么?
发布于 2013-02-17 04:09:32
此搜索的MQL如下所示。
这个特殊的实例可能比必要的复杂,因为我最初是从Freebase交互式搜索中获得它的,然后只是手动添加/改进了过滤器。
我用不同的公司名称进行了验证,并取得了相对的成功,例如,如果底层数据在Freebase中被正确编码,它就可以工作(一些公司缺失了,对于一些公司来说领导数据不完整等等)。
这个查询有几个技巧:
u0中的公司名称需要与Freebase中记录的公司名称精确匹配。您可以使用contains谓词而不是equal谓词,但这可能会引入许多不相关的结果。例如,您需要使用“国际商用机器公司”、“苹果公司”、“通用汽车公司”而不是这些名称(“国际商业机器公司”、“苹果公司”、“通用汽车公司”)的常见替代名称("International Business Machines","Apple",“GM”...)u1 filter,在One of谓词中表示领导角色,因为不幸的是,这些角色的术语相对宽松,我精心挑选了这个列表,首先(在Freebase中)查找包含“CEO”或“Chief Executive Officer u2 filter”的领导角色的实例,以便只选择当前任职的人,而不是前任CEO (希望Freebase记录了他们任期的结束日期)。根据您的应用程序,您可能需要测试查询是否返回一条且恰好一条记录,如果不是,则进行相应的调整。
是一个测试和编辑这类查询的便捷工具。
[
{
"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": []
}https://stackoverflow.com/questions/13394483
复制相似问题