class SimpleProvenanceService implements ProvenanceService {

    @Override
    public void deleteActivity(Resource activityIRI) {
        try (RepositoryConnection conn = repo.getConnection()) {
            if (!conn.contains(activityIRI, null, null)) {
                throw new IllegalArgumentException("Activity " + activityIRI + " does not exist");
            }
            conn.begin();
            List<Resource> generated = getReferencedEntityIRIs(activityIRI, Activity.generated_IRI, conn);
            List<Resource> invalided = getReferencedEntityIRIs(activityIRI, Activity.invalidated_IRI, conn);
            List<Resource> used = getReferencedEntityIRIs(activityIRI, Activity.used_IRI, conn);
            conn.remove(activityIRI, null, null);
            conn.remove((Resource) null, null, activityIRI);
            generated.forEach(resource -> removeIfNotReferenced(resource, conn));
            invalided.forEach(resource -> removeIfNotReferenced(resource, conn));
            used.forEach(resource -> removeIfNotReferenced(resource, conn));
            conn.commit();
        }
    }

}