valerio.bozzolan created this task.
valerio.bozzolan added a project: MediaWiki-extensions-WikibaseRepository.
Herald added a subscriber: Aklapper.
Herald added a project: Wikidata.

TASK DESCRIPTION

Prehamble

Knowing that the wbeditentity API module can be used to save a label/description, and that the add parameter can be used to don't overwrite an existing label/description, in the following way:

{
    "labels": [
        {
            "language": "en",
            "value": "English label that will be added without overwriting. It works!",
            "add": "1"
        }
    ]
}

...and knowing that the same API module can be used also to create claims, in the following way:

{
    "claims": {
        'P123': [ some statements on this property ]
    }
}

Bug

When doing both the actions in the same request (creating claims and adding unexisting labels/descriptions), it seems to ignore the add parameter, and labels/descriptions are overwrited.

As an example, look at this diff:

You can note that labels/descriptions were overwrited. But this was the data (note the add parameters):

This data reproduces the problem:

{
    "labels": [
        {
            "language": "en",
            "value": "Milos Culafic",
            "add": "1"
        },
        {
            "language": "it",
            "value": "Milos Culafic",
            "add": "1"
        }
    ],
    "descriptions": [
        {
            "language": "en",
            "value": "Montenegrin volleyball player",
            "add": "1"
        },
        {
            "language": "it",
            "value": "pallavolista montenegrino",
            "add": "1"
        }
    ],
    "claims": {
        "P18": [
            {
                "type": "statement",
                "rank": "normal",
                "references": [
                    {
                        "snaks": {
                            "P248": [
                                {
                                    "snaktype": "value",
                                    "property": "P248",
                                    "datatype": "wikibase-item",
                                    "datavalue": {
                                        "type": "wikibase-entityid",
                                        "value": {
                                            "entity-type": "item",
                                            "numeric-id": 16571730,
                                            "id": "Q16571730"
                                        }
                                    }
                                }
                            ]
                        }
                    }
                ],
                "mainsnak": {
                    "snaktype": "value",
                    "property": "P18",
                    "datatype": "commonsMedia",
                    "datavalue": {
                        "type": "string",
                        "value": "Milos Culafic (Legavolley 2017).jpg"
                    }
                }
            }
        ],
        "P373": [
            {
                "type": "statement",
                "rank": "normal",
                "references": [
                    {
                        "snaks": {
                            "P248": [
                                {
                                    "snaktype": "value",
                                    "property": "P248",
                                    "datatype": "wikibase-item",
                                    "datavalue": {
                                        "type": "wikibase-entityid",
                                        "value": {
                                            "entity-type": "item",
                                            "numeric-id": 16571730,
                                            "id": "Q16571730"
                                        }
                                    }
                                }
                            ]
                        }
                    }
                ],
                "mainsnak": {
                    "snaktype": "value",
                    "property": "P373",
                    "datatype": "string",
                    "datavalue": {
                        "type": "string",
                        "value": "Milos Culafic"
                    }
                }
            }
        ]
    }
}

As workaround I can don't rely on the add parameter and do some client-side decisions, comparing the existing labels/descriptions, and skipping the existings. I can also split in multiple request the labels/descriptions action versus the claims actions.


TASK DETAIL
https://phabricator.wikimedia.org/T183939

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: valerio.bozzolan
Cc: valerio.bozzolan, Aklapper, Lahi, Gq86, GoranSMilovanovic, QZanden, LawExplorer, Wikidata-bugs, aude, Mbch331
_______________________________________________
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to