/** * Gets all the super classes of the given class in the ontology * * @param ontology ontology to be queried * @param owlClass the class whose super classes are to be retrieved * @return a set of super classes */ private static Stream<OWLClass> superClasses(final OWLOntology ontology, final OWLClass owlClass) { return ontology.subClassAxiomsForSubClass(owlClass) // .map(OWLSubClassOfAxiom::getSuperClass) // .filter(owlSuperDescription -> owlSuperDescription instanceof OWLClass) // .map(x -> (OWLClass) x); // }
/** * Gets all the super classes of the given class in the ontology * * @param ontology ontology to be queried * @param owlClass the class whose super classes are to be retrieved * @return a set of super classes */ private static Stream<OWLClass> superClasses(final OWLOntology ontology, final OWLClass owlClass) { return ontology.subClassAxiomsForSubClass(owlClass) // .map(OWLSubClassOfAxiom::getSuperClass) // .filter(owlSuperDescription -> owlSuperDescription instanceof OWLClass) // .map(x -> (OWLClass) x); // }
/** * A convenience method that examines the axioms in the specified ontology and return the class * expressions corresponding to super classes of this class. * * @param e entity * @param ontology The ontology to be examined * @return A {@code Set} of {@code OWLClassExpression}s that represent the superclasses of this * class, which have been asserted in the specified ontology. */ public static Stream<OWLClassExpression> getSuperClasses(OWLClass e, OWLOntology ontology) { return Searcher.sup(ontology.subClassAxiomsForSubClass(e)); }
/** * A convenience method that examines the axioms in the specified ontology and return the class * expressions corresponding to super classes of this class. * * @param e entity * @param ontology The ontology to be examined * @return A {@code Set} of {@code OWLClassExpression}s that represent the superclasses of this * class, which have been asserted in the specified ontology. */ public static Stream<OWLClassExpression> getSuperClasses(OWLClass e, OWLOntology ontology) { return Searcher.sup(ontology.subClassAxiomsForSubClass(e)); }
@Override public Stream<OWLSubClassOfAxiom> subClassAxiomsForSubClass(OWLClass cls) { return withReadLock(() -> delegate.subClassAxiomsForSubClass(cls)); }
@Override public Stream<OWLSubClassOfAxiom> subClassAxiomsForSubClass(OWLClass cls) { return withReadLock(() -> delegate.subClassAxiomsForSubClass(cls)); }
@Override public Stream<OWLSubClassOfAxiom> subClassAxiomsForSubClass(OWLClass cls) { return withReadLock(() -> delegate.subClassAxiomsForSubClass(cls)); }
@Override public Stream<OWLSubClassOfAxiom> subClassAxiomsForSubClass(OWLClass cls) { return withReadLock(() -> delegate.subClassAxiomsForSubClass(cls)); }
/** * A convenience method that examines the axioms in the specified ontology and return the class * expressions corresponding to super classes of this class. * * @param e entity * @param ontology The ontology to be examined * @return A {@code Set} of {@code OWLClassExpression}s that represent the superclasses of this * class, which have been asserted in the specified ontology. */ public static Stream<OWLClassExpression> getSuperClasses(OWLClass e, OWLOntology ontology) { return Searcher.sup(ontology.subClassAxiomsForSubClass(e)); }
protected void processClass(AtomicInteger total, AtomicInteger count, OWLOntology ont, OWLClass cls) { count.incrementAndGet(); int sup = (int) sup(ont.subClassAxiomsForSubClass(cls), OWLClassExpression.class) .filter(c -> !c.isAnonymous()) .count(); if (sup == 0) { total.incrementAndGet(); } else { total.addAndGet(sup); } }
protected void processClass(AtomicInteger total, AtomicInteger count, OWLOntology ont, OWLClass cls) { count.incrementAndGet(); int sup = (int) sup(ont.subClassAxiomsForSubClass(cls), OWLClassExpression.class) .filter(c -> !c.isAnonymous()) .count(); if (sup == 0) { total.incrementAndGet(); } else { total.addAndGet(sup); } }
protected void processClass(AtomicInteger total, AtomicInteger count, OWLOntology ont, OWLClass cls) { count.incrementAndGet(); int sup = (int) sup(ont.subClassAxiomsForSubClass(cls), OWLClassExpression.class) .filter(c -> !c.isAnonymous()) .count(); if (sup == 0) { total.incrementAndGet(); } else { total.addAndGet(sup); } }
protected void processClass(AtomicInteger total, AtomicInteger count, OWLOntology ont, OWLClass cls) { count.incrementAndGet(); int sup = (int) sup(ont.subClassAxiomsForSubClass(cls), OWLClassExpression.class) .filter(c -> !c.isAnonymous()) .count(); if (sup == 0) { total.incrementAndGet(); } else { total.addAndGet(sup); } }
private void generateChanges(OWLOntology targetOntology, OWLClass cls, Collection<OWLOntology> ontologies) { // We remove the existing superclasses and then combine these // into an intersection which is made equivalent. List<OWLClassExpression> descs = new ArrayList<>(); for (OWLOntology ont : ontologies) { ont.subClassAxiomsForSubClass(cls).forEach(ax -> { addChange(new RemoveAxiom(ont, ax)); descs.add(ax.getSuperClass()); }); } OWLClassExpression equivalentClass = df.getOWLObjectIntersectionOf(descs); addChange(new AddAxiom(targetOntology, df.getOWLEquivalentClassesAxiom(Arrays.asList(cls, equivalentClass)))); } }
protected void amalgamate(OWLOntology ont, OWLClass cls) { List<OWLSubClassOfAxiom> axioms = asList(ont.subClassAxiomsForSubClass(cls)); if (axioms.size() < 2) { return; } axioms.forEach(ax -> addChange(new RemoveAxiom(ont, ax))); Stream<OWLClassExpression> superclasses = axioms.stream() .map(OWLSubClassOfAxiom::getSuperClass); OWLObjectIntersectionOf intersection = df.getOWLObjectIntersectionOf(superclasses); addChange(new AddAxiom(ont, df.getOWLSubClassOfAxiom(cls, intersection))); } }
protected void amalgamate(OWLOntology ont, OWLClass cls) { List<OWLSubClassOfAxiom> axioms = asList(ont.subClassAxiomsForSubClass(cls)); if (axioms.size() < 2) { return; } axioms.forEach(ax -> addChange(new RemoveAxiom(ont, ax))); Stream<OWLClassExpression> superclasses = axioms.stream() .map(OWLSubClassOfAxiom::getSuperClass); OWLObjectIntersectionOf intersection = df.getOWLObjectIntersectionOf(superclasses); addChange(new AddAxiom(ont, df.getOWLSubClassOfAxiom(cls, intersection))); } }
protected void amalgamate(OWLOntology ont, OWLClass cls) { List<OWLSubClassOfAxiom> axioms = asList(ont.subClassAxiomsForSubClass(cls)); if (axioms.size() < 2) { return; } axioms.forEach(ax -> addChange(new RemoveAxiom(ont, ax))); Stream<OWLClassExpression> superclasses = axioms.stream() .map(OWLSubClassOfAxiom::getSuperClass); OWLObjectIntersectionOf intersection = df.getOWLObjectIntersectionOf(superclasses); addChange(new AddAxiom(ont, df.getOWLSubClassOfAxiom(cls, intersection))); } }
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))); }
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))); }
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))); }