/** * Refills the section with rows. This method will be called * by the system and should be directly called. */ protected void refill(OWLOntology ontology) { for (OWLClassAssertionAxiom ax : ontology.getClassAssertionAxioms(getRootObject())) { addRow(new OWLClassAssertionAxiomTypeFrameSectionRow(getOWLEditorKit(), this, ontology, getRootObject(), ax)); added.add(ax.getClassExpression()); } }
protected void refillInferred() { getOWLModelManager().getReasonerPreferences().executeTask(OptionalInferenceTask.SHOW_INFERRED_TYPES, () -> { if (!getOWLModelManager().getReasoner().isConsistent()) { return; } if (!getRootObject().isAnonymous()){ for (OWLClass inferredType : getReasoner().getTypes(getRootObject().asOWLNamedIndividual(), true).getFlattened()) { if (!added.contains(inferredType)) { OWLClassAssertionAxiom ax = getOWLDataFactory().getOWLClassAssertionAxiom(inferredType, getRootObject()); addInferredRowIfNontrivial(new OWLClassAssertionAxiomTypeFrameSectionRow(getOWLEditorKit(), OWLClassAssertionAxiomTypeFrameSection.this, null, getRootObject(), ax)); added.add(inferredType); } } } }); }
public void visit(OWLClassAssertionAxiom axiom) { if (axiom.getIndividual().equals(getRootObject())) { reset(); } } }
protected OWLClassAssertionAxiom createAxiom(OWLClassExpression classExpression) { return getOWLDataFactory().getOWLClassAssertionAxiom(classExpression, getRootObject()); }
public boolean dropObjects(List<OWLObject> objects) { List<OWLOntologyChange> changes = new ArrayList<>(); for (OWLObject obj : objects) { if (obj instanceof OWLClassExpression) { OWLClassExpression classExpression = (OWLClassExpression) obj; OWLAxiom ax = getOWLDataFactory().getOWLClassAssertionAxiom(classExpression, getRootObject()); changes.add(new AddAxiom(getOWLModelManager().getActiveOntology(), ax)); } else { return false; } } getOWLModelManager().applyChanges(changes); return true; }
public void run() { if (!getOWLModelManager().getReasoner().isConsistent()) { return; } if (!getRootObject().isAnonymous()){ for (OWLClass inferredType : getReasoner().getTypes(getRootObject().asOWLNamedIndividual(), true).getFlattened()) { if (!added.contains(inferredType)) { OWLClassAssertionAxiom ax = getOWLDataFactory().getOWLClassAssertionAxiom(inferredType, getRootObject()); addInferredRowIfNontrivial(new OWLClassAssertionAxiomTypeFrameSectionRow(getOWLEditorKit(), OWLClassAssertionAxiomTypeFrameSection.this, null, getRootObject(), ax)); added.add(inferredType); } } } } });
public OWLAnonymousIndividualPropertyAssertionsFrame(OWLEditorKit owlEditorKit) { super(owlEditorKit); addSection(new OWLClassAssertionAxiomTypeFrameSection(owlEditorKit, this), 0); addSection(new OWLAnnotationFrameSection(owlEditorKit, this), 0); } }
/** * Obtains a comparator which can be used to sort the rows * in this section. * @return A comparator if to sort the rows in this section, * or <code>null</code> if the rows shouldn't be sorted. */ public Comparator<OWLFrameSectionRow<OWLIndividual, OWLClassAssertionAxiom, OWLClassExpression>> getRowComparator() { return new Comparator<OWLFrameSectionRow<OWLIndividual, OWLClassAssertionAxiom, OWLClassExpression>>() { private Comparator<OWLObject> comparator = getOWLModelManager().getOWLObjectComparator(); public int compare(OWLFrameSectionRow<OWLIndividual, OWLClassAssertionAxiom, OWLClassExpression> o1, OWLFrameSectionRow<OWLIndividual, OWLClassAssertionAxiom, OWLClassExpression> o2) { if (o1.isInferred() && !o2.isInferred()) { return 1; } else if (o2.isInferred() && !o1.isInferred()) { return -1; } return comparator.compare(o1.getAxiom().getClassExpression(), o2.getAxiom().getClassExpression()); } }; }
public OWLObjectEditor<OWLClassExpression> getObjectEditor() { return getOWLEditorKit().getWorkspace().getOWLComponentFactory().getOWLClassDescriptionEditor(null, AxiomType.CLASS_ASSERTION); }
@Override protected boolean isResettingChange(OWLOntologyChange change) { return change.isAxiomChange() && change.getAxiom() instanceof OWLClassAssertionAxiom && ((OWLClassAssertionAxiom) change.getAxiom()).getIndividual().equals(getRootObject()); }
public boolean dropObjects(List<OWLObject> objects) { List<OWLOntologyChange> changes = new ArrayList<>(); for (OWLObject obj : objects) { if (obj instanceof OWLClassExpression) { OWLClassExpression classExpression = (OWLClassExpression) obj; OWLAxiom ax = getOWLDataFactory().getOWLClassAssertionAxiom(classExpression, getRootObject()); changes.add(new AddAxiom(getOWLModelManager().getActiveOntology(), ax)); } else { return false; } } getOWLModelManager().applyChanges(changes); return true; }
public void run() { if (!getOWLModelManager().getReasoner().isConsistent()) { return; } if (!getRootObject().isAnonymous()){ for (OWLClass inferredType : getReasoner().getTypes(getRootObject().asOWLNamedIndividual(), true).getFlattened()) { if (!added.contains(inferredType)) { OWLClassAssertionAxiom ax = getOWLDataFactory().getOWLClassAssertionAxiom(inferredType, getRootObject()); addRow(new OWLClassAssertionAxiomTypeFrameSectionRow(getOWLEditorKit(), OWLClassAssertionAxiomTypeFrameSection.this, null, getRootObject(), ax)); added.add(inferredType); } } } } });
protected OWLClassAssertionAxiom createAxiom(OWLClassExpression classExpression) { return getOWLDataFactory().getOWLClassAssertionAxiom(classExpression, getRootObject()); }
public OWLAnonymousIndividualPropertyAssertionsFrame(OWLEditorKit owlEditorKit) { super(owlEditorKit); addSection(new OWLClassAssertionAxiomTypeFrameSection(owlEditorKit, this), 0); addSection(new OWLAnnotationFrameSection(owlEditorKit, this), 0); } }
/** * Obtains a comparator which can be used to sort the rows * in this section. * @return A comparator if to sort the rows in this section, * or <code>null</code> if the rows shouldn't be sorted. */ public Comparator<OWLFrameSectionRow<OWLIndividual, OWLClassAssertionAxiom, OWLClassExpression>> getRowComparator() { return new Comparator<OWLFrameSectionRow<OWLIndividual, OWLClassAssertionAxiom, OWLClassExpression>>() { private Comparator<OWLObject> comparator = getOWLModelManager().getOWLObjectComparator(); public int compare(OWLFrameSectionRow<OWLIndividual, OWLClassAssertionAxiom, OWLClassExpression> o1, OWLFrameSectionRow<OWLIndividual, OWLClassAssertionAxiom, OWLClassExpression> o2) { if (o1.isInferred() && !o2.isInferred()) { return 1; } else if (o2.isInferred() && !o1.isInferred()) { return -1; } return comparator.compare(o1.getAxiom().getClassExpression(), o2.getAxiom().getClassExpression()); } }; }
public OWLObjectEditor<OWLClassExpression> getObjectEditor() { return getOWLEditorKit().getWorkspace().getOWLComponentFactory().getOWLClassDescriptionEditor(null, AxiomType.CLASS_ASSERTION); }
@Override protected boolean isResettingChange(OWLOntologyChange change) { return change.isAxiomChange() && change.getAxiom() instanceof OWLClassAssertionAxiom && ((OWLClassAssertionAxiom) change.getAxiom()).getIndividual().equals(getRootObject()); }
protected void refillInferred() { getOWLModelManager().getReasonerPreferences().executeTask(OptionalInferenceTask.SHOW_INFERRED_TYPES, () -> { if (!getOWLModelManager().getReasoner().isConsistent()) { return; } if (!getRootObject().isAnonymous()){ for (OWLClass inferredType : getReasoner().getTypes(getRootObject().asOWLNamedIndividual(), true).getFlattened()) { if (!added.contains(inferredType)) { OWLClassAssertionAxiom ax = getOWLDataFactory().getOWLClassAssertionAxiom(inferredType, getRootObject()); addInferredRowIfNontrivial(new OWLClassAssertionAxiomTypeFrameSectionRow(getOWLEditorKit(), OWLClassAssertionAxiomTypeFrameSection.this, null, getRootObject(), ax)); added.add(inferredType); } } } }); }
/** * Refills the section with rows. This method will be called * by the system and should be directly called. */ protected void refill(OWLOntology ontology) { for (OWLClassAssertionAxiom ax : ontology.getClassAssertionAxioms(getRootObject())) { addRow(new OWLClassAssertionAxiomTypeFrameSectionRow(getOWLEditorKit(), this, ontology, getRootObject(), ax)); added.add(ax.getClassExpression()); } }
public boolean dropObjects(List<OWLObject> objects) { List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>(); for (OWLObject obj : objects) { if (obj instanceof OWLClassExpression) { OWLClassExpression classExpression = (OWLClassExpression) obj; OWLAxiom ax = getOWLDataFactory().getOWLClassAssertionAxiom(classExpression, getRootObject()); changes.add(new AddAxiom(getOWLModelManager().getActiveOntology(), ax)); } else { return false; } } getOWLModelManager().applyChanges(changes); return true; }