@Test public void testRule() { Set<IntegerAnnotation> annotations = new TreeSet<>(); IntegerOntologyObjectFactory factory = new IntegerOntologyObjectFactoryImpl(); NormalizerNR2_1 normalizer = new NormalizerNR2_1(factory); IntegerObjectProperty r1 = factory.getDataTypeFactory().createObjectProperty( factory.getEntityManager().createNamedEntity(IntegerEntityType.OBJECT_PROPERTY, "r1", false)); IntegerObjectProperty r2 = factory.getDataTypeFactory().createObjectProperty( factory.getEntityManager().createNamedEntity(IntegerEntityType.OBJECT_PROPERTY, "r2", false)); IntegerObjectProperty r3 = factory.getDataTypeFactory().createObjectProperty( factory.getEntityManager().createNamedEntity(IntegerEntityType.OBJECT_PROPERTY, "r3", false)); IntegerObjectProperty r4 = factory.getDataTypeFactory().createObjectProperty( factory.getEntityManager().createNamedEntity(IntegerEntityType.OBJECT_PROPERTY, "r4", false)); IntegerObjectProperty s = factory.getDataTypeFactory().createObjectProperty( factory.getEntityManager().createNamedEntity(IntegerEntityType.OBJECT_PROPERTY, "s", false)); IntegerSubPropertyChainOfAxiom originalAxiom = null; { List<IntegerObjectPropertyExpression> list = new ArrayList<>(); list.add(r1); list.add(r2); list.add(r3); list.add(r4); originalAxiom = factory.getComplexAxiomFactory().createSubPropertyChainOfAxiom(list, s, annotations); } Set<IntegerAxiom> normalizedAxioms = normalizer.apply(originalAxiom); IntegerObjectProperty u1 = null; IntegerObjectProperty u2 = null; for (IntegerAxiom normAxiom : normalizedAxioms) { Assert.assertTrue(normAxiom instanceof RI3Axiom); if (normAxiom instanceof RI3Axiom) { RI3Axiom axiom = (RI3Axiom) normAxiom; if (axiom.getSuperProperty() == s.getId() && axiom.getRightSubProperty() == r4.getId()) { u2 = factory.getDataTypeFactory().createObjectProperty(axiom.getLeftSubProperty()); } if (axiom.getLeftSubProperty() == r1.getId() && axiom.getRightSubProperty() == r2.getId()) { u1 = factory.getDataTypeFactory().createObjectProperty(axiom.getSuperProperty()); } } } Set<IntegerAxiom> expectedAxioms = new HashSet<>(); expectedAxioms.add( factory.getNormalizedAxiomFactory().createRI3Axiom(r1.getId(), r2.getId(), u1.getId(), annotations)); expectedAxioms.add( factory.getNormalizedAxiomFactory().createRI3Axiom(u1.getId(), r3.getId(), u2.getId(), annotations)); expectedAxioms.add( factory.getNormalizedAxiomFactory().createRI3Axiom(u2.getId(), r4.getId(), s.getId(), annotations)); Assert.assertEquals(expectedAxioms, normalizedAxioms); }
@Override public Set<IntegerAxiom> apply(IntegerAxiom axiom) { Objects.requireNonNull(axiom); Set<IntegerAxiom> ret = Collections.emptySet(); if (axiom instanceof IntegerSubPropertyChainOfAxiom) { ret = applyRule((IntegerSubPropertyChainOfAxiom) axiom); } return ret; }
NormalizerNR2_1 implements NormalizationRule { @Override public Set<IntegerAxiom> apply(IntegerAxiom axiom) { Objects.requireNonNull(axiom); Set<IntegerAxiom> ret = Collections.emptySet(); if (axiom instanceof IntegerSubPropertyChainOfAxiom) { ret = applyRule((IntegerSubPropertyChainOfAxiom) axiom); } return ret; } }
NormalizerNR2_1 implements NormalizationRule { @Override public Set<IntegerAxiom> apply(IntegerAxiom axiom) { Objects.requireNonNull(axiom); Set<IntegerAxiom> ret = Collections.emptySet(); if (axiom instanceof IntegerSubPropertyChainOfAxiom) { ret = applyRule((IntegerSubPropertyChainOfAxiom) axiom); } return ret; } NormalizerNR2_1(IntegerOntologyObjectFactory factory); }
NormalizerNR2_1 implements NormalizationRule { @Override public Set<IntegerAxiom> apply(IntegerAxiom axiom) { Objects.requireNonNull(axiom); Set<IntegerAxiom> ret = Collections.emptySet(); if (axiom instanceof IntegerSubPropertyChainOfAxiom) { ret = applyRule((IntegerSubPropertyChainOfAxiom) axiom); } return ret; } NormalizerNR2_1(IntegerOntologyObjectFactory factory); @Override Set<IntegerAxiom> apply(IntegerAxiom axiom); }
NormalizerNR2_1 implements NormalizationRule { @Override public Set<IntegerAxiom> apply(IntegerAxiom axiom) { Objects.requireNonNull(axiom); Set<IntegerAxiom> ret = Collections.emptySet(); if (axiom instanceof IntegerSubPropertyChainOfAxiom) { ret = applyRule((IntegerSubPropertyChainOfAxiom) axiom); } return ret; } NormalizerNR2_1(IntegerOntologyObjectFactory factory); @Override Set<IntegerAxiom> apply(IntegerAxiom axiom);  }