Skip to main content

No project description provided

Project description

GitHub License GitHub issues Actions status image

Wikibase Migrator

WikibaseMigrator is a tool to migrate wikibase entities from one wikibase instance to another. During the migration process all used Item and Property IDs are mapped to the IDs from the target Wikibase instance.

Installation

Install wikibasemigrator after cloning with

pip install .

for development with

pip install .[test]

How to use

Web UI

The webserver can be started over the cli with

 wbmigrate webserver --config FactGrid.yaml --host localhost --port 9100

or with docker

CLI Tool

After installing the project cli is available under the name ẁbmigrate

wbmigrate --help
 Usage: wbmigrate [OPTIONS] COMMAND [ARGS]...                                                                 
                                                                                                              
╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --install-completion          Install completion for the current shell.                                    │
│ --show-completion             Show completion for the current shell, to copy it or customize the           │
│                               installation.                                                                │
│ --help                        Show this message and exit.                                                  │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ─────────────────────────────────────────────────────────────────────────────────────────────────╮
│ app         Run the WikibaseMigrator web server as local app Note: Experimental feature as some of the     │
│             imported resources are not localized yet                                                       │
│ webserver   Start the WikibaseMigrator web server                                                          │
│ migrate     Migrate the provided entities                                                                  │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

wbmigrate migrate

wbmigrate migrate --help
 Usage: wbmigrate migrate [OPTIONS]                                                                           
                                                                                                              
 Migrate the provided entities                                                                                
                                                                                                              
╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────╮
│ *  --config                               TEXT  The configuration file defining the Wikibases              │
│                                                 [default: None]                                            │
│                                                 [required]                                                 │
│ *  --summary                              TEXT  Summary message to add to the wikibase edits               │
│                                                 [default: None]                                            │
│                                                 [required]                                                 │
│    --entity                               TEXT  The items to migrate [default: None]                       │
│    --query                                TEXT  The query querying the items to migrate. The items to      │
│                                                 migrate must have the binding ?items                       │
│                                                 [default: None]                                            │
│    --query-file                           TEXT  The query file with a query querying the items to migrate. │
│                                                 The items to migrate must have the binding ?item           │
│                                                 [default: None]                                            │
│    --show-details    --no-show-details          Show detailed information during the migration process     │
│                                                 [default: no-show-details]                                 │
│    --force           --no-force                 If True migrate items directly to target wikibase          │
│                                                 [default: no-force]                                        │
│    --help                                       Show this message and exit.                                │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

wbmigrate webserver

wbmigrate webserver --help
 Usage: wbmigrate webserver [OPTIONS]                                                                         
                                                                                                              
 Start the WikibaseMigrator web server                                                                        
                                                                                                              
╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────╮
│ *  --config        TEXT     The configuration file defining the Wikibases [default: None] [required]       │
│    --host          TEXT     host of the webserver [default: 0.0.0.0]                                       │
│    --port          INTEGER  port of the webserver [default: 8080]                                          │
│    --help                   Show this message and exit.                                                    │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Migration Pipeline

flowchart TD
    source[(source Wikibase)]
    target[(target Wikibase)]
    config@{ shape: doc, label: "Mapping Profile" }
    A@{ shape: circle, label: "Start" }
    A-- provide --> B(Entity IDs)
    B--start-->t
    config-->t
    q1<-.query.->target
        q3<-.query.->target
    subgraph Migrate
    subgraph Translation
            direction LR
            t@{ shape: sm-circ, label: "Small start" }
            t-->q1
            q1[[query mappings]]
            t-->q2[[query entity records]]
            ser@{ shape: docs, label: "Source Entity Records"}
            q2--result-->ser
            map@{ shape: doc, label: "Mapping Table" }
            q1--result-->map
            translate[translate]
            map-->translate
            ser-->translate
            translate-->TranslationResults@{ shape: docs, label: "Translated Entities"}
            
            
        end
        ex{exists<br>in target?}
        TranslationResults --> ex
        ex --noo-->TranslationResultsFinal
        ex --yes-->m
        TranslationResultsFinal@{ shape: docs, label: "Translated & Merged Entities"}
        mergedEntities-->TranslationResultsFinal

        subgraph merge
                m@{ shape: sm-circ, label: "Small start" }
                q3[[query entity records]]
                m-->q3
                targetEntities@{ shape: docs, label: "Target Entities"}
                translatedEntities@{ shape: docs, label: "Translated Entities"}
                q3--result-->targetEntities
                m-->translatedEntities
                merger[merge]
                translatedEntities-->merger
                targetEntities-->merger
                mergedEntities@{ shape: docs, label: "Merged Entities"}
                merger-->mergedEntities
            end
        migrator[migrate]
    end
    q2<-.query.->source
    TranslationResultsFinal-->migrator
    migrator --write--> target
    stop@{ shape: framed-circle, label: "Stop" }
    migrator-->stop

Mering Entities

If an entity already exists in the target wikibase instance the source entity is first translated to the target and than merged with the target entity. The merging of entities differs from the default wikibase entity merging for cases where the statement does not have qualifiers. In this case if the statement value is equal the qualifiers of the source are merged into the target. Otherwise, the merge results in an additional statement to preserve both qualifier information (equal to the wikibase entity merge)

Acknowledgements

This project was funded by FactGrid

Licence

This repository is licensed under the Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wikibasemigrator-0.0.8.tar.gz (394.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wikibasemigrator-0.0.8-py3-none-any.whl (172.1 kB view details)

Uploaded Python 3

File details

Details for the file wikibasemigrator-0.0.8.tar.gz.

File metadata

  • Download URL: wikibasemigrator-0.0.8.tar.gz
  • Upload date:
  • Size: 394.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for wikibasemigrator-0.0.8.tar.gz
Algorithm Hash digest
SHA256 7c92971bb9eba4c4d6a264b3085be0706b26c587f1eed4007ce6c62baf774eb1
MD5 a8a4087144c0e42266cd0e3addad13f2
BLAKE2b-256 23081932784def20e8166e2976b0f679eed7ed2c0dbfa49b9842c47e1349549b

See more details on using hashes here.

Provenance

The following attestation bundles were made for wikibasemigrator-0.0.8.tar.gz:

Publisher: python-publish.yml on tholzheim/WikibaseMigrator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wikibasemigrator-0.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for wikibasemigrator-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 1616cfe59bb336d3086352d063383784dba6fe3f4af59ff9f0b5ea77a0459b9b
MD5 f5c6ddadbc626fd6893676c3ff4beae3
BLAKE2b-256 ac19de7bfa5386bf917c1604e027f54e0e458ec131dc0d6e78820957479c5e36

See more details on using hashes here.

Provenance

The following attestation bundles were made for wikibasemigrator-0.0.8-py3-none-any.whl:

Publisher: python-publish.yml on tholzheim/WikibaseMigrator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page