From: Marko Luukkainen Date: Mon, 13 Jan 2020 09:16:13 +0000 (+0200) Subject: Added relations checks for graph path comparison X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=7bd962c96d0a43bbc0fca67e87a1bc877a451fe0;p=simantics%2Finterop.git Added relations checks for graph path comparison Note: I have not spotted any failures with the previous logic. gitlab #21 Change-Id: I22cb17b35c6c21c65b93f6a2f04dd8e4ef0e4511 --- diff --git a/org.simantics.interop/src/org/simantics/interop/test/GraphComparator.java b/org.simantics.interop/src/org/simantics/interop/test/GraphComparator.java index ba9bdf0..6f8c4d1 100644 --- a/org.simantics.interop/src/org/simantics/interop/test/GraphComparator.java +++ b/org.simantics.interop/src/org/simantics/interop/test/GraphComparator.java @@ -711,8 +711,19 @@ public class GraphComparator { if (leftPath.getLength() != rightPath.getLength()) continue; if (comparableResources.contains(leftPath.getEnd(), rightPath.getEnd())) { - map.map(leftPath, rightPath); - break; + boolean preds = true; + for (int i = 0; i < leftPath.getLength(); i++) { + Statement sl = leftPath.getStatements().get(i); + Statement sr = rightPath.getStatements().get(i); + if (!sl.getPredicate().equals(sr.getPredicate()) && !comparableResources.contains(sl.getPredicate(), sr.getPredicate())) { + preds = false; + break; + } + } + if (preds) { + map.map(leftPath, rightPath); + break; + } } } }