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:
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"}) |
;; 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"])) |
;; 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) |
;; 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) |
buildscript { | |
repositories { | |
maven { url "http://repo.spring.io/libs-snapshot" } | |
mavenLocal() | |
} | |
dependencies { | |
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.0.2.RELEASE") | |
} | |
} |
// 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); |
I hereby claim:
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] |
package com.complexible.stardog.ext.spring; | |
import com.complexible.common.protocols.server.ServerException; | |
import com.complexible.stardog.Stardog; | |
import com.complexible.stardog.StardogException; | |
import com.complexible.stardog.api.admin.AdminConnection; | |
import com.complexible.stardog.api.admin.AdminConnectionConfiguration; | |
import com.complexible.stardog.protocols.snarl.SNARLProtocolConstants; | |
public class EmbeddedProvider implements Provider { |
@Grab('com.complexible.stardog:stardog-groovy:3.0.0') | |
import com.complexible.stardog.ext.groovy.Stardog | |
def stardog = new Stardog([url: "snarl://localhost:5820/", to:"testdb", username:"admin", password:"admin", reasoning:true]) | |
stardog.query("select ?x WHERE { ?x a <urn:SomeSubclass> } LIMIT 2", { println it } ) // <- Stardog answers the query with reasoned relationships! |