From a4470f2cf50c3f6d4c586930ccd8eaa55ded25a5 Mon Sep 17 00:00:00 2001 From: Marko Luukkainen Date: Tue, 7 Jan 2020 15:42:43 +0200 Subject: [PATCH] Necessary changes for UC change management support UpdateTree changes are applied before property changes, so that possible UC additions/deletions are processed first. (This may require additional changes). Use possible custom property relation when applying PropertyChange. Do not report added/removed asserted properties with GraphComparator. gitlab #21 Change-Id: Ida163051fd27db06ab504ec86dc86d2d8887bfa0 --- .../interop/update/model/ModelUpdate.java | 5 +++-- .../interop/update/model/PropertyChange.java | 3 +++ .../simantics/interop/test/GraphComparator.java | 14 ++++++++------ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/org.simantics.interop.update/src/org/simantics/interop/update/model/ModelUpdate.java b/org.simantics.interop.update/src/org/simantics/interop/update/model/ModelUpdate.java index 2cb2883..ff56d43 100644 --- a/org.simantics.interop.update/src/org/simantics/interop/update/model/ModelUpdate.java +++ b/org.simantics.interop.update/src/org/simantics/interop/update/model/ModelUpdate.java @@ -348,12 +348,13 @@ public abstract class ModelUpdate { public void applySelected(WriteGraph graph) throws DatabaseException { Layer0Utils.addCommentMetadata(graph, "Apply selected model updates"); graph.markUndoPoint(); + + updateTree.getUpdateOps().applySelected(graph); + for (PropertyChange mod : updateList.getChanges()) { if (mod.selected()) mod.apply(graph); } - - updateTree.getUpdateOps().applySelected(graph); } diff --git a/org.simantics.interop.update/src/org/simantics/interop/update/model/PropertyChange.java b/org.simantics.interop.update/src/org/simantics/interop/update/model/PropertyChange.java index 9a95984..5220736 100644 --- a/org.simantics.interop.update/src/org/simantics/interop/update/model/PropertyChange.java +++ b/org.simantics.interop.update/src/org/simantics/interop/update/model/PropertyChange.java @@ -101,6 +101,9 @@ public class PropertyChange { value = graph.getValue(pair.second.getObject()); } Resource pred = pair.second.getPredicate(); + if (getChanges().getComparable().containsRight(pred)) + pred = getChanges().getComparable().getLeft(pred); + if (value != null) { graph.deny(s, pred); graph.claimLiteral(s, pred, value); 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 052a9a9..ac39e2f 100644 --- a/org.simantics.interop/src/org/simantics/interop/test/GraphComparator.java +++ b/org.simantics.interop/src/org/simantics/interop/test/GraphComparator.java @@ -850,8 +850,6 @@ public class GraphComparator { if (!changes1Set.contains(s)) { changes1Set.add(s); changes1.add(s); - if (s.getObject().getResourceId() == 532631L) - System.out.println(); } } @@ -1185,16 +1183,20 @@ public class GraphComparator { break; else { while (i2 < ss2.size()) { - if (DEBUG) System.out.println("Compare Prop diff2 " + printStatement(g,ss2.get(i2))); - addAddition(ss2.get(i2)); + Statement s = ss2.get(i2); + if (DEBUG) System.out.println("Compare Prop diff2 " + printStatement(g,s)); + if (!s.isAsserted(r2)) + addAddition(s); i2++; } break; } } else if (i2 >= ss2.size()) { while (i1 < ss1.size()) { - if (DEBUG) System.out.println("Compare Prop diff1 " + printStatement(g,ss1.get(i1))); - addDeletion(ss1.get(i1)); + Statement s = ss1.get(i1); + if (DEBUG) System.out.println("Compare Prop diff1 " + printStatement(g,s)); + if (!s.isAsserted(r1)) + addDeletion(s); i1++; } break; -- 2.47.1