]> gerrit.simantics Code Review - simantics/interop.git/commitdiff
Added relations checks for graph path comparison 72/3772/1
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Mon, 13 Jan 2020 09:16:13 +0000 (11:16 +0200)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Mon, 13 Jan 2020 09:16:13 +0000 (11:16 +0200)
Note: I have not spotted any failures with the previous logic.

gitlab #21

Change-Id: I22cb17b35c6c21c65b93f6a2f04dd8e4ef0e4511

org.simantics.interop/src/org/simantics/interop/test/GraphComparator.java

index ba9bdf099397a90a8a2bc423c26d24354a29a2bf..6f8c4d1b15e13d10a652dac5551abbb7d0a329e1 100644 (file)
@@ -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;
+                                       }
                                }
                        }
                }