CPS Wikibase

This module can query Wikidata or query and post to a Wikibase server when credentials are supplied.

This project is used by CPS Deckenmalerei and CPS Impress.

CPS

CPS tools have been written for and provided by the CPS (Computational Publishing Service) as part of NFDI4Culture hosted at Wikibase4Research at TIB.

Setup

Debian
sudo apt install build-essential python3-full python3-pip mercurial
hg clone https://hg.kewl.org/pub/cps_wb
cd cps_wb
make venv

TCSH

source ~/.venvs/cps_wb/bin/activate.csh
make install
rehash

BASH

source ~/.venvs/cps_wb/bin/activate
make install
PyPi

This project is also packaged at PyPi

Use cps-wb as a dependency to include it.

Demo

The command line functionality will query a wikibase server and print out an entity.

Eg. Wikidata human.

wikibase Q5

As a class, cps_wikibase is used to insert data into a wikibase as well as read it.

Class WB

Init

When supplied with a username and password the class init will login to the CPS development server. Full configuration is found in the global wbi_config for Wikibaseintegrator.

Qitem

This method will query for a Q entity.

Pproperty

This method will query for a P entity.

Edict

This method will store the result set from an entity query in a dictionary.

item

This method will create or reuse an item entity and apply any label and claims.

If an entity is created, the method will wait until the entity exists on the server for querying.

finditem

This method will locate an entity on the server.

property

This method will create or reuse a property entity and apply any label.

If an entity is created, the method will wait until the entity exists on the server for querying.

findproperty

This method will locate an entity on the server.

Class wikilabel

This class represent a Wikibase label which incorporates the label itself, a description and its language.

Init

Creates a label for use in class WB and elsewhere.

str

This method returns an easy to read string representation of a label.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies