protected Set<OWLDisjointClassesAxiom> getClassAxioms(OWLClassExpression descr, OWLOntology ont) { if (!descr.isAnonymous()){ return ont.getDisjointClassesAxioms(descr.asOWLClass()); } else{ Set<OWLDisjointClassesAxiom> axioms = new HashSet<>(); for (OWLDisjointClassesAxiom ax : ont.getAxioms(AxiomType.DISJOINT_CLASSES)){ if (ax.getClassExpressions().contains(descr)){ axioms.add(ax); } } return axioms; } }
@Override public void visit(OWLDisjointClassesAxiom axiom) { axiom.classExpressions().filter(c -> !c.isAnonymous()).forEach(ce -> { if (source == null) { source = ce.asOWLClass(); } else if (target == null) { target = ce.asOWLClass(); } else { return; } }); }
@Override public List<OWLClassExpression> getRenderablesForItem(OWLClass subject, OWLDisjointClassesAxiom item, OWLOntology ontology) { return new ArrayList<>(item.getClassExpressionsMinus(subject)); }
public void visit(OWLDisjointClassesAxiom axiom) { hashCode = 31; hashCode = hashCode * MULT + axiom.getClassExpressions().hashCode(); hashCode = hashCode * MULT + axiom.getAnnotations().hashCode(); }
public void visit(OWLDisjointClassesAxiom axiom) { if (axiom.getClassExpressions().size() == 2) { desc = factory.getOWLObjectIntersectionOf(axiom.getClassesInSignature().toArray(new OWLClassExpression[2])); } }
/** * Builder initialized from an existing object. * * @param expected the existing object * @param df data factory */ public BuilderDisjointClasses(OWLDisjointClassesAxiom expected, OWLDataFactory df) { this(df); withItems(expected.classExpressions()).withAnnotations(expected.annotations()); }
@Override public NodeSet<OWLClass> getDisjointClasses(OWLClassExpression ce) { ensurePrepared(); OWLClassNodeSet nodeSet = new OWLClassNodeSet(); if (ce.isAnonymous()) { return nodeSet; } getRootOntology().importsClosure().flatMap(o -> o.disjointClassesAxioms(ce.asOWLClass())) .flatMap(ax -> ax .classExpressions()).filter(op -> !op.isAnonymous()) .forEach(op -> nodeSet.addNode(getEquivalentClasses( op))); return nodeSet; }
@Override public void visit(OWLDisjointClassesAxiom axiom) { isLocal = false; if (pairs(axiom.classExpressions()).map(v -> df.getOWLDisjointClassesAxiom(v.i, v.j)) .anyMatch(ax -> !kernel.isEntailed(ax))) { return; } isLocal = true; }
@Override public void visit(OWLDisjointClassesAxiom axiom) { dl(() -> insufficientOperands(axiom)); ql(() -> axiom.classExpressions().filter(ce -> !isOWL2QLSubClassExpression(ce)) .forEach(this::nonSubclass)); rl(() -> axiom.classExpressions() .filter(ce -> !ce.accept(equivalentClassExpressionChecker).booleanValue()) .forEach(this::nonSubclass)); }
/** * Gets the general axioms in the ontology. These are axioms such as DifferentIndividuals, * General Class axioms which do not describe or define a named class and so can't be written * out as a frame, nary disjoint classes, disjoint object properties, disjoint data properties * and HasKey axioms where the class expression is anonymous. * * @return A set of axioms that are general axioms (and can't be written out in a frame-based * style). */ private List<OWLAxiom> getGeneralAxioms() { List<OWLAxiom> generalAxioms = new ArrayList<>(); add(generalAxioms, ontology.generalClassAxioms()); add(generalAxioms, ontology.axioms(DIFFERENT_INDIVIDUALS)); add(generalAxioms, ontology.axioms(DISJOINT_CLASSES).filter(ax -> ax.classExpressions().count() > 2)); add(generalAxioms, ontology.axioms(DISJOINT_OBJECT_PROPERTIES).filter(ax -> ax.properties().count() > 2)); add(generalAxioms, ontology.axioms(DISJOINT_DATA_PROPERTIES).filter(ax -> ax.properties().count() > 2)); add(generalAxioms, ontology.axioms(HAS_KEY).filter(ax -> ax.getClassExpression().isAnonymous())); generalAxioms.sort(null); return generalAxioms; }
@Override public OWLAxiom visit(OWLDisjointClassesAxiom axiom) { return df .getOWLDisjointClassesAxiom(axiom.classExpressions().map(p -> p.accept(classVisitor))); }
writeNewLine(); writeOntologyHeader(); o.annotationPropertiesInSignature().sorted(ooc).forEach(this::write); o.datatypesInSignature().sorted(ooc).forEach(this::write); o.objectPropertiesInSignature().sorted(ooc).forEach(prop -> { write(prop); OWLObjectPropertyExpression invProp = prop.getInverseProperty(); o.axioms(AxiomType.DISJOINT_CLASSES).sorted(ooc) .forEach(ax -> writeMoreThanTwo(ax, ax.classExpressions(), DISJOINT_CLASSES)); o.axioms(AxiomType.EQUIVALENT_CLASSES).sorted(ooc) .forEach(ax -> writeMoreThanTwo(ax, ax.classExpressions(), EQUIVALENT_CLASSES));
filtersort(o.subClassAxiomsForSubClass(cls)).forEach(ax -> { superclasses.put(ax.getSuperClass(), ax); axioms.add(ax); if (renderExtensions) { SectionMap<Object, OWLAxiom> subClasses = new SectionMap<>(); filtersort(o.subClassAxiomsForSuperClass(cls)).forEach(ax -> { subClasses.put(ax.getSubClass(), ax); axioms.add(ax); SectionMap<Object, OWLAxiom> disjointClasses = new SectionMap<>(); filtersort(o.disjointClassesAxioms(cls)).forEach(ax -> { if (ax.classExpressions().count() == 2) { OWLClassExpression disjointWith = ax.getClassExpressionsMinus(cls).iterator() .next(); disjointClasses.put(disjointWith, ax); filtersort(o.disjointClassesAxioms(cls)).forEach(ax -> { if (ax.classExpressions().count() > 2) { axioms.add(ax); writeSection(DISJOINT_CLASSES, ax.classExpressions().iterator(), ", ", false);
@Override public void visit(OWLDisjointClassesAxiom axiom) { process(axiom); axiom.classExpressions().forEach(a -> a.accept(this)); }
@Override public Stream<K> visit(OWLDisjointClassesAxiom axiom) { Stream<OWLClassExpression> stream = axiom.classExpressions(); if (named) { stream = stream.filter(c -> !c.isAnonymous()); } return (Stream<K>) stream; }
combined.addAll(expansion); for(OWLDisjointClassesAxiom disjointAx : disjointClassesAxioms) { for(OWLClassExpression desc : asList(disjointAx.classExpressions())) { if(desc.isAnonymous()) { combined.add(disjointAx); break; if(!expansionSig.contains(desc.asOWLClass())) { break; ax.signature().forEach(ent-> { if (!expandedWithDefinition.contains(ent)) { ent.accept(expander).forEach(expAx -> dealWithDisjoints(expansion, disjointClassesAxioms, expansionSig, expAx)); expandedWithDefinition.add(ent); add(expansion, ont.disjointClassesAxioms(ent.asOWLClass())); while (!expansion.containsAll(asList(ont.logicalAxioms()))) { if(progressMonitor.isCancelled()) { return Collections.emptySet(); .forEach(ent -> add(expansion, ont.referencingAxioms(ent)));
if (ax.classExpressions().count() != 2) { error("Expected two classes in a disjoin classes axiom.", ax, false); Iterator<OWLClassExpression> it = ax.classExpressions().iterator(); OWLClassExpression ce1 = it.next(); OWLClassExpression ce2 = it.next(); if (ce1.isBottomEntity() || ce1.isTopEntity() || ce2.isBottomEntity() || ce2 .isTopEntity()) { error("Disjoint classes axiom using Top or Bottom entities are not supported.", ax, c.setValue(cls2); f.addClause(c); addQualifiers(c, ax.annotations());
public NodeSet<OWLClass> getDisjointClasses(OWLClassExpression ce, boolean direct) { OWLClassNodeSet nodeSet = new OWLClassNodeSet(); if (!ce.isAnonymous()) { for(OWLOntology ontology : getRootOntology().getImportsClosure()) { for(OWLDisjointClassesAxiom ax : ontology.getDisjointClassesAxioms(ce.asOWLClass())) { for(OWLClassExpression op : ax.getClassExpressions()) { if(!op.isAnonymous()) { nodeSet.addNode(getEquivalentClasses(op)); } } } } } return nodeSet; }
writeOntologyHeader(ontology); for (OWLAnnotationProperty prop : ontology.getAnnotationPropertiesInSignature()) { write(prop); for (OWLDatatype datatype : ontology.getDatatypesInSignature()) { write(datatype); for (OWLObjectProperty prop : ontology.getObjectPropertiesInSignature()) { write(prop); OWLObjectPropertyExpression invProp = prop.getInverseProperty(); for (OWLDisjointClassesAxiom ax : ontology.getAxioms(AxiomType.DISJOINT_CLASSES)) { if (ax.getClassExpressions().size() > 2) { Map<Object, Set<OWLAnnotation>> map = new HashMap<Object, Set<OWLAnnotation>>(); map.put(ax.getClassExpressions(), ax.getAnnotations()); writeSection(DISJOINT_CLASSES, map, ",", false, ontology); for (OWLEquivalentClassesAxiom ax : ontology.getAxioms(AxiomType.EQUIVALENT_CLASSES)) { if (ax.getClassExpressions().size() > 2) { Map<Object, Set<OWLAnnotation>> map = new HashMap<Object, Set<OWLAnnotation>>(); map.put(ax.getClassExpressions(), ax.getAnnotations()); writeSection(EQUIVALENT_CLASSES, map, ",", false, ontology);
for (OWLOntology ontology : getOntologies()) { Map<OWLClassExpression, Set<OWLAnnotation>> superclasses = new TreeMap<OWLClassExpression, Set<OWLAnnotation>>(); for (OWLSubClassOfAxiom ax : ontology.getSubClassAxiomsForSubClass(cls)) { if (isDisplayed(ax)) { superclasses.put(ax.getSuperClass(), ax.getAnnotations()); for (OWLOntology ont : getOntologies()) { Set<OWLClassExpression> subClasses = new TreeSet<OWLClassExpression>(); for (OWLSubClassOfAxiom ax : ont.getSubClassAxiomsForSuperClass(cls)) { if (isDisplayed(ax)) { subClasses.add(ax.getSubClass()); for (OWLDisjointClassesAxiom ax : ontology.getDisjointClassesAxioms(cls)) { if (isDisplayed(ax)) { if (ax.getClassExpressions().size() <= 2) { pairwiseDisjointClassesAxioms.add(ax); OWLClassExpression disjointWith = ax.getClassExpressionsMinus(cls).iterator().next(); disjointClasses.put(disjointWith, ax.getAnnotations()); for (OWLDisjointClassesAxiom ax : ontology.getDisjointClassesAxioms(cls)) { if (isDisplayed(ax)) { if (ax.getClassExpressions().size() > 2) { Set<OWLClassExpression> allDisjointClasses = new TreeSet<OWLClassExpression>(ax.getClassExpressions()); allDisjointClasses.remove(cls); naryDisjointClasses.addAll(allDisjointClasses);