Jeroen I encourage you to look closely at JSON-LD, because this is
precisely the use case it was designed for.
Depending on how you choose to encode your data in JSON-LD, it need not
offer any additional complexities to a consumer of the data. For instance,
you can supply a link to a JSON-LD Context in an HTTP Link Header.
The big advantages of JSON-LD over other JSON-based representations of
linked data come from the use of the JSON-LD "Context". By associating the
JSON object with a Context, you can map from the strings used as JSON names
(such as "sister city") to full URIs such as (I'm guessing) <
https://www.wikidata.org/wiki/Property:P123>gt;. Data consumers who wish to
treat the JSON object simply as JSON can use the strings as keys, but
JSON-LD aware consumers can parse the data as RDF if they wish. Even
developers who don't use the JSON-LD features at runtime can at least use
them to identify the meanings of those strings when they are writing their
Javascript code.
Conal
On 3 December 2015 at 05:46, Jeroen De Dauw <jeroendedauw(a)gmail.com> wrote:
Hey,
Conal, thanks for explaining. The items are indeed not linked. Indeed, the
current format hides the fact that they are items altogether. Perhaps this
is going a step too far, and it is better to take an approach similar to
that of Hay: still have a dedicated wikibase-item data type for which the
value includes the id, but also the label. What are your thoughts on using
this approach [0]? (Everyone is welcome to comment on this.) As you can
see, it makes the format significantly more verbose and is not quite as
trivial to use when you don't care about the links or ids. It's still a lot
simpler than dealing with the canonical Wikibase item format, and perhaps
strikes a better balance than what I created initially.
[0]
https://gist.github.com/JeroenDeDauw/fc17f9fdd2e4567a17ff
And if the data serialization is JSON, why not
use JSON-LD which is
all the rage these days?
http://www.w3.org/TR/json-ld/
Thanks for the suggestion. I'm not really familiar with JSON-LD and
quickly read through the examples there. While this is certainly
interesting, I wonder what the actual benefits are, going on the assumption
that most developers are unfamiliar with this format. It does add
complexity, so I'm quite hesitant to use this in the main format. That
said, this might be a good candidate for an additional response format.
(And adding additional formats to the API in a clean way ought to be quite
easy, see
https://github.com/JeroenDeDauw/QueryrAPI/issues/39)
Cheers
--
Jeroen De Dauw -
http://www.bn2vs.com
Software craftsmanship advocate
~=[,,_,,]:3
_______________________________________________
Wikidata mailing list
Wikidata(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata
--
Conal Tuohy
http://conaltuohy.com/
@conal_tuohy
+61-466-324297