Source:
static Promise<Collection<Property>> evalStatements(final BranchContext context, final Collection<String> sourceFilter, final Collection<String> typeFilter, final Collection<String> destinationFilter, final boolean groupedRelationshipsOnly, final String expressionForm) { final ImmutableList.Builder<String> fieldsToLoad = ImmutableList.builder(); fieldsToLoad.add(SOURCE_ID, TYPE_ID, DESTINATION_ID); if (groupedRelationshipsOnly) { fieldsToLoad.add(GROUP); } final Collection<String> sourceIds = evalToConceptIds(context, sourceFilter, expressionForm); final Collection<String> typeIds = evalToConceptIds(context, typeFilter, expressionForm); final Collection<String> destinationIds = evalToConceptIds(context, destinationFilter, expressionForm); final SnomedRelationshipSearchRequestBuilder req = SnomedRequests.prepareSearchRelationship() .all() .filterByActive(true) .filterBySource(sourceIds) .filterByType(typeIds) .filterByDestination(destinationIds) .filterByCharacteristicTypes(getCharacteristicTypes(expressionForm)) .setEclExpressionForm(expressionForm) .setFields(fieldsToLoad.build()); if (groupedRelationshipsOnly) { req.filterByGroup(1, Integer.MAX_VALUE); } Promise<Collection<Property>> then = req.build(context.id(), context.branchPath()) .execute(context.service(IEventBus.class)) .then(input -> input.stream().map(r -> new Property(r.getSourceId(), r.getTypeId(), r.getDestinationId(), r.getGroup())).collect(Collectors.toSet())); if (Trees.STATED_FORM.equals(expressionForm)) { final Set<Property> axiomStatements = evalAxiomStatements(context, groupedRelationshipsOnly, sourceIds, typeIds, destinationIds); return then.then(relationshipStatements -> ImmutableSet.<Property>builder().addAll(relationshipStatements).addAll(axiomStatements).build()); } else { return then; } }

Target:
static Promise<Collection<Property>> evalStatements(final BranchContext context, final Collection<String> sourceFilter, final Collection<String> typeFilter, final Collection<String> destinationFilter, final boolean groupedRelationshipsOnly, final String expressionForm) { final ImmutableList.Builder<String> fieldsToLoad = ImmutableList.builder(); fieldsToLoad.add(SOURCE_ID, TYPE_ID, DESTINATION_ID); if (groupedRelationshipsOnly) { fieldsToLoad.add(GROUP); } final Collection<String> sourceIds = evalToConceptIds(context, sourceFilter, expressionForm); final Collection<String> typeIds = evalToConceptIds(context, typeFilter, expressionForm); final Collection<String> destinationIds = evalToConceptIds(context, destinationFilter, expressionForm); final SnomedRelationshipSearchRequestBuilder searchRelationships = SnomedRequests.prepareSearchRelationship() .all() .filterByActive(true) .filterBySource(sourceIds) .filterByType(typeIds) .filterByDestination(destinationIds) .filterByCharacteristicTypes(getCharacteristicTypes(expressionForm)) .setEclExpressionForm(expressionForm) .setFields(fieldsToLoad.build()); if (groupedRelationshipsOnly) { searchRelationships.filterByGroup(1, Integer.MAX_VALUE); } Promise<Collection<Property>> relationshipSearch = searchRelationships.build(context.id(), context.branchPath()) .execute(context.service(IEventBus.class)) .then(input -> input.stream().map(r -> new Property(r.getSourceId(), r.getTypeId(), r.getDestinationId(), r.getGroup())).collect(Collectors.toSet())); if (Trees.STATED_FORM.equals(expressionForm)) { final Set<Property> axiomStatements = evalAxiomStatements(context, groupedRelationshipsOnly, sourceIds, typeIds, destinationIds); return relationshipSearch.then(relationshipStatements -> ImmutableSet.<Property>builder().addAll(relationshipStatements).addAll(axiomStatements).build()); } else { return relationshipSearch; } }