]> gerrit.simantics Code Review - simantics/interop.git/blobdiff - org.simantics.interop/src/org/simantics/interop/test/GraphComparator.java
Handle added and removed properties as property modifications
[simantics/interop.git] / org.simantics.interop / src / org / simantics / interop / test / GraphComparator.java
index d24509395633f7471114302a9815d2a66ed108eb..aae895b7a5835ce068829e6e4dffbefe3b8158ea 100644 (file)
@@ -1265,7 +1265,10 @@ public class GraphComparator {
                                                        }
                                                } else {
                                                        // Non literal properties.
-                                                       if (comparator.compare(g, s1.getObject(), s2.getObject()) != ResourceComparator.NO_MATCH) {
+                                                       int comp = comparator.compare(g, s1.getObject(), s2.getObject());
+                                                       if (comp == ResourceComparator.NO_MATCH) {
+                                                               addModification(r1,s1,r2,s2);
+                                                       } else if (comp != ResourceComparator.EXACT_MATCH) {
                                                                if (!s1.getObject().equals(s1.getSubject()) && !s2.getObject().equals(s2.getSubject())) {
                                                                        if (!a1 && !a2) {
                                                                                // compare props matches objects, so we can call that only for non asserted statements
@@ -1279,7 +1282,7 @@ public class GraphComparator {
                                                                        addModification(r1,s1,r2,s2);
                                                                }
                                                        } else {
-                                                               addModification(r1,s1,r2,s2);
+                                                               // Exact match, nothing to do.
                                                        }
                                                }
                                        } else {
@@ -1291,14 +1294,18 @@ public class GraphComparator {
                                }
                                case -1:{
                                        if (DEBUG) System.out.println("Compare Prop diff1s " + printStatement(g,s1));
-                                       addDeletion(s1);
+                                       // Use modification, since deletions do not support asserted statements
+                                       addModification(r1,s1,r2,null);
+                                       //addDeletion(s1);
                                        i1++;
                                        break;
                                }
                                        
                                case 1:{
                                        if (DEBUG) System.out.println("Compare Prop diff2s " + printStatement(g,s2));
-                                       addAddition(s2);
+                                       // Use modification, since additions do not support asserted statements
+                                       addModification(r1,null,r2,s2);
+                                       //addAddition(s2);
                                        i2++;
                                        break;
                                }