NormalizerNR1_5 implements NormalizationRule { @Override public Set<IntegerAxiom> apply(IntegerAxiom axiom) { Objects.requireNonNull(axiom); Set<IntegerAxiom> ret = Collections.emptySet(); if (axiom instanceof IntegerEquivalentClassesAxiom) { ret = applyRule((IntegerEquivalentClassesAxiom) axiom); } return ret; } NormalizerNR1_5(IntegerOntologyObjectFactory factory); @Override Set<IntegerAxiom> apply(IntegerAxiom axiom);  }
@Test public void testUsingClasses() { Set<IntegerAnnotation> annotations = new TreeSet<>(); IntegerOntologyObjectFactory factory = new IntegerOntologyObjectFactoryImpl(); NormalizerNR1_5 normalizer = new NormalizerNR1_5(factory); IntegerClass c = factory.getDataTypeFactory() .createClass(factory.getEntityManager().createNamedEntity(IntegerEntityType.CLASS, "C", false)); IntegerClass d = factory.getDataTypeFactory() .createClass(factory.getEntityManager().createNamedEntity(IntegerEntityType.CLASS, "D", false)); Set<IntegerClassExpression> set = new HashSet<>(); set.add(c); set.add(d); IntegerEquivalentClassesAxiom axiom = factory.getComplexAxiomFactory().createEquivalentClassesAxiom(set, annotations); Set<IntegerAxiom> normalizedAxioms = normalizer.apply(axiom); Set<IntegerAxiom> expectedAxioms = new HashSet<>(); expectedAxioms.add(factory.getComplexAxiomFactory().createSubClassOfAxiom(c, d, annotations)); expectedAxioms.add(factory.getComplexAxiomFactory().createSubClassOfAxiom(d, c, annotations)); Assert.assertEquals(expectedAxioms, normalizedAxioms); }
@Test public void testUsingClassExpressions() { Set<IntegerAnnotation> annotations = new TreeSet<>(); IntegerOntologyObjectFactory factory = new IntegerOntologyObjectFactoryImpl(); NormalizerNR1_5 normalizer = new NormalizerNR1_5(factory); IntegerObjectProperty r = factory.getDataTypeFactory().createObjectProperty( factory.getEntityManager().createNamedEntity(IntegerEntityType.OBJECT_PROPERTY, "r", false)); IntegerClass c1 = factory.getDataTypeFactory() .createClass(factory.getEntityManager().createNamedEntity(IntegerEntityType.CLASS, "C1", false)); IntegerClass c2 = factory.getDataTypeFactory() .createClass(factory.getEntityManager().createNamedEntity(IntegerEntityType.CLASS, "C2", false)); IntegerClass c3 = factory.getDataTypeFactory() .createClass(factory.getEntityManager().createNamedEntity(IntegerEntityType.CLASS, "C3", false)); IntegerClassExpression c = factory.getDataTypeFactory().createObjectSomeValuesFrom(r, c1); Set<IntegerClassExpression> parameter = new HashSet<>(); parameter.add(c2); parameter.add(c3); IntegerClassExpression d = factory.getDataTypeFactory().createObjectIntersectionOf(parameter); Set<IntegerClassExpression> set = new HashSet<>(); set.add(c); set.add(d); IntegerEquivalentClassesAxiom axiom = factory.getComplexAxiomFactory().createEquivalentClassesAxiom(set, annotations); Set<IntegerAxiom> normalizedAxioms = normalizer.apply(axiom); Set<IntegerAxiom> expectedAxioms = new HashSet<>(); expectedAxioms.add(factory.getComplexAxiomFactory().createSubClassOfAxiom(c, d, annotations)); expectedAxioms.add(factory.getComplexAxiomFactory().createSubClassOfAxiom(d, c, annotations)); Assert.assertEquals(expectedAxioms, normalizedAxioms); }