Skip to content

Instantly share code, notes, and snippets.

Michael Grove mhgrove

Block or report user

Report or block mhgrove

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:2952a69d54397b46f17e
mhgrove:dist mhgrove$ ./bin/stardog-admin db create -n foo
Successfully created database 'foo'.
mhgrove:dist mhgrove$ ./bin/stardog query foo "insert data { graph <tag:stardog:api:context:equipment> { <urn:a> <urn:b> <urn:c> } . graph <tag:stardog:api:context:phase-of-development> { <urn:d> <urn:e> <urn:f> } }"
Update query processed successfully in 00:00:00.147.
mhgrove:dist mhgrove$ ./bin/stardog data export foo --format NQUADS
<urn:a> <urn:b> <urn:c> <tag:stardog:api:context:equipment> .
<urn:d> <urn:e> <urn:f> <tag:stardog:api:context:phase-of-development> .
mhgrove:dist mhgrove$ ./bin/stardog query foo "SELECT ?s ?p ?o
mhgrove /
Created Apr 10, 2015
Demonstrates the use of Adder#graph correctly adds a Rule to the database
public void ruleExample() throws Exception {
final String aRule = "PREFIX :<urn:test:>\n" +
" IF {\n" +
" ?r a :Rectangle ;\n" +
" :width ?w ;\n" +
" :height ?h\n" +
" BIND (?w * ?h AS ?area)\n" +
" }\n" +
" THEN {\n" +
mhgrove / output
Created May 27, 2014
Describe Console Output
View output
mhgrove:stardog-2.1.3 mhgrove$ ./bin/stardog-admin server start
mhgrove:stardog-2.1.3 mhgrove$ ./bin/stardog-admin db create -n describe
Creating index: 100% complete in 00:00:00 (0.0K triples/sec)
Creating index finished in 00:00:00.010
Loading complete.
Inserted 0 triples in 00:00:00.082 at 0.0 triples/sec
Successfully created database 'describe'.
mhgrove:stardog-2.1.3 mhgrove$ ./bin/stardog data add --named-graph urn:context describe ~/Downloads/census-2011_qs103sc.ttl
Adding data from file: /Users/mhgrove/Downloads/census-2011_qs103sc.ttl
View gist:9639292
mhgrove:dist mhgrove$ cat input.nt
<urn:foo> <urn:bar> "literal".
mhgrove:dist mhgrove$ ./bin/stardog-admin db create -n foo -s input.nt
Bulk loading data to new database.
Parsing triples: 100% complete in 00:00:00 (1 triples - 0.2K triples/sec)
Parsing triples finished in 00:00:00.005
Creating index: 100% complete in 00:00:00 (0.2K triples/sec)
Creating index finished in 00:00:00.005
Computing statistics: 100% complete in 00:00:00 (0.2K triples/sec)
Computing statistics finished in 00:00:00.006
* <p>This is the extension point for 17.6 (Extensible Value Testing) of the SPARQL spec.</p>
* <p>For implementations of Function to be visible to the query parser and engine, they must be registered
* via the JDK {@link java.util.ServiceLoader}. Create a file called
* {@code com.complexible.stardog.plan.filter.functions.Function} in the {@code META-INF/services} directory.
* The contents of this file should be all of the *fully-qualified* class names for the custom Functions. Then
* if a jar containing the {@code META-INF/services} directory and the implementations for the Functions is
* included on the classpath, Stardog will pick up the implementations on startup.</p>
// this is where we'll store our constraints
Sail aConstraints = new MemoryStore();
// more specifically, we'll store them in a particular named graph
URI aConstraintGraph = Values.iri("urn:icv");
// and here is our database. note this can be *any* type of Repository
Repository aRepo = new SailRepository(new MemoryStore());
public void channelRead0(
ChannelHandlerContext ctx, FullHttpRequest request) throws Exception {
if (!request.getDecoderResult().isSuccess()) {
sendError(ctx, BAD_REQUEST);
if (request.getMethod() != GET) {
sendError(ctx, METHOD_NOT_ALLOWED);
public static final class ByteBufHttpOutputStream extends OutputStream {
* The channel to which the {@link ByteBuf} objects are written
private final ChannelHandlerContext mChannelHandlerContext;
* The {@link ByteBuf} to which data is currently being written
mhgrove /
Last active Dec 21, 2015
Modified LocalEcho class which demonstrates the name collision in LocalAddress
package netty;
import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap;
mhgrove /
Created Aug 20, 2013
Netty HTTP Streaming Bug
// Copyright (c) 2010 - 2013, Clark & Parsia, LLC. <>
// For more information about licensing and copyright of this software, please contact
// or visit
package netty;
You can’t perform that action at this time.