X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.interop%2Fsrc%2Forg%2Fsimantics%2Finterop%2Ftest%2FGraphComparator.java;fp=org.simantics.interop%2Fsrc%2Forg%2Fsimantics%2Finterop%2Ftest%2FGraphComparator.java;h=052a9a9ee19ad7bce23cba188e2bc923fbd76a2d;hb=8b92927f87a7966d268ab7678d29992485752c21;hp=61d7128c5de031a9d3aa83f5e0756cb8b0ed2b28;hpb=c201a20a77db051116870d6c7eece50374293824;p=simantics%2Finterop.git 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 61d7128..052a9a9 100644 --- a/org.simantics.interop/src/org/simantics/interop/test/GraphComparator.java +++ b/org.simantics.interop/src/org/simantics/interop/test/GraphComparator.java @@ -52,7 +52,7 @@ import org.simantics.utils.datastructures.Pair; */ public class GraphComparator { - private static final boolean DEBUG = false; + private static final boolean DEBUG = true; private Resource r1; private Resource r2; @@ -152,10 +152,16 @@ public class GraphComparator { } public void addComparableResources(Resource r1, Resource r2) { + if (DEBUG) + System.out.println("Preset " + r1 + " = " + r2); comparableResources.map(r1, r2); } public void addComparableResources(BijectionMap matching) { + if (DEBUG) { + for (Entry entry : matching.getEntries()) + System.out.println("Preset " + entry.getKey() + " = " + entry.getValue()); + } comparableResources.addAll(matching); } @@ -269,6 +275,11 @@ public class GraphComparator { // These cases have longer path than one to identified objects. processUnreliableDeep(unreliableLeft, unreliableRight, objectsLeft, objectsRight); } + if (objectsLeft.isEmpty() && unreliableLeft.size() > 0 && unreliableRight.size() > 0) { + // comparison is ending, but we have still unprocessed unidentified resources left. + // These cases have longer path than one to identified objects. + processUnreliableDeep(unreliableLeft, unreliableRight, objectsLeft, objectsRight); + } } }); @@ -277,8 +288,6 @@ public class GraphComparator { } for (Statement s : unreliableLeft) { if (!comparableStatements.containsLeft(s)) - if (s.getObject().getResourceId() == 303248) - System.out.println(); addDeletion(s); } for (Statement s : unreliableRight) { @@ -299,7 +308,8 @@ public class GraphComparator { if (r1.equals(r2)) continue; - + if (r1.getResourceId() == 610446L) + System.out.println(); if (processedResources.contains(r1)) continue; processedResources.add(r1); @@ -779,7 +789,9 @@ public class GraphComparator { throw new DatabaseException("Comparator error: Trying to map " + left + " to " + right + " while mappings " + left + " to " + comparableResources.getRight(left) + " and " + comparableResources.getLeft(right) + " to " + right + " exist."); } else { if (DEBUG) System.out.println(left + " = " + right); - comparableResources.map(left, right); + if (left.getResourceId() == 610381L) + System.out.println(); + comparableResources.map(left, right); } } @@ -838,6 +850,8 @@ public class GraphComparator { if (!changes1Set.contains(s)) { changes1Set.add(s); changes1.add(s); + if (s.getObject().getResourceId() == 532631L) + System.out.println(); } }