PropertiesHandler implements Properties { @Override public void removeProperties(NamedResource individual, URI context, Map<Assertion, Set<Value<?>>> properties) { new EpistemicAxiomRemover(connector).remove(individual, properties, context); } PropertiesHandler(StorageConnector connector); @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 removePropertiesDeletesStatementsFromRepository() { final Assertion a = Assertion.createPropertyAssertion(Generator.generateUri(), false); final Integer vOne = 117; final Integer vTwo = 118; handler.removeProperties(SUBJECT, null, Collections.singletonMap(a, new HashSet<>(Arrays.asList(new Value<>(vOne), new Value<>(vTwo))))); verify(connectorMock) .remove(SUBJECT_RESOURCE, createProperty(a.getIdentifier().toString()), createTypedLiteral(vOne), null); verify(connectorMock) .remove(SUBJECT_RESOURCE, createProperty(a.getIdentifier().toString()), createTypedLiteral(vTwo), null); }
@Test public void removePropertiesDeletesStatementsFromCorrectContext() { final Assertion a = Assertion.createPropertyAssertion(Generator.generateUri(), false); final String vOne = Generator.generateUri().toString(); final String vTwo = Generator.generateUri().toString(); final URI context = Generator.generateUri(); handler.removeProperties(SUBJECT, context, Collections.singletonMap(a, new HashSet<>(Arrays.asList(new Value<>(NamedResource.create(vOne)), new Value<>(NamedResource.create(vTwo)))))); verify(connectorMock) .remove(SUBJECT_RESOURCE, createProperty(a.getIdentifier().toString()), createResource(vOne), context.toString()); verify(connectorMock) .remove(SUBJECT_RESOURCE, createProperty(a.getIdentifier().toString()), createResource(vTwo), context.toString()); }