use of com.b2international.snowowl.snomed.reasoner.domain.ClassificationTask in project snow-owl by b2ihealthcare.
the class ClassificationTaskConverter method expand.
@Override
public void expand(final List<ClassificationTask> results) {
final Multimap<String, ClassificationTask> tasksByBranch = Multimaps.index(results, ClassificationTask::getBranch);
final Branches branches = RepositoryRequests.branching().prepareSearch().setLimit(tasksByBranch.keySet().size()).filterByIds(tasksByBranch.keySet()).build().execute(context());
final Map<String, Long> headTimestamps = branches.stream().collect(Collectors.toMap(Branch::path, Branch::headTimestamp));
// Overwrite stored status if the branch has moved forward in the meantime, except if the task is saved
for (final ClassificationTask task : results) {
if (SAVE_AND_SCHEDULED_STATUSES.contains(task.getStatus())) {
continue;
}
if (task.getTimestamp() < headTimestamps.get(task.getBranch())) {
task.setStatus(ClassificationStatus.STALE);
}
}
if (expand().isEmpty()) {
return;
}
final Set<String> classificationTaskIds = results.stream().map(ClassificationTask::getId).collect(Collectors.toSet());
expandEquivalentConceptSets(results, classificationTaskIds);
expandRelationshipChanges(results, classificationTaskIds);
expandConcreteDomainChanges(results, classificationTaskIds);
}
use of com.b2international.snowowl.snomed.reasoner.domain.ClassificationTask in project snow-owl by b2ihealthcare.
the class EquivalencyChecker method processResults.
@Override
protected LongKeyLongMap processResults(final String classificationId) {
final Set<String> conceptIdsToCheck = additionalConcepts.stream().map(SnomedConcept::getId).collect(Collectors.toSet());
final LongKeyLongMap equivalentConceptMap = PrimitiveMaps.newLongKeyLongOpenHashMap();
final ClassificationTask classificationTask = ClassificationRequests.prepareGetClassification(classificationId).setExpand("equivalentConceptSets()").build(repositoryId).execute(getEventBus()).getSync();
if (!ClassificationStatus.COMPLETED.equals(classificationTask.getStatus())) {
throw new ReasonerApiException("Selected reasoner could not start or failed to finish its job.");
}
if (!classificationTask.getEquivalentConceptsFound()) {
return equivalentConceptMap;
}
final EquivalentConceptSets equivalentConceptSets = classificationTask.getEquivalentConceptSets();
registerEquivalentConcepts(equivalentConceptSets, conceptIdsToCheck, equivalentConceptMap);
return equivalentConceptMap;
}
Aggregations