wikibasemigrator

A Python module to migrate entities from one Wikibase instance to another

https://github.com/tholzheim/wikibasemigrator

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 1 committers (100.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.5%) to scientific vocabulary
Last synced: 7 months ago · JSON representation ·

Repository

A Python module to migrate entities from one Wikibase instance to another

Basic Info
  • Host: GitHub
  • Owner: tholzheim
  • License: apache-2.0
  • Language: Python
  • Default Branch: master
  • Size: 448 KB
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • Open Issues: 6
  • Releases: 16
Created over 1 year ago · Last pushed 9 months ago
Metadata Files
Readme License Code of conduct Citation

README.md

PyPI - Version image GitHub License GitHub issues Actions status Docker Pulls

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

shell pip install wikibasemigrator

for Development

Install WikibaseMigrator after cloning with shell pip install . for development with shell pip install .[test]

How to use

Docker

commandline docker run -p 8009:8080 -v ~/.config/WikibaseMigrator/profiles/WikibaseMigrationTest.yaml:/config.yaml tholzheim/wbmigrator

Exchange ~/.config/WikibaseMigrator/profiles/WikibaseMigrationTest.yaml with the location of your migration profile configuration if needed

Web UI

The webserver can be started over the cli with shell 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 shell wbmigrate --help ```commandline 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

shell wbmigrate migrate --help ```commandline 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

shell wbmigrate webserver --help ```commandline 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

```mermaid 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

```

Merging Entities

If an entity already exists in the target wikibase instance the source entity is first translated to the target and then 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

Owner

  • Login: tholzheim
  • Kind: user

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: WikibaseMigrator
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Tim
    family-names: Holzheim
    email: tim.holzheim@rwth-aachen.de
    orcid: 'https://orcid.org/0000-0003-2533-6363'
repository-code: 'https://github.com/tholzheim/WikibaseMigrator'
abstract: >-
  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.
keywords:
  - Wikibase
  - Wikidata
  - migration
  - mapping
license: Apache-2.0
commit: 'ddb806e  '
version: 0.0.7
date-released: '2024-12-03'

GitHub Events

Total
  • Create event: 13
  • Release event: 13
  • Issues event: 49
  • Delete event: 1
  • Issue comment event: 8
  • Public event: 1
  • Push event: 46
Last Year
  • Create event: 13
  • Release event: 13
  • Issues event: 49
  • Delete event: 1
  • Issue comment event: 8
  • Public event: 1
  • Push event: 46

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 133
  • Total Committers: 1
  • Avg Commits per committer: 133.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 133
  • Committers: 1
  • Avg Commits per committer: 133.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
tholzheim t****m@r****e 133
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 31
  • Total pull requests: 0
  • Average time to close issues: 4 days
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 0.16
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 31
  • Pull requests: 0
  • Average time to close issues: 4 days
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 0.16
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • tholzheim (31)
Pull Request Authors
Top Labels
Issue Labels
enhancement (20) bug (8) question (6) documentation (3)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 104 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 14
  • Total maintainers: 1
pypi.org: wikibasemigrator
  • Versions: 14
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 104 Last month
Rankings
Dependent packages count: 9.9%
Average: 32.9%
Dependent repos count: 56.0%
Maintainers (1)
Last synced: 8 months ago

Dependencies

.github/workflows/CI.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
Dockerfile docker
  • python 3.12-alpine build
docker-compose.yml docker
pyproject.toml pypi
  • Authlib *
  • Pygments *
  • SPARQLWrapper *
  • nicegui *
  • pandas *
  • pydantic *
  • python-dateutil *
  • pyyaml *
  • quickstatements_client *
  • typer *
  • wikibaseintegrator >=0.12.8
.github/workflows/docker-image.yml actions
  • actions/checkout v4 composite
  • docker/build-push-action v6 composite
  • docker/login-action v3 composite
  • docker/metadata-action v5 composite
.github/workflows/python-publish.yml actions
  • actions/checkout v4 composite
  • actions/download-artifact v4 composite
  • actions/setup-python v5 composite
  • actions/upload-artifact v4 composite
  • pypa/gh-action-pypi-publish release/v1 composite