Page MenuHomePhabricator

page/media - add structured metadata support
Open, NormalPublic

Description

What

Depicts statments were added to images from commons. The apps would like to display these depicts staments in the UI. The apps would also like to be able to display any additional metadata fields that are added via structured data on commons in the future

How

{
  "structured": {
    "pageid": 41837276,
    "ns": 6,
    "title": "File:Pluto-01 Stern 03 Pluto Color TXT.jpg",
    "lastrevid": 349086472,
    "modified": "2019-05-07T13:02:06Z",
    "type": "mediainfo",
    "id": "M41837276",
    "labels": {
      "en": {
        "language": "en",
        "value": "High-resolution MVIC image of Pluto in enhanced color to bring out differences in surface composition."
      }
    },
    "descriptions": {},
    "statements": {
      "P180": {
        "labels": {
          "en": {
            "language": "en",
            "value": "depicts"
          }
        },
        "values": [
          {
            "mainsnak": {
              "snaktype": "value",
              "property": "P180",
              "hash": "37091d3741ed1d6b19bf23f5947366650883be7d",
              "datavalue": {
                "value": {
                  "entity-type": "item",
                  "numeric-id": 339,
                  "id": "Q339",
                  "labels": {
                    "en": {
                      "language": "en",
                      "value": "Pluto"
                    }
                  }
                },
                "type": "wikibase-entityid"
              }
            },
            "type": "statement",
            "id": "M41837276$31a303cd-44a6-e116-09ab-fb02d71f2aef",
            "rank": "preferred"
          }
        ]
      }
    }
  }
}

Ideally this is a passthrough of the response from T224678 if the feature request is accepted and implemented

Event Timeline

JoeWalsh created this task.May 22 2019, 3:36 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 22 2019, 3:36 PM
LGoto triaged this task as Normal priority.May 22 2019, 3:39 PM
LGoto moved this task from Needs triage to Upcoming on the Product-Infrastructure-Team-Backlog board.

One thing to pause and think through here: do we want to handle this in a generic way from the start, by returning all data in the 'statements' category (perhaps with some modifications, like looking up and using the meanings of P-numbers rather than the raw P-numbers themselves)? Or do we want to add support for specific kinds of statements (such as 'depicts') one-by-one, as they are added in SDC?

Of course, handling just 'depicts' now doesn't preclude us doing something more generic later, but it would mean having to deprecate the initial handling, eventually removing it (and probably breaking some outdated Android clients in the process...)

Some raw wbgetentities output, for reference:
https://commons.wikimedia.org/w/api.php?action=wbgetentities&formatversion=2&ids=M41837276

@Mholloway a generic passthrough for all the statements seems fine (assuming the JSON structure won't change upstream). Thoughts @cooltey @Sharvaniharan @Dbrant?

generic passthrough for all the statements

That would be perfectly fine.

Aklapper renamed this task from page/media - add structured depicts statment support to page/media - add structured depicts statement support.May 28 2019, 8:25 PM

Per sync discussion, let's hold off until we've had a chat with the Wikibase maintainers about providing labels for Q-numbers in the claims.

JoeWalsh renamed this task from page/media - add structured depicts statement support to page/media - add structured metadata support.Jun 6 2019, 3:50 PM
JoeWalsh updated the task description. (Show Details)