Search in sources :

Example 6 with PropertyValue

use of edu.stanford.bmir.protege.web.shared.frame.PropertyValue in project webprotege by protegeproject.

the class PropertyValueMinimiser method minimisePropertyValues.

public List<PropertyValue> minimisePropertyValues(List<PropertyValue> propertyValues) {
    List<PropertyValue> result = Lists.newArrayList(propertyValues);
    for (int i = 0; i < propertyValues.size(); i++) {
        for (int j = 0; j < propertyValues.size(); j++) {
            if (i != j && result.get(i) != null && result.get(j) != null) {
                PropertyValue propertyValueA = propertyValues.get(i);
                PropertyValue propertyValueB = propertyValues.get(j);
                if (subsumptionChecker.isSubsumedBy(propertyValueA, propertyValueB)) {
                    // Don't show B because this is more specific!
                    result.set(j, null);
                }
            }
        }
    }
    result.removeIf(Objects::isNull);
    return result;
}
Also used : Objects(java.util.Objects) PropertyValue(edu.stanford.bmir.protege.web.shared.frame.PropertyValue)

Aggregations

PropertyValue (edu.stanford.bmir.protege.web.shared.frame.PropertyValue)6 OWLClassData (edu.stanford.bmir.protege.web.shared.entity.OWLClassData)2 PropertyValueDescriptor (edu.stanford.bmir.protege.web.shared.frame.PropertyValueDescriptor)2 HashSet (java.util.HashSet)2 OWLNamedIndividualData (edu.stanford.bmir.protege.web.shared.entity.OWLNamedIndividualData)1 ClassFrame (edu.stanford.bmir.protege.web.shared.frame.ClassFrame)1 NamedIndividualFrame (edu.stanford.bmir.protege.web.shared.frame.NamedIndividualFrame)1 PropertyValueList (edu.stanford.bmir.protege.web.shared.frame.PropertyValueList)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Objects (java.util.Objects)1