Skip to content

Instantly share code, notes, and snippets.

@laczoka
Created February 20, 2013 15:15
Show Gist options
  • Save laczoka/4996236 to your computer and use it in GitHub Desktop.
Save laczoka/4996236 to your computer and use it in GitHub Desktop.
How to load triples into Stardog Convenience script for running SPARQL queries against Stardog
+You should almost always import data when you create a new database.
+I could load 40k triples/sec, 10M triples under 4 minutes
+
+Follow the quickstart guide at http://stardog.com/docs/quick-start/.
+
+If you have triples in multiple files (.rdf,.n3,.nt, etc.) just use
+
+zip alltriples.zip file1 file2 ....
+
+to compress it, it will speedup the load.
+
+then run
+
+./stardog-admin create -n myDB -t D -u admin -p admin \
+ --server snarl://localhost:5820/ alltriples.zip
#!/bin/bash
PREFIXES="PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX gr: <http://purl.org/goodrelations/v1#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX pto: <http://www.productontology.org/id/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> "
if [ $# -lt 2 ];then
echo
echo "Missing required parmater"
echo "Usage: qstardog DBNAME \"SPARQLQUERY\""
echo "Usage: qstardog foodb \"SELECT ?offer { ?offer a gr:Offering }\""
echo
echo "Predefined prefixes:"
echo
echo "$PREFIXES"
else
./stardog query -c "http://localhost:5822/$1;reasoning=RDFS" -q "$PREFIXES $2"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment