use of org.openrdf.repository.sail.SailRepository in project gocd by gocd.
the class InMemoryRepositoryFactory method emptyRepository.
public static Repository emptyRepository() {
try {
Repository repo = new SailRepository(new MemoryStore());
repo.initialize();
return repo;
} catch (RepositoryException ex) {
throw new ShineRuntimeException(ex);
}
}
use of org.openrdf.repository.sail.SailRepository in project incubator-rya by apache.
the class RdfCloudTripleStoreTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
connector = new MockInstance().getConnector("", "");
RdfCloudTripleStore sail = new RdfCloudTripleStore();
AccumuloRdfConfiguration conf = new AccumuloRdfConfiguration();
conf.setTablePrefix("lubm_");
sail.setConf(conf);
AccumuloRyaDAO crdfdao = new AccumuloRyaDAO();
crdfdao.setConnector(connector);
crdfdao.setConf(conf);
sail.setRyaDAO(crdfdao);
repository = new SailRepository(sail);
repository.initialize();
connection = repository.getConnection();
loadData();
}
use of org.openrdf.repository.sail.SailRepository in project incubator-rya by apache.
the class CbSailComponent method createEndpoint.
@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
String sailRepoNameParam = Repository.class.getName();
if (parameters.containsKey(sailRepoNameParam)) {
sailRepoNameParam = getAndRemoveParameter(parameters, SAILREPONAME, String.class);
}
Repository sailRepository = getCamelContext().getRegistry().lookup(sailRepoNameParam, Repository.class);
checkNotNull(sailRepository, "Sail Repository must exist within the camel registry. Using lookup name[" + sailRepoNameParam + "]");
CbSailEndpoint sailEndpoint = new CbSailEndpoint(uri, this, sailRepository, remaining);
setProperties(sailEndpoint, parameters);
return sailEndpoint;
}
use of org.openrdf.repository.sail.SailRepository in project incubator-rya by apache.
the class TriplestoreProvenanceCollectorTest method testCollect.
@Test
public void testCollect() throws ProvenanceCollectionException, RepositoryException, MalformedQueryException, QueryEvaluationException {
Sail ms = new MemoryStore();
SailRepository repo = new SailRepository(ms);
repo.initialize();
TriplestoreProvenanceCollector coll = new TriplestoreProvenanceCollector(repo, "fakeUser", "SPARQL");
coll.recordQuery("fakeQuery");
String queryString = "SELECT ?x ?y WHERE { ?x ?p ?y } ";
TupleQuery tupleQuery = repo.getConnection().prepareTupleQuery(QueryLanguage.SPARQL, queryString);
TupleQueryResult result = tupleQuery.evaluate();
// TODO not asserting on the results.
assertTrue(result.hasNext());
}
use of org.openrdf.repository.sail.SailRepository in project incubator-rya by apache.
the class MongoGeoTemporalIndexIT method variableSubjQuery_Test.
@Test
public void variableSubjQuery_Test() throws Exception {
final Sail sail = GeoRyaSailFactory.getInstance(conf);
final SailRepositoryConnection conn = new SailRepository(sail).getConnection();
try {
addStatements(conn);
final String query = "PREFIX time: <http://www.w3.org/2006/time#> \n" + "PREFIX tempo: <tag:rya-rdf.org,2015:temporal#> \n" + "PREFIX geo: <http://www.opengis.net/ont/geosparql#>" + "PREFIX geof: <http://www.opengis.net/def/function/geosparql/>" + "SELECT * " + "WHERE { " + " ?subj time:atTime ?time . " + " ?subj geo:asWKT ?point . " + " FILTER(geof:sfWithin(?point, \"POLYGON((-3 -2, -3 2, 1 2, 1 -2, -3 -2))\"^^geo:wktLiteral)) " + " FILTER(tempo:equals(?time, \"2015-12-30T12:00:00Z\")) " + "}";
final TupleQueryResult rez = conn.prepareTupleQuery(QueryLanguage.SPARQL, query).evaluate();
final List<BindingSet> results = new ArrayList<>();
while (rez.hasNext()) {
final BindingSet bs = rez.next();
results.add(bs);
}
final MapBindingSet expected1 = new MapBindingSet();
expected1.addBinding("point", VF.createLiteral("POINT (0 0)"));
expected1.addBinding("time", VF.createLiteral("2015-12-30T12:00:00Z"));
final MapBindingSet expected2 = new MapBindingSet();
expected2.addBinding("point", VF.createLiteral("POINT (1 1)"));
expected2.addBinding("time", VF.createLiteral("2015-12-30T12:00:00Z"));
assertEquals(2, results.size());
assertEquals(expected1, results.get(0));
assertEquals(expected2, results.get(1));
} finally {
conn.close();
sail.shutDown();
}
}
Aggregations