Page MenuHomePhabricator

🧬 Wikibase GraphQL Prototype
Closed, ResolvedPublic13 Estimated Story Points

Description

As a follow-up to the work done in https://phabricator.wikimedia.org/T396983, we'd like to build a prototype for the labels of linked entities functionality in GraphQL on a publicly available wiki like beta or patch demo

Acceptance criteria:

  • For the endpoint itself, we'll limit it to a GET item/label and a GET item/statement
  • Ensure that only the labels of linked entities (statement property and statement value items) can be requested, and not everything else (for example, descriptions or subsequent statements and so on.)
  • statement value types that must be supported: string values and item values
  • The final endpoint will be exposed through a special page
  • if possible, check if we can make it easy to try out via GraphiQL client on another special page

Task breakdown

  1. create a special page that exposes a GraphQL endpoint
    • should allow for querying a single item and return its ID
    • example query: { item(id: "Q71") { id } }
  2. fetching labels of the item
    • { item(id: "Q71") { labels { ar de en } } }
  3. fetching statements of the item including statement property ids and labels
    • example query:
{
  item(id: "Q71") {
    statements {
      property { 
        id
        labels { en } 
      }
    }
  }
}
  1. Batching to ensure that statement property labels are queried at once (possibly together with the labels of the main item)
  2. Support querying statements with string values
    • filter out statements with value types we don't support
    • "type" for the value type might be a reserved keyword
    • example query:
{
  item(id: "Q71") {
    statements {
      property { 
        id
      }
      value {
        type
        content
      }
    }
  }
}
  1. Support item values
  2. Support labels of item values
  3. GraphiQL

Event Timeline

Jakob_WMDE set the point value for this task to 13.
Jakob_WMDE moved this task from Polished to Ready for planning on the Wikibase Reuse Team board.
Dima_Koushha_WMDE renamed this task from Proof of concept for Wikibase GraphQL to :graphql: Proof of concept for Wikibase GraphQL.Jul 22 2025, 12:08 PM
Dima_Koushha_WMDE renamed this task from :graphql: Proof of concept for Wikibase GraphQL to 🧬 Proof of concept for Wikibase GraphQL.Jul 22 2025, 12:09 PM
Jakob_WMDE renamed this task from 🧬 Proof of concept for Wikibase GraphQL to 🧬 Wikibase GraphQL Prototype.Jul 23 2025, 9:23 AM
Jakob_WMDE updated the task description. (Show Details)
Jakob_WMDE subscribed.

@Ifrahkhanyaree_WMDE can be verified on https://99f00a63c6.catalyst.wmcloud.org/wiki/Special:WikibaseGraphQLSandbox
Example query:

{
  item(id: "Q4") {
    labels { en de }

    statements {
      property {
        id 
        labels { en de }
      }
      value {
        ... on StringValue {
          content
        }
        ... on ItemValue {
          item: content {
            id
            labels { en de }
          }
        }
      }
    }
  }
}