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 (mandatory) 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 -P my_project 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.

Create a JSON list file from one or several Excel files

dsp-tools excel [option] folder_with_excel_files output_file.json

The following option is available:

  • -l | --listname listname: name to be used for the list (filename before last occurrence of _ is used if omitted)

The command is used to create a JSON list file from one or several Excel files. It is possible to create multilingual lists. Therefore, an Excel file for each language has to be provided. The data has to be in the first worksheet of the Excel file and all Excel files have to be in the same directory. When calling the excel command, this directory has to be provided as an argument to the call.

The following example shows how to create a JSON list from Excel files in a directory called lists.

dsp-tools excel lists list.json

The description of the expected Excel format can be found here. More information about the usage of this command can be found here.

Create resources from an Excel file

dsp-tools excel2resources excel_file.xlsx output_file.json

The command is used to create the resources section of an ontology from an Excel file. Therefore, an Excel file has to be provided with the data in the first worksheet of the Excel file.

The following example shows how to create the resources section from an Excel file called Resources.xlsx. The output is written to a file called resources.json.

dsp-tools excel2resources Resources.xlsx resources.json

More information about the usage of this command can be found here .

Create properties from an Excel file

dsp-tools excel2properties excel_file.xlsx output_file.json

The command is used to create the properties section of an ontology from an Excel file. Therefore, an Excel file has to be provided with the data in the first worksheet of the Excel file.

The following example shows how to create the properties section from an Excel file called Properties.xlsx. The output is written to a file called properties.json.

dsp-tools excel2properties Properties.xlsx properties.json

More information about the usage of this command can be found here .


Last update: 2021-09-08