Page MenuHomePhabricator

[Federated Values] Client Remote Items handling and display
Open, Needs TriagePublic

Description

Summary

When a Wikibase repository uses Federated Values (Remote Items from Wikidata as statement values), Client wikis (e.g., Wikipedia consuming data from that repository) need appropriate handling to parse, lookup, and display these Remote Items.

Problem

The current Client code path does not recognize RemoteEntityId (concept URI-based entity IDs). When Client attempts to:

  1. Parse entity IDs from repository data containing Remote Items
  2. Look up entity data for formatting/display
  3. Format entity values for Lua/Scribunto or wikitext output

...it will fail or produce incorrect results because:

  • WikibaseClient.EntityIdParser uses DispatchingEntityIdParser which doesn't understand concept URIs
  • WikibaseClient.EntityLookup doesn't know how to resolve RemoteEntityId
  • Client's DataAccessSnakFormatterFactory and value formatters don't have the RemoteEntityIdValueFormatter decoration

Scope

  1. Entity ID Parsing in Client: Extend Client's entity ID parsing to recognize concept URI format (e.g., https://www.wikidata.org/entity/Q42). Either:
    • Wire in RemoteEntityIdParser as a decorator in Client
    • Or ensure the serialized format coming from Repo is already resolved
  1. Entity Lookup in Client: When Client encounters a RemoteEntityId in statement data, it needs to either:
    • Have access to the cached entity data from the repository's wb_remote_entity table
    • Fetch from the remote source directly
    • Display a minimal fallback (ID only, link to source)
  1. Value Formatting in Client:
    • Lua/Scribunto access (mw.wikibase.getEntity(), mw.wikibase.formatValue())
    • Wikitext rendering of statements containing Remote Items
    • Ensure links point to the remote source (Wikidata), not the local repository
  1. Usage Tracking: How should Remote Item usage be tracked in Client? Currently UsageTrackingSnakFormatter adds label/title usage for entity values.

Questions

  • How should Remote Items appear in Lua table output from mw.wikibase.getEntity()?
  • Should there be a visual distinction for Remote Items in Client-rendered output?
  • What happens if the repository has Remote Items but Client doesn't have the feature enabled?

Event Timeline

lojo_wmde renamed this task from [Federated Values MVP] Client Remote Items handling and display to [Federated Values] Client Remote Items handling and display.Thu, Dec 4, 1:50 PM