freebase MQL对此会查询什么



我想找IBM的首席执行官。对此的MQL查询是什么?

此搜索的MQL如下所示
这个特定的实例可能比必要的更复杂,因为我最初是从Freebase交互式搜索中得到的,然后只是手动添加/改进了过滤器
我用各种公司名称进行了验证,并取得了相对成功,即只要基础数据在Freebase中正确编码,它就可以工作(有些公司缺失,有些公司的领导层数据不完整等)
这个查询有几个技巧:

  • u0fitler中的公司名称需要与Freebase中记录的公司名称精确匹配。您可以使用contains谓词而不是equal谓词,但这可能会引入许多不相关的命中。例如,您需要使用"IBM"、"Apple股份有限公司"、"General Motors",而不是这些名称的常用替代名称("International Business Machines"、"苹果"、"通用汽车"…)
  • 领导角色上的u1过滤器用广泛的One of谓词表示,因为不幸的是,这些角色的命名相对宽松,重复(例如,可能是CEOChief Executive Officer),并且CEO的角色通常与其他公司角色相结合,如董事长和/或总裁等
  • 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": []
}

最新更新