Search in sources :

Example 16 with DatasetAccessor

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());
}
Also used : Model(org.apache.jena.rdf.model.Model) DatasetAccessor(org.apache.jena.query.DatasetAccessor) Test(org.junit.Test)

Example 17 with DatasetAccessor

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());
}
Also used : Model(org.apache.jena.rdf.model.Model) DatasetAccessor(org.apache.jena.query.DatasetAccessor) Test(org.junit.Test)

Example 18 with DatasetAccessor

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));
    }
}
Also used : DatasetAccessor(org.apache.jena.query.DatasetAccessor)

Example 19 with DatasetAccessor

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());
}
Also used : Model(org.apache.jena.rdf.model.Model) DatasetAccessor(org.apache.jena.query.DatasetAccessor) Test(org.junit.Test)

Example 20 with DatasetAccessor

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);
}
Also used : DatasetAccessor(org.apache.jena.query.DatasetAccessor) Test(org.junit.Test) AbstractFusekiTest(org.apache.jena.fuseki.AbstractFusekiTest) FusekiTest(org.apache.jena.fuseki.FusekiTest)

Aggregations

DatasetAccessor (org.apache.jena.query.DatasetAccessor)32 Test (org.junit.Test)31 AbstractFusekiTest (org.apache.jena.fuseki.AbstractFusekiTest)21 FusekiTest (org.apache.jena.fuseki.FusekiTest)21 Model (org.apache.jena.rdf.model.Model)20 AuthScope (org.apache.http.auth.AuthScope)2