use of org.apache.jena.query.ResultSet in project jena by apache.
the class StoreUtils method containsGraph.
public static boolean containsGraph(Store store, Node graphNode) {
String qs = "SELECT * { GRAPH " + FmtUtils.stringForNode(graphNode) + " { ?s ?p ?o }} LIMIT 1";
Dataset ds = SDBFactory.connectDataset(store);
try (QueryExecution qExec = QueryExecutionFactory.create(qs, ds)) {
ResultSet rs = qExec.execSelect();
return rs.hasNext();
}
}
use of org.apache.jena.query.ResultSet in project jena by apache.
the class TestSolverTDB method solve_02.
@Test
public void solve_02() {
ResultSet rs1 = exec("(bgp (:s :p :o2))", graph);
ResultSet rs2 = results("empty");
equals(rs1, rs2);
}
use of org.apache.jena.query.ResultSet in project jena by apache.
the class TestSolverTDB method solve_04.
@Test
public void solve_04() {
// Below everything.
ResultSet rs1 = exec("(bgp (:a :p :a))", graph);
ResultSet rs2 = results("empty");
equals(rs1, rs2);
}
use of org.apache.jena.query.ResultSet in project jena by apache.
the class TestMultipleEmbedded method multiple_04.
// Two servers, one dataset under two names.
@Test
public void multiple_04() {
DatasetGraph dsg = dataset();
int port1 = FusekiLib.choosePort();
FusekiEmbeddedServer server1 = FusekiEmbeddedServer.create().setPort(port1).add("/ds1", dsg).build().start();
Txn.executeWrite(dsg, () -> dsg.add(q1));
int port2 = FusekiLib.choosePort();
FusekiEmbeddedServer server2 = FusekiEmbeddedServer.create().setPort(port2).add("/ds2", dsg).build().start();
Txn.executeWrite(dsg, () -> dsg.add(q2));
query("http://localhost:" + port1 + "/ds1", "SELECT * {?s ?p ?o}", qExec -> {
ResultSet rs = qExec.execSelect();
int x = ResultSetFormatter.consume(rs);
assertEquals(2, x);
});
query("http://localhost:" + port2 + "/ds2", "SELECT * {?s ?p ?o}", qExec -> {
ResultSet rs = qExec.execSelect();
int x = ResultSetFormatter.consume(rs);
assertEquals(2, x);
});
server1.stop();
server2.stop();
}
use of org.apache.jena.query.ResultSet in project jena by apache.
the class TestEmbeddedFuseki method embedded_01.
// Test - build on default port.
@Test
public void embedded_01() {
DatasetGraph dsg = dataset();
// Default port.
int port = 3330;
FusekiEmbeddedServer server = FusekiEmbeddedServer.create().add("/ds", dsg).build();
assertTrue(server.getDataAccessPointRegistry().isRegistered("/ds"));
server.start();
query("http://localhost:" + port + "/ds/query", "SELECT * { ?s ?p ?o}", qExec -> {
ResultSet rs = qExec.execSelect();
assertFalse(rs.hasNext());
});
server.stop();
}
Aggregations