Skip to content

Instantly share code, notes, and snippets.

@AlBaker
Created January 28, 2013 02:46
Show Gist options
  • Save AlBaker/4652621 to your computer and use it in GitHub Desktop.
Save AlBaker/4652621 to your computer and use it in GitHub Desktop.
Stardog withConnection closure example
// withConnection, tx safe
stardog.withConnection { con ->
def queryString = """
SELECT ?s ?p ?o
{
?s ?p ?o
}
"""
TupleQueryResult result = null;
try {
Query query = con.query(queryString);
result = query.executeSelect();
while (result.hasNext()) {
println result.next();
}
result.close();
} catch (Exception e) {
println "Caught exception ${e}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment