private void generateChanges(OWLClass cls, OWLObjectPropertyExpression property, Collection<OWLOntology> ontologies, OWLOntology targetOntology) { // We collect all of the fillers for existential restrictions along // the target property and all of the fillers for hasValue restrictions // as nominals FillerCollector collector = new FillerCollector(property); ontologies.forEach(o -> o.subClassAxiomsForSubClass(cls) .forEach(ax -> ax.getSuperClass().accept(collector))); if (collector.fillers.isEmpty()) { return; } OWLObjectUnionOf union = df.getOWLObjectUnionOf(collector.fillers); OWLClassExpression closureAxiomDesc = df.getOWLObjectAllValuesFrom(property, union); addChange(new AddAxiom(targetOntology, df.getOWLSubClassOfAxiom(cls, closureAxiomDesc))); }
/** * Creates a composite change that will add a closure axiom for a given * class along a specified property. * * @param dataFactory The data factory that should be used to create the necessary objects * @param cls The class for which the closure axiom will be generated * @param property The property that the closure axiom will act along * @param ontologies The ontologies that will be examined for subclass axioms * @param targetOntology The target ontology that changes will be applied to. */ public AddClassExpressionClosureAxiom(OWLDataFactory dataFactory, OWLClass cls, OWLObjectPropertyExpression property, Collection<OWLOntology> ontologies, OWLOntology targetOntology) { super(dataFactory); checkNotNull(cls, "cls cannot be null"); checkNotNull(property, "property cannot be null"); checkNotNull(ontologies, "ontologies cannot be null"); checkNotNull(targetOntology, "targetOntology cannot be null"); generateChanges(cls, property, ontologies, targetOntology); }
/** * Creates a composite change that will add a closure axiom for a given * class along a specified property. * * @param dataFactory The data factory that should be used to create the necessary objects * @param cls The class for which the closure axiom will be generated * @param property The property that the closure axiom will act along * @param ontologies The ontologies that will be examined for subclass axioms * @param targetOntology The target ontology that changes will be applied to. */ public AddClassExpressionClosureAxiom(OWLDataFactory dataFactory, OWLClass cls, OWLObjectPropertyExpression property, Collection<OWLOntology> ontologies, OWLOntology targetOntology) { super(dataFactory); checkNotNull(cls, "cls cannot be null"); checkNotNull(property, "property cannot be null"); checkNotNull(ontologies, "ontologies cannot be null"); checkNotNull(targetOntology, "targetOntology cannot be null"); generateChanges(cls, property, ontologies, targetOntology); }
private void generateChanges(OWLClass cls, OWLObjectPropertyExpression property, Collection<OWLOntology> ontologies, OWLOntology targetOntology) { // We collect all of the fillers for existential restrictions along // the target property and all of the fillers for hasValue restrictions // as nominals FillerCollector collector = new FillerCollector(property); ontologies.forEach(o -> o.subClassAxiomsForSubClass(cls) .forEach(ax -> ax.getSuperClass().accept(collector))); if (collector.fillers.isEmpty()) { return; } OWLObjectUnionOf union = df.getOWLObjectUnionOf(collector.fillers); OWLClassExpression closureAxiomDesc = df.getOWLObjectAllValuesFrom(property, union); addChange(new AddAxiom(targetOntology, df.getOWLSubClassOfAxiom(cls, closureAxiomDesc))); }
/** * Creates a composite change that will add a closure axiom for a given * class along a specified property. * * @param dataFactory The data factory that should be used to create the necessary objects * @param cls The class for which the closure axiom will be generated * @param property The property that the closure axiom will act along * @param ontologies The ontologies that will be examined for subclass axioms * @param targetOntology The target ontology that changes will be applied to. */ public AddClassExpressionClosureAxiom(OWLDataFactory dataFactory, OWLClass cls, OWLObjectPropertyExpression property, Collection<OWLOntology> ontologies, OWLOntology targetOntology) { super(dataFactory); checkNotNull(cls, "cls cannot be null"); checkNotNull(property, "property cannot be null"); checkNotNull(ontologies, "ontologies cannot be null"); checkNotNull(targetOntology, "targetOntology cannot be null"); generateChanges(cls, property, ontologies, targetOntology); }
private void generateChanges(OWLClass cls, OWLObjectPropertyExpression property, Collection<OWLOntology> ontologies, OWLOntology targetOntology) { // We collect all of the fillers for existential restrictions along // the target property and all of the fillers for hasValue restrictions // as nominals FillerCollector collector = new FillerCollector(property); ontologies.forEach(o -> o.subClassAxiomsForSubClass(cls) .forEach(ax -> ax.getSuperClass().accept(collector))); if (collector.fillers.isEmpty()) { return; } OWLObjectUnionOf union = df.getOWLObjectUnionOf(collector.fillers); OWLClassExpression closureAxiomDesc = df.getOWLObjectAllValuesFrom(property, union); addChange(new AddAxiom(targetOntology, df.getOWLSubClassOfAxiom(cls, closureAxiomDesc))); }