After downloading Stardog and a license key, I turned to the “Stardog Quick Start” page at: {install directory}/stardog-1.0.2/docs/manual/quick-start/index.html
.
What follows is an annotated version of that page that reports “dumb” and perhaps not so “dumb” mistakes I made to get the server running and the first database loaded. (I have also included what output to expect if you are successful at each step.)
First, tell Stardog where its home directory (where databases and other files will be stored) is:If you’re using some weird Unix shell that doesn’t create environment variables in this way, adjust accordingly. Stardog requires STARDOG_HOME to be defined.
$ export STARDOG_HOME=/data/stardog
I edited my .bashrc file to insert this statement.
Be sure to remember to open another shell so that the variable gets set for that window. (Yes, I forgot the first time around.)
Second, copy the stardog-license-key.binYou’ll get this either with an evaluation copy of Stardog or with a licensed copy. into place:
$ cp stardog-license-key.bin $STARDOG_HOME
Of course stardog-license-key.bin has to be readable by the Stardog process.
Mine defaulted to 664 but it is a good idea to check.
Third, start the Stardog server. By default the server will expose SNARL and HTTP interfaces—on ports 5820 and 5822, respectively.
$ ./stardog-admin server start
If successful, you will see:
Starting Stardog server in background, see /home/patrick/working/stardog-1.0.2/stardog.log for more information. ************************************************************ This copy of Stardog is licensed to Patrick Durusau (patrick@durusau.net), Patrick Durusau This is a Community license This license does not expire. ************************************************************ :; ;; `;`: `'+', :: `++ `;:` +###++, ,#+ `++ . ##+.,', '#+ ++ + ,## ####++ ####+: ##,++` .###+++ .####+ ####++++# `##+ ####+' ##+#++ ###++``###'+++ `###'+++ ###`,++,: ####+ ##+ ++. ##: ### `++ ### `++` ##` ++: ###++, ##+ ++, ##` ##; `++ ##: ++; ##, ++: ;+++ ##+ ####++, ##` ##: `++ ##: ++' ;##'#++ ;++ ##+ ### ++, ##` ##' `++ ##; ++: ####+ ,. +++ ##+ ##: ++, ##` ### `++ ### .++ '#; ,####++' +##++ ###+#+++` ##` :####+++ `####++' ;####++` `####+; ##++ ###+,++` ##` ;###:++ `###+; `###++++ ## `++ .## ;++ #####++` `;;;. ************************************************************ Stardog server 1.0.2 started on Sun Jul 22 16:54:01 EDT 2012. SNARL server running on snarl://localhost:5820/ HTTP server running on http://localhost:5822/. Stardog documentation accessible at http://localhost:5822/docs SNARL & HTTP servers listening on all interfaces STARDOG_HOME=/home/patrick/working/stardog-1.0.2
Fourth, create a database with an input file; use the –server parameter to specify which server:
$ ./stardog-admin create -n myDB -t D -u admin -p admin –server snarl://localhost:5820/ examples/data/University0_0.owl
Gotcha! Would you believe that UniversityO_O.owl has two 0 digits in the name?
Violent disagreement notwithstanding, it is always bad practice to use easily confused letter and digits in files names. Always.
If you are successful you will see:
Bulk loading data to new database. Data load complete. Loaded 8,521 triples in 00:00:01 @ 8.1K triples/sec. Successfully created database 'myDB'.
Fifth, optionally, admire the pure RDF bulk loading power…woof!
OK. 😉
Sixth, query the database:
$ ./stardog query -c http://localhost:5822/myDB -q “SELECT DISTINCT ?s WHERE { ?s ?p ?o } LIMIT 10”
If successful, you will see:
Executing Query: SELECT DISTINCT ?s WHERE { ?s ?p ?o } LIMIT 10 +--------------------------------------------------------+ | s | +--------------------------------------------------------+ | http://api.stardog.com | | http://www.University0.edu | | http://www.Department0.University0.edu | | http://www.Department0.University0.edu/FullProfessor0 | | http://www.Department0.University0.edu/Course0 | | http://www.Department0.University0.edu/GraduateCourse0 | | http://www.Department0.University0.edu/GraduateCourse1 | | http://www.University84.edu | | http://www.University875.edu | | http://www.University241.edu | +--------------------------------------------------------+ Query returned 10 results in 00:00:00.093
If you happen to make any mistakes, you may want to be aware of:
./stardog-admin drop -n myDB
😉
Your performance will vary but these notes may save you a few minutes and some annoyance in getting Stardog up and running.