This file contains 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
/** | |
* <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 file contains 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
// start a transaction before adding the data. This is not required, | |
// but it is faster to group the entire add into a single transaction rather | |
// than rely on the auto commit of the underlying stardog connection. | |
aModel.begin(); | |
// read data into the model. note, this will add statement at a time. | |
// Bulk loading needs to be performed directly with the BulkUpdateHandler provided | |
// by the underlying graph, or by reading in files in RDF/XML format, which uses the | |
// bulk loader natively. Alternatively, you can load data into the Stardog | |
// database using SNARL, or via the command line client. |
This file contains 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
/* | |
* Copyright (c) 2010-2015 Clark & Parsia, LLC. <http://www.clarkparsia.com> | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software | |
* distributed under the License is distributed on an "AS IS" BASIS, |
This file contains 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
aConn.begin(); | |
aConn.add().io() | |
.format(RDFFormat.N3) | |
.stream(new FileInputStream("data/sp2b_10k.n3")); | |
Model aGraph = Models2.newModel(Values.statement(Values.iri("urn:subj"), | |
Values.iri("urn:pred"), | |
Values.iri("urn:obj"))); |
This file contains 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
ReasoningConnection aReasoningConn = ConnectionConfiguration | |
.to("reasoningExampleTest") | |
.credentials("admin", "admin") | |
.reasoning(true) | |
.connect() | |
.as(ReasoningConnection.class); |
This file contains 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
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 | |
> WHERE { |
This file contains 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
// this is where we'll store our constraints | |
Sail aConstraints = new MemoryStore(); | |
aConstraints.initialize(); | |
// 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()); |
This file contains 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
@Override | |
public void channelRead0( | |
ChannelHandlerContext ctx, FullHttpRequest request) throws Exception { | |
if (!request.getDecoderResult().isSuccess()) { | |
sendError(ctx, BAD_REQUEST); | |
return; | |
} | |
if (request.getMethod() != GET) { | |
sendError(ctx, METHOD_NOT_ALLOWED); |
This file contains 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
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 | |
*/ |
This file contains 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
package netty; | |
import io.netty.bootstrap.Bootstrap; | |
import io.netty.bootstrap.ServerBootstrap; | |
import io.netty.channel.Channel; | |
import io.netty.channel.ChannelFuture; | |
import io.netty.channel.ChannelHandlerContext; | |
import io.netty.channel.ChannelInboundHandlerAdapter; | |
import io.netty.channel.ChannelInitializer; | |
import io.netty.channel.EventLoopGroup; |
NewerOlder