Page MenuHomePhabricator

Support for labels and descriptions
Closed, ResolvedPublic

Description

integraality currently only supports properties (and properties with qualifiers).

There is no reason we could not support computing completion for labels and/or descriptions in a given language (Originally reported by @Raimund-Liebert-WMAT).

To sort out:

Syntax

We need a syntax for configuring this in the {Property dashboard template}.

Integraality so far borrowed the Listeria syntax:

  • labels use label/xx (with xx the language code, eg label/de)
  • description use description ; there does not seem to support languages, but we could extend naturally to description/xx

Although I find the QuickStatements syntax maybe more elegant:

  • labels use Lxx (with xx the langcode)
  • descriptions use Dxx (ditto)

→ TODO: decide on which syntax to use.

SPARQL

We need the relevant SPARQL queries for:

  • Items within a group with a given label
  • Items within a group without a given label
  • Items with no group with a given label
  • Items with no group without a given label
  • Total Items with a given label
  • Total Items without a given label

Coding

First rough plan:

  1. in property_statistics.py:
    1. Create an equivalent to PropertyConfig (or extend it?) for Labels/Descriptions
    2. Create all methods with the SPARQL queries
    3. Get these methods used:
      1. Either if/else call them in the make_*
      2. Alternatively, move these methods to the PropertyConfig object, and rely on polymorphism.
  2. in pages_processor, extend parse_config_properties to support the new syntax and create the 1.A object.

Event Timeline

JeanFred created this task.Mar 29 2020, 2:14 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 29 2020, 2:14 PM
JeanFred triaged this task as Medium priority.Mar 29 2020, 2:15 PM
JeanFred raised the priority of this task from Medium to High.Apr 16 2020, 10:48 AM
JeanFred moved this task from Backlog to Enhancements on the Tool-inteGraality board.
JeanFred updated the task description. (Show Details)Apr 16 2020, 10:50 AM

Regarding the syntax I brainstormed with @VIGNERON and the QS syntax is the winner :)

Items within a group with a given label

SELECT DISTINCT ?entity ?entityLabel ?value ?valueLabel WHERE {
  ?entity wdt:P31 wd:Q41960;
    wdt:P551 wd:Q3115846.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "fr". }
  FILTER(EXISTS {
    ?entity rdfs:label ?lang_label.
    FILTER((LANG(?lang_label)) = "de")
  })
}

Items within a group without a given label

SELECT DISTINCT ?entity ?entityLabel ?value ?valueLabel WHERE {
  ?entity wdt:P31 wd:Q41960;
    wdt:P551 wd:Q3115846.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "fr". }
  FILTER(NOT EXISTS {
    ?entity rdfs:label ?lang_label.
    FILTER((LANG(?lang_label)) = "de")
  })
}

And for descriptions: use schema:description

Mentioned in SAL (#wikimedia-cloud) [2020-04-24T22:22:06Z] <wm-bot> <jeanfred> Deploy latest from Git master: 6963040, 35a3ea7, 22e27b5, 9dd44ff, 0e45815, 6f36ffd (T248788)

With R2566:6f36ffd616e9, there is partial support for labels: statistics will be computer with the Lde syntax − see eg https://www.wikidata.org/wiki/User:Jean-Fr%C3%A9d%C3%A9ric/Red_Pandas.

Still missing is:

  • Looking glass feature / Todo mode
  • Descriptions

Mentioned in SAL (#wikimedia-cloud) [2020-04-29T20:33:48Z] <wm-bot> <jeanfred> Deploy latest from Git master: eabbac8, b74b352 (T248788)

With R2566:b74b35227cf9, the queries feature is working as well.

Mentioned in SAL (#wikimedia-cloud) [2020-05-01T22:58:59Z] <wm-bot> <jeanfred> Deploy latest from Git master: f0db935, f8d9fdf, f57c060, 6c534b7 (T248788)

JeanFred closed this task as Resolved.May 9 2020, 5:01 PM
JeanFred claimed this task.

Closing this as resolved, as most of the functionality is there. Follow-up work can be filed as separate tasks.