Page MenuHomePhabricator

Resolve redirects for labels of item redirects used in statement/qualifier/reference values
Closed, ResolvedPublic5 Estimated Story Points

Description

When requesting data of a statement, qualifier or reference value where the value is a redirected item, we want the following behavior:

  • the ID should be the one of the redirect source
  • for labels, the redirect is resolved so that the label(s) of the redirect target are returned
  • no message is added to the extensions field in the response for this redirect

Example

  • Q1 has a statement linking to Q3 via property P1
  • Q3 is a redirect to Q2
  • Q2 has an english label "potato"

Request:

{
  item(id: "Q1") {
    statements(propertyId: "P1") {
      value {
        ... on ItemValue {
          id
          label(languageCode: "en")
        }
      }
    }
  }
}

Expected response:

{
  "data": {
    "item": {
      "statements": [
        {
          "value": {
            "id": "Q3",
            "label": "potato"
          }
        }
      ]
    }
  }
}

Task breakdown notes:

  • redirects should be resolved in the BatchGetItemLabels use case
  • there is probably an existing mechanism to resolve multiple item ids to the ids of their redirects since redirect labels are also resolved on the item page GUI

Event Timeline

Question for dev chat/refinement:

  1. Is the resolving happening currently without any notifications?
  2. Is the notification something we find useful to do? if yes, why?

Question for dev chat/refinement:

  1. Is the resolving happening currently without any notifications?

Contrary to what I claimed in Polishing, there's currently no resolving of statement value redirects. When the query asks for the statement value's Item ID, the redirect source ID will be returned, when the label is requested, the response will show null.

  1. Is the notification something we find useful to do? if yes, why?

We aren't quite sure which Item ID should be returned for redirected values (source or target?) but if we resolve the redirect, then the notification message including a list of mapped IDs sounds useful (as we're doing for redirected Items):

"extensions": {
  "message": "For at least one Item, redirects have been resolved automatically",
  "redirects": {
    "Q66": "Q162"
  }
}
Ifrahkhanyaree_WMDE set the point value for this task to 5.
Jakob_WMDE renamed this task from Handle item redirects in statement/qualifier/reference values to Resolve redirects for labels of item redirects used in statement/qualifier/reference values.Jan 15 2026, 12:06 PM
Jakob_WMDE updated the task description. (Show Details)

Change #1230349 had a related patch set uploaded (by Jakob; author: Jakob):

[mediawiki/extensions/Wikibase@master] GQL: Resolve redirects for labels in item values

https://gerrit.wikimedia.org/r/1230349

Change #1230349 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] GQL: Resolve redirects for labels in item values

https://gerrit.wikimedia.org/r/1230349