I hereby claim:
- I am AlBaker on github.
- I am albaker (https://keybase.io/albaker) on keybase.
- I have a public key whose fingerprint is 7839 033A 430C 83A3 D0B6 5E83 0C92 F9D3 2D04 3F1B
To claim this, I am signing this object:
| (ns testjobs | |
| (:require [clojurewerkz.quartzite.scheduler :as qs] | |
| [clojurewerkz.quartzite.jobs :as j] | |
| [clojurewerkz.quartzite.triggers :as t] | |
| [clojurewerkz.quartzite.conversion :as qc] | |
| [clojurewerkz.quartzite.schedule.simple :refer [schedule with-repeat-count with-interval-in-milliseconds]])) | |
| (j/defjob TestJob | |
| [ctx] |
I hereby claim:
To claim this, I am signing this object:
| // presume part of a class that has access to a ConnectionPool | |
| /* | |
| * @param sparql - the SPARQL Update String to process | |
| * @param args - a map of String,Object that will be used to bind query variables | |
| */ | |
| public void update(String sparql, Map<String, Object> args) { | |
| Connection connection = pool.obtain(); | |
| try { | |
| UpdateQuery query = connection.update(sparql); |
| buildscript { | |
| repositories { | |
| maven { url "http://repo.spring.io/libs-snapshot" } | |
| mavenLocal() | |
| } | |
| dependencies { | |
| classpath("org.springframework.boot:spring-boot-gradle-plugin:1.0.2.RELEASE") | |
| } | |
| } |
| ;; First, add a triple | |
| ;; Then run an udpate query, which is its own transaction | |
| ;; Finally, confirm via ask | |
| (with-open [c (connect test-db-spec)] | |
| (with-transaction [c] | |
| (insert! c ["urn:testUpdate:a1" "urn:testUpdate:b" "aloha world"])) | |
| (update c "DELETE { ?a ?b \"aloha world\" } INSERT { ?a ?b \"shalom world\" } WHERE { ?a ?b \"aloha world\" }" | |
| {:parameters {"?a" "urn:testUpdate:a1" "?b" "urn:testUpdate:b"}}) | |
| (ask c "ask { ?s ?p \"shalom world\" }") => truthy) |
| ;; Ask returns a Boolean | |
| (with-open [c (connect test-db-spec)] | |
| (ask c "ask { ?s <http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#teacherOf> ?o }")) => truthy) |
| ;; Graph results converted into Clojure data using the values methods | |
| (with-open [c (connect test-db-spec)] | |
| (let [g (graph c "CONSTRUCT { <urn:test> ?p ?o } WHERE { <urn:test> ?p ?o } ")] | |
| g) => (list [(as-uri "urn:test") (as-uri "urn:test:clj:prop3") "Hello World"])) |
| myapp.core=> (use 'stardog.core) | |
| nil | |
| myapp.core=> (def db-spec (create-db-spec "testdb" "snarl://localhost:5820/" "admin" "admin" "none")) | |
| #'myapp.core/db-spec | |
| myapp.core=> (def ds (make-datasource db-spec)) | |
| myapp.core=> (with-connection-pool [conn ds] | |
| #_=> (query conn "SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 2")) | |
| ({:s #<URI urn:test1>, :p #<URI urn:test:predicate>, :o "hello world"} {:s #<URI urn:test1>, :p #<URI urn:test:predicate>, :o "hello world2"}) |
| (let [c (connect test-db-spec)] | |
| (with-transaction [c] | |
| (insert! c ["urn:test" "urn:test:clj:prop2" "Hello World"]) | |
| (insert! c ["urn:test" "urn:test:clj:prop2" "Hello World2"])) |
| => (use 'stardog.core) | |
| => (def c (connect {:db "testdb" :url "snarl://localhost"})) | |
| => (def results (query c "select ?n { .... }")) | |
| => (take 5 results) | |
| ({:n #<StardogURI http://example.org/math#2>} {:n #<StardogURI http://example.org/math#3>} {:n #<StardogURI http://example.org/math#5>} {:n #<StardogURI http://example.org/math#7>} {:n #<StardogURI http://example.org/math#11>}) | |
| => (def string-results (query c "select ?n { .... }" {:converter str})) | |
| => (take 5 string-results) | |
| ({:n "http://example.org/math#2"} {:n "http://example.org/math#3"} {:n "http://example.org/math#5"} {:n "http://example.org/math#7"} {:n "http://example.org/math#11"}) |