Contributing to Scholia
Source code and issue tracker
Scholia development is hosted at https://github.com/fnielsen/scholia.
Technology stack
Scholia is mainly based on
- Python (>= 2.7)
- HTML with Bootstrap CSS
- JavaScript with jQuery and wikidata-sdk
- SPARQL to query the Wikidata Query Service
Getting started - set up a local scholia server for testing purposes
Clone Scholia repository from GitHub
$ git clone https://github.com/fnielsen/scholia.git # via HTTPS $ git clone git@github.com:fnielsen/scholia.git # or via SSH
Install required Python libraries:
$ pip install -r requirements.txt # either globally $ pip install -r requirements.txt # or locally
On Debian 8/9 you need to install the packages python3, python3-pip, and python3-flask and use pip3:
$ apt-get install python3 python3-pip python3-flask $ pip3 install -r requirements.txt
Run Scholia functionality as a script, e.g.:
$ python -m scholia.query twitter-to-q fnielsen Q20980928
Run Scholia locally as a web application
python runserver.py
Testing
Rudimentary testing and code style checking are implemented via tox. Before committing please run the following code in the main directory:
tox
The style is checked with flake8. Also follow the commit message recommendations, cf. Writing good commit messages.
Examples
Adding new SPARQL queries to Scholia
- Assign the task for yourself (if it is in an issue tracker)
- Get the new query e.g. Example from https://github.com/fnielsen/scholia/pull/848/files
SELECT DISTINCT ?author ?authorLabel ?award ?awardLabel WHERE {
?item wdt:P1433 wd:{{ q }} ;
wdt:P50 ?author .
?author wdt:P166 ?award .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
- Add a name e.g. authorAwardsSparql to the query and the whole thing to your version/fork of the file https://github.com/fnielsen/scholia/tree/master/scholia/[…]
authorAwardsSparql = `
SELECT DISTINCT ?author ?authorLabel ?award ?awardLabel WHERE {
?item wdt:P1433 wd:{{ q }} ;
wdt:P50 ?author .
?author wdt:P166 ?award .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
`
- Add that name to the sparql-to-data table
sparqlToDataTable(authorAwardsSparql, "#author-awards");
- Add some table formatting
<h2 id="Author-awards">Author awards</h2>
<table class="table table-hover" id="author-awards"></table>
- Pull request to master file