@Test public void testGCI3ObjectInverseOf() { Set<IntegerAnnotation> annotations = new TreeSet<>(); IntegerOntologyObjectFactory factory = new IntegerOntologyObjectFactoryImpl(); IntegerClass a = createNewClass(factory, "A"); IntegerClass b = createNewClass(factory, "B"); IntegerObjectProperty r = createNewObjectProperty(factory, "r"); Set<ComplexIntegerAxiom> ontology = new HashSet<>(); ontology.add(factory.getComplexAxiomFactory().createSubClassOfAxiom(factory.getDataTypeFactory() .createObjectSomeValuesFrom(factory.getDataTypeFactory().createObjectInverseOf(r), a), b, annotations)); OntologyNormalizer normalizer = new OntologyNormalizer(); Set<NormalizedIntegerAxiom> normalizedSet = normalizer.normalize(ontology, factory); Set<NormalizedIntegerAxiom> expectedSet = new HashSet<>(); expectedSet.add(factory.getNormalizedAxiomFactory().createGCI3Axiom( factory.getEntityManager().createOrGetInverseObjectPropertyOf(r.getId()), a.getId(), b.getId(), annotations)); Assert.assertEquals(expectedSet, normalizedSet); }
public Set<NormalizedIntegerAxiom> normalize(Set<ComplexIntegerAxiom> originalAxiomSet, IntegerOntologyObjectFactory factory) { Objects.requireNonNull(originalAxiomSet); Objects.requireNonNull(factory); Set<NormalizedIntegerAxiom> ret = new HashSet<>(); SimpleNormalizer normalizer = new SimpleNormalizer(factory); Set<Integer> objectPropIdSet = new HashSet<>(); Set<IntegerAxiom> currentAxiomSet = new HashSet<>(); for (ComplexIntegerAxiom axiom : originalAxiomSet) { objectPropIdSet.addAll(axiom.getObjectPropertiesInSignature()); if (axiom instanceof IntegerInverseObjectPropertiesAxiom) { Set<IntegerAxiom> newSet = normalizer.normalize(axiom); currentAxiomSet.addAll(newSet); } else { currentAxiomSet.add(axiom); } } for (Integer propId : objectPropIdSet) { Integer inversePropId = factory.getEntityManager().createOrGetInverseObjectPropertyOf(propId); currentAxiomSet.addAll(normalizer.getAxiomsForInverseObjectProperties(propId, inversePropId)); } while (currentAxiomSet.size() > 0) { Set<IntegerAxiom> nextAxiomSet = new HashSet<>(); for (IntegerAxiom axiom : currentAxiomSet) { if (axiom instanceof NormalizedIntegerAxiom) { ret.add((NormalizedIntegerAxiom) axiom); } else { Set<IntegerAxiom> newSet = normalizer.normalize(axiom); nextAxiomSet.addAll(newSet); } } currentAxiomSet = nextAxiomSet; } return Collections.unmodifiableSet(ret); }
OntologyNormalizer { public Set<NormalizedIntegerAxiom> normalize(Set<ComplexIntegerAxiom> originalAxiomSet, IntegerOntologyObjectFactory factory) { Objects.requireNonNull(originalAxiomSet); Objects.requireNonNull(factory); Set<NormalizedIntegerAxiom> ret = new HashSet<>(); SimpleNormalizer normalizer = new SimpleNormalizer(factory); Set<Integer> objectPropIdSet = new HashSet<>(); Set<IntegerAxiom> currentAxiomSet = new HashSet<>(); for (ComplexIntegerAxiom axiom : originalAxiomSet) { objectPropIdSet.addAll(axiom.getObjectPropertiesInSignature()); if (axiom instanceof IntegerInverseObjectPropertiesAxiom) { Set<IntegerAxiom> newSet = normalizer.normalize(axiom); currentAxiomSet.addAll(newSet); } else { currentAxiomSet.add(axiom); } } for (Integer propId : objectPropIdSet) { Integer inversePropId = factory.getEntityManager().createOrGetInverseObjectPropertyOf(propId); currentAxiomSet.addAll(normalizer.getAxiomsForInverseObjectProperties(propId, inversePropId)); } while (currentAxiomSet.size() > 0) { Set<IntegerAxiom> nextAxiomSet = new HashSet<>(); for (IntegerAxiom axiom : currentAxiomSet) { if (axiom instanceof NormalizedIntegerAxiom) { ret.add((NormalizedIntegerAxiom) axiom); } else { Set<IntegerAxiom> newSet = normalizer.normalize(axiom); nextAxiomSet.addAll(newSet); } } currentAxiomSet = nextAxiomSet; } return Collections.unmodifiableSet(ret); } }
OntologyNormalizer { public Set<NormalizedIntegerAxiom> normalize(Set<ComplexIntegerAxiom> originalAxiomSet, IntegerOntologyObjectFactory factory) { Objects.requireNonNull(originalAxiomSet); Objects.requireNonNull(factory); Set<NormalizedIntegerAxiom> ret = new HashSet<>(); SimpleNormalizer normalizer = new SimpleNormalizer(factory); Set<Integer> objectPropIdSet = new HashSet<>(); Set<IntegerAxiom> currentAxiomSet = new HashSet<>(); for (ComplexIntegerAxiom axiom : originalAxiomSet) { objectPropIdSet.addAll(axiom.getObjectPropertiesInSignature()); if (axiom instanceof IntegerInverseObjectPropertiesAxiom) { Set<IntegerAxiom> newSet = normalizer.normalize(axiom); currentAxiomSet.addAll(newSet); } else { currentAxiomSet.add(axiom); } } for (Integer propId : objectPropIdSet) { Integer inversePropId = factory.getEntityManager().createOrGetInverseObjectPropertyOf(propId); currentAxiomSet.addAll(normalizer.getAxiomsForInverseObjectProperties(propId, inversePropId)); } while (currentAxiomSet.size() > 0) { Set<IntegerAxiom> nextAxiomSet = new HashSet<>(); for (IntegerAxiom axiom : currentAxiomSet) { if (axiom instanceof NormalizedIntegerAxiom) { ret.add((NormalizedIntegerAxiom) axiom); } else { Set<IntegerAxiom> newSet = normalizer.normalize(axiom); nextAxiomSet.addAll(newSet); } } currentAxiomSet = nextAxiomSet; } return Collections.unmodifiableSet(ret); } OntologyNormalizer(); }
OntologyNormalizer { public Set<NormalizedIntegerAxiom> normalize(Set<ComplexIntegerAxiom> originalAxiomSet, IntegerOntologyObjectFactory factory) { Objects.requireNonNull(originalAxiomSet); Objects.requireNonNull(factory); Set<NormalizedIntegerAxiom> ret = new HashSet<>(); SimpleNormalizer normalizer = new SimpleNormalizer(factory); Set<Integer> objectPropIdSet = new HashSet<>(); Set<IntegerAxiom> currentAxiomSet = new HashSet<>(); for (ComplexIntegerAxiom axiom : originalAxiomSet) { objectPropIdSet.addAll(axiom.getObjectPropertiesInSignature()); if (axiom instanceof IntegerInverseObjectPropertiesAxiom) { Set<IntegerAxiom> newSet = normalizer.normalize(axiom); currentAxiomSet.addAll(newSet); } else { currentAxiomSet.add(axiom); } } for (Integer propId : objectPropIdSet) { Integer inversePropId = factory.getEntityManager().createOrGetInverseObjectPropertyOf(propId); currentAxiomSet.addAll(normalizer.getAxiomsForInverseObjectProperties(propId, inversePropId)); } while (currentAxiomSet.size() > 0) { Set<IntegerAxiom> nextAxiomSet = new HashSet<>(); for (IntegerAxiom axiom : currentAxiomSet) { if (axiom instanceof NormalizedIntegerAxiom) { ret.add((NormalizedIntegerAxiom) axiom); } else { Set<IntegerAxiom> newSet = normalizer.normalize(axiom); nextAxiomSet.addAll(newSet); } } currentAxiomSet = nextAxiomSet; } return Collections.unmodifiableSet(ret); } OntologyNormalizer(); Set<NormalizedIntegerAxiom> normalize(Set<ComplexIntegerAxiom> originalAxiomSet,
			IntegerOntologyObjectFactory factory); }
OntologyNormalizer { public Set<NormalizedIntegerAxiom> normalize(Set<ComplexIntegerAxiom> originalAxiomSet, IntegerOntologyObjectFactory factory) { Objects.requireNonNull(originalAxiomSet); Objects.requireNonNull(factory); Set<NormalizedIntegerAxiom> ret = new HashSet<>(); SimpleNormalizer normalizer = new SimpleNormalizer(factory); Set<Integer> objectPropIdSet = new HashSet<>(); Set<IntegerAxiom> currentAxiomSet = new HashSet<>(); for (ComplexIntegerAxiom axiom : originalAxiomSet) { objectPropIdSet.addAll(axiom.getObjectPropertiesInSignature()); if (axiom instanceof IntegerInverseObjectPropertiesAxiom) { Set<IntegerAxiom> newSet = normalizer.normalize(axiom); currentAxiomSet.addAll(newSet); } else { currentAxiomSet.add(axiom); } } for (Integer propId : objectPropIdSet) { Integer inversePropId = factory.getEntityManager().createOrGetInverseObjectPropertyOf(propId); currentAxiomSet.addAll(normalizer.getAxiomsForInverseObjectProperties(propId, inversePropId)); } while (currentAxiomSet.size() > 0) { Set<IntegerAxiom> nextAxiomSet = new HashSet<>(); for (IntegerAxiom axiom : currentAxiomSet) { if (axiom instanceof NormalizedIntegerAxiom) { ret.add((NormalizedIntegerAxiom) axiom); } else { Set<IntegerAxiom> newSet = normalizer.normalize(axiom); nextAxiomSet.addAll(newSet); } } currentAxiomSet = nextAxiomSet; } return Collections.unmodifiableSet(ret); } OntologyNormalizer(); Set<NormalizedIntegerAxiom> normalize(Set<ComplexIntegerAxiom> originalAxiomSet,
			IntegerOntologyObjectFactory factory);  }