1

我是 Freebase 的新手并写了以下查询:

[{
  "key": "Ehingen",
  "postal_codes": [],
  "/location/statistical_region/population": [{
    "number": null,
    "year": null,
    "source": null
  }],
"type": "/location/citytown"
}]

如果有一个城市的Key,结果是正确的,但是当有多个时,我得到错误:

Unique query may have at most one result. Got 6

我必须如何正确编写代码?

感谢您的帮助

4

1 回答 1

2

目前尚不清楚您如何使用该key物业或您认为这意味着什么。键是强标识符,通常在单个命名空间中查找(例如英语维基百科、MusicBrainz、国会图书馆等)。查询不受命名空间约束的键值是非常不寻常的。

这是一个有效的最小转换:

[{
  "key": [{
    "value": "Ehingen",
    "namespace": null
  }],
  "postal_codes": [],
  "/location/statistical_region/population": [{
    "number": null,
    "year": null,
    "source": null
  }],
  "type": "/location/citytown"
}]

但你也可能意味着:

[{
  "name": "Ehingen",
  "postal_codes": [],
  "/location/statistical_region/population": [{
    "number": null,
    "year": null,
    "source": null
  }],
  "type": "/location/citytown"
}]

或者

[{
  "name~=": "Ehingen",
  "name": null,
  "postal_codes": [],
  "/location/statistical_region/population": [{
    "number": null,
    "year": null,
    "source": null
  }],
  "type": "/location/citytown"
}]

或者

[{
  "name~=": "Ehingen*",
  "name": null,
  "postal_codes": [],
  "/location/statistical_region/population": [{
    "number": null,
    "year": null,
    "source": null
  }],
  "type": "/location/citytown"
}]

其他可能性包括使用 Freebase Search API 和查询英语以外的其他语言。

于 2013-05-23T02:37:39.137 回答