Page MenuHomePhabricator

[Story] JSON should (optionally) contain full URIs for referenced external entities
Open, NormalPublic


Wikidata contains a variety of properties that refer to external resources using standard identifiers for such resources, e.g. ISBN, VIAF, MusicBrainz, GND, etc. It should be possible for clients to resolve these to URIs automatically. Team decision: We include the URI expansion in the JSON representation of the respective Statement, as a second DataValue in the same Snak.

Currently, Wikibase knows nothing about the interpretation of external IDs, which are stored and interpreted as plain StringValues. In order to provide URI expansion, a new identifier DataType would be needed on top of StringValue. The base URI would be recorded as a new "base URI" property in the respective property definitions (in addition to the URL pattern for the formatter; both can but don't have to be the same; team decision: no fallback for these two URL/URI patterns for now).

NOTE: This ticket only covers the machine readable URI, not the "presentational" URL for the user interface.
TODO: All DataModel specifications (the abstract, the PHP and the JSON one) must be updated to describe the "additional values" stuff.



Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 3:50 AM
bzimport set Reference to bz71992.
bzimport added a subscriber: Unknown Object (MLST).
daniel created this task.Oct 13 2014, 11:42 AM
Lydia_Pintscher removed a subscriber: Unknown Object (MLST).
Lydia_Pintscher removed a subscriber: Unknown Object (MLST).
daniel added a comment.Feb 9 2015, 5:22 PM

Proposed representation in JSON:

"mainsnak": {
          "snaktype": "value",
          "property": "P214",
          "datatype": "string",
          "datavalue": {
              "value": "294687716",
              "type": "string"
          "datavalue-uri": {
              "value": "",
              "type": "string"

That is, next to the "datavalue" field of the snak, we introduce "datavalue-uri". Doing this on the snak level makes sense since expansion depends on the data type (rather than the value type). This conventiently allows the expansion to takle place in the snak serializer, and keeps knowledge about this out of the data value serializer.

Tpt added a subscriber: Tpt.Feb 17 2015, 9:36 PM
Jonas renamed this task from JSON should (optionally) contain full URIs for referenced external entities to [Story] JSON should (optionally) contain full URIs for referenced external entities.Aug 15 2015, 7:24 PM
Jonas set Security to None.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 15 2015, 7:24 PM
Jonas updated the task description. (Show Details)Aug 15 2015, 7:24 PM

To have the information of the URI mapping from the statement on the Property use the PropertyInfoBuilder.

Needs decision on how to deal with this information in relation to the DataModel. See for discussion on this.

thiemowmde updated the task description. (Show Details)Sep 8 2015, 1:09 PM
thiemowmde removed a subscriber: Wikidata-bugs.

I'm wondering if we still need this or if doing it in RDF was enough.