我似乎只能使用新的freebase MQL读取API执行唯一查询(即在查询中包含实体ID):
以下搜索id和type:
https://www.googleapis.com/freebase/v1/mqlread?query={"name":null,"id":"/en/bob_dylan","type":"/people/person"}
并成功返回:
{
"result": {
"type": "/people/person",
"id": "/en/bob_dylan",
"name": "Bob Dylan"
}
}
以下搜索仅使用类型:
https://www.googleapis.com/freebase/v1/mqlread?query={"name":null,"type":"/people/person"}
或
https://www.googleapis.com/freebase/v1/mqlread?query={"name":[],"type":"/people/person"}
并返回以下错误:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "badRequest",
"message": "Unique query may have at most one result. Got 100"
}
],
"code": 400,
"message": "Unique query may have at most one result. Got 100"
}
}
我希望它能够返回一个人名列表
答案 0 :(得分:6)
您必须在[]中包装查询,如下例所示:
https://www.googleapis.com/freebase/v1/mqlread?query=[{"name":[],"type":"/people/person"}]
答案 1 :(得分:1)
我最近也遇到过类似的问题。确保获得单个结果集的最佳方法是在mql查询中使用“limit:1”参数。 例如:
https://www.googleapis.com/freebase/v1/mqlread?query={"type":[],"name":"india","limit":1}