Search in sources :

Example 1 with RemoveStatementsOperation

use of org.eclipse.rdf4j.http.protocol.transaction.operations.RemoveStatementsOperation in project rdf4j by eclipse.

the class HTTPRepositoryConnection method removeWithoutCommit.

@Override
protected void removeWithoutCommit(Resource subject, IRI predicate, Value object, Resource... contexts) throws RepositoryException {
    if (this.getRepository().useCompatibleMode()) {
        txn.add(new RemoveStatementsOperation(subject, predicate, object, contexts));
        return;
    }
    flushTransactionState(Protocol.Action.DELETE);
    if (toRemove == null) {
        toRemove = new LinkedHashModel();
    }
    if (subject == null) {
        subject = SESAME.WILDCARD;
    }
    if (predicate == null) {
        predicate = SESAME.WILDCARD;
    }
    if (object == null) {
        object = SESAME.WILDCARD;
    }
    toRemove.add(subject, predicate, object, contexts);
}
Also used : RemoveStatementsOperation(org.eclipse.rdf4j.http.protocol.transaction.operations.RemoveStatementsOperation) LinkedHashModel(org.eclipse.rdf4j.model.impl.LinkedHashModel)

Example 2 with RemoveStatementsOperation

use of org.eclipse.rdf4j.http.protocol.transaction.operations.RemoveStatementsOperation in project rdf4j by eclipse.

the class TransactionSAXParser method createRemoveStatementsOperation.

private TransactionOperation createRemoveStatementsOperation() throws SAXException {
    if (parsedValues.size() < 3) {
        throw new SAXException("At least three values required for RemoveStatementsOperation, found: " + parsedValues.size());
    }
    try {
        Resource subject = (Resource) parsedValues.get(0);
        IRI predicate = (IRI) parsedValues.get(1);
        Value object = parsedValues.get(2);
        Resource[] contexts = createContexts(3);
        parsedValues.clear();
        return new RemoveStatementsOperation(subject, predicate, object, contexts);
    } catch (ClassCastException e) {
        throw new SAXException("Invalid argument(s) for RemoveStatementsOperation", e);
    }
}
Also used : IRI(org.eclipse.rdf4j.model.IRI) RemoveStatementsOperation(org.eclipse.rdf4j.http.protocol.transaction.operations.RemoveStatementsOperation) Resource(org.eclipse.rdf4j.model.Resource) Value(org.eclipse.rdf4j.model.Value) SAXException(org.xml.sax.SAXException)

Aggregations

RemoveStatementsOperation (org.eclipse.rdf4j.http.protocol.transaction.operations.RemoveStatementsOperation)2 IRI (org.eclipse.rdf4j.model.IRI)1 Resource (org.eclipse.rdf4j.model.Resource)1 Value (org.eclipse.rdf4j.model.Value)1 LinkedHashModel (org.eclipse.rdf4j.model.impl.LinkedHashModel)1 SAXException (org.xml.sax.SAXException)1