NormalizerNR3_3 implements NormalizationRule { @Override public Set<IntegerAxiom> apply(IntegerAxiom axiom) { Objects.requireNonNull(axiom); Set<IntegerAxiom> ret = Collections.emptySet(); if (axiom instanceof IntegerSubClassOfAxiom) { ret = applyRule((IntegerSubClassOfAxiom) axiom); } return ret; } NormalizerNR3_3(IntegerOntologyObjectFactory factory); @Override Set<IntegerAxiom> apply(IntegerAxiom axiom);  }
@Test public void testRule() { Set<IntegerAnnotation> annotations = new TreeSet<>(); IntegerOntologyObjectFactory factory = new IntegerOntologyObjectFactoryImpl(); NormalizerNR3_3 normalizer = new NormalizerNR3_3(factory); IntegerObjectProperty r = factory.getDataTypeFactory().createObjectProperty( factory.getEntityManager().createNamedEntity(IntegerEntityType.OBJECT_PROPERTY, "r", false)); IntegerObjectProperty s1 = factory.getDataTypeFactory().createObjectProperty( factory.getEntityManager().createNamedEntity(IntegerEntityType.OBJECT_PROPERTY, "s1", false)); IntegerObjectProperty s2 = factory.getDataTypeFactory().createObjectProperty( factory.getEntityManager().createNamedEntity(IntegerEntityType.OBJECT_PROPERTY, "s2", false)); IntegerClass c1 = factory.getDataTypeFactory() .createClass(factory.getEntityManager().createNamedEntity(IntegerEntityType.CLASS, "C1", false)); IntegerClass d1 = factory.getDataTypeFactory() .createClass(factory.getEntityManager().createNamedEntity(IntegerEntityType.CLASS, "D1", false)); IntegerClass d2 = factory.getDataTypeFactory() .createClass(factory.getEntityManager().createNamedEntity(IntegerEntityType.CLASS, "D2", false)); IntegerClass d3 = factory.getDataTypeFactory() .createClass(factory.getEntityManager().createNamedEntity(IntegerEntityType.CLASS, "D3", false)); IntegerClass d4 = factory.getDataTypeFactory() .createClass(factory.getEntityManager().createNamedEntity(IntegerEntityType.CLASS, "D4", false)); IntegerClass d5 = factory.getDataTypeFactory() .createClass(factory.getEntityManager().createNamedEntity(IntegerEntityType.CLASS, "D5", false)); IntegerClass d6 = factory.getDataTypeFactory() .createClass(factory.getEntityManager().createNamedEntity(IntegerEntityType.CLASS, "D6", false)); Set<IntegerClassExpression> set1 = new HashSet<>(); set1.add(d2); set1.add(d3); IntegerClassExpression dPrime0 = factory.getDataTypeFactory().createObjectIntersectionOf(set1); IntegerClassExpression dPrime1 = factory.getDataTypeFactory().createObjectSomeValuesFrom(r, dPrime0); Set<IntegerClassExpression> set2 = new HashSet<>(); set2.add(d1); set2.add(dPrime1); IntegerClassExpression d = factory.getDataTypeFactory().createObjectIntersectionOf(set2); Set<IntegerClassExpression> set3 = new HashSet<>(); set3.add(d4); set3.add(d5); IntegerClassExpression dPrime2 = factory.getDataTypeFactory().createObjectIntersectionOf(set3); IntegerClassExpression c2 = factory.getDataTypeFactory().createObjectSomeValuesFrom(s1, dPrime2); IntegerClassExpression c3 = factory.getDataTypeFactory().createObjectSomeValuesFrom(s2, d6); Set<IntegerClassExpression> set4 = new HashSet<>(); set4.add(d2); set4.add(c1); set4.add(c2); set4.add(c3); IntegerClassExpression c = factory.getDataTypeFactory().createObjectIntersectionOf(set4); IntegerSubClassOfAxiom axiom = factory.getComplexAxiomFactory().createSubClassOfAxiom(d, c, annotations); Set<IntegerAxiom> normalizedAxioms = normalizer.apply(axiom); Set<IntegerAxiom> expectedAxioms = new HashSet<>(); expectedAxioms.add(factory.getComplexAxiomFactory().createSubClassOfAxiom(d, d2, annotations)); expectedAxioms.add(factory.getComplexAxiomFactory().createSubClassOfAxiom(d, c1, annotations)); expectedAxioms.add(factory.getComplexAxiomFactory().createSubClassOfAxiom(d, c2, annotations)); expectedAxioms.add(factory.getComplexAxiomFactory().createSubClassOfAxiom(d, c3, annotations)); Assert.assertEquals(expectedAxioms, normalizedAxioms); }