SchemaSanitizingObjectSupport extends ResourceObjectSupport implements SchemaSanitizingObject { @Override public boolean sanitizeSchema(Resource propertyUri) { try { sanitizeSubProperties(propertyUri.toString()); sanitizeSuperProperties(); sanitizeSymmetry(); sanitizeTransitivity(); sanitizeInverseProperties(); } catch (RepositoryException e) { return false; } return true; }  @Override boolean sanitizeSchema(Resource propertyUri); @Override boolean sanitizeSchema(String propertyUri);  }
@Test public void testTransitivitySanitizing() throws Exception { SanitizingTestResource resource1 = anno4j.createObject(SanitizingTestResource.class); SanitizingTestResource resource2 = anno4j.createObject(SanitizingTestResource.class); SanitizingTestResource resource3 = anno4j.createObject(SanitizingTestResource.class); resource2.setTransitive(Sets.newHashSet(resource3)); resource1.setTransitive(Sets.newHashSet(resource2)); resource1.sanitizeSchema("urn:anno4j_test:sanitizing_transitive"); assertEquals(Sets.newHashSet(resource2, resource3), resource1.getTransitive()); }
@Test public void testSymmetrySanitizing() throws Exception { SanitizingTestResource resource1 = anno4j.createObject(SanitizingTestResource.class); SanitizingTestResource resource2 = anno4j.createObject(SanitizingTestResource.class); resource1.setSymmetric(Sets.newHashSet(resource2)); resource1.sanitizeSchema("urn:anno4j_test:sanitizing_transitive"); assertEquals(Sets.newHashSet(resource2), resource1.getSymmetric()); assertEquals(Sets.newHashSet(resource1), resource2.getSymmetric()); }