Page MenuHomePhabricator

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

Description

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.

Details

Reference
bz71992

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:50 AM
bzimport set Reference to bz71992.
bzimport added a subscriber: Unknown Object (MLST).
Lydia_Pintscher removed a subscriber: Unknown Object (MLST).
Lydia_Pintscher removed a subscriber: Unknown Object (MLST).

Proposed representation in JSON:

"mainsnak": {
          "snaktype": "value",
          "property": "P214",
          "datatype": "string",
          "datavalue": {
              "value": "294687716",
              "type": "string"
          },
          "datavalue-uri": {
              "value": "https://viaf.org/viaf/294687716/",
              "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.

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.

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 https://github.com/wmde/WikibaseDataModelSerialization/pull/171#issuecomment-138296191 for discussion on this.

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