All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.protege.editor.owl.ui.frame.dataproperty.OWLSubDataPropertyAxiomSuperPropertyFrameSection Maven / Gradle / Ivy

Go to download

OWL ontology editing infrastructure used by the Protege desktop application.

The newest version!
package org.protege.editor.owl.ui.frame.dataproperty;

import org.protege.editor.owl.OWLEditorKit;
import org.protege.editor.owl.model.inference.ReasonerPreferences.OptionalInferenceTask;
import org.protege.editor.owl.ui.editor.OWLDataPropertyEditor;
import org.protege.editor.owl.ui.editor.OWLObjectEditor;
import org.protege.editor.owl.ui.frame.AbstractOWLFrameSection;
import org.protege.editor.owl.ui.frame.OWLFrame;
import org.protege.editor.owl.ui.frame.OWLFrameSectionRow;
import org.semanticweb.owlapi.model.*;

import java.util.Comparator;
import java.util.HashSet;
import java.util.Set;


/**
 * Author: Matthew Horridge
* The University Of Manchester
* Bio-Health Informatics Group
* Date: 16-Feb-2007

*/ public class OWLSubDataPropertyAxiomSuperPropertyFrameSection extends AbstractOWLFrameSection { public static final String LABEL = "SubProperty Of"; private Set added = new HashSet<>(); public OWLSubDataPropertyAxiomSuperPropertyFrameSection(OWLEditorKit editorKit, OWLFrame frame) { super(editorKit, LABEL, "Super property", frame); } protected OWLSubDataPropertyOfAxiom createAxiom(OWLDataProperty object) { return getOWLDataFactory().getOWLSubDataPropertyOfAxiom(getRootObject(), object); } public OWLObjectEditor getObjectEditor() { return new OWLDataPropertyEditor(getOWLEditorKit()); } protected void clear() { } protected void refill(OWLOntology ontology) { added.clear(); for (OWLSubDataPropertyOfAxiom ax : ontology.getDataSubPropertyAxiomsForSubProperty(getRootObject())) { addRow(new OWLSubDataPropertyAxiomSuperPropertyFrameSectionRow(getOWLEditorKit(), this, ontology, getRootObject(), ax)); added.add(ax); } } protected void refillInferred() { getOWLModelManager().getReasonerPreferences().executeTask(OptionalInferenceTask.SHOW_INFERRED_SUPER_DATATYPE_PROPERTIES, () -> { if (!getOWLModelManager().getReasoner().isConsistent()) { return; } for (OWLDataPropertyExpression infSup : getOWLModelManager().getReasoner().getSuperDataProperties(getRootObject(), true).getFlattened()) { if (!added.contains(infSup)) { final OWLSubDataPropertyOfAxiom ax = getOWLDataFactory().getOWLSubDataPropertyOfAxiom( getRootObject(), infSup); addInferredRowIfNontrivial(new OWLSubDataPropertyAxiomSuperPropertyFrameSectionRow(getOWLEditorKit(), OWLSubDataPropertyAxiomSuperPropertyFrameSection.this, null, getRootObject(), ax)); } } }); } @Override protected boolean isResettingChange(OWLOntologyChange change) { if (!change.isAxiomChange()) { return false; } OWLAxiom axiom = change.getAxiom(); if (axiom instanceof OWLSubDataPropertyOfAxiom) { return ((OWLSubDataPropertyOfAxiom) axiom).getSubProperty().equals(getRootObject()); } return false; } public Comparator> getRowComparator() { return null; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy