Command line interface

CLI scripts can be used perform all actions available in the UI

LinkedDataHub CLI wraps the HTTP API into a set of shell scripts with convenient parameters. The scripts should run on any Unix-based system. They can be used for testing, automation, scheduled execution and such. It is usually much quicker to perform actions using CLI rather than the user interface, as well as easier to reproduce.

Some scripts correspond to a single request to LinkedDataHub, others combine others into tasks with multiple interdependent requests, such as CSV import.

You will need to supply a .pem file of your WebID certificate as well as its password as script arguments, among others.

The CLI scripts use the environmental variable $SCRIPT_ROOT, which should point to the scripts in your LinkedDataHub fork.

They also use the Jena's CLI commands internally, so make sure to have them on $PATH before running the scripts.

Parameters

Common parameters used by most scripts include:

-f
--cert-pem-file
.pem file with the WebID certificate of the agent
-p
--cert-password
Password of the WebID certificate
-b
--base
Base URI of the application
--proxy
The host this request will be proxied through (optional)
It can be used with port 5443 for which the client certificate authentication is always enabled, for example --proxy https://localhost:5443/

Other parameters are script-specific.

Usage

A usage message with parameters of a script is printed when the scripted is run without any arguments. There can be named parameters and default parameters, both of those can be optional. For example:

~/WebRoot/AtomGraph/LinkedDataHub/scripts$ ./create-select.sh
Creates a SPARQL SELECT query.

Usage:  ./create-select.sh options

Options:
  -f, --cert-pem-file CERT_FILE        .pem file with the WebID certificate of the agent
  -p, --cert-password CERT_PASSWORD    Password of the WebID certificate
  -b, --base BASE_URI                  Base URI of the application
  --proxy PROXY_URL                    The host this request will be proxied through (optional)

  --title TITLE                        Title of the chart
  --description DESCRIPTION            Description of the chart (optional)
  --slug STRING                        String that will be used as URI path segment (optional)
  --fragment STRING                    String that will be used as URI fragment identifier (optional)

  --query-file ABS_PATH                Absolute path to the text file with the SPARQL query string
  --service SERVICE_URI                URI of the SPARQL service specific to this query (optional)

The optional parameters are marked with (Optional). In this case there is no default argument, but some scripts require document (named graph) URI as the default parameter, e.g. ontology document URL.

This is how a create-select.sh invocation would look like:

./create-select.sh \
  -b "$base" \
  -f "$cert_pem_file" \
  -p "$cert_password" \
  --proxy "$proxy" \
  --title "Select concepts" \
  --slug select-concepts \
  --query-file "$pwd/queries/select-concepts.rq"

Scripts

Currently supported:

Purpose Script
General
Create document create-document.sh
Update document update-document.sh
Create container create-container.sh
Create item create-item.sh
Create result set chart create-result-set-chart.sh
Create SELECT query create-select.sh
Imports
Create file imports/create-file.sh
Create query imports/create-query.sh
Create CSV import imports/create-csv-import.sh
Import CSV data imports/import-csv.sh
Administration
Add owl:import to ontology admin/add-ontology-import.sh
Clear and reload ontology admin/clear-ontology.sh
Access control
Add agent to group admin/acl/add-agent-to-group.sh
Create authorization admin/acl/create-authorization.sh
Create group admin/acl/create-group.sh
Make application publicly readable to any agent admin/acl/make-public.sh
Model
Create class admin/model/create-class.sh
Create CONSTRUCT query admin/model/create-construct.sh
Create ontology admin/model/create-ontology.sh
Create property constraint admin/model/create-property-constraint.sh
Create SELECT query admin/model/create-select.sh
Import ontology admin/model/import-ontology.sh

Usage example:

./create-file.sh https://localhost:4443/ \
  -f "$cert_pem_file" \
  -p "$cert_password" \
  --title "Friends" \
  --file-slug 646af756-a49f-40da-a25e-ea8d81f6d306 \
  --file friends.csv \
  --file-content-type text/csv

See also the data import user guides.

Find the CLI scripts on GitHub or check out the demo apps that use them.