Command Line Interface
This page describes the command line interface (CLI) to interact with Stardog. Please view Stardog and Stardog Admin CLI Reference Manuals for a full description of all CLI commands.
Page Contents
Overview
Stardog’s command-line interface (CLI) comes in two parts:
stardog-admin
: administrative clientstardog
: a user’s client
The admin and user tools operate on local or remote databases using HTTP. These CLI tools are self-documenting, and their help
output is their canonical documentation. In other words, if there is a conflict between this documentation and the output of the CLI tools’ help
command, the CLI output is correct.
Security Considerations
We divide administrative functionality into two CLI programs for reasons of security: stardog-admin
will need, in production environments, to have considerably tighter access restrictions than stardog
.
For usability, Stardog provides a default user admin
and password admin
in stardog-admin
commands if no user or password are given. This is insecure; before any serious use of Stardog is contemplated, read the Security section at least twice, and then–minimally–change the administrative password to something we haven’t published online!
Command Groups
The CLI tools use “command groups” to make CLI subcommands easier to find. To print help for a particular command group, just ask for help:
See the Stardog CLI Reference and Stardog Admin CLI Reference for the canonical list of commands.
The main help command for either CLI tool will print a list of the command groups:
To get more information about a particular command, simply issue the help command for it, including its command group:
Finally, everything here about command groups, commands, and online help works for stardog-admin
.
Connection Strings
You need to know how to make a connection string to talk to a Stardog database. A connection string may consist solely of the database name in cases where:
- Stardog is listening on the standard port 5820; and
- the command is invoked on the same machine where the server is running.
In other cases, a “fully qualified” connection string, as described below, is required.
Further, the connection string is assumed to be the first argument of any command that requires a connection string. Some CLI subcommands require a Stardog connection string as an argument. This is to identify the server and database upon which operations are to be performed.
Connection strings are URLs and may either be local to the machine where the CLI is run or on some other remote machine.
Stardog connection strings use the http://
protocol scheme.
Example Connection Strings
To make a connection string, you need to know the machine name, the port the Stardog Server is running on, and the name of the database:
Here are some example connection strings:
http://myserver/myStardog/myDb
http://localhost:12345/myOtherDb
http://169.175.100.5:1111/oneLastDb;reasoning=true
Using the default port for Stardog’s use of HTTP simplifies connection strings. connectionOptions
are a series of ;
delimited key-value pairs, which themselves are =
delimited. Key names must be lowercase, and their values are case-sensitive.
Autocomplete
Stardog also supports CLI autocomplete via bash autocompletion. To install autocomplete for the bash shell, you’ll first want to make sure bash completion is installed.
To enable, edit
.bash_profile
:Then, edit
.bash_profile
Now put the Stardog autocomplete script—
stardog-completion.sh
which is found in your distribution—into yourbash_completion.d
directory, typically one of/etc/bash_completion.d
,/usr/local/etc/bash_completion.d
or~/bash_completion.d.
Alternately you can put it anywhere you want, but tell
.bash_profile
about it:Now put the Stardog autocomplete script—
stardog-completion.sh
which is found in your distribution—into yourbash_completion.d
directory, typically one of/etc/bash_completion.d
,/usr/local/etc/bash_completion.d
or~/bash_completion.d.
Alternately you can put it anywhere you want, but tell
.bash_profile
about it:
Installing Man Pages Locally
To install the man pages locally in your Unix-like environment: