Search in sources :

Example 1 with OWLDataPropertyDomainAxiom

use of org.semanticweb.owlapi.model.OWLDataPropertyDomainAxiom in project webprotege by protegeproject.

the class DataPropertyFrameTranslator method getFrame.

@Override
public DataPropertyFrame getFrame(OWLDataPropertyData subject) {
    Set<OWLAxiom> propertyValueAxioms = new HashSet<>();
    Set<OWLClassData> domains = new HashSet<>();
    Set<OWLDatatypeData> ranges = new HashSet<>();
    boolean functional = false;
    for (OWLOntology ontology : rootOntology.getImportsClosure()) {
        propertyValueAxioms.addAll(ontology.getAnnotationAssertionAxioms(subject.getEntity().getIRI()));
        for (OWLDataPropertyDomainAxiom ax : ontology.getDataPropertyDomainAxioms(subject.getEntity())) {
            if (!ax.getDomain().isAnonymous()) {
                domains.add(renderingManager.getRendering(ax.getDomain().asOWLClass()));
            }
        }
        for (OWLDataPropertyRangeAxiom ax : ontology.getDataPropertyRangeAxioms(subject.getEntity())) {
            if (ax.getRange().isDatatype()) {
                ranges.add(renderingManager.getRendering(ax.getRange().asOWLDatatype()));
            }
        }
        if (EntitySearcher.isFunctional(subject.getEntity(), ontology)) {
            functional = true;
        }
    }
    Set<PropertyValue> propertyValues = new HashSet<>();
    AxiomPropertyValueTranslator translator = new AxiomPropertyValueTranslator();
    for (OWLAxiom ax : propertyValueAxioms) {
        propertyValues.addAll(translator.getPropertyValues(subject.getEntity(), ax, rootOntology, State.ASSERTED, renderingManager));
    }
    PropertyValueList pvl = new PropertyValueList(propertyValues);
    return new DataPropertyFrame(subject, pvl, domains, ranges, functional);
}
Also used : OWLDatatypeData(edu.stanford.bmir.protege.web.shared.entity.OWLDatatypeData) OWLClassData(edu.stanford.bmir.protege.web.shared.entity.OWLClassData) OWLDataPropertyDomainAxiom(org.semanticweb.owlapi.model.OWLDataPropertyDomainAxiom) OWLOntology(org.semanticweb.owlapi.model.OWLOntology) OWLDataPropertyRangeAxiom(org.semanticweb.owlapi.model.OWLDataPropertyRangeAxiom) OWLAxiom(org.semanticweb.owlapi.model.OWLAxiom) HashSet(java.util.HashSet)

Aggregations

OWLClassData (edu.stanford.bmir.protege.web.shared.entity.OWLClassData)1 OWLDatatypeData (edu.stanford.bmir.protege.web.shared.entity.OWLDatatypeData)1 HashSet (java.util.HashSet)1 OWLAxiom (org.semanticweb.owlapi.model.OWLAxiom)1 OWLDataPropertyDomainAxiom (org.semanticweb.owlapi.model.OWLDataPropertyDomainAxiom)1 OWLDataPropertyRangeAxiom (org.semanticweb.owlapi.model.OWLDataPropertyRangeAxiom)1 OWLOntology (org.semanticweb.owlapi.model.OWLOntology)1