Skip to content

PyPI version

Installation and usage

The following paragraphs gives you an overview of how to install and use dsp-tools.

Installation

To install the latest version run:

pip3 install dsp-tools

To update to the latest version run:

pip3 install --upgrade dsp-tools

Create a data model on a DSP server

dsp-tools create [options] data_model_definition.json

The following options are available:

  • -s | --server server: URL of the DSP server (default: localhost:3333)
  • -u | --user username: username used for authentication with the DSP API (default: root@example.com)
  • -p | --password password: password used for authentication with the DSP API (default: test)
  • -V | --validate: If set, only the validation of the JSON file is performed.
  • -l | --lists: If set, only the lists are created using a simplified schema. Please note that in this case the project must already exist.
  • -v | --verbose: If set, some information about the progress is printed to the console.

The command is used to read the definition of a data model (provided in a JSON file) and create it on the DSP server. The following example shows how to load the ontology defined in data_model_definition.json onto the DSP server https://api.dsl.server.org provided with the -s option. The username root@example.com and the password test are used.

dsp-tools create -s https://api.dsl.server.org -u root@example.com -p test data_model_definition.json

The description of the expected JSON format can be found here.

Get a data model from a DSP server

dsp-tools get [options] output_file.json

The following options are available:

  • -s | --server server: URL of the DSP server (default: localhost:3333)
  • -u | --user username: username used for authentication with the DSP API (default: root@example.com)
  • -p | --password password: password used for authentication with the DSP API (default: test)
  • -P | --project shortcode | shortname | iri: shortcode, shortname or IRI of the project
  • -v | --verbose: If set, some information about the progress is printed to the console.

The command is used to get the definition of a data model from a DSP server and write it into a JSON file. This JSON file could then be used to upload the data model to another DSP server. The following example shows how to get the data model from a DSP server https://api.dsl.server.org provided with the -s option. The username root@example.com and the password test are used. The data model is saved into the output file output_file.json.

dsp-tools get -s https://api.dsl.server.org -u root@example.com -p test output_file.json

Upload data to a DSP server

dsp-tools xmlupload [options] xml_data_file.xml

The following options are available:

  • -s | --server server: URL of the DSP server (default: localhost:3333)
  • -u | --user username: username used for authentication with the DSP API (default: root@example.com)
  • -p | --password password: password used for authentication with the DSP API (default: test)
  • -i | --imgdir dirpath: path to the directory where the bitstream objects are stored (default: .)
  • -S | --sipi SIPIserver: URL of the SIPI IIIF server (default: http://0.0.0.0:1024)
  • -v | --verbose: If set, more information about the uploaded resources is printed to the console.

The command is used to upload data defined in an XML file onto a DSP server. The following example shows how to upload data from an XML file xml_data_file.xml onto the DSP server https://api.dsl.server.org provided with the -s option. The username root@example.com and the password test are used. The interface for the SIPI IIIF server is provided with the -S option (https://iiif.dsl.server.org).

dsp-tools xmlupload -s https://api.dsl.server.org -u root@example.com -p test -S https://iiif.dsl.server.org xml_data_file.xml

The description of the expected XML format can be found here.

Convert an Excel file into a JSON file that is compatible with dsp-tools

dsp-tools excel [options] excel_file.xlsx output_file.json

The following options are available:

  • -S | --sheet sheetname: name of the Excel worksheet to use (default: Tabelle1)
  • -s | --shortcode shortcode: shortcode of the project (required)
  • -l | --listname listname: name to be used for the list and the list definition file (required)
  • -L | --label label: label to be used for the list (required)
  • -x | --lang lang: language used for the list labels and commentaries (default: en)
  • -v | --verbose: If set, some information about the progress is printed to the console.

The description of the expected Excel format can be found here.


Last update: 2021-07-12