Search in sources :

Example 6 with OWLPrimitiveData

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

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

the class TextFieldEditor method getValue.

@Override
public Optional<FormDataValue> getValue() {
    Optional<OWLPrimitiveData> editedValue = editor.getValue();
    if (!editedValue.isPresent()) {
        return Optional.empty();
    }
    OWLLiteralData literalData = (OWLLiteralData) editedValue.get();
    if (literalData.getLiteral().getLiteral().trim().isEmpty()) {
        return Optional.empty();
    }
    if (stringType == StringType.SIMPLE_STRING) {
        return Optional.of(FormDataPrimitive.get(literalData.getLiteral().getLiteral()));
    } else {
        return Optional.of(FormDataPrimitive.get(literalData.getLiteral().getLiteral(), literalData.getLang()));
    }
}
Also used : OWLLiteralData(edu.stanford.bmir.protege.web.shared.entity.OWLLiteralData) OWLPrimitiveData(edu.stanford.bmir.protege.web.shared.entity.OWLPrimitiveData)

Example 8 with OWLPrimitiveData

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

the class AnnotationPropertyFrameEditor method getValue.

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

Example 9 with OWLPrimitiveData

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

the class PropertyValueComparator method compare.

@Override
public int compare(PropertyValue o1, PropertyValue o2) {
    // if(o1.getState() == State.DERIVED) {
    // if(o2.getState() != State.DERIVED) {
    // return -1;
    // }
    // }
    // else if(o2.getState() == State.DERIVED) {
    // return 1;
    // }
    // Sort property values by language, property rendering and then value rendering.
    // rdfs:label and then rdfs:comment get priority over other properties.
    OWLPrimitiveData val1 = o1.getValue();
    OWLPrimitiveData val2 = o2.getValue();
    if (val1 instanceof OWLLiteralData && val2 instanceof OWLLiteralData) {
        OWLLiteralData lit1 = (OWLLiteralData) val1;
        OWLLiteralData lit2 = (OWLLiteralData) val2;
        if (lit1.hasLang() && lit2.hasLang()) {
            if (isDefaultLanguage(lit1)) {
                if (!isDefaultLanguage(lit2)) {
                    return BEFORE;
                }
            } else {
                if (isDefaultLanguage(lit2)) {
                    return AFTER;
                }
            }
            int langDelta = lit1.getLang().compareToIgnoreCase(lit2.getLang());
            if (langDelta != 0) {
                return langDelta;
            }
        }
    }
    OWLPropertyData property1 = o1.getProperty();
    OWLPropertyData property2 = o2.getProperty();
    if (property1.isOWLAnnotationProperty()) {
        if (property2.isOWLAnnotationProperty()) {
            OWLAnnotationPropertyData annoProp1 = (OWLAnnotationPropertyData) property1;
            OWLAnnotationPropertyData annoProp2 = (OWLAnnotationPropertyData) property2;
            return annotationPropertyComparator.compare(annoProp1.getEntity(), annoProp2.getEntity());
        } else {
            return BEFORE;
        }
    } else if (property2.isOWLAnnotationProperty()) {
        return AFTER;
    }
    String prop1BrowserText = property1.getBrowserText();
    String prop2BrowserText = property2.getBrowserText();
    int delta = prop1BrowserText.compareToIgnoreCase(prop2BrowserText);
    if (delta != 0) {
        return delta;
    }
    String val1Rendering = val1.getBrowserText();
    String val2Rendering = val2.getBrowserText();
    return val1Rendering.compareToIgnoreCase(val2Rendering);
}
Also used : OWLAnnotationPropertyData(edu.stanford.bmir.protege.web.shared.entity.OWLAnnotationPropertyData) OWLLiteralData(edu.stanford.bmir.protege.web.shared.entity.OWLLiteralData) OWLPropertyData(edu.stanford.bmir.protege.web.shared.entity.OWLPropertyData) OWLPrimitiveData(edu.stanford.bmir.protege.web.shared.entity.OWLPrimitiveData)

Example 10 with OWLPrimitiveData

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

the class NamedIndividualFrameEditor method getRawSameAs.

private Set<OWLNamedIndividualData> getRawSameAs() {
    Set<OWLNamedIndividualData> rawSameAs = new HashSet<>();
    Optional<List<OWLPrimitiveData>> sameAsList = sameAs.getValue();
    if (sameAsList.isPresent()) {
        for (OWLPrimitiveData data : sameAsList.get()) {
            rawSameAs.add((OWLNamedIndividualData) data);
        }
    }
    return rawSameAs;
}
Also used : OWLNamedIndividualData(edu.stanford.bmir.protege.web.shared.entity.OWLNamedIndividualData) PropertyValueList(edu.stanford.bmir.protege.web.shared.frame.PropertyValueList) OWLPrimitiveData(edu.stanford.bmir.protege.web.shared.entity.OWLPrimitiveData)

Aggregations

OWLPrimitiveData (edu.stanford.bmir.protege.web.shared.entity.OWLPrimitiveData)12 OWLClassData (edu.stanford.bmir.protege.web.shared.entity.OWLClassData)5 OWLLiteralData (edu.stanford.bmir.protege.web.shared.entity.OWLLiteralData)3 ColumnType (edu.stanford.bmir.protege.web.shared.csv.ColumnType)2 PropertyValueList (edu.stanford.bmir.protege.web.shared.frame.PropertyValueList)2 OWLEntity (org.semanticweb.owlapi.model.OWLEntity)2 UiHandler (com.google.gwt.uibinder.client.UiHandler)1 OWLAnnotationPropertyData (edu.stanford.bmir.protege.web.shared.entity.OWLAnnotationPropertyData)1 OWLDatatypeData (edu.stanford.bmir.protege.web.shared.entity.OWLDatatypeData)1 OWLEntityData (edu.stanford.bmir.protege.web.shared.entity.OWLEntityData)1 OWLNamedIndividualData (edu.stanford.bmir.protege.web.shared.entity.OWLNamedIndividualData)1 OWLObjectPropertyData (edu.stanford.bmir.protege.web.shared.entity.OWLObjectPropertyData)1 OWLPropertyData (edu.stanford.bmir.protege.web.shared.entity.OWLPropertyData)1 AnnotationPropertyFrame (edu.stanford.bmir.protege.web.shared.frame.AnnotationPropertyFrame)1 DataPropertyFrame (edu.stanford.bmir.protege.web.shared.frame.DataPropertyFrame)1 ArrayList (java.util.ArrayList)1 EntityType (org.semanticweb.owlapi.model.EntityType)1 OWLLiteral (org.semanticweb.owlapi.model.OWLLiteral)1