1

私は Freebase の初心者で、次のクエリを作成しました。

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

キーを持つ都市が 1 つある場合、結果は正しいですが、複数ある場合はエラーが発生します。

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 に答える