Created
January 28, 2013 02:46
-
-
Save AlBaker/4652621 to your computer and use it in GitHub Desktop.
Stardog withConnection closure example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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