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

org.protege.editor.owl.ui.frame.dataproperty.OWLDataPropertyDomainFrameSection 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.frame.OWLFrame;
import org.protege.editor.owl.ui.frame.property.AbstractPropertyDomainFrameSection;
import org.protege.editor.owl.ui.frame.property.AbstractPropertyDomainFrameSectionRow;
import org.semanticweb.owlapi.model.*;
import org.semanticweb.owlapi.reasoner.Node;
import org.semanticweb.owlapi.reasoner.NodeSet;
import org.semanticweb.owlapi.reasoner.OWLReasoner;
import org.semanticweb.owlapi.reasoner.impl.OWLClassNodeSet;

import java.util.Set;


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

*/ public class OWLDataPropertyDomainFrameSection extends AbstractPropertyDomainFrameSection { public OWLDataPropertyDomainFrameSection(OWLEditorKit editorKit, OWLFrame owlDataPropertyOWLFrame) { super(editorKit, owlDataPropertyOWLFrame); } protected OWLDataPropertyDomainAxiom createAxiom(OWLClassExpression object) { return getOWLDataFactory().getOWLDataPropertyDomainAxiom(getRootObject(), object); } protected AbstractPropertyDomainFrameSectionRow createFrameSectionRow(OWLDataPropertyDomainAxiom domainAxiom, OWLOntology ontology) { return new OWLDataPropertyDomainFrameSectionRow(getOWLEditorKit(), this, ontology, getRootObject(), domainAxiom); } protected Set getAxioms(OWLOntology ontology) { return ontology.getDataPropertyDomainAxioms(getRootObject()); } protected NodeSet getInferredDomains() { OWLReasoner reasoner = getOWLModelManager().getReasoner(); OWLDataProperty p = getRootObject(); OWLDataFactory factory = getOWLModelManager().getOWLOntologyManager().getOWLDataFactory(); if (p.equals(factory.getOWLTopDataProperty())) { return new OWLClassNodeSet(reasoner.getTopClassNode()); } OWLClassExpression domain = factory.getOWLDataSomeValuesFrom(p, factory.getTopDatatype()); Node domainNode = reasoner.getEquivalentClasses(domain); if (domainNode != null && !domainNode.getEntities().isEmpty()) { return new OWLClassNodeSet(domainNode); } else { return reasoner.getDataPropertyDomains(getRootObject(), true); } } @Override protected void refillInferred() { getOWLModelManager().getReasonerPreferences().executeTask(OptionalInferenceTask.SHOW_INFERRED_DATATYPE_PROPERTY_DOMAINS, () -> { if (!getOWLModelManager().getReasoner().isConsistent()) { return; } OWLDataPropertyDomainFrameSection.super.refillInferred(); }); } @Override protected boolean isResettingChange(OWLOntologyChange change) { return change.isAxiomChange() && change.getAxiom() instanceof OWLDataPropertyDomainAxiom && ((OWLDataPropertyDomainAxiom) change.getAxiom()).getProperty().equals(getRootObject()); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy