+ if (result.second != null)
+ showWarning(result.second);
+ if (originalModel != null) {
+ // three-way comparison: use change information to configure
+ // the comparison between the old and the new model.
+
+ // 1. map comparable resources
+ for (Entry<Resource, Resource> origToOld : changes2.getComparable().getEntries()) {
+ Resource oldR = origToOld.getValue();
+ Resource newR = changes3.getComparable().getRight(origToOld.getKey());
+ if (newR != null) {
+ comparator.addComparableResources(oldR, newR);
+ }
+ }
+ // 2. mark removed resources as distinct, so that comparison does not pair them
+ for (Statement s : changes2.getDeletions()) {
+ if (changes3.getComparable().containsLeft(s.getObject()))
+ comparator.addNonMatchedRight(changes3.getComparable().getRight(s.getObject()));
+ }
+
+ for (Statement s : changes3.getDeletions()) {
+ if (changes2.getComparable().containsLeft(s.getObject()))
+ comparator.addNonMatchedLeft(changes2.getComparable().getRight(s.getObject()));
+ }
+ if (uei.isNewDistinct()) {
+ // 3. mark added resources as distinct, so that comparison does not pair them
+ for (Statement s : changes2.getAdditions()) {
+ comparator.addNonMatchedLeft(s.getObject());
+ }
+
+ for (Statement s : changes3.getAdditions()) {
+ comparator.addNonMatchedRight(s.getObject());
+ }
+ }
+ }