0

この質問に加えて:リンク情報が入力されていないように見えるトピックから、テキストや地理位置情報などのデータを取得できるかどうかを尋ねています (ただし、ウィキペディアにはテキストの説明があります)。

4

1 に答える 1

1

So, the problem is that when you run the following query you don't get any results:

[{
  "name": "River Thames",
  "type": "/location/location",
  "geolocation": [{
    "latitude":  null,
    "longitude": null
  }],
  "/common/topic/article": [{
    "text": {
      "maxlength": 16384,
      "chars":     null
    }
  }]
}]​

Try it out

This is because Freebase doesn't have geocoordinates (yet) for a topic called "River Thames". In other words, there are no combination of facts in Freebase that will match this query structure exactly so it returns nothing. It does however have coordinates for the mouth of the river so you will get results for this similar query:

[{
  "name": "River Thames",
  "type": "/location/location",
  "/geography/river/mouth_long_lat": [{
    "latitude":  null,
    "longitude": null
  }],
  "/common/topic/article": [{
    "text": {
      "maxlength": 16384,
      "chars":     null
    }
  }]
}]​

Try it out

But what should you do if you don't know beforehand whether the data that you're looking for is completely filled out in Freebase yet?

You can mark certain parts of a query as being "optional" which means that they should be returned if the data is present but that the query should still return results even if that data isn't present. So for your original query that would look like this:

[{
  "name": "River Thames",
  "type": "/location/location",
  "geolocation": [{
    "latitude":  null,
    "longitude": null,
    "optional":  true
  }],
  "/common/topic/article": [{
    "text": {
      "maxlength": 16384,
      "chars":     null
    }
  }]
}]​

Try it out

Now you should get results with the text of the article present but the geolocation returned as an empty array.

One more thing I should point out is that you should be aware that the query you've written is asking for a list of ALL topics in Freebase with the name "River Thames". Right now, that query only returns one result but in the future, when more data is added to Freebase, it may return multiple results. If you're really only interested in THIS River Thames, you should query it using its unique MID like this:

{
  "id": "/m/0d2kt"
  "name": null,
  "type": "/location/location",
  "geolocation": [{
    "latitude":  null,
    "longitude": null,
    "optional":  true
  }],
  "/common/topic/article": [{
    "text": {
      "maxlength": 16384,
      "chars":     null
    }
  }]
}​

Try it out

于 2011-11-01T18:49:38.893 に答える