Page MenuHomePhabricator

Integrate WLM-it app with Commons Structured Data
Closed, ResolvedPublic4 Estimated Story Points

Description

Example file without <file depicts (P180) something>:

https://commons.wikimedia.org/wiki/File:Catania_-_Chiesa_di_San_Sebastiano_-_2023-09-02.jpg

Example API to read claims from page ID 136822337:

https://commons.wikimedia.org/w/api.php?action=wbgetclaims&entity=M136822337


Example file with claim <file depicts (P180) Barack Obama (Q76)>:

https://commons.wikimedia.org/wiki/File:President_Barack_Obama_(cropped).jpg (page ID 53109362)

Example API to read claims from page ID 53109362:

https://commons.wikimedia.org/w/api.php?action=wbgetclaims&entity=M53109362

Example output:

"P180": [
    {
        "mainsnak": {
            "snaktype": "value",
            "property": "P180",
            "hash": "534f48f874f8846f8693121e1bab2d078a9c5b34",
            "datavalue": {
                "value": {
                    "entity-type": "item",
                    "numeric-id": 76,
                    "id": "Q76"
                },
                "type": "wikibase-entityid"
            },
            "datatype": "wikibase-item"
        },
        "type": "statement",
        "id": "M53109362$64a16f62-48f1-969b-6cf0-167df30ca65e",
        "rank": "preferred"
    }
],

How to save claims

Untested but suggested:

https://commons.wikimedia.org/w/api.php?action=help&modules=wbsetclaimvalue

Tested but probably over-complicated:

https://commons.wikimedia.org/w/api.php?action=help&modules=wbeditentity

Event Timeline

valerio.bozzolan triaged this task as Medium priority.
valerio.bozzolan lowered the priority of this task from Medium to Low.Sep 5 2023, 1:17 PM

The Wikidata JS API could be simply integrated into the backend of the app. If this is not included in the next developements (and it's a simple change that could be included), we can try to work on it together as soon as it is possible.

The feature is now available.

Property P180 (depicts) is populated with the Qxx identifier of the monument.

The feature is controlled by an opt-in/opt-out flag, which can be configured for each participating country.

Ysogo claimed this task.