Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dpriskorn/improvewikidata
Python REPL TUI frontend to WikidataIntegrator that has similiar functionallity to QuickStatements
https://github.com/dpriskorn/improvewikidata
Last synced: 20 days ago
JSON representation
Python REPL TUI frontend to WikidataIntegrator that has similiar functionallity to QuickStatements
- Host: GitHub
- URL: https://github.com/dpriskorn/improvewikidata
- Owner: dpriskorn
- License: gpl-3.0
- Created: 2021-01-18T12:06:13.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-01-19T09:15:14.000Z (about 4 years ago)
- Last Synced: 2024-12-19T09:27:53.715Z (about 1 month ago)
- Size: 12.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ImproveWikidata
ImproveWikidata is a python REPL TUI that reads from a rule-directory with
json-files and lets the user semi-automatically improve Wikidata based on the
choosen rule.In essence this is a TUI frontend to
[[Wikidata:WikibaseIntegrator|WikibaseIntegrator]], that enables users to share
json rules using git or other measures and collaborate on editing Wikidata in a
semi-automatic way in the terminal.It's licensed under GPL-v3 or later unless they are snippets from someone else
(source is then noted above the code)## Requirements
* Python
* requests
* wikibaseintegratorInstall requirements using your OS package manager or by using pip:
`$ sudo pip install wikibaseintegrator requests`If pip fails with errors related to python 2.7 you need to upgrade your OS. E.g. if you are using an old version of Ubuntu like 18.04.
## Getting started
To get started install the following libraries with your package manager or
python PIP:
* requests
* wikibaseintegratorPlease create a bot password for running the script for
safety reasons here: https://www.wikidata.org/wiki/Special:BotPasswordsAdd the following variables to your ~/.bashrc (recommended):
export IMPROVEWIKIDATA_USERNAME="username"
export IMPROVEWIKIDATA_PASSWORD="password"Alternatively edit the file named config.py yourself and adjust the following
content:username = "username"
password= "password"### Pseudo code describing the internal operation of the script
load the config
check if username and password is set and fail if not
read the rules directory
start a repl and wait for a commandcommand run [rulenumber]
run the rule with the number or failcommand list
list rules and exitcommand show [rulenumber]
show the rules details in human readable formcommand new [optional name of new rule]
create a new rule by asking the user a series of questionsrun:
read the rules json
fail if invalid
fetch the items limiting to the first 50
loop through the items
skip if improvement is already made
show the improvement to be made
ask the user whether to make it or not
upload to WDlist:
loop through the rules and list
e.g.:
number name valid
1 add-operating-area-to-swedish-unions yesif no rules exist encourage the user to create a new one
new:
ask for name if not given
ask for type (add/remove)note: during all these questions it should be possible to search for either PID
or QID, if the search matches a valid item, accept it immediatelyask for predicate
ask for object
while loop: ask if narrow is wanted
ask for predicate
ask for objectif add:
ask for add predicate
ask for add object
while loop: ask if qualifier is wanted
ask for predicate
ask for object
while loop: ask if reference is wanted
ask for predicate
ask for object
ask if retrieved date is today
while loop: ask if qualifier is wanted
ask for predicate
ask for objectnote: this function for now only supports removing either the whole
predicate/object or a single qualifier or a single reference or qualifier on a
reference.if remove:
ask for remove predicate
ask for remove object
ask if the whole thing should be removed or only a qualifier or reference
while loop: ask if qualifier is wanted
ask for predicate
ask for object
while loop: ask if reference is wanted
ask for predicate
ask for object
while loop: ask if qualifier is wanted
ask for predicate
ask for object