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
String sparql = "ASK { ?a ?b \"aloha world\" }"; | |
Map<String, Object> params = new HashMap<String, Object>() {{ | |
put("b", new URIImpl(uriB)); | |
}}; | |
// SnarlTemplate returns boolean for ask | |
// Also parameter binding in the query is supported | |
boolean result = tmp.ask(sparql, params); |
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
// Accepts the SPARQL Update queries | |
stardog.update("DELETE { ?a ?b \"hello world2\" } INSERT { ?a ?b \"aloha world2\" } WHERE { ?a ?b \"hello world2\" }") | |
def list = [] | |
stardog.query("SELECT ?x ?y ?z WHERE { ?x ?y \"aloha world2\" } LIMIT 2", { list << it } ) | |
assertTrue(list.size == 1) |
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
(ns pallet-java-example.main | |
(:use [clojure.tools.cli :only (cli)] | |
[clojure.pprint]) | |
(:gen-class :main true) | |
(:require | |
[pallet.api :refer [group-spec server-spec node-spec plan-fn converge lift]] | |
[pallet.compute :refer [nodes images]] | |
[clojure.pprint :refer [pprint]] | |
[pallet.compute.vmfest :refer [add-image]] | |
[pallet.node :refer [group-name primary-ip]] |
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
PREFIX swrlb: <http://www.w3.org/2003/11/swrlb#> | |
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> | |
IF { | |
?x a :Person; hasAge ?age. | |
FILTER (?age >= 13 && ?age <= 19) | |
} | |
THEN { | |
?x a :Teenager. | |
} |
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
{:aws {:provider "aws-ec2" :identity "ident" | |
:credential "cred" :environment {:user { :username "ubuntu" :private-key-path | |
"path/to/aws.pem" :public-key-path "path/to/aws.pub"}}}} |
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
<bean name="dataSource" class="com.complexible.stardog.ext.spring.DataSourceFactoryBean"> | |
<property name="to" value="testdb"/> | |
<property name="username" value="admin"/> | |
<property name="password" value="admin"/> | |
<property name="reasoningType" value="QL"/> | |
</bean> |
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
@Grab('com.github.albaker:GroovySparql:0.7.2') | |
import groovy.sparql.* | |
// SPARQL 1.0 or 1.1 endpoint | |
def sparql = new Sparql(endpoint:"http://localhost:1234/testdb/query", user:"user", pass:"pass") | |
def query = "SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 4" | |
// sparql result variables projected into the closure delegate | |
sparql.each query, { |
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
@Grab('com.complexible.stardog:stardog-groovy:2.1.2') | |
import com.complexible.stardog.ext.groovy.Stardog | |
def stardog = new Stardog([url: "snarl://localhost:5820/", to:"testdb", username:"admin", password:"admin"]) | |
stardog.query("select ?x ?y ?z WHERE { ?x ?y ?z } LIMIT 2", { println it } ) |
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
=> (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"}) |
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
(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"])) |