SimpleProvenanceService implements ProvenanceService { @Override public void addActivity(Activity activity) { try (RepositoryConnection conn = repo.getConnection()) { if (conn.contains(activity.getResource(), null, null)) { throw new IllegalArgumentException("Activity " + activity.getResource() + " already exists"); } conn.add(activity.getModel()); } }  @Override RepositoryConnection getConnection(); @Override Activity createActivity(ActivityConfig config); @Override void addActivity(Activity activity); @Override Optional<Activity> getActivity(Resource activityIRI); @Override void updateActivity(Activity newActivity); @Override void deleteActivity(Resource activityIRI);  }
@Test public void addActivityTest() throws Exception { Activity activity = activityFactory.createNew(activityIRI); service.addActivity(activity); try (RepositoryConnection conn = repo.getConnection()) { activity.getModel().forEach(statement -> conn.contains(statement.getSubject(), statement.getPredicate(), statement.getObject())); } }