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);
}
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();
}
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());
}
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);
}
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());
}
Aggregations