2

I have a little problem, maybe can you help me. I'm trying to get the "currency features" from freebase. So I tried to do : "/base/schemastaging/person_extra/net_worth": null but, I can't get the value written on freebase (for example, with Madonna, it's 650,000,000). Do you know, why it's not working ?

4

1 回答 1

3

First of all, as the property path suggests, /base/schemastaging/person_extra/net_worth is just being staged right now so the final property ID will be something else (follow the mailing list to discuss new schema). You should NOT be using this property for anything other than experimentation.

The reason why you don't see the data that you want withe the following query is because this property is a CVT.

{
  "id":   "/en/madonna",
  "type": "/base/schemastaging/person_extra",
  "net_worth": null
}

CVT values are complex objects that need to be expanded to access the values that you want. In this case, net_worth is a CVT so that we can record a person's net worth at different points in time.

If you expand your query to include the relevant properties from /measurement_unit/dated_money_value you'll see the data that you're after.

{
  "id":   "/en/madonna",
  "type": "/base/schemastaging/person_extra",
  "net_worth": {
    "amount":     null,
    "currency":   null,
    "valid_date": null
  }
}

One other issue, that isn't obvious from this example, is that since there can be multiple dated money values, you'll need to make your query more precise so as to get only the latest value. You can do that like this;

{
  "id":   "/en/madonna",
  "type": "/base/schemastaging/person_extra",
  "net_worth": {
    "amount":     null,
    "currency":   null,
    "valid_date": null,
    "sort":       "-valid_date",
    "limit":      1,
    "optional":   true
  }
}​

Update: Made net worth an optional property value.

于 2012-11-01T19:30:59.317 回答