Stardog’s command-line interface (CLI) comes in two parts:
stardog-admin: administrative client
stardog: a user’s client
The admin and user’s tools operate on local or remote databases using HTTP protocol. 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.
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
For usability, Stardog provides a default user
admin and password
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!
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:
$ stardog help [command_group_name]
The main help command for either CLI tool will print a listing of the command groups:
$ stardog help usage: stardog [ --krb5 ] [ --krb5-disable-rdns ] <command> [ <args> ] Commands are: data Commands which can modify or dump the contents of a database doc Unstructured document processing file Commands for manipulating rdf files graphql Commands for working with GraphQL help Display help information icv Commands for working with Stardog Integrity Constraint support namespace Commands which work with the namespaces defined for a database query Commands which query a Stardog database reasoning Commands which use the reasoning capabilities of a Stardog database tx Commands for managing transactions version Prints information about this version of Stardog. See 'stardog help <command>' for more information on a specific command.
To get more information about a particular command, simply issue the help command for it including its command group:
$ stardog help query execute
Finally, everything here about command groups, commands, and online help works for
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 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 they may be on some other remote machine.
Stardog connection strings use the
http:// protocol scheme.
To make a connection string, you need to know the machine name, the port Stardog Server is running on and the name of the database:
Here are some example connection strings
Using the default port for Stardog’s use of HTTP protocol 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.
Stardog also supports CLI autocomplete via
bash autocompletion. To install autocomplete for bash shell, you’ll first want to make sure bash completion is installed.
$ brew install bash-completion
To enable, edit
if [ -f `brew --prefix`/etc/bash_completion ]; then . `brew --prefix`/etc/bash_completion fi
$ sudo port install bash-completion
if [ -f /opt/local/etc/bash_completion ]; then . /opt/local/etc/bash_completion fi
$ sudo apt-get install bash-completion
$ sudo yum install bash-completion
Now put the Stardog autocomplete script—
stardog-completion.sh which is found in your distribution—into your
bash_completion.d directory, typically one of
Alternately you can put it anywhere you want, but tell
.bash_profile about it:
To install the man pages locally in your Unix-like environment:
$ cp <stardog-installation-directory>/docs/man1/* /usr/local/share/man1 $ cp <stardog-installation-directory>/docs/man8/* /usr/local/share/man8 $ mandb $ man stardog-admin-server-start