OwlapiProperties implements Properties { @Override public void removeProperties(NamedResource individual, URI context, Map<Assertion, Set<Value<?>>> properties) throws OntoDriverException { ensureValidity(individual, properties); if (!properties.isEmpty()) { adapter.getPropertiesHandler().removeProperties(individual, properties); } afterChangeCallback.execute(); } OwlapiProperties(OwlapiAdapter adapter, Procedure beforeCallback, Procedure afterChangeCallback); @Override Collection<Axiom<?>> getProperties(NamedResource individual, URI context, boolean includeInferred); @Override void addProperties(NamedResource individual, URI context, Map<Assertion, Set<Value<?>>> properties); @Override void removeProperties(NamedResource individual, URI context, Map<Assertion, Set<Value<?>>> properties);  }
@Test public void removePropertiesCommitsTransactionIfTurnedOn() throws Exception { final Map<Assertion, Set<Value<?>>> props = Collections.singletonMap( Assertion.createDataPropertyAssertion(URI.create("http: Collections.singleton(new Value<>("String"))); properties.removeProperties(INDIVIDUAL, null, props); verify(handlerMock).removeProperties(INDIVIDUAL, props); verify(afterMock).execute(); }
@Test public void removePropertiesDoesNothingWhenPropertiesAreEmpty() throws Exception { properties.removeProperties(INDIVIDUAL, null, Collections.emptyMap()); verify(handlerMock, never()).removeProperties(any(NamedResource.class), anyMap()); verify(afterMock).execute(); }