Page MenuHomePhabricator

Investigate why import of entities fails
Open, Needs TriagePublicBUG REPORT

Description

Import of entities from Wikidata fails if there are already items in the Wikibase that violate the rules for duplicates.

Specifically:

  • properties with matching language+label combination are not allowed in a Wikibase
  • items with matching language+label+description combination are not allowed in a Wikibase (unless description is empty - then it's fine).

We could approach fixing this in an iterative way:
First (T381996),

  • If a conflict is encountered, the conflicting entity is gracefully skipped.
  • For each import, we keep track of which entities were successfully imported and which were skipped due to a conflict.
  • Ideally, save the log of the error in the database for skipped entities, so we could analyze why entities are being skipped (in case there are some other potential rules that we are still not aware of).
  • Consider import a 'partial' success (new status) even if some/all entities were skipped due to such conflicts.
  • Show an import report to the user that lists entities that were imported successfully and those that were skipped due to conflicts with existing entities in the Wikibase.

Then:

  • The 'no more than one import per Wikibase' restriction could pretty much be removed.

Later:

  • Predict which of the imported entities will conflict with those already existing in the Wikibase and show in UI before the user starts the import.

This sequence is based on the assumption that it is easier to catch errors during import than to write logic for prevention of those errors.

Related Objects

StatusSubtypeAssignedTask
ResolvedGoalAnton.Kokh
OpenBUG REPORTNone
OpenCharlie_WMDE

Event Timeline

Here is one job that's still trying and probably won't work. Transferbot is getting a 404 but why!

k logs job/run-transferbot-xhwlk -n api-jobs
https://lexicobase.wikibase.cloud/w/api.php?action=wbeditentity&format=json
    Could not parse response: You have requested the domain: lexicobase.wikibase.cloud. But that wiki can not currently be loaded.<br/>It may never have existed or it might now be deleted.<br/>Failure looking up wiki lexicobase.wikibase.cloud.<br/>You can check the platform status at <a href="https://status.wikibase.cloud">status.wikibase.cloud</a>.<br/>
    retrying in 270s (attempt: 54, maxlag: 5s)

1 problem discovered - people deleting wikibase before the import finishes (then it stays in Pending)
Still to find out why the thing fails.

Seems like also a lot of our failures are from people running an import a second time and of course that then introduces label conflicts. This can be seen in the logs as:

"*": "Property <a href=\"/wiki/Property:P10\" title=\"Property:P10\">P10</a> already has label \"Vader\" associated with language code af."

Anton.Kokh changed the subtype of this task from "Task" to "Bug Report".Dec 11 2024, 12:47 PM

Looking at another wiki e-lit.wikibase.cloud. the errors we saw look like. This seems to be due to users having already created some entities with the names of ones we are importing

"*": "Property <a href=\"/wiki/Property:P1\" title=\"Property:P1\">P1</a> already has label \"instance of\" associated with language code en."
Traceback (most recent call last):
  File "/usr/bin/mangle_data", line 55, in <module>
    main()
  File "/usr/bin/mangle_data", line 51, in main
    print(json.dumps(out, ensure_ascii=False))
BrokenPipeError: [Errno 32] Broken pipe
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe