use of edu.stanford.bmir.protege.web.server.logging.Markers.BROWSING in project webprotege by protegeproject.
the class EntitySearcher method invoke.
/**
* Invokes the entity searcher to perform a search.
*/
public void invoke() {
Stopwatch stopwatch = Stopwatch.createStarted();
matchCounter.reset();
searchCounter.reset();
results.clear();
tagsByLabel.clear();
tagsManager.getProjectTags().forEach(tag -> tagsByLabel.put(tag.getLabel(), tag));
tagsByEntity.clear();
tagsByEntity.putAll(tagsManager.getTags(projectId));
Pattern searchPattern = compileSearchPattern(searchWords);
entityStreamSupplier.get().filter(this::isRequiredEntityType).peek(this::incrementSearchCounter).map(this::performMatch).filter(Objects::nonNull).peek(this::incrementMatchCounter).sorted().skip(skip).limit(limit).map(m -> toSearchResult(searchPattern, m)).forEach(results::add);
logger.info(BROWSING, "{} {} Performed entity search for \"{}\". Found {} matches in {} entities in {} ms.", projectId, userId, searchString, matchCounter.getCounter(), searchCounter.getCounter(), stopwatch.elapsed(TimeUnit.MILLISECONDS));
}
use of edu.stanford.bmir.protege.web.server.logging.Markers.BROWSING in project webprotege by protegeproject.
the class GetIndividualsActionHandler method execute.
@Nonnull
@Override
public GetIndividualsResult execute(@Nonnull GetIndividualsAction action, @Nonnull ExecutionContext executionContext) {
Stream<OWLNamedIndividual> stream;
if (action.getType().isOWLThing()) {
stream = rootOntology.getIndividualsInSignature(Imports.INCLUDED).stream();
} else {
stream = rootOntology.getImportsClosure().stream().flatMap(o -> o.getClassAssertionAxioms(action.getType()).stream()).map(OWLClassAssertionAxiom::getIndividual).filter(OWLIndividual::isNamed).map(OWLIndividual::asOWLNamedIndividual);
}
Counter counter = new Counter();
List<OWLNamedIndividualData> individualsData = stream.peek(i -> counter.increment()).map(renderingManager::getRendering).filter(i -> {
String searchString = action.getFilterString();
return searchString.isEmpty() || StringUtils.containsIgnoreCase(i.getBrowserText(), searchString);
}).distinct().sorted().collect(toList());
PageRequest pageRequest = action.getPageRequest();
Pager<OWLNamedIndividualData> pager = Pager.getPagerForPageSize(individualsData, pageRequest.getPageSize());
Page<OWLNamedIndividualData> page = pager.getPage(pageRequest.getPageNumber());
OWLClassData type = renderingManager.getRendering(action.getType());
logger.info(BROWSING, "{} {} retrieved instances of {} ({})", projectId, executionContext.getUserId(), action.getType(), renderingManager.getRendering(action.getType()).getBrowserText());
return new GetIndividualsResult(type, page, counter.getCount(), individualsData.size());
}
Aggregations