PhiloBiblon / philobiblon-ui

PhiloBiblon UI
Creative Commons Attribution Share Alike 4.0 International
0 stars 0 forks source link

Edit item claims #36

Closed jmformenti closed 3 months ago

jmformenti commented 5 months ago

For that claims that use Q items as values, we need to limit the values that appear in the dropdown.

Depending on the claim Pnumber the list of values could change, so the proposal is use an strategy like: https://github.com/PhiloBiblon/philobiblon-ui/blob/master/frontend/components/QuerySearch.vue#L132 but indexing by property.

For example:

claim_autocomplete: {
  'P799': {
    items: [],
    sparqlQuery: 'SELECT ?itemLabel WHERE { VALUES ?item { wd:Q80 wd:Q81 } SERVICE wikibase:label { bd:serviceParam wikibase:language "${lang},en". } }'
  },
  ...
}

In this case, for the claim P799 (Dataset status) we will obtain the values for the dropdown using the related sparql query and the values will be cached in the items array.

In case that there is no an entry for the current property, we will obtain the values as we do now: https://github.com/PhiloBiblon/philobiblon-ui/blob/master/frontend/service/wikibase.service.js#L283

Definition of done

  1. For claims with an autocomplete defined, we will obtain the values from the related sparql query and cached in items.
  2. For claims without an autocomplete defined, we will obtain the values as we do now.
  3. Check that the values for the dropdown are using the current selected language.