Search in sources :

Example 1 with OWLDatatypeData

use of edu.stanford.bmir.protege.web.shared.entity.OWLDatatypeData in project webprotege by protegeproject.

the class DataPropertyFrameEditor method getValue.

@Override
public Optional<LabelledFrame<DataPropertyFrame>> getValue() {
    if (!lastDataPropertyFrame.isPresent()) {
        return Optional.empty();
    }
    final Set<OWLClassData> domainsClasses = Sets.newHashSet();
    if (domains.getValue().isPresent()) {
        for (OWLPrimitiveData primitiveData : domains.getValue().get()) {
            domainsClasses.add(((OWLClassData) primitiveData));
        }
    }
    final Set<OWLDatatypeData> rangeTypes = Sets.newHashSet();
    if (ranges.getValue().isPresent()) {
        for (OWLPrimitiveData primitiveData : ranges.getValue().get()) {
            rangeTypes.add(((OWLDatatypeData) primitiveData));
        }
    }
    DataPropertyFrame frame = new DataPropertyFrame(lastDataPropertyFrame.get().getFrame().getSubject(), annotations.getValue().get(), domainsClasses, rangeTypes, functionalCheckBox.getValue());
    return Optional.of(new LabelledFrame<>(lastDataPropertyFrame.get().getDisplayName(), frame));
}
Also used : OWLClassData(edu.stanford.bmir.protege.web.shared.entity.OWLClassData) OWLDatatypeData(edu.stanford.bmir.protege.web.shared.entity.OWLDatatypeData) DataPropertyFrame(edu.stanford.bmir.protege.web.shared.frame.DataPropertyFrame) OWLPrimitiveData(edu.stanford.bmir.protege.web.shared.entity.OWLPrimitiveData)

Example 2 with OWLDatatypeData

use of edu.stanford.bmir.protege.web.shared.entity.OWLDatatypeData 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)

Example 3 with OWLDatatypeData

use of edu.stanford.bmir.protege.web.shared.entity.OWLDatatypeData in project webprotege by protegeproject.

the class DataPropertyFrameTranslator method getAxioms.

@Override
public Set<OWLAxiom> getAxioms(DataPropertyFrame frame, Mode mode) {
    Set<OWLAxiom> result = new HashSet<>();
    for (PropertyAnnotationValue pv : frame.getAnnotationPropertyValues()) {
        AxiomPropertyValueTranslator translator = new AxiomPropertyValueTranslator();
        result.addAll(translator.getAxioms(frame.getSubject().getEntity(), pv, mode));
    }
    for (OWLClassData domain : frame.getDomains()) {
        OWLAxiom ax = DataFactory.get().getOWLDataPropertyDomainAxiom(frame.getSubject().getEntity(), domain.getEntity());
        result.add(ax);
    }
    for (OWLDatatypeData range : frame.getRanges()) {
        OWLAxiom ax = DataFactory.get().getOWLDataPropertyRangeAxiom(frame.getSubject().getEntity(), range.getEntity());
        result.add(ax);
    }
    if (frame.isFunctional()) {
        result.add(DataFactory.get().getOWLFunctionalDataPropertyAxiom(frame.getSubject().getEntity()));
    }
    return result;
}
Also used : OWLClassData(edu.stanford.bmir.protege.web.shared.entity.OWLClassData) OWLDatatypeData(edu.stanford.bmir.protege.web.shared.entity.OWLDatatypeData) OWLAxiom(org.semanticweb.owlapi.model.OWLAxiom) HashSet(java.util.HashSet)

Aggregations

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