From 7dabc6b2abdb5e196cb06bd73f38f1e35609dae6 Mon Sep 17 00:00:00 2001 From: Georgy Litvinov Date: Tue, 24 Jan 2023 13:09:57 +0100 Subject: [PATCH] fixed check for redundant possible object properties (#358) Co-authored-by: Georgy Litvinov --- .../individual/GroupedPropertyList.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/api/src/main/java/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/GroupedPropertyList.java b/api/src/main/java/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/GroupedPropertyList.java index 7964adce9..75a40773e 100644 --- a/api/src/main/java/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/GroupedPropertyList.java +++ b/api/src/main/java/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/GroupedPropertyList.java @@ -258,10 +258,8 @@ public class GroupedPropertyList extends BaseTemplateModel { if (possibleOP == null) { continue; } - for(ObjectProperty populatedOP : populatedOPs) { - if (redundant(populatedOP, possibleOP)) { - continue; - } + if (isInPopulatedOPs(populatedOPs, possibleOP)) { + continue; } if (!vClassUris.contains(possibleOP.getDomainVClassURI())) { continue; @@ -288,6 +286,15 @@ public class GroupedPropertyList extends BaseTemplateModel { return possibleProperties; } + private boolean isInPopulatedOPs(List populatedOPs, ObjectProperty possibleOP) { + for(ObjectProperty populatedOP : populatedOPs) { + if (redundant(populatedOP, possibleOP)) { + return true; + } + } + return false; + } + /** * Don't know what the real problem is with VIVO-976, but somehow we have the same property * showing up once with a blank node as a domain, and once with null or OWL:Thing as a domain.