Skip to content

Commit

Permalink
fix: allow filtering for joins
Browse files Browse the repository at this point in the history
...when selecting a source type in the alignment view.

Before no results would be shown because the internal check expects all
types to match while in the view only one can be specified.
  • Loading branch information
stempler committed Mar 15, 2024
1 parent 60b087b commit 4309686
Showing 1 changed file with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,32 @@ public Collection<? extends Cell> getTypeCells(Cell queryCell) {
.getDefinition().getType();
if (target == null || DefinitionUtil.isSuperType(target, typeCellTarget)) {
// target matches
if (sources.isEmpty() || matchesSources(typeCell.getSource(), sources)) {
// source matches, too
result.add(typeCell);

if (sources.size() == 1) {
/*
* Special case handling when there is exactly one type,
* that in this case also allows to find a Join that only
* uses one of the types.
*
* Unclear if this is intended, but the else case does not
* yield any results in such cases, which could be due to
* the implementation of `matchesSources` in that case being
* focused on property relations.
*/
TypeEntityDefinition type = sources.iterator().next();
if (sources.isEmpty() || matchesSources(type,
typeCell.getSource().values().stream()
.map(e -> AlignmentUtil.getTypeEntity(e.getDefinition()))
.toList())) {
// source matches, too
result.add(typeCell);
}
}
else {
if (sources.isEmpty() || matchesSources(typeCell.getSource(), sources)) {
// source matches, too
result.add(typeCell);
}
}
}
}
Expand Down

0 comments on commit 4309686

Please sign in to comment.