Skip to content
Please note that GitHub no longer supports your web browser.

We recommend upgrading to the latest Google Chrome or Firefox.

Learn more
Permalink
Branch: master
Find file Copy path
Find file Copy path
7 contributors

Users who have contributed to this file

@fehrhart @fnielsen @Daniel-Mietchen @nichtich @larsgw @AbdBarho @egonw
117 lines (73 sloc) 3.04 KB

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

Getting started - set up a local scholia server for testing purposes

  1. 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
    
  2. 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
  3. Run Scholia functionality as a script, e.g.:

    $ python -m scholia.query twitter-to-q fnielsen
    Q20980928
  4. 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

  1. Assign the task for yourself (if it is in an issue tracker)
  2. 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". }
}
  1. 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". }
}
`
  1. Add that name to the sparql-to-data table
sparqlToDataTable(authorAwardsSparql, "#author-awards");
  1. Add some table formatting
<h2 id="Author-awards">Author awards</h2>

<table class="table table-hover" id="author-awards"></table>
  1. Pull request to master file
You can’t perform that action at this time.