Hi there,
I'm currently working on a .NET implementation of Wikibase API client, and have some (perhaps somewhat trivial) questions
Take the API response for wbgetentities on Q513 https://www.wikidata.org/wiki/Special:ApiSandbox#action=wbgetentities&forma t=json&uselang=en&ids=Q513&redirects=yes&props=claims&normalize=1 for example. In the response, we have a claim
.
"P625": [
{
"mainsnak": {
"snaktype": "value",
"property": "P625",
"hash": "72a03bd4ecbba1e7d0e0dfc2779ceccf9b2e0bcb",
"datavalue": {
"value": {
"latitude": 27.988055555556,
"longitude": 86.925277777778,
"altitude": null,
"precision": 0.00027777777777778,
"globe": "http://www.wikidata.org/entity/Q2"
},
"type": "globecoordinate"
},
"datatype": "globe-coordinate"
},
"type": "statement",
"id": "q513$6dcddd25-48a6-229a-0e36-31b122c2c813",
"rank": "normal",
"references": [
{
.
1. Is "altitude" attribute in "globe-coordinate" property type still in use? I saw this attribute in the API responses, but as far as I can observe, they are always null. Is this attribute either reserved for future use or obsoleted? (I've opened T177269 https://phabricator.wikimedia.org/T177269 but later thought that maybe mail list is more appropriate for this.)
2. Currently the "type" (in "datavalue" node) and "datatype" attributes seems somewhat duplicate, are you planning to make it possible for one "datatype" to support some other "type"s, to some extent similar to polymorphism?
Regards,
Xinyan
Hey,
Is "altitude" attribute in "globe-coordinate" property type still in use?
It is not in use and never really was. (Code indicating it is not in use: https://github.com/DataValues/Geo/blob/2d8e852d04318b13bd0db39b24afe7c56c61d... )
I'm not entirely sure why it is still in the API output and what the plans with it are, but my guess is that it is still there for compatibility reasons and that there is no intention of using this key in the future. If I where creating an API client I'd just ignore this key.
Currently the “type” (in “datavalue” node) and “datatype” attributes
seems somewhat duplicate, are you planning to make it possible for one “datatype” to support some other “type”s, to some extent similar to polymorphism?
The "type" key is part of the "datavalue" map, and indicates the type of the DataValue. The DataValues are what is used to represent all values. The "datatype" key is the type of the property. This latter type always has corresponding DataValue, but many property types can have the same DataValue. The property type can add restrictions on what the value can be. So you can have a "number DataValue" used by both a "number property type" and a "percentage property type", where the percentage one limits the allowed values to [0, 100].
Hopefully there is some user-facing documentation on this somewhere.
Cheers
-- Jeroen De Dauw | https://entropywins.wtf | https://keybase.io/jeroendedauw Software craftsmanship advocate | Developer at Wikimedia Germany ~=[,,_,,]:3
On 12 October 2017 at 04:08, CXY forest93@163.com wrote:
Hi there,
I'm currently working on a .NET implementation of Wikibase API client, and have some (perhaps somewhat trivial) questions
Take the API response for wbgetentities on Q513 https://www.wikidata.org/wiki/Special:ApiSandbox#action=wbgetentities&format=json&uselang=en&ids=Q513&redirects=yes&props=claims&normalize=1 for example. In the response, we have a claim
…
"P625": [
{ "mainsnak": { "snaktype": "value", "property": "P625", "hash": "72a03bd4ecbba1e7d0e0dfc2779ceccf9b2e0bcb", "datavalue": { "value": { "latitude": 27.988055555556, "longitude": 86.925277777778, "altitude": null, "precision": 0.00027777777777778, "globe": "http://www.wikidata.org/entity/Q2" }, "type": "globecoordinate" }, "datatype": "globe-coordinate" }, "type": "statement", "id": "q513$6dcddd25-48a6-229a-0e36-31b122c2c813", "rank": "normal", "references": [ {
…
- Is "altitude" attribute in "globe-coordinate" property type still
in use? I saw this attribute in the API responses, but as far as I can observe, they are always null. Is this attribute either reserved for future use or obsoleted? (I’ve opened T177269 https://phabricator.wikimedia.org/T177269but later thought that maybe mail list is more appropriate for this.)
- Currently the “type” (in “datavalue” node) and “datatype”
attributes seems somewhat duplicate, are you planning to make it possible for one “datatype” to support some other “type”s, to some extent similar to polymorphism?
Regards,
Xinyan
Wikidata-tech mailing list Wikidata-tech@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata-tech
Hi Jeroen,
Thanks for your explanation. As for the property type (“datatype”) / value type (“type”), I will make the assumption that one property type will corresponds to one value type, while one value type can be applied to different property types. Hope I didn’t make any mistake.
Regards,
Xinyan
From: wikidata-tech-bounces@lists.wikimedia.org [mailto:wikidata-tech-bounces@lists.wikimedia.org] On Behalf Of Jeroen De Dauw Sent: Thursday, October 12, 2017 12:10 PM To: Wikidata technical discussion wikidata-tech@lists.wikimedia.org Subject: Re: [Wikidata-tech] Some questions on Wikibase API
Hey,
Is "altitude" attribute in "globe-coordinate" property type still in use?
It is not in use and never really was. (Code indicating it is not in use: https://github.com/DataValues/Geo/blob/2d8e852d04318b13bd0db39b24afe7c56c61d...)
I'm not entirely sure why it is still in the API output and what the plans with it are, but my guess is that it is still there for compatibility reasons and that there is no intention of using this key in the future. If I where creating an API client I'd just ignore this key.
Currently the “type” (in “datavalue” node) and “datatype” attributes seems somewhat duplicate, are you planning to make it possible for one “datatype” to support some other “type”s, to some extent similar to polymorphism?
The "type" key is part of the "datavalue" map, and indicates the type of the DataValue. The DataValues are what is used to represent all values. The "datatype" key is the type of the property. This latter type always has corresponding DataValue, but many property types can have the same DataValue. The property type can add restrictions on what the value can be. So you can have a "number DataValue" used by both a "number property type" and a "percentage property type", where the percentage one limits the allowed values to [0, 100].
Hopefully there is some user-facing documentation on this somewhere.
Cheers
-- Jeroen De Dauw | https://entropywins.wtf | https://keybase.io/jeroendedauw
Software craftsmanship advocate | Developer at Wikimedia Germany
~=[,,_,,]:3
On 12 October 2017 at 04:08, CXY <forest93@163.com mailto:forest93@163.com > wrote:
Hi there,
I'm currently working on a .NET implementation of Wikibase API client, and have some (perhaps somewhat trivial) questions
Take the API response for wbgetentities on Q513 https://www.wikidata.org/wiki/Special:ApiSandbox#action=wbgetentities&format=json&uselang=en&ids=Q513&redirects=yes&props=claims&normalize=1 for example. In the response, we have a claim
…
"P625": [
{
"mainsnak": {
"snaktype": "value",
"property": "P625",
"hash": "72a03bd4ecbba1e7d0e0dfc2779ceccf9b2e0bcb",
"datavalue": {
"value": {
"latitude": 27.988055555556,
"longitude": 86.925277777778,
"altitude": null,
"precision": 0.00027777777777778,
"globe": "http://www.wikidata.org/entity/Q2"
},
"type": "globecoordinate"
},
"datatype": "globe-coordinate"
},
"type": "statement",
"id": "q513$6dcddd25-48a6-229a-0e36-31b122c2c813",
"rank": "normal",
"references": [
{
…
1. Is "altitude" attribute in "globe-coordinate" property type still in use? I saw this attribute in the API responses, but as far as I can observe, they are always null. Is this attribute either reserved for future use or obsoleted? (I’ve opened T177269 https://phabricator.wikimedia.org/T177269 but later thought that maybe mail list is more appropriate for this.)
2. Currently the “type” (in “datavalue” node) and “datatype” attributes seems somewhat duplicate, are you planning to make it possible for one “datatype” to support some other “type”s, to some extent similar to polymorphism?
Regards,
Xinyan
_______________________________________________ Wikidata-tech mailing list Wikidata-tech@lists.wikimedia.org mailto:Wikidata-tech@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata-tech
wikidata-tech@lists.wikimedia.org