use of org.apache.jena.query.DatasetAccessor in project jena by apache.
the class TestFileUpload method upload_gsp_04.
@Test
public void upload_gsp_04() {
{
DatasetAccessor du = DatasetAccessorFactory.createHTTP(ServerCtl.serviceGSP());
Model m = du.getModel();
assertEquals(0, m.size());
}
FileSender x = new FileSender(ServerCtl.urlDataset());
x.add("D.ttl", "<http://example/s> <http://example/p> <http://example/o> .", "text/plain");
x.add("D.trig", "<http://example/g> { <http://example/s> <http://example/p> 123,456 }", "text/plain");
x.send("POST");
DatasetAccessor du = DatasetAccessorFactory.createHTTP(ServerCtl.serviceGSP());
Model m = du.getModel();
assertEquals(1, m.size());
m = du.getModel("http://example/g");
assertEquals(2, m.size());
}
use of org.apache.jena.query.DatasetAccessor in project jena by apache.
the class TestFileUpload method dataset_accessor_01.
// Via DatasetAccessor
@Test
public void dataset_accessor_01() {
FileSender x = new FileSender(ServerCtl.urlDataset());
x.add("D.nq", "", "application/-n-quads");
x.send("PUT");
DatasetAccessor du = DatasetAccessorFactory.createHTTP(ServerCtl.serviceGSP());
Model m = du.getModel();
assertEquals(0, m.size());
}
use of org.apache.jena.query.DatasetAccessor in project jena by apache.
the class TestUtils method copyToRemoteDataset.
/**
* Copies a dataset to a remote service that provides SPARQL 1.1 Graph Store
* protocol support
*
* @param source
* Source Dataset
* @param service
* Remote Graph Store protocol service
* @param authenticator
* HTTP Authenticator
*/
public static void copyToRemoteDataset(Dataset source, String service, HttpClient client) {
DatasetAccessor target = DatasetAccessorFactory.createHTTP(service, client);
target.putModel(source.getDefaultModel());
Iterator<String> uris = source.listNames();
while (uris.hasNext()) {
String uri = uris.next();
target.putModel(uri, source.getNamedModel(uri));
}
}
use of org.apache.jena.query.DatasetAccessor in project jena by apache.
the class TestFileUpload method upload_gsp_03.
// Extension of GSP - no graph selector => dataset
@Test
public void upload_gsp_03() {
FileSender x = new FileSender(ServerCtl.serviceGSP());
x.add("D.ttl", "<http://example/s> <http://example/p> <http://example/o> .", "text/turtle");
x.add("D.trig", "<http://example/g> { <http://example/s> <http://example/p> <http://example/o> }", "text/trig");
x.send("POST");
DatasetAccessor du = DatasetAccessorFactory.createHTTP(ServerCtl.serviceGSP());
Model m = du.getModel();
assertEquals(1, m.size());
}
use of org.apache.jena.query.DatasetAccessor in project jena by apache.
the class TestDatasetAccessorHTTP method delete_02.
@Test
public void delete_02() {
DatasetAccessor du = connectToService();
du.deleteModel(gn1);
boolean exists = du.containsModel(gn1);
assertFalse("Expected gn1 not to exist", exists);
}
Aggregations