Search in sources :

Example 1 with EntityType

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

the class CSVColumnRelationEditorViewImpl method handleRelationTypeFieldChanged.

@UiHandler("relationTypeField")
protected void handleRelationTypeFieldChanged(ChangeEvent event) {
    final Optional<OWLPrimitiveData> property = propertyField.getValue();
    if (property.isPresent()) {
        EntityType<?> propertyType = ((OWLEntity) property.get().getObject()).getEntityType();
        if (getColumnType().isPresent()) {
            ColumnType type = getColumnType().get();
            List<EntityType<?>> propertyTypes = type.getPropertyTypes();
            if (!propertyTypes.contains(propertyType)) {
                final EntityType<?> firstPermissiblePropertyType = propertyTypes.get(0);
                propertyField.coerceToEntityType(firstPermissiblePropertyType);
            }
        }
    }
    ValueChangeEvent.fire(this, property);
}
Also used : EntityType(org.semanticweb.owlapi.model.EntityType) ColumnType(edu.stanford.bmir.protege.web.shared.csv.ColumnType) OWLEntity(org.semanticweb.owlapi.model.OWLEntity) OWLPrimitiveData(edu.stanford.bmir.protege.web.shared.entity.OWLPrimitiveData) UiHandler(com.google.gwt.uibinder.client.UiHandler)

Example 2 with EntityType

use of org.semanticweb.owlapi.model.EntityType 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)

Example 3 with EntityType

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

the class EntityLookupRequestTestCase method getSearchedEntityTypesReturnsCopy.

@Test
public void getSearchedEntityTypesReturnsCopy() {
    Set<EntityType<?>> types = new HashSet<EntityType<?>>();
    types.add(EntityType.CLASS);
    EntityLookupRequest request = new EntityLookupRequest("Test", SearchType.SUB_STRING_MATCH_IGNORE_CASE, 20, types);
    request.getSearchedEntityTypes().add(EntityType.OBJECT_PROPERTY);
    assertEquals(types, request.getSearchedEntityTypes());
}
Also used : EntityType(org.semanticweb.owlapi.model.EntityType) EntityLookupRequest(edu.stanford.bmir.protege.web.shared.entity.EntityLookupRequest) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 4 with EntityType

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

the class PerformEntitySearchActionHandler method execute.

@Nonnull
@Override
public PerformEntitySearchResult execute(@Nonnull PerformEntitySearchAction action, @Nonnull ExecutionContext executionContext) {
    Set<EntityType<?>> entityTypes = action.getEntityTypes();
    String searchString = action.getSearchString();
    EntitySearcher entitySearcher = EntitySearcher.get(projectId, tagsManager, executionContext.getUserId(), () -> entityStream(entityTypes, rootOntology, Imports.INCLUDED), renderer, entityTypes, searchString);
    PageRequest pageRequest = action.getPageRequest();
    int pageSize = pageRequest.getPageSize();
    entitySearcher.setLimit(pageSize);
    int pageNumber = pageRequest.getPageNumber();
    entitySearcher.setSkip((pageNumber - 1) * pageSize);
    entitySearcher.invoke();
    int totalSearchResults = entitySearcher.getSearchResultsCount();
    List<EntitySearchResult> results = entitySearcher.getResults();
    int pageCount = (totalSearchResults / pageSize) + 1;
    Page<EntitySearchResult> page = new Page<>(pageNumber > pageCount ? 1 : pageNumber, pageCount, results, totalSearchResults);
    return new PerformEntitySearchResult(totalSearchResults, page);
}
Also used : EntityType(org.semanticweb.owlapi.model.EntityType) PageRequest(edu.stanford.bmir.protege.web.shared.pagination.PageRequest) Page(edu.stanford.bmir.protege.web.shared.pagination.Page) EntitySearchResult(edu.stanford.bmir.protege.web.shared.search.EntitySearchResult) PerformEntitySearchResult(edu.stanford.bmir.protege.web.shared.search.PerformEntitySearchResult) PerformEntitySearchResult(edu.stanford.bmir.protege.web.shared.search.PerformEntitySearchResult) Nonnull(javax.annotation.Nonnull)

Example 5 with EntityType

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

the class EntityLookupRequestTestCase method suppliedSearchedEntityTypesIsCopied.

@Test
public void suppliedSearchedEntityTypesIsCopied() {
    Set<EntityType<?>> types = new HashSet<EntityType<?>>();
    types.add(EntityType.CLASS);
    Set<EntityType<?>> typesCopy = new HashSet<EntityType<?>>(types);
    EntityLookupRequest request = new EntityLookupRequest("Test", SearchType.SUB_STRING_MATCH_IGNORE_CASE, 20, types);
    types.add(EntityType.OBJECT_PROPERTY);
    assertEquals(typesCopy, request.getSearchedEntityTypes());
}
Also used : EntityType(org.semanticweb.owlapi.model.EntityType) EntityLookupRequest(edu.stanford.bmir.protege.web.shared.entity.EntityLookupRequest) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

EntityType (org.semanticweb.owlapi.model.EntityType)7 HashSet (java.util.HashSet)3 EntityLookupRequest (edu.stanford.bmir.protege.web.shared.entity.EntityLookupRequest)2 Test (org.junit.Test)2 OWLEntity (org.semanticweb.owlapi.model.OWLEntity)2 UiHandler (com.google.gwt.uibinder.client.UiHandler)1 AutoCompletionChoice (edu.stanford.bmir.gwtcodemirror.client.AutoCompletionChoice)1 EscapingShortFormProvider (edu.stanford.bmir.protege.web.server.shortform.EscapingShortFormProvider)1 PrimitiveType (edu.stanford.bmir.protege.web.shared.PrimitiveType)1 AxiomTypeGroup (edu.stanford.bmir.protege.web.shared.axiom.AxiomTypeGroup)1 ColumnType (edu.stanford.bmir.protege.web.shared.csv.ColumnType)1 OWLLiteralData (edu.stanford.bmir.protege.web.shared.entity.OWLLiteralData)1 OWLPrimitiveData (edu.stanford.bmir.protege.web.shared.entity.OWLPrimitiveData)1 FilterId (edu.stanford.bmir.protege.web.shared.filter.FilterId)1 Page (edu.stanford.bmir.protege.web.shared.pagination.Page)1 PageRequest (edu.stanford.bmir.protege.web.shared.pagination.PageRequest)1 EntityNameMatchResult (edu.stanford.bmir.protege.web.shared.search.EntityNameMatchResult)1 EntityNameMatcher (edu.stanford.bmir.protege.web.shared.search.EntityNameMatcher)1 EntitySearchResult (edu.stanford.bmir.protege.web.shared.search.EntitySearchResult)1 PerformEntitySearchResult (edu.stanford.bmir.protege.web.shared.search.PerformEntitySearchResult)1