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
@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
<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
{: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
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
(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
// 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
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
SnarlTemplate tmp = new SnarlTemplate(); | |
tmp.setDataSource(dataSource); | |
String sparql = "DELETE { ?a ?b \"aloha world\" } INSERT { ?a ?b \"shalom world\" } WHERE { ?a ?b \"aloha world\" }"; | |
Map<String, Object> params = new HashMap<String, Object>() {{ | |
put("b", new URIImpl(uriB)); | |
}}; | |
// Execute the SPARQL Update 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
(defproject quickstart "0.1.0-SNAPSHOT" | |
:description "FIXME Pallet project for quickstart" | |
:dependencies [[org.clojure/clojure "1.5.1"] | |
[com.palletops/pallet "0.8.0-RC.3"] | |
[com.palletops/pallet-vmfest "0.3.0-beta.2"] | |
[com.palletops/pallet-docker "0.1.0"] | |
[com.palletops/app-deploy-crate "0.8.0-alpha.3"] | |
[com.palletops/runit-crate "0.8.0-alpha.1"] | |
[com.palletops/docker-crate "0.8.0-alpha.1"] | |
[com.palletops/java-crate "0.8.0-beta.5"] |