Search in sources :

Example 1 with UpdateDrop

use of org.apache.jena.sparql.modify.request.UpdateDrop in project jena by apache.

the class FusekiTestServer method resetServer.

/*package*/
static void resetServer() {
    if (countServer.get() == 0)
        throw new RuntimeException("No server started!");
    if (CLEAR_DSG_DIRECTLY) {
        Txn.executeWrite(dsgTesting, () -> dsgTesting.clear());
    } else {
        Update clearRequest = new UpdateDrop(Target.ALL);
        UpdateProcessor proc = UpdateExecutionFactory.createRemote(clearRequest, serviceUpdate());
        try {
            proc.execute();
        } catch (Throwable e) {
            e.printStackTrace();
            throw e;
        }
    }
}
Also used : UpdateProcessor(org.apache.jena.update.UpdateProcessor) Update(org.apache.jena.update.Update) UpdateDrop(org.apache.jena.sparql.modify.request.UpdateDrop)

Example 2 with UpdateDrop

use of org.apache.jena.sparql.modify.request.UpdateDrop in project jena by apache.

the class AbstractTestUpdateGraphMgt method testCreateDrop2.

@Test
public void testCreateDrop2() {
    DatasetGraph gStore = getEmptyDatasetGraph();
    Update u = new UpdateCreate(graphIRI);
    UpdateAction.execute(u, gStore);
    u = new UpdateCreate(graphIRI, true);
    UpdateAction.execute(u, gStore);
    // JENA-1068
    // assertTrue(gStore.containsGraph(graphIRI)) ;
    assertTrue(graphEmpty(gStore.getGraph(graphIRI)));
    u = new UpdateDrop(graphIRI);
    UpdateAction.execute(u, gStore);
    assertFalse(gStore.containsGraph(graphIRI));
    u = new UpdateDrop(graphIRI, true);
    UpdateAction.execute(u, gStore);
}
Also used : UpdateCreate(org.apache.jena.sparql.modify.request.UpdateCreate) Update(org.apache.jena.update.Update) DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) UpdateDrop(org.apache.jena.sparql.modify.request.UpdateDrop) Test(org.junit.Test)

Example 3 with UpdateDrop

use of org.apache.jena.sparql.modify.request.UpdateDrop in project jena by apache.

the class UpdateProgrammatic method main.

public static void main(String[] args) {
    Dataset dataset = DatasetFactory.createTxnMem();
    UpdateRequest request = UpdateFactory.create();
    request.add(new UpdateDrop(Target.ALL));
    request.add(new UpdateCreate("http://example/g2"));
    request.add(new UpdateLoad("file:etc/update-data.ttl", "http://example/g2"));
    UpdateAction.execute(request, dataset);
    System.out.println("# Debug format");
    SSE.write(dataset);
    System.out.println();
    System.out.println("# N-Quads: S P O G");
    RDFDataMgr.write(System.out, dataset, Lang.NQUADS);
}
Also used : UpdateCreate(org.apache.jena.sparql.modify.request.UpdateCreate) UpdateLoad(org.apache.jena.sparql.modify.request.UpdateLoad) Dataset(org.apache.jena.query.Dataset) UpdateDrop(org.apache.jena.sparql.modify.request.UpdateDrop)

Example 4 with UpdateDrop

use of org.apache.jena.sparql.modify.request.UpdateDrop in project jena by apache.

the class FusekiJdbcTestServer method resetServer.

/*package*/
static void resetServer() {
    if (countServer.get() == 0)
        throw new RuntimeException("No server started!");
    if (CLEAR_DSG_DIRECTLY) {
        Txn.executeWrite(dsgTesting, () -> dsgTesting.clear());
    } else {
        Update clearRequest = new UpdateDrop(Target.ALL);
        UpdateProcessor proc = UpdateExecutionFactory.createRemote(clearRequest, serviceUpdate());
        try {
            proc.execute();
        } catch (Throwable e) {
            e.printStackTrace();
            throw e;
        }
    }
}
Also used : UpdateProcessor(org.apache.jena.update.UpdateProcessor) Update(org.apache.jena.update.Update) UpdateDrop(org.apache.jena.sparql.modify.request.UpdateDrop)

Example 5 with UpdateDrop

use of org.apache.jena.sparql.modify.request.UpdateDrop in project jena by apache.

the class TestRemoteEndpointResultsWithAuth method cleanupTest.

/**
 * Clean up after each test by resetting the Fuseki instance
 */
@After
public void cleanupTest() {
    Update clearRequest = new UpdateDrop(Target.ALL);
    UpdateExecution.service(FusekiTestAuth.serviceUpdate()).update(clearRequest).httpClient(client).execute();
}
Also used : Update(org.apache.jena.update.Update) UpdateDrop(org.apache.jena.sparql.modify.request.UpdateDrop) After(org.junit.After)

Aggregations

UpdateDrop (org.apache.jena.sparql.modify.request.UpdateDrop)7 Update (org.apache.jena.update.Update)6 UpdateCreate (org.apache.jena.sparql.modify.request.UpdateCreate)3 UpdateProcessor (org.apache.jena.update.UpdateProcessor)3 DatasetGraph (org.apache.jena.sparql.core.DatasetGraph)2 Test (org.junit.Test)2 Dataset (org.apache.jena.query.Dataset)1 UpdateLoad (org.apache.jena.sparql.modify.request.UpdateLoad)1 UpdateException (org.apache.jena.update.UpdateException)1 After (org.junit.After)1