use of com.b2international.index.query.Expressions.ExpressionBuilder in project snow-owl by b2ihealthcare.
the class ReasonerTaxonomyBuilder method addActiveInferredRelationships.
public ReasonerTaxonomyBuilder addActiveInferredRelationships(final RevisionSearcher searcher) {
entering("Registering active inferred relationships using revision searcher");
final ExpressionBuilder whereExpressionBuilder = Expressions.builder().filter(active()).filter(characteristicTypeId(Concepts.INFERRED_RELATIONSHIP));
if (!excludedModuleIds.isEmpty()) {
whereExpressionBuilder.mustNot(modules(excludedModuleIds));
}
addRelationships(searcher, whereExpressionBuilder, existingInferredRelationships);
leaving("Registering active inferred relationships using revision searcher");
return this;
}
use of com.b2international.index.query.Expressions.ExpressionBuilder in project snow-owl by b2ihealthcare.
the class ReasonerTaxonomyBuilder method addFullySpecifiedNames.
public ReasonerTaxonomyBuilder addFullySpecifiedNames(final RevisionSearcher searcher) {
entering("Registering fully specified names using revision searcher");
checkState(fullySpecifiedNames == null, "Fully specified names should only be collected once");
fullySpecifiedNames = PrimitiveMaps.newLongKeyOpenHashMapWithExpectedSize(conceptMap.size());
final ExpressionBuilder whereExpressionBuilder = Expressions.builder().filter(SnomedDescriptionIndexEntry.Expressions.active()).filter(SnomedDescriptionIndexEntry.Expressions.type(Concepts.FULLY_SPECIFIED_NAME));
if (!excludedModuleIds.isEmpty()) {
whereExpressionBuilder.mustNot(modules(excludedModuleIds));
}
final List<String> conceptIds = new ArrayList<>(SCROLL_LIMIT);
final List<String> terms = new ArrayList<>(SCROLL_LIMIT);
Query.select(String[].class).from(SnomedDescriptionIndexEntry.class).fields(// 0
SnomedDescriptionIndexEntry.Fields.CONCEPT_ID, // 1
SnomedDescriptionIndexEntry.Fields.TERM).where(whereExpressionBuilder.build()).limit(SCROLL_LIMIT).build().stream(searcher).forEachOrdered(hits -> {
for (final String[] description : hits) {
if (conceptMap.containsKey(description[0])) {
conceptIds.add(description[0]);
terms.add(description[1]);
} else {
LOGGER.debug("Not registering FSN as its concept {} is inactive.", description[0]);
}
}
for (int i = 0; i < conceptIds.size(); i++) {
fullySpecifiedNames.put(Long.parseLong(conceptIds.get(i)), terms.get(i));
}
conceptIds.clear();
terms.clear();
});
leaving("Registering fully specified names using revision searcher");
return this;
}
Aggregations