use of org.apache.jena.rdflink.RDFLink in project jena by apache.
the class TestService method service_query_bad_no_dataset.
@Test(expected = QueryExceptionHTTP.class)
public void service_query_bad_no_dataset() {
DatasetGraph dsg = env.dsg();
dsg.executeWrite(() -> dsg.add(SSE.parseQuad("(_ :s :p :o)")));
// Not a dataset of the server
String queryString = "SELECT * { SERVICE <" + env.serverPath("JUNK") + "> { ?s ?p ?o }} ";
// Connect to local, unused, permanently empty dataset
try (RDFLink link = RDFLinkFactory.connect(localDataset())) {
try (QueryExec qExec = link.query(queryString)) {
// Where it should go wrong.
RowSet rs = qExec.select();
// Should go on execution.
rs.hasNext();
fail("Should not get here");
}
}
}
use of org.apache.jena.rdflink.RDFLink in project jena by apache.
the class TestService method service_query_extra_params.
@Test
public void service_query_extra_params() {
String queryString = "ASK { SERVICE <" + SERVICE + "?format=json> { BIND(now() AS ?now) } }";
try (RDFLink link = RDFLinkFactory.connect(localDataset())) {
boolean b = link.queryAsk(queryString);
assertTrue(b);
}
}
use of org.apache.jena.rdflink.RDFLink in project jena by apache.
the class TestService method service_query_silent_nosite.
@Test
public void service_query_silent_nosite() {
logOnlyErrors(QueryIterService.class, () -> {
DatasetGraph dsg = env.dsg();
String queryString = "SELECT * { SERVICE SILENT <http://nosuchsite/> { VALUES ?X { 1 2 } }} ";
try (RDFLink link = RDFLinkFactory.connect(localDataset())) {
try (QueryExec qExec = link.query(queryString)) {
RowSet rs = qExec.select();
assertTrue(rs.hasNext());
Binding binding = rs.next();
assertFalse(rs.hasNext());
assertTrue(binding.isEmpty());
}
}
});
}
use of org.apache.jena.rdflink.RDFLink in project jena by apache.
the class TestAuthRemote method auth_link_good_auth_1.
@Test
public void auth_link_good_auth_1() {
try (RDFLink link = RDFLinkHTTP.newBuilder().destination(env.datasetURL()).httpClient(env.httpClientAuthGood()).build()) {
link.queryAsk("ASK{}");
link.update("INSERT DATA { <x:s> <x:p> <x:o> }");
Graph graph = link.get();
assertNotNull(graph);
DatasetGraph dsg = link.getDataset();
assertNotNull(dsg);
}
}
use of org.apache.jena.rdflink.RDFLink in project jena by apache.
the class TestService method service_query_silent_no_service.
@Test
public void service_query_silent_no_service() {
logOnlyErrors(QueryIterService.class, () -> {
DatasetGraph dsg = env.dsg();
String queryString = "SELECT * { SERVICE SILENT <" + SERVICE + "JUNK> { VALUES ?X { 1 2 } }} ";
try (RDFLink link = RDFLinkFactory.connect(localDataset())) {
try (QueryExec qExec = link.query(queryString)) {
RowSet rs = qExec.select();
assertTrue(rs.hasNext());
Binding binding = rs.next();
assertFalse(rs.hasNext());
assertTrue(binding.isEmpty());
}
}
});
}
Aggregations