Page MenuHomePhabricator

[Task] Provide JS with sufficient information to determine the human readable label given the vocabulary URI for a unit
Closed, ResolvedPublic

Description

The JS frontend needs a way to get a human readable label for a given vocabulary URI when initiating edit mode on an existing quantity value.

A vocabulary URI is a URI refering to a concept on the designated vocabulary repo. For now, the vocab repo is always the local repo, but in the future, the default vocab repo should be Wikidata. Cinceptually, vocab repo need not be Wikibase repos, and tehre could be more than one vocab repo.

For reference: the relevant functionality is implemented in the backend by EntityLabelUnitFormatter combined with a SuffixEntityIdParser.

Implementation options discussed:

  1. The JS frontend code could re-use the label that was already rendered into the HTML output by the backend. The unit label could be marked up with a special CSS class, or placed in a data attribute.
  2. The FormatValue API module could support formatting of vocabulary URIs. This would be achieved by introducing a (pseudo-)data type for vocab URIs (using string values). That data type would be somewhat complimentary to the proposed "ID" type: IDs would expand to URIs for normalization. Vocab URIs would be replaced by labels for display. Conceptually, they are quite similar though.
  3. Introduce a new API module for formatting vocab URIs.

After some exploration, we decided to go with option 1 for now. An API module as described for option 2 may still be useful, but is not necessary for the task at hand. Filed as T111219.

Event Timeline

daniel raised the priority of this task from to High.
daniel updated the task description. (Show Details)
daniel renamed this task from Implement a service for mapping a vocabulary URI to a human readable label. to [Task] Implement a service for mapping a vocabulary URI to a human readable label..Sep 2 2015, 2:46 PM
daniel updated the task description. (Show Details)
daniel set Security to None.
daniel renamed this task from [Task] Implement a service for mapping a vocabulary URI to a human readable label. to [Task] Provide JS with sufficient information to determine the human readable label given the vocabulary URI for a unit.Sep 2 2015, 5:25 PM
daniel updated the task description. (Show Details)