On 17.10.2012 13:20, Andreas Schultz wrote:
Wouldn't a representation like the following be
more
appropriate?
"value": {
"latitude" : 32.233,
"longitude" : -2.233,
}
That is, if "snaktype": "value", then there has to be a
"value" key
with a data type specific value object.
I agree - it should either be "value", or the same as the top-level property, as
in:
"location": {
"location": {
"latitude" : 32.233,
"longitude" : -2.233,
}
"as-of": {
...
}
}
Something that imho would also be useful, is a way to
specify the data
type - this could be optional. For the Geo example something like the
following would make sense:
"datatype": "geo"
Without such a definition, a consumer would have to derive the data
type from the keys and/or the lexical representation of the values,
which would usually be a tough task.
I agree that at least for the external representation, every value should always
be accompanied by its data type. It's just a pain having to look up the data
type, or maintain a mapping locally.
The question is how to represent this structurally.
"location": {
"value": {
"value": {
"latitude" : 32.233,
"longitude" : -2.233,
},
"type": "geo"
}
}
or, resp:
"location": {
"location": {
"value": {
"latitude" : 32.233,
"longitude" : -2.233,
},
"type": "geo"
}
}
The latter makes more sense to me. But it's a lot of overhead. Alternatively:
"location": {
"value": {
"_type": "geo"
"latitude" : 32.233,
"longitude" : -2.233,
},
}
Using "magic" keys (prefixed with "_" or whatever) is kind of nasty,
but saves
quite a bit of structural complexity.
-- daniel
--
Daniel Kinzler, Softwarearchitekt
Wikimedia Deutschland - Gesellschaft zur Förderung Freien Wissens e. V.