Search in sources :

Example 1 with UsageFilter

use of edu.stanford.bmir.protege.web.shared.usage.UsageFilter in project webprotege by protegeproject.

the class UsagePortletPresenter method applyFilter.

private void applyFilter(FilterSet filterSet) {
    Set<EntityType<?>> entityTypeSet = new HashSet<>();
    if (filterSet.hasSetting(CLASS_FILTER, FilterSetting.ON)) {
        entityTypeSet.add(EntityType.CLASS);
    }
    if (filterSet.hasSetting(PROPERTY_FILTER, FilterSetting.ON)) {
        entityTypeSet.add(EntityType.OBJECT_PROPERTY);
        entityTypeSet.add(EntityType.DATA_PROPERTY);
        entityTypeSet.add(EntityType.ANNOTATION_PROPERTY);
    }
    if (filterSet.hasSetting(INDIVIDUAL_FILTER, FilterSetting.ON)) {
        entityTypeSet.add(EntityType.NAMED_INDIVIDUAL);
    }
    if (filterSet.hasSetting(DATATYPE_FILTER, FilterSetting.ON)) {
        entityTypeSet.add(EntityType.DATATYPE);
    }
    Set<AxiomType<?>> axiomTypes = new HashSet<>();
    for (AxiomTypeGroup group : AxiomTypeGroup.values()) {
        FilterId id = new FilterId(group.getDisplayName());
        if (filterSet.hasSetting(id, FilterSetting.ON)) {
            axiomTypes.addAll(group.getAxiomTypes());
        }
    }
    UsageFilter usageFilter = new UsageFilter(filterSet.hasSetting(SHOW_DEFINING_AXIOMS, FilterSetting.ON), entityTypeSet, axiomTypes);
    this.filter = Optional.of(usageFilter);
    updateDisplayForSelectedEntity();
}
Also used : EntityType(org.semanticweb.owlapi.model.EntityType) AxiomType(org.semanticweb.owlapi.model.AxiomType) FilterId(edu.stanford.bmir.protege.web.shared.filter.FilterId) UsageFilter(edu.stanford.bmir.protege.web.shared.usage.UsageFilter) HashSet(java.util.HashSet) AxiomTypeGroup(edu.stanford.bmir.protege.web.shared.axiom.AxiomTypeGroup)

Aggregations

AxiomTypeGroup (edu.stanford.bmir.protege.web.shared.axiom.AxiomTypeGroup)1 FilterId (edu.stanford.bmir.protege.web.shared.filter.FilterId)1 UsageFilter (edu.stanford.bmir.protege.web.shared.usage.UsageFilter)1 HashSet (java.util.HashSet)1 AxiomType (org.semanticweb.owlapi.model.AxiomType)1 EntityType (org.semanticweb.owlapi.model.EntityType)1