Bug 529253 - [Compare] Stereotype applications left behind by sub-unit refactoring merge

Add a post-processor that analyzes ResourceAttachmentChanges
to detect incoming changes that are actually refactorings
(rename/move) of resources.  Re-write the MatchResources
accordingly to record the matching of resources on the two
sides that have different URIs, and use this in the merge
phase to ensure that the merge result reflects the new
resource URIs.

This includes JUnit tests for that scenario specifically
and also others in the scope of bug 529217.

Change-Id: Iec8a2a9c8169f05000740383691978d9100b91e6
diff --git a/plugins/compare/bundles/org.eclipse.papyrus.compare.uml2/META-INF/MANIFEST.MF b/plugins/compare/bundles/org.eclipse.papyrus.compare.uml2/META-INF/MANIFEST.MF
index 64145be..dba9b15 100644
--- a/plugins/compare/bundles/org.eclipse.papyrus.compare.uml2/META-INF/MANIFEST.MF
+++ b/plugins/compare/bundles/org.eclipse.papyrus.compare.uml2/META-INF/MANIFEST.MF
@@ -16,7 +16,8 @@
  org.eclipse.emf.transaction;bundle-version="[1.8.0,2.0.0)",
  org.apache.commons.lang;bundle-version="[2.6.0,3.0.0)",
  org.eclipse.emf.compare.uml2;bundle-version="2.5.0",
- org.eclipse.emf.compare.ide;bundle-version="3.3.0"
+ org.eclipse.emf.compare.ide;bundle-version="3.3.0",
+ org.eclipse.emf.compare;bundle-version="[3.5.1,4.0.0)"
 Export-Package: org.eclipse.papyrus.compare.uml2.internal.hook,
  org.eclipse.papyrus.compare.uml2.internal.hook.migration
 Import-Package: com.google.common.base;version="[15.0.0,22.0.0)",
diff --git a/plugins/compare/bundles/org.eclipse.papyrus.compare.uml2/plugin.xml b/plugins/compare/bundles/org.eclipse.papyrus.compare.uml2/plugin.xml
index 72719cb..f7c5029 100644
--- a/plugins/compare/bundles/org.eclipse.papyrus.compare.uml2/plugin.xml
+++ b/plugins/compare/bundles/org.eclipse.papyrus.compare.uml2/plugin.xml
@@ -7,4 +7,23 @@
             class="org.eclipse.papyrus.compare.uml2.internal.hook.ProfileMigrationHook">
       </resourceSetHook>
    </extension>
+   <extension
+         point="org.eclipse.emf.compare.rcp.postProcessor">
+      <processor
+            class="org.eclipse.papyrus.compare.uml2.internal.postprocessor.PapyrusPostProcessor"
+            description="Post-processor for Papyrus models."
+            label="Papyrus Post Processor"
+            ordinal="30">
+         <nsURI
+               value="http://www.eclipse.org/uml2/\d.0.0/UML">
+         </nsURI>
+      </processor>
+   </extension>
+   <extension
+         point="org.eclipse.emf.compare.rcp.merger">
+      <merger
+            class="org.eclipse.papyrus.compare.uml2.internal.postprocessor.ResourceRefactoringMerger"
+            ranking="30">
+      </merger>
+   </extension>
 </plugin>
diff --git a/plugins/compare/bundles/org.eclipse.papyrus.compare.uml2/src/org/eclipse/papyrus/compare/uml2/internal/postprocessor/PapyrusPostProcessor.java b/plugins/compare/bundles/org.eclipse.papyrus.compare.uml2/src/org/eclipse/papyrus/compare/uml2/internal/postprocessor/PapyrusPostProcessor.java
new file mode 100644
index 0000000..2e7f03f
--- /dev/null
+++ b/plugins/compare/bundles/org.eclipse.papyrus.compare.uml2/src/org/eclipse/papyrus/compare/uml2/internal/postprocessor/PapyrusPostProcessor.java
@@ -0,0 +1,391 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     Christian W. Damus - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.compare.uml2.internal.postprocessor;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.collect.Iterables.filter;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
+import static org.eclipse.papyrus.compare.uml2.internal.postprocessor.PapyrusResourceIndex.getResource;
+import static org.eclipse.papyrus.compare.uml2.internal.postprocessor.PapyrusResourceIndex.index;
+import static org.eclipse.papyrus.compare.uml2.internal.postprocessor.PapyrusResourceIndex.opposite;
+import static org.eclipse.papyrus.compare.uml2.internal.postprocessor.PapyrusResourceIndex.setResource;
+import static org.eclipse.papyrus.compare.uml2.internal.postprocessor.PapyrusResourceIndex.setURI;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterators;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.emf.common.util.Monitor;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.DifferenceSource;
+import org.eclipse.emf.compare.Match;
+import org.eclipse.emf.compare.MatchResource;
+import org.eclipse.emf.compare.ReferenceChange;
+import org.eclipse.emf.compare.ResourceAttachmentChange;
+import org.eclipse.emf.compare.postprocessor.IPostProcessor;
+import org.eclipse.emf.compare.uml2.internal.postprocessor.util.UMLCompareUtil;
+import org.eclipse.emf.compare.utils.MatchUtil;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.uml2.uml.Element;
+
+/**
+ * Post-processor for comparisons of Papyrus models.
+ *
+ * @author Christian W. Damus
+ */
+public class PapyrusPostProcessor implements IPostProcessor {
+
+	/**
+	 * A predicate matching diffs that are {@link ResourceAttachmentChange}s that move a stereotype
+	 * application.
+	 */
+	static final Predicate<Diff> IS_STEREOTYPE_APPLICATION_RESOURCE_MOVE = and(isStereotypeApplicationRAC(),
+			ofKind(DifferenceKind.MOVE));
+
+	/**
+	 * A predicate matching diffs that are {@link ResourceAttachmentChange}s that move the principal UML
+	 * element of a resource.
+	 */
+	static final Predicate<Diff> IS_RESOURCE_REFACTORING_MOVE = and(isResourceRefactoringRAC(),
+			ofKind(DifferenceKind.MOVE));
+
+	/**
+	 * Initializes me.
+	 */
+	public PapyrusPostProcessor() {
+		super();
+	}
+
+	public void postMatch(Comparison comparison, Monitor monitor) {
+		// Handle refactoring of model resources, esp. sub-units
+		rematchRefactoredUMLResources(comparison, monitor);
+	}
+
+	public void postDiff(Comparison comparison, Monitor monitor) {
+		// Pass
+	}
+
+	public void postRequirements(Comparison comparison, Monitor monitor) {
+		// Ensure that certain diffs of stereotype applications are merged
+		// only after certain other diffs of their base UML elements
+		findStereotypeApplicationDependencies(comparison);
+	}
+
+	public void postEquivalences(Comparison comparison, Monitor monitor) {
+		// Pass
+	}
+
+	public void postConflicts(Comparison comparison, Monitor monitor) {
+		// Pass
+	}
+
+	public void postComparison(Comparison comparison, Monitor monitor) {
+		// Pass
+	}
+
+	/**
+	 * Find diffs for stereotype applications moved from one resource to another and add the moves (if any) of
+	 * their base elements as pre-requisites.
+	 * 
+	 * @param comparison
+	 *            the contextual comparison
+	 */
+	protected void findStereotypeApplicationDependencies(Comparison comparison) {
+		for (ResourceAttachmentChange rac : getStereotypeApplicationResourceMoves(comparison)) {
+			// Also the diff that moves the base element, if any
+			Match match = rac.getMatch();
+			EObject stereotypeApplication = MatchUtil.getMatchedObject(match, rac.getSource());
+
+			Element baseElement = UMLCompareUtil.getBaseElement(stereotypeApplication);
+			if (baseElement != null) {
+				Match baseMatch = comparison.getMatch(baseElement);
+				Diff moveDiff = findMoveDiff(baseMatch, comparison, rac.getSource());
+				if (moveDiff != null) {
+					rac.getRequires().add(moveDiff);
+				}
+			}
+		}
+	}
+
+	/**
+	 * Obtain a predicate matching diffs that are {@link ResourceAttachmentChange}s pertaining to a stereotype
+	 * application.
+	 * 
+	 * @return the is-stereotype-application-RAC predicate
+	 */
+	protected static Predicate<Diff> isStereotypeApplicationRAC() {
+		return new Predicate<Diff>() {
+			public boolean apply(Diff input) {
+				if (!(input instanceof ResourceAttachmentChange)) {
+					return false;
+				}
+
+				Match match = input.getMatch();
+				EObject object = match.getLeft();
+				if (object == null) {
+					object = match.getRight();
+				}
+
+				return object != null && !(object instanceof Element)
+						&& UMLCompareUtil.getBaseElement(object) != null;
+			}
+		};
+	}
+
+	/**
+	 * Selects the resource attachment changes that indicate moves of stereotype applications from a resource
+	 * to another.
+	 * 
+	 * @param comparison
+	 *            the comparison from which to select the diffs
+	 * @return the stereotype application moves between resources
+	 */
+	protected Iterable<ResourceAttachmentChange> getStereotypeApplicationResourceMoves(
+			Comparison comparison) {
+
+		return filter(filter(comparison.getDifferences(), ResourceAttachmentChange.class),
+				IS_STEREOTYPE_APPLICATION_RESOURCE_MOVE);
+	}
+
+	/**
+	 * Obtains a predicate matching {@link ResourceAttachmentChange}s of UML elements that signify the
+	 * refactoring (rename/move) of a resource.
+	 * 
+	 * @return the is-resource-refactoring-RAC predicate
+	 */
+	protected static Predicate<Diff> isResourceRefactoringRAC() {
+		return new Predicate<Diff>() {
+			public boolean apply(Diff input) {
+				if (!(input instanceof ResourceAttachmentChange)) {
+					return false;
+				}
+
+				Match match = input.getMatch();
+				EObject object = match.getLeft();
+				if (object == null) {
+					object = match.getRight();
+				}
+
+				return object instanceof Element && index(match).getResourceRefactoring(match) != null;
+			}
+		};
+	}
+
+	/**
+	 * Find the nearest diff to a given {@code match} that moves it (perhaps indirectly via the content tree)
+	 * from a resource to another resource.
+	 * 
+	 * @param match
+	 *            a match for which to look for a move diff
+	 * @param comparison
+	 *            the contextual comparison
+	 * @param side
+	 *            the side of the comparison on which to look for move diffs
+	 * @return a diff that moves that {@code match}ed object from one resource to another, or {@code null} if
+	 *         it is not moved between resources
+	 */
+	protected Diff findMoveDiff(Match match, Comparison comparison, DifferenceSource side) {
+		Diff result = null;
+
+		if (match != null) {
+			EObject object = MatchUtil.getMatchedObject(match, side);
+			if (object != null) {
+				for (Diff next : comparison.getDifferences(object)) {
+					if (next instanceof ReferenceChange
+							&& ((ReferenceChange)next).getReference().isContainment()) {
+						result = next;
+						break;
+					}
+				}
+			}
+
+			if (result == null) {
+				// Maybe the object is moved to a resource root?
+				Iterator<ResourceAttachmentChange> iter = Iterators.filter(match.getDifferences().iterator(),
+						ResourceAttachmentChange.class);
+				if (iter.hasNext()) {
+					result = iter.next();
+				}
+			}
+
+			if (result == null && match.eContainer() instanceof Match) {
+				// Look up the tree
+				result = findMoveDiff((Match)match.eContainer(), comparison, side);
+			}
+		}
+
+		return result;
+	}
+
+	/**
+	 * Analyze the matching of resources to re-match any that have different URIs but that by dint of their
+	 * primary UML element having moved are actually a refactoring (rename or move) of a single logical UML
+	 * resource.
+	 * 
+	 * @param comparison
+	 *            the contextual comparison
+	 * @param monitor
+	 *            progress monitor
+	 */
+	protected void rematchRefactoredUMLResources(Comparison comparison, Monitor monitor) {
+		// Look for renamed resources, which are matched by their root UML elements
+		Map<Resource, MatchResource> updates = Maps.newHashMap();
+		PapyrusResourceIndex resourceGroups = index(comparison);
+
+		for (MatchResource mres : comparison.getMatchedResources()) {
+			if (!rematch(comparison, mres, DifferenceSource.LEFT, resourceGroups, updates)) {
+				// Try the other way around
+				rematch(comparison, mres, DifferenceSource.RIGHT, resourceGroups, updates);
+			}
+		}
+
+		if (!updates.isEmpty()) {
+			// Remove incomplete matches
+			for (Iterator<MatchResource> iter = Lists.reverse(comparison.getMatchedResources())
+					.iterator(); iter.hasNext() && !updates.isEmpty();) {
+
+				MatchResource next = iter.next();
+
+				MatchResource update = updates.remove(next.getLeft());
+				if (update == null || update == next) {
+					update = updates.remove(next.getRight());
+					if (update == next) {
+						update = null;
+					}
+				}
+
+				if (update != null) {
+					// MatchResource::locationChanges is no longer used,
+					// so don't worry about updating that
+
+					// Capture the origin from the match we're deleting
+					if (update.getOrigin() == null) {
+						update.setOrigin(next.getOrigin());
+						update.setOriginURI(next.getOriginURI());
+					}
+
+					// Remove the redundant match
+					iter.remove();
+				}
+			}
+		}
+	}
+
+	/**
+	 * Attempt to re-match a UML resource that appears to be unmatched with a UML resource on the other side,
+	 * also unmatched, that contains the same root {@link Element}, on the assumption that such element
+	 * constitutes logical content of the resource.
+	 * 
+	 * @param comparison
+	 *            the contextual comparison
+	 * @param mres
+	 *            a resource to re-match
+	 * @param side
+	 *            the side from which to try to find a new match on the other side
+	 * @param index
+	 *            an index of relationships between resources in the context of the the {@code comparison}
+	 * @param updates
+	 *            collects the incomplete matches of resources that were merged into incomplete matches on the
+	 *            other side, which need to be removed from the {@code comparison} in a subsequent step
+	 *            (because it isn't safe to do so in-line)
+	 * @return {@code true} if a new match was found for the resource from this {@code side}; {@code false},
+	 *         otherwise
+	 */
+	protected boolean rematch(Comparison comparison, MatchResource mres, DifferenceSource side,
+			PapyrusResourceIndex index, Map<Resource, MatchResource> updates) {
+
+		final DifferenceSource opposite = opposite(side);
+		final Resource oneSide = getResource(mres, side);
+		final Resource otherSide = getResource(mres, opposite);
+
+		if (oneSide != null && otherSide == null) {
+			// Don't process a resource match that we've already melded into another
+			if (!updates.containsKey(oneSide) && !oneSide.getContents().isEmpty()) {
+				EObject root = oneSide.getContents().get(0);
+				if (!(root instanceof Element)) {
+					// Only need this for UML resources that reliably contain
+					// only one real element, to handle stereotype applications
+					// that are additional non-UML roots
+					return false;
+				}
+
+				Match rootMatch = comparison.getMatch(root);
+				if (rootMatch != null) {
+					EObject otherRoot = MatchUtil.getMatchedObject(rootMatch, opposite);
+					if (otherRoot == null) {
+						return false;
+					}
+
+					Resource other = ((InternalEObject)otherRoot).eDirectResource();
+					if (other != null) {
+						combine(mres, other, opposite, index, updates);
+						return true;
+					}
+				}
+			}
+		}
+
+		return false;
+	}
+
+	/**
+	 * Combine a resource match with an{@code other} resource.
+	 * 
+	 * @param uml
+	 *            an unmatched UML resource to complete with the {@code other}
+	 * @param other
+	 *            a resource with which to complete the match
+	 * @param otherSide
+	 *            the side on which the {@code other} resource is
+	 * @param index
+	 *            an index of relationships between resources in the context of the the {@code comparison}
+	 * @param updates
+	 *            collects the incomplete matches of resources that were merged into incomplete matches on the
+	 *            other side, which need to be removed from the {@code comparison} in a subsequent step
+	 *            (because it isn't safe to do so in-line)
+	 */
+	protected void combine(MatchResource uml, Resource other, DifferenceSource otherSide,
+			PapyrusResourceIndex index, Map<Resource, MatchResource> updates) {
+
+		// Meld the matches for the UML resource
+		setResource(uml, otherSide, other);
+		setURI(uml, otherSide, other.getURI().toString());
+		updates.put(other, uml);
+
+		// And do the same for other Papyrus resources in the same group
+		DifferenceSource thisSide = opposite(otherSide);
+		Map<String, MatchResource> thisGroup = index.getGroup(uml, thisSide);
+		Map<String, MatchResource> otherGroup = index.getGroup(uml, otherSide);
+
+		for (Map.Entry<String, MatchResource> next : thisGroup.entrySet()) {
+			MatchResource combine = next.getValue();
+
+			if (combine != uml && getResource(combine, otherSide) == null) {
+				MatchResource combineWith = otherGroup.get(next.getKey());
+				if (combineWith != null && getResource(combineWith, thisSide) == null) {
+					Resource combineWithResource = getResource(combineWith, otherSide);
+					setResource(combine, otherSide, combineWithResource);
+					setURI(combine, otherSide, combineWithResource.getURI().toString());
+					updates.put(combineWithResource, combine);
+				}
+			}
+		}
+	}
+}
diff --git a/plugins/compare/bundles/org.eclipse.papyrus.compare.uml2/src/org/eclipse/papyrus/compare/uml2/internal/postprocessor/PapyrusResourceIndex.java b/plugins/compare/bundles/org.eclipse.papyrus.compare.uml2/src/org/eclipse/papyrus/compare/uml2/internal/postprocessor/PapyrusResourceIndex.java
new file mode 100644
index 0000000..053491d
--- /dev/null
+++ b/plugins/compare/bundles/org.eclipse.papyrus.compare.uml2/src/org/eclipse/papyrus/compare/uml2/internal/postprocessor/PapyrusResourceIndex.java
@@ -0,0 +1,355 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     Christian W. Damus - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.compare.uml2.internal.postprocessor;
+
+import com.google.common.base.Objects;
+import com.google.common.collect.Maps;
+
+import java.util.Map;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.compare.CompareFactory;
+import org.eclipse.emf.compare.ComparePackage;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.DifferenceSource;
+import org.eclipse.emf.compare.Match;
+import org.eclipse.emf.compare.MatchResource;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+
+/**
+ * An index of relationships between Papyrus resources on each side of a comparison.
+ *
+ * @author Christian W. Damus
+ */
+public final class PapyrusResourceIndex {
+	/**
+	 * Mapping by side and Papyrusesque extensionless URI of the groups of resources that each together
+	 * comprise a Papyrus model.
+	 */
+	private final Map<SidedURI, Map<String, MatchResource>> groups = Maps.newHashMap();
+
+	/** Cache of matches by resource. */
+	private final Map<Resource, MatchResource> matches = Maps.newHashMap();
+
+	/** Token stored in the match cache for cache misses. */
+	private final MatchResource noMatch = CompareFactory.eINSTANCE.createMatchResource();
+
+	/** The comparison that I index. */
+	private final Comparison comparison;
+
+	/**
+	 * Index the resource matches in the given {@code comparison}.
+	 * 
+	 * @param comparison
+	 *            the comparison to index
+	 */
+	private PapyrusResourceIndex(Comparison comparison) {
+		super();
+
+		this.comparison = comparison;
+
+		for (MatchResource next : comparison.getMatchedResources()) {
+			if (next.getLeftURI() != null) {
+				URI uri = URI.createURI(next.getLeftURI());
+				SidedURI key = SidedURI.left(uri.trimFileExtension());
+				getGroup(key).put(uri.fileExtension(), next);
+			}
+			if (next.getRightURI() != null) {
+				URI uri = URI.createURI(next.getRightURI());
+				SidedURI key = SidedURI.right(uri.trimFileExtension());
+				getGroup(key).put(uri.fileExtension(), next);
+			}
+		}
+	}
+
+	/**
+	 * Get all of the resource matches (including the given {@code match}) that are the resources together
+	 * comprising the Papyrus model containing it.
+	 * 
+	 * @param match
+	 *            a resource match
+	 * @param side
+	 *            the side of the comparison on which the {@code match} is being considered
+	 * @return a mapping of file extension to match for all of the resources of the Papyrus model of which the
+	 *         {@code match} is one
+	 */
+	public Map<String, MatchResource> getGroup(MatchResource match, DifferenceSource side) {
+		URI uri = URI.createURI(getURI(match, side));
+		return getGroup(SidedURI.of(uri.trimFileExtension(), side));
+	}
+
+	/**
+	 * Get the group for the given URI on its side, creating the group if necessary.
+	 * 
+	 * @param key
+	 *            a URI (without extension) on a side of the comparison
+	 * @return its resource match group
+	 */
+	private Map<String, MatchResource> getGroup(SidedURI key) {
+		Map<String, MatchResource> result = groups.get(key);
+		if (result == null) {
+			result = Maps.newHashMap();
+			groups.put(key, result);
+		}
+		return result;
+	}
+
+	/**
+	 * Queries the match for a given {@code resource} in the context of my comparison.
+	 * 
+	 * @param resource
+	 *            a resource in my comparison
+	 * @return its match
+	 */
+	public MatchResource getMatch(Resource resource) {
+		MatchResource result = matches.get(resource);
+
+		if (result == null) {
+			result = noMatch;
+
+			if (resource != null) {
+				for (MatchResource next : comparison.getMatchedResources()) {
+					if (next.getLeft() == resource || next.getRight() == resource
+							|| next.getOrigin() == resource) {
+
+						result = next;
+						break;
+					}
+				}
+			} // else always cache a miss for the null resource
+
+			// Cache the result, whether a miss ('noMatch') or not
+			matches.put(resource, result);
+		}
+
+		return (result == noMatch) ? null : result;
+	}
+
+	/**
+	 * Obtains the match that represents the refactoring of a {@code resource} of which the given matched
+	 * object is a root. This resource match will match resources on either side that have different URIs,
+	 * which is the refactoring.
+	 * 
+	 * @param objectMatch
+	 *            a match of an object that is a UML resource root element, either the root of the entire
+	 *            model or of some sub-unit
+	 * @return the refactoring resource match that was inferred from the different resources in the given
+	 *         object match, or {@code null} if there is no refactoring of the resources containing the object
+	 */
+	public MatchResource getResourceRefactoring(Match objectMatch) {
+		EObject left = objectMatch.getLeft();
+		EObject right = objectMatch.getRight();
+
+		if (left == null || right == null) {
+			// There is no resource match if the object doesn't exist on both sides
+			return null;
+		}
+
+		MatchResource leftRes = getMatch(left.eResource());
+		MatchResource rightRes = getMatch(right.eResource());
+
+		if (leftRes == null || rightRes == null) {
+			// We could not have detected a resource match without both sides
+			return null;
+		}
+
+		if (Objects.equal(leftRes.getLeftURI(), rightRes.getRightURI())) {
+			// Not refactored
+			return null;
+		}
+
+		// It's not a rename/move/etc. resource refactoring if the resources
+		// on the left and right were not matched together
+		return leftRes == rightRes ? leftRes : null;
+	}
+
+	/**
+	 * Obtains the unique (lazily computed) index of Papyrus resources in the context of a {@code comparison}.
+	 * 
+	 * @param comparison
+	 *            a comparison
+	 * @return its resource index
+	 */
+	public static PapyrusResourceIndex index(Comparison comparison) {
+		Attachment attachment = (Attachment)EcoreUtil.getExistingAdapter(comparison, Attachment.class);
+		if (attachment == null) {
+			attachment = new PapyrusResourceIndex(comparison).new Attachment(comparison);
+		}
+		return attachment.getIndex();
+	}
+
+	/**
+	 * Obtains the unique (lazily computed) index of Papyrus resources in the context of the comparison
+	 * containing a {@code match}.
+	 * 
+	 * @param match
+	 *            a match in some comparison
+	 * @return its resource index
+	 */
+	public static PapyrusResourceIndex index(Match match) {
+		return index(match.getComparison());
+	}
+
+	/**
+	 * Compute the side opposite a given {@code side}.
+	 * 
+	 * @param side
+	 *            a side of the comparison
+	 * @return the other side
+	 */
+	protected static DifferenceSource opposite(DifferenceSource side) {
+		return DifferenceSource.get(1 - side.ordinal());
+	}
+
+	/**
+	 * Obtains the resource on the given {@code side} of a {@code match}.
+	 * 
+	 * @param match
+	 *            a resource match
+	 * @param side
+	 *            a side
+	 * @return the resource on that {@code side} of the {@code match}
+	 */
+	protected static Resource getResource(MatchResource match, DifferenceSource side) {
+		switch (side) {
+			case LEFT:
+				return match.getLeft();
+			case RIGHT:
+				return match.getRight();
+			default:
+				throw new IllegalArgumentException("side"); //$NON-NLS-1$
+		}
+	}
+
+	/**
+	 * Obtains the resource URI on the given {@code side} of a {@code match}.
+	 * 
+	 * @param match
+	 *            a resource match
+	 * @param side
+	 *            a side
+	 * @return the URI on that {@code side} of the {@code match}
+	 */
+	protected static String getURI(MatchResource match, DifferenceSource side) {
+		switch (side) {
+			case LEFT:
+				return match.getLeftURI();
+			case RIGHT:
+				return match.getRightURI();
+			default:
+				throw new IllegalArgumentException("side"); //$NON-NLS-1$
+		}
+	}
+
+	/**
+	 * Assigns the {@code resource} on the given {@code side} of a {@code match}.
+	 * 
+	 * @param match
+	 *            a resource match
+	 * @param side
+	 *            a side
+	 * @param resource
+	 *            the resource to assign on that {@code side} of the {@code match}
+	 */
+	protected static void setResource(MatchResource match, DifferenceSource side, Resource resource) {
+		switch (side) {
+			case LEFT:
+				match.setLeft(resource);
+				break;
+			case RIGHT:
+				match.setRight(resource);
+				break;
+			default:
+				throw new IllegalArgumentException("side"); //$NON-NLS-1$
+		}
+	}
+
+	/**
+	 * Assigns the resource {@code URI} on the given {@code side} of a {@code match}.
+	 * 
+	 * @param match
+	 *            a resource match
+	 * @param side
+	 *            a side
+	 * @param URI
+	 *            the URI to assign on that {@code side} of the {@code match}
+	 */
+	protected static void setURI(MatchResource match, DifferenceSource side, String uri) {
+		switch (side) {
+			case LEFT:
+				match.setLeftURI(uri);
+				break;
+			case RIGHT:
+				match.setRightURI(uri);
+				break;
+			default:
+				throw new IllegalArgumentException("side"); //$NON-NLS-1$
+		}
+	}
+
+	//
+	// Nested types
+	//
+
+	/**
+	 * An adapter that attaches the unique instance of the index to a {@link Comparison} for subsequent
+	 * retrieval.
+	 */
+	private final class Attachment extends AdapterImpl {
+		/**
+		 * Initializes me with my target {@code comparison}.
+		 * 
+		 * @param comparison
+		 *            the comparison to which I attach
+		 */
+		Attachment(Comparison comparison) {
+			super();
+
+			comparison.eAdapters().add(this);
+		}
+
+		@Override
+		public boolean isAdapterForType(Object type) {
+			return type == PapyrusResourceIndex.class || type == Attachment.class;
+		}
+
+		/**
+		 * Obtains the index that I attach to the comparison.
+		 * 
+		 * @return my index
+		 */
+		PapyrusResourceIndex getIndex() {
+			return PapyrusResourceIndex.this;
+		}
+
+		@Override
+		public void notifyChanged(Notification msg) {
+			if (msg.isTouch() || msg.getNotifier() != comparison) {
+				return;
+			}
+
+			switch (msg.getFeatureID(Comparison.class)) {
+				case ComparePackage.COMPARISON__MATCHED_RESOURCES:
+					// Purge cache of resource matches
+					matches.clear();
+					break;
+				default:
+					// Pass
+					break;
+			}
+		}
+	}
+}
diff --git a/plugins/compare/bundles/org.eclipse.papyrus.compare.uml2/src/org/eclipse/papyrus/compare/uml2/internal/postprocessor/ResourceRefactoringMerger.java b/plugins/compare/bundles/org.eclipse.papyrus.compare.uml2/src/org/eclipse/papyrus/compare/uml2/internal/postprocessor/ResourceRefactoringMerger.java
new file mode 100644
index 0000000..66afb05
--- /dev/null
+++ b/plugins/compare/bundles/org.eclipse.papyrus.compare.uml2/src/org/eclipse/papyrus/compare/uml2/internal/postprocessor/ResourceRefactoringMerger.java
@@ -0,0 +1,183 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     Christian W. Damus - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.compare.uml2.internal.postprocessor;
+
+import static org.eclipse.emf.compare.utils.MatchUtil.getMatchedObject;
+import static org.eclipse.papyrus.compare.uml2.internal.postprocessor.PapyrusPostProcessor.IS_RESOURCE_REFACTORING_MOVE;
+import static org.eclipse.papyrus.compare.uml2.internal.postprocessor.PapyrusPostProcessor.IS_STEREOTYPE_APPLICATION_RESOURCE_MOVE;
+import static org.eclipse.papyrus.compare.uml2.internal.postprocessor.PapyrusResourceIndex.getResource;
+import static org.eclipse.papyrus.compare.uml2.internal.postprocessor.PapyrusResourceIndex.index;
+import static org.eclipse.papyrus.compare.uml2.internal.postprocessor.PapyrusResourceIndex.opposite;
+
+import java.lang.reflect.Field;
+import java.util.Collection;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceSource;
+import org.eclipse.emf.compare.Match;
+import org.eclipse.emf.compare.MatchResource;
+import org.eclipse.emf.compare.ResourceAttachmentChange;
+import org.eclipse.emf.compare.merge.ResourceAttachmentChangeMerger;
+import org.eclipse.emf.compare.merge.ResourceChangeAdapter;
+import org.eclipse.emf.compare.uml2.internal.postprocessor.util.UMLCompareUtil;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.papyrus.compare.uml2.internal.UMLPapyrusComparePlugin;
+import org.eclipse.uml2.uml.Element;
+
+/**
+ * A specialized merger for the {@link ResourceAttachmentChange}s in resources that are refactored (renamed or
+ * moved) and which, therefore, are not actually logically moving those objects.
+ *
+ * @author Christian W. Damus
+ */
+public class ResourceRefactoringMerger extends ResourceAttachmentChangeMerger {
+
+	/**
+	 * Initializes me.
+	 */
+	public ResourceRefactoringMerger() {
+		super();
+	}
+
+	@Override
+	public boolean isMergerFor(Diff target) {
+		return IS_STEREOTYPE_APPLICATION_RESOURCE_MOVE.apply(target)
+				|| IS_RESOURCE_REFACTORING_MOVE.apply(target);
+	}
+
+	@Override
+	protected Resource findOrCreateTargetResource(Match match, boolean rightToLeft) {
+		DifferenceSource targetSide = rightToLeft ? DifferenceSource.LEFT : DifferenceSource.RIGHT;
+		EObject movedObject = getMatchedObject(match, targetSide);
+
+		if (movedObject instanceof Element) {
+			// This is not the stereotype application case
+			return super.findOrCreateTargetResource(match, rightToLeft);
+
+		} else {
+			// We were moved to another resource. If our base element was, also, then
+			// we should be moved to its resource regardless
+
+			Element baseElement = UMLCompareUtil.getBaseElement(movedObject);
+			if (baseElement != null) {
+				return baseElement.eResource();
+			}
+		}
+
+		return super.findOrCreateTargetResource(match, rightToLeft);
+	}
+
+	@Override
+	protected void move(ResourceAttachmentChange diff, boolean rightToLeft) {
+		Match match = diff.getMatch();
+
+		Resource left = match.getLeft().eResource();
+		Resource right = match.getRight().eResource();
+
+		super.move(diff, rightToLeft);
+
+		if (IS_RESOURCE_REFACTORING_MOVE.apply(diff)) {
+			// We've moved the UML element. Bring along all stereotype applications
+			// and other related content and delete the originating resources
+			PapyrusResourceIndex index = index(match);
+
+			if (rightToLeft) {
+				MatchResource leftMatch = index.getMatch(left);
+				Resource newLeft = demandResource(leftMatch, DifferenceSource.LEFT);
+				newLeft.getContents().addAll(left.getContents());
+				markForDeletion(left);
+
+				for (Map.Entry<String, MatchResource> next : index.getGroup(leftMatch, DifferenceSource.LEFT)
+						.entrySet()) {
+					if (next.getValue() != leftMatch) {
+						left = next.getValue().getLeft();
+						newLeft = demandResource(next.getValue(), DifferenceSource.LEFT);
+						newLeft.getContents().addAll(left.getContents());
+						markForDeletion(left);
+					}
+				}
+			} else {
+				MatchResource rightMatch = index.getMatch(right);
+				Resource newRight = demandResource(rightMatch, DifferenceSource.RIGHT);
+				newRight.getContents().addAll(right.getContents());
+				markForDeletion(right);
+
+				for (Map.Entry<String, MatchResource> next : index
+						.getGroup(rightMatch, DifferenceSource.RIGHT).entrySet()) {
+					if (next.getValue() != rightMatch) {
+						right = next.getValue().getRight();
+						newRight = demandResource(next.getValue(), DifferenceSource.RIGHT);
+						newRight.getContents().addAll(right.getContents());
+						markForDeletion(right);
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * Add a {@code resource} the collection of resources to be deleted when the merge result is saved.
+	 *
+	 * @param resource
+	 *            a resource to be deleted on save of the merge
+	 */
+	protected void markForDeletion(Resource resource) {
+		ResourceChangeAdapter rca = (ResourceChangeAdapter)EcoreUtil.getExistingAdapter(resource,
+				ResourceChangeAdapter.class);
+		if (rca != null) {
+			try {
+				Field resourcesToDelete = rca.getClass().getDeclaredField("resourcesToDelete"); //$NON-NLS-1$
+				resourcesToDelete.setAccessible(true);
+
+				@SuppressWarnings("unchecked")
+				Collection<? super Resource> resourcesToDeleteValue = (Collection<? super Resource>)resourcesToDelete
+						.get(rca);
+				resourcesToDeleteValue.add(resource);
+			} catch (Exception e) {
+				UMLPapyrusComparePlugin.getDefault().getLog()
+						.log(new Status(IStatus.ERROR, UMLPapyrusComparePlugin.PLUGIN_ID,
+								"Failed to mark resource for deletion: " + resource.getURI(), //$NON-NLS-1$
+								e));
+			}
+		}
+	}
+
+	/**
+	 * Obtains the new (refactored) resource on the given {@code side} of the comparison, based on the URI of
+	 * the resource opposite to it in the {@code match}. The resulting resource is created if it does not yet
+	 * exist in the resource set on this {@code side}.
+	 * 
+	 * @param match
+	 *            a resource match
+	 * @param side
+	 *            the side of the comparison in which to get the refactored resource
+	 * @return the refactored resource
+	 */
+	protected Resource demandResource(MatchResource match, DifferenceSource side) {
+		ResourceSet rset = getResource(match, side).getResourceSet();
+		URI uri = getResource(match, opposite(side)).getURI();
+
+		Resource result = rset.getResource(uri, false);
+		if (result == null) {
+			result = rset.createResource(uri);
+		}
+
+		return result;
+	}
+}
diff --git a/plugins/compare/bundles/org.eclipse.papyrus.compare.uml2/src/org/eclipse/papyrus/compare/uml2/internal/postprocessor/SidedURI.java b/plugins/compare/bundles/org.eclipse.papyrus.compare.uml2/src/org/eclipse/papyrus/compare/uml2/internal/postprocessor/SidedURI.java
new file mode 100644
index 0000000..293a68b
--- /dev/null
+++ b/plugins/compare/bundles/org.eclipse.papyrus.compare.uml2/src/org/eclipse/papyrus/compare/uml2/internal/postprocessor/SidedURI.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     Christian W. Damus - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.compare.uml2.internal.postprocessor;
+
+import com.google.common.base.Preconditions;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.compare.DifferenceSource;
+
+/**
+ * A resource {@link URI} on some {@linkplain DifferenceSource side} of a comparison.
+ *
+ * @author Christian W. Damus
+ */
+final class SidedURI {
+
+	private final URI uri;
+
+	private final DifferenceSource side;
+
+	/**
+	 * Initializes me.
+	 */
+	private SidedURI(URI uri, DifferenceSource side) {
+		super();
+
+		this.uri = Preconditions.checkNotNull(uri);
+		this.side = Preconditions.checkNotNull(side);
+	}
+
+	public URI uri() {
+		return uri;
+	}
+
+	public DifferenceSource side() {
+		return side;
+	}
+
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + ((side == null) ? 0 : side.hashCode());
+		result = prime * result + ((uri == null) ? 0 : uri.hashCode());
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj) {
+			return true;
+		}
+		if (obj == null) {
+			return false;
+		}
+		if (getClass() != obj.getClass()) {
+			return false;
+		}
+		SidedURI other = (SidedURI)obj;
+		if (side != other.side) {
+			return false;
+		}
+		if (uri == null) {
+			if (other.uri != null) {
+				return false;
+			}
+		} else if (!uri.equals(other.uri)) {
+			return false;
+		}
+		return true;
+	}
+
+	public static SidedURI left(URI uri) {
+		return new SidedURI(uri, DifferenceSource.LEFT);
+	}
+
+	public static SidedURI right(URI uri) {
+		return new SidedURI(uri, DifferenceSource.RIGHT);
+	}
+
+	public static SidedURI of(URI uri, DifferenceSource side) {
+		return new SidedURI(uri, side);
+	}
+}
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/src/org/eclipse/papyrus/compare/diagram/tests/egit/AbstractGitMergeTestCase.java b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/src/org/eclipse/papyrus/compare/diagram/tests/egit/AbstractGitMergeTestCase.java
index 378963b..65d1257 100644
--- a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/src/org/eclipse/papyrus/compare/diagram/tests/egit/AbstractGitMergeTestCase.java
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/src/org/eclipse/papyrus/compare/diagram/tests/egit/AbstractGitMergeTestCase.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (C) 2015 EclipseSource Munich Gmbh and Others.
+ * Copyright (C) 2015, 2018 EclipseSource Munich Gmbh and Others.
  *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -8,12 +8,14 @@
  * 
  * Contributors:
  *     Philip Langer - initial API and implementation
+ *     Christian W. Damus - bug 529253
  *******************************************************************************/
 package org.eclipse.papyrus.compare.diagram.tests.egit;
 
 import static com.google.common.base.Predicates.and;
 import static com.google.common.collect.Iterables.filter;
 import static com.google.common.collect.Iterables.transform;
+import static org.hamcrest.Matchers.hasItem;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -29,6 +31,7 @@
 import org.eclipse.core.resources.mapping.IModelProviderDescriptor;
 import org.eclipse.core.resources.mapping.ModelProvider;
 import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
 import org.eclipse.core.runtime.preferences.InstanceScope;
@@ -40,6 +43,7 @@
 import org.eclipse.emf.compare.ide.ui.internal.logical.resolver.CrossReferenceResolutionScope;
 import org.eclipse.emf.compare.ide.ui.internal.preferences.EMFCompareUIPreferences;
 import org.eclipse.emf.compare.ide.ui.tests.workspace.TestProject;
+import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.resource.Resource;
 import org.eclipse.emf.ecore.resource.ResourceSet;
 import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
@@ -49,6 +53,13 @@
 import org.eclipse.jgit.util.SystemReader;
 import org.eclipse.papyrus.compare.diagram.tests.egit.fixture.GitTestRepository;
 import org.eclipse.papyrus.compare.diagram.tests.egit.fixture.MockSystemReader;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Stereotype;
+import org.hamcrest.Description;
+import org.hamcrest.FeatureMatcher;
+import org.hamcrest.Matcher;
+import org.hamcrest.TypeSafeDiagnosingMatcher;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -57,6 +68,7 @@
 import org.osgi.framework.Bundle;
 
 import com.google.common.base.Function;
+import com.google.common.base.Objects;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Predicate;
 import com.google.common.collect.ImmutableList;
@@ -73,7 +85,7 @@
  * 
  * @author Philip Langer <planger@eclipsesource.com>
  */
-@SuppressWarnings("restriction")
+@SuppressWarnings({"restriction", "nls" })
 public abstract class AbstractGitMergeTestCase {
 
 	protected static final String DEFAULT_PROJECT = "Project1";
@@ -87,6 +99,7 @@
 	protected static final String BRANCH_RIGHT = Constants.R_HEADS + "branch_right";
 
 	private static final Predicate<File> IS_EXISTING_FILE = new Predicate<File>() {
+		@Override
 		public boolean apply(File input) {
 			return input != null && input.exists() && input.isFile();
 		}
@@ -336,16 +349,16 @@
 		final File workingDirectory = repository.getRepository().getWorkTree();
 		final Iterable<File> filesOfInterest = filter(getAllContainedFiles(workingDirectory),
 				and(IS_EXISTING_FILE, getFileOfInterestFilter()));
-		final Iterable<URI> urisOfInterest = transform(filesOfInterest,
-				toUri(workingDirectory.getAbsolutePath()));
+		final Iterable<URI> urisOfInterest = transform(filesOfInterest, toUri());
 		for (URI uriOfInterest : urisOfInterest) {
 			final Resource resource = resourceSet.getResource(uriOfInterest, true);
 			validateResult(resource);
 		}
 	}
 
-	private Function<File, URI> toUri(String string) {
+	private Function<File, URI> toUri() {
 		return new Function<File, URI>() {
+			@Override
 			public URI apply(File input) {
 				return URI.createPlatformResourceURI(repository.getRepoRelativePath(input), true);
 			}
@@ -354,6 +367,7 @@
 
 	private Predicate<File> getFileOfInterestFilter() {
 		return new Predicate<File>() {
+			@Override
 			public boolean apply(File input) {
 				return !input.getAbsolutePath().startsWith(gitDir.getAbsolutePath()) && shouldValidate(input);
 			}
@@ -375,6 +389,164 @@
 	}
 
 	/**
+	 * Obtain a matcher for the Git-relative paths of files that are conflicted.
+	 * 
+	 * @return a matcher of Git-relative paths of files that are conflicted
+	 */
+	protected Matcher<String> isConflicted() {
+		return new TypeSafeDiagnosingMatcher<String>() {
+			@Override
+			public void describeTo(Description description) {
+				description.appendText("is conflicted");
+			}
+
+			@Override
+			protected boolean matchesSafely(String item, Description failure) {
+				boolean result = false;
+
+				try {
+					result = repository.status().getConflicting()
+							.contains(new Path(DEFAULT_PROJECT).append(item).toString());
+
+					if (!result) {
+						failure.appendText(item).appendText(" is not conflicted");
+					}
+				} catch (Exception e) {
+					e.printStackTrace();
+					failure.appendText("could not determine conflict status: " + e.getMessage());
+				}
+
+				return result;
+			}
+		};
+	}
+
+	/**
+	 * Obtain a matcher for the Git-relative paths of files that exist.
+	 * 
+	 * @return a matcher of Git-relative paths of files that exist
+	 */
+	protected Matcher<String> fileExists() {
+		return new TypeSafeDiagnosingMatcher<String>() {
+			@Override
+			public void describeTo(Description description) {
+				description.appendText("file exists");
+			}
+
+			@Override
+			protected boolean matchesSafely(String item, Description failure) {
+				boolean result = fileExists(item);
+
+				if (!result) {
+					failure.appendText(item).appendText(" does not exist");
+				}
+
+				return result;
+			}
+		};
+	}
+
+	/**
+	 * Obtain a matcher for resources that are loaded.
+	 * 
+	 * @return a matcher of resources that are loaded
+	 */
+	protected <T extends Resource> Matcher<T> isLoaded() {
+		return new TypeSafeDiagnosingMatcher<T>() {
+			@Override
+			public void describeTo(Description description) {
+				description.appendText("resource loaded");
+			}
+
+			@Override
+			protected boolean matchesSafely(T item, Description failure) {
+				boolean result = item.isLoaded();
+
+				if (!result) {
+					failure.appendText(item.getURI().lastSegment()).appendText(" is not loaded");
+				}
+
+				return result;
+			}
+		};
+	}
+
+	/**
+	 * Obtain a matcher for UML elements that have the {@code name}d stereotype applied.
+	 * 
+	 * @param name
+	 *            the simple name of a stereotype (not a qualified name)
+	 * @return the matcher
+	 */
+	protected <T extends Element> Matcher<T> stereotypedAs(String name) {
+		Matcher<Iterable<? super Stereotype>> named = hasItem(named(name));
+
+		return new FeatureMatcher<T, Iterable<Stereotype>>(named, String.format("stereotyped as «%s»", name),
+				"appliedStereotypes") {
+
+			@Override
+			protected Iterable<Stereotype> featureValueOf(T actual) {
+				return actual.getAppliedStereotypes();
+			}
+		};
+	}
+
+	/**
+	 * Obtain a matcher for UML elements that have the given {@code name}.
+	 * 
+	 * @param name
+	 *            the simple name of an element (not a qualified name)
+	 * @return the matcher
+	 */
+	protected <T extends NamedElement> Matcher<T> named(final String name) {
+		return new TypeSafeDiagnosingMatcher<T>() {
+			@Override
+			public void describeTo(Description description) {
+				description.appendText("named \"").appendText(name).appendText("\"");
+			}
+
+			@Override
+			protected boolean matchesSafely(T item, Description failure) {
+				boolean result = Objects.equal(item.getName(), name);
+
+				if (!result) {
+					failure.appendValue(item).appendText(" is not named \"").appendText(name)
+							.appendText("\"");
+				}
+
+				return result;
+			}
+		};
+	}
+
+	/**
+	 * Obtain a matcher for objects that are stored in the given {@code resource}.
+	 * 
+	 * @param resource
+	 *            the resource containing the elements to match
+	 * @return the matcher
+	 */
+	protected <T extends EObject> Matcher<T> storedIn(final Resource resource) {
+		return new TypeSafeDiagnosingMatcher<T>() {
+			@Override
+			public void describeTo(Description description) {
+				description.appendText("stored in ").appendValue(resource.getURI());
+			}
+
+			@Override
+			protected boolean matchesSafely(T item, Description failure) {
+				boolean result = item.eResource() == resource;
+
+				if (!result) {
+					failure.appendValue(item).appendText(" is not in ").appendValue(resource.getURI());
+				}
+
+				return result;
+			}
+		};
+	}
+
+	/**
 	 * Returns the resolution scope to be used for this test case.
 	 * <p>
 	 * The default value is {@link CrossReferenceResolutionScope#WORKSPACE}. Subclasses may override this
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/src/org/eclipse/papyrus/compare/diagram/tests/egit/ResourceAttachmentChangeRename1GitMergeTest.java b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/src/org/eclipse/papyrus/compare/diagram/tests/egit/ResourceAttachmentChangeRename1GitMergeTest.java
new file mode 100644
index 0000000..a63e873
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/src/org/eclipse/papyrus/compare/diagram/tests/egit/ResourceAttachmentChangeRename1GitMergeTest.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (C) 2015, 2018 EclipseSource Munich Gmbh and Others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     Philip Langer - initial API and implementation
+ *     Christian W. Damus - bug 529217
+ *******************************************************************************/
+package org.eclipse.papyrus.compare.diagram.tests.egit;
+
+import static java.util.Arrays.asList;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.any;
+import static org.hamcrest.Matchers.everyItem;
+import static org.hamcrest.Matchers.hasItem;
+import static org.hamcrest.Matchers.notNullValue;
+
+import java.io.File;
+
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * Tests the renaming of a UML Package sub-model that has internal changes on another branch. This scenario
+ * contains two diagrams, one for the root of the model and another for the extracted package.
+ * <dl>
+ * <dt>Origin:</dt>
+ * <dd>A class diagram in the root model showing a package containing a class. This package is a sub-model
+ * unit that has its own diagram showing the content of the package, being the class.</dd>
+ * <dt>Left:</dt>
+ * <dd>The one class in the sub-model unit is renamed and another class added in the package. The layout of
+ * both classes in the sub-model unit's diagram is changed.</dd>
+ * <dt>Right:</dt>
+ * <dd>The sub-model unit package is renamed, along with all of the sub-unit resources to match the new
+ * package name.</dd>
+ * </dl>
+ *
+ * @author Philip Langer <planger@eclipsesource.com>
+ */
+@SuppressWarnings("nls")
+public class ResourceAttachmentChangeRename1GitMergeTest extends AbstractGitMergeTestCase {
+
+	private static final String TEST_SCENARIO_PATH = "testmodels/resourceattachmentchange/rename1/";
+
+	private static final String SUBUNIT_UML = "Subunit1.uml";
+
+	private static final String MODEL_UML = "model.uml";
+
+	@Override
+	protected String getTestScenarioPath() {
+		return TEST_SCENARIO_PATH;
+	}
+
+	@Override
+	protected boolean shouldValidate(File file) {
+		return file.getName().equals(MODEL_UML) || file.getName().equals(SUBUNIT_UML);
+	}
+
+	@Override
+	protected void validateResult() throws Exception {
+		assertThat("conflicts remain", noConflict());
+
+		assertThat(asList("model.di", "model.notation", MODEL_UML, //
+				"Subunit1.di", "Subunit1.notation", SUBUNIT_UML), //
+				everyItem(fileExists()));
+
+		assertThat(asList("Package1.di", "Package1.notation", "Package1.uml"), //
+				everyItem(not(fileExists())));
+	}
+
+	@Override
+	protected void validateResult(Resource resource) throws Exception {
+		switch (resource.getURI().lastSegment()) {
+			case MODEL_UML:
+				checkModelResource(resource);
+				break;
+			case SUBUNIT_UML:
+				checkSubunitResource(resource);
+				break;
+		}
+	}
+
+	private void checkModelResource(Resource resource) {
+		assertThat(resource.getContents(), hasItem(any(Model.class)));
+		final Model model = (Model)EcoreUtil.getObjectByType(resource.getContents(),
+				UMLPackage.Literals.MODEL);
+
+		assertThat(model.getNestedPackages(), hasItem(any(Package.class)));
+		final Package package_ = model.getNestedPackages().get(0);
+
+		checkLeftChanges(package_);
+		checkRightChanges(package_);
+	}
+
+	private void checkLeftChanges(Package package_) {
+		assertThat(package_.getOwnedType("Foo"), notNullValue());
+		assertThat(package_.getOwnedType("Bar"), notNullValue());
+	}
+
+	private void checkRightChanges(Package package_) {
+		assertThat(package_.getName(), is("Subunit1"));
+	}
+
+	private void checkSubunitResource(Resource resource) {
+		assertThat(resource.getContents(), hasItem(any(Package.class)));
+		final Package package_ = (Package)EcoreUtil.getObjectByType(resource.getContents(),
+				UMLPackage.Literals.PACKAGE);
+
+		checkLeftChanges(package_);
+		checkRightChanges(package_);
+	}
+}
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/src/org/eclipse/papyrus/compare/diagram/tests/egit/ResourceAttachmentChangeRename2GitMergeTest.java b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/src/org/eclipse/papyrus/compare/diagram/tests/egit/ResourceAttachmentChangeRename2GitMergeTest.java
new file mode 100644
index 0000000..95d71f3
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/src/org/eclipse/papyrus/compare/diagram/tests/egit/ResourceAttachmentChangeRename2GitMergeTest.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (C) 2015, 2018 EclipseSource Munich Gmbh and Others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     Philip Langer - initial API and implementation
+ *     Christian W. Damus - bug 529217
+ *******************************************************************************/
+package org.eclipse.papyrus.compare.diagram.tests.egit;
+
+import static java.util.Arrays.asList;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.everyItem;
+import static org.hamcrest.Matchers.not;
+
+import java.io.File;
+
+import org.eclipse.emf.ecore.resource.Resource;
+
+/**
+ * Tests the renaming of a UML Package sub-model that is resobed on another branch. This scenario contains two
+ * diagrams, one for the root of the model and another for the extracted package.
+ * <dl>
+ * <dt>Origin:</dt>
+ * <dd>A class diagram in the root model showing a package containing a class. This package is a sub-model
+ * unit that has its own diagram showing the content of the package, being the class.</dd>
+ * <dt>Left:</dt>
+ * <dd>The sub-model unit is resorbed.</dd>
+ * <dt>Right:</dt>
+ * <dd>The sub-model unit package is renamed, along with all of the sub-unit resources to match the new
+ * package name.</dd>
+ * </dl>
+ *
+ * @author Philip Langer <planger@eclipsesource.com>
+ */
+@SuppressWarnings("nls")
+
+public class ResourceAttachmentChangeRename2GitMergeTest extends AbstractGitMergeTestCase {
+
+	private static final String TEST_SCENARIO_PATH = "testmodels/resourceattachmentchange/rename2/";
+
+	private static final String SUBUNIT_UML = "Subunit1.uml";
+
+	private static final String MODEL_UML = "model.uml";
+
+	@Override
+	protected String getTestScenarioPath() {
+		return TEST_SCENARIO_PATH;
+	}
+
+	@Override
+	protected boolean shouldValidate(File file) {
+		return file.getName().equals(MODEL_UML) || file.getName().equals(SUBUNIT_UML);
+	}
+
+	@Override
+	protected void validateResult() throws Exception {
+		assertThat("no conflicts", isConflicting());
+
+		assertThat(asList("model.di", "model.notation", MODEL_UML), //
+				everyItem(fileExists()));
+
+		assertThat(asList("model.notation", MODEL_UML, //
+				"Subunit1.notation", "Subunit1.di", SUBUNIT_UML), //
+				everyItem(isConflicted()));
+		assertThat("model.di", not(isConflicted()));
+	}
+
+	@Override
+	protected void validateResult(Resource resource) throws Exception {
+		// Nothing further to check (every scenario conflicts)
+	}
+}
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/src/org/eclipse/papyrus/compare/diagram/tests/egit/ResourceAttachmentChangeRename3GitMergeTest.java b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/src/org/eclipse/papyrus/compare/diagram/tests/egit/ResourceAttachmentChangeRename3GitMergeTest.java
new file mode 100644
index 0000000..e62028f
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/src/org/eclipse/papyrus/compare/diagram/tests/egit/ResourceAttachmentChangeRename3GitMergeTest.java
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * Copyright (C) 2015, 2018 EclipseSource Munich Gmbh and Others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     Philip Langer - initial API and implementation
+ *     Christian W. Damus - bugs 529217, 529253
+ *******************************************************************************/
+package org.eclipse.papyrus.compare.diagram.tests.egit;
+
+import static java.util.Arrays.asList;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.any;
+import static org.hamcrest.Matchers.everyItem;
+import static org.hamcrest.Matchers.hasItem;
+
+import java.io.File;
+
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * Tests the renaming of a UML Package sub-model that has stereotyped elements moved into it on another
+ * branch. This scenario contains two diagrams, one for the root of the model and another for the extracted
+ * package.
+ * <dl>
+ * <dt>Origin:</dt>
+ * <dd>A class diagram in the root model showing a package containing a class, alongside two stereotyped
+ * elements. This package is a sub-model unit that has its own diagram showing the content of the package,
+ * being the class.</dd>
+ * <dt>Left:</dt>
+ * <dd>The two stereotype elements are moved into the package. The layout of both diagrams is changed: in the
+ * root package to move the two shapes into the nested package shape, and in the sub-unit package's diagram to
+ * add shapes for the two elements.</dd>
+ * <dt>Right:</dt>
+ * <dd>The sub-model unit package is renamed, along with all of the sub-unit resources to match the new
+ * package name.</dd>
+ * </dl>
+ *
+ * @author Philip Langer <planger@eclipsesource.com>
+ */
+@SuppressWarnings("nls")
+public class ResourceAttachmentChangeRename3GitMergeTest extends AbstractGitMergeTestCase {
+
+	private static final String TEST_SCENARIO_PATH = "testmodels/resourceattachmentchange/rename3/";
+
+	private static final String SUBUNIT_UML = "Subunit1.uml";
+
+	private static final String MODEL_UML = "model.uml";
+
+	@Override
+	protected String getTestScenarioPath() {
+		return TEST_SCENARIO_PATH;
+	}
+
+	@Override
+	protected boolean shouldValidate(File file) {
+		return file.getName().equals(MODEL_UML) || file.getName().equals(SUBUNIT_UML);
+	}
+
+	@Override
+	protected void validateResult() throws Exception {
+		assertThat("conflicts remain", noConflict());
+
+		assertThat(asList("model.di", "model.notation", MODEL_UML, //
+				"Subunit1.di", "Subunit1.notation", SUBUNIT_UML), //
+				everyItem(fileExists()));
+
+		assertThat(asList("Package1.di", "Package1.notation", "Package1.uml"), //
+				everyItem(not(fileExists())));
+	}
+
+	@Override
+	protected void validateResult(Resource resource) throws Exception {
+		switch (resource.getURI().lastSegment()) {
+			case MODEL_UML:
+				checkModelResource(resource);
+				break;
+			case SUBUNIT_UML:
+				checkSubunitResource(resource);
+				break;
+		}
+	}
+
+	private void checkModelResource(Resource resource) {
+		assertThat(resource.getContents(), hasItem(any(Model.class)));
+		final Model model = (Model)EcoreUtil.getObjectByType(resource.getContents(),
+				UMLPackage.Literals.MODEL);
+
+		assertThat(model.getNestedPackages(), hasItem(any(Package.class)));
+		final Package package_ = model.getNestedPackages().get(0);
+
+		checkLeftChanges(package_);
+		checkRightChanges(package_);
+	}
+
+	private void checkLeftChanges(Package package_) {
+		Type strings = package_.getOwnedType("Strings");
+		assertThat(strings, stereotypedAs("Utility"));
+		assertThat(strings.getStereotypeApplications(), everyItem(storedIn(strings.eResource())));
+		Package jface = package_.getNestedPackage("jface");
+		assertThat(jface, stereotypedAs("Framework"));
+		assertThat(jface.getStereotypeApplications(), everyItem(storedIn(jface.eResource())));
+	}
+
+	private void checkRightChanges(Package package_) {
+		assertThat(package_.getName(), is("Subunit1"));
+	}
+
+	private void checkSubunitResource(Resource resource) {
+		assertThat(resource.getContents(), hasItem(any(Package.class)));
+		final Package package_ = (Package)EcoreUtil.getObjectByType(resource.getContents(),
+				UMLPackage.Literals.PACKAGE);
+
+		checkLeftChanges(package_);
+		checkRightChanges(package_);
+	}
+}
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/src/org/eclipse/papyrus/compare/diagram/tests/suite/PapyrusGitTests.java b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/src/org/eclipse/papyrus/compare/diagram/tests/suite/PapyrusGitTests.java
index 5f06496..58f0c89 100644
--- a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/src/org/eclipse/papyrus/compare/diagram/tests/suite/PapyrusGitTests.java
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/src/org/eclipse/papyrus/compare/diagram/tests/suite/PapyrusGitTests.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2016, 2017 Obeo and others.
+ * Copyright (c) 2016, 2018 Obeo and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -9,7 +9,7 @@
  *     Obeo - initial API and implementation
  *     Philip Langer - added further tests
  *     Alexandra Buzila - additional tests
- *     Christian W. Damus - bug 526932
+ *     Christian W. Damus - bugs 526932, 529217, 529253
  *******************************************************************************/
 package org.eclipse.papyrus.compare.diagram.tests.suite;
 
@@ -25,6 +25,9 @@
 import org.eclipse.papyrus.compare.diagram.tests.egit.ResourceAttachmentChangeAdd2GitMergeTest;
 import org.eclipse.papyrus.compare.diagram.tests.egit.ResourceAttachmentChangeDelete1GitMergeTest;
 import org.eclipse.papyrus.compare.diagram.tests.egit.ResourceAttachmentChangeDelete2GitMergeTest;
+import org.eclipse.papyrus.compare.diagram.tests.egit.ResourceAttachmentChangeRename1GitMergeTest;
+import org.eclipse.papyrus.compare.diagram.tests.egit.ResourceAttachmentChangeRename2GitMergeTest;
+import org.eclipse.papyrus.compare.diagram.tests.egit.ResourceAttachmentChangeRename3GitMergeTest;
 import org.eclipse.papyrus.compare.diagram.tests.egit.StereotypeApplicationsInSubunitsTest;
 import org.eclipse.papyrus.compare.diagram.tests.egit.StereotypeConflictTest;
 import org.eclipse.papyrus.compare.diagram.tests.egit.mergeresolution.MergeResolutionManagerTest;
@@ -50,7 +53,11 @@
 		ResourceAttachmentChangeMoveNoConflictTests.class, ResourceAttachmentChangeMoveOrderTests.class,
 		StereotypeConflictTest.class, IgnoreDiFileChangesInGitMergeTest.class,
 		MoveOfDiagramConflictDetectionTest.class, AdditiveMergeDiagramTests.class,
-		MergeResolutionManagerTest.class, StereotypeApplicationsInSubunitsTest.class })
+		MergeResolutionManagerTest.class, StereotypeApplicationsInSubunitsTest.class, //
+		ResourceAttachmentChangeRename1GitMergeTest.class, //
+		ResourceAttachmentChangeRename2GitMergeTest.class, //
+		ResourceAttachmentChangeRename3GitMergeTest.class, //
+})
 public class PapyrusGitTests {
 
 	@BeforeClass
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/left/Package1.di b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/left/Package1.di
new file mode 100644
index 0000000..bf9abab
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/left/Package1.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/left/Package1.notation b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/left/Package1.notation
new file mode 100644
index 0000000..b61c3f7
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/left/Package1.notation
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/gmfdiag/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_gqBjYGIWEeWaI82ZiBQcnA" type="PapyrusUMLClassDiagram" name="ClassDiagram2" measurementUnit="Pixel">
+  <children xmi:type="notation:Shape" xmi:id="_hg79QGIWEeWaI82ZiBQcnA" type="Class_Shape">
+    <children xmi:type="notation:DecorationNode" xmi:id="_hg9ycGIWEeWaI82ZiBQcnA" type="Class_NameLabel"/>
+    <children xmi:type="notation:DecorationNode" xmi:id="_hg9ycWIWEeWaI82ZiBQcnA" type="Class_FloatingNameLabel">
+      <layoutConstraint xmi:type="notation:Location" xmi:id="_hg9ycmIWEeWaI82ZiBQcnA" y="5"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_hg9yc2IWEeWaI82ZiBQcnA" type="Class_AttributeCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_hg9ydGIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_hg9ydWIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_hg9ydmIWEeWaI82ZiBQcnA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg9yd2IWEeWaI82ZiBQcnA"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_hg-ZgGIWEeWaI82ZiBQcnA" type="Class_OperationCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_hg-ZgWIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_hg-ZgmIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_hg-Zg2IWEeWaI82ZiBQcnA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg-ZhGIWEeWaI82ZiBQcnA"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_hg-ZhWIWEeWaI82ZiBQcnA" type="Class_NestedClassifierCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_hg-ZhmIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_hg-Zh2IWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_hg-ZiGIWEeWaI82ZiBQcnA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg-ZiWIWEeWaI82ZiBQcnA"/>
+    </children>
+    <element xmi:type="uml:Class" href="Package1.uml#_Tvs-0GISEeWuYNIEaw6oIA"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg79QWIWEeWaI82ZiBQcnA" x="100" y="100"/>
+  </children>
+  <children xmi:type="notation:Shape" xmi:id="_bTQ78OqBEeeGNpM5WA6vzA" type="Class_Shape">
+    <children xmi:type="notation:DecorationNode" xmi:id="_bTSxIOqBEeeGNpM5WA6vzA" type="Class_NameLabel"/>
+    <children xmi:type="notation:DecorationNode" xmi:id="_bTTYMOqBEeeGNpM5WA6vzA" type="Class_FloatingNameLabel">
+      <layoutConstraint xmi:type="notation:Location" xmi:id="_bTTYMeqBEeeGNpM5WA6vzA" y="15"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_bTTYMuqBEeeGNpM5WA6vzA" type="Class_AttributeCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_bTTYM-qBEeeGNpM5WA6vzA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_bTTYNOqBEeeGNpM5WA6vzA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_bTTYNeqBEeeGNpM5WA6vzA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_bTTYNuqBEeeGNpM5WA6vzA"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_bTT_QOqBEeeGNpM5WA6vzA" type="Class_OperationCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_bTT_QeqBEeeGNpM5WA6vzA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_bTT_QuqBEeeGNpM5WA6vzA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_bTT_Q-qBEeeGNpM5WA6vzA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_bTT_ROqBEeeGNpM5WA6vzA"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_bTT_ReqBEeeGNpM5WA6vzA" type="Class_NestedClassifierCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_bTT_RuqBEeeGNpM5WA6vzA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_bTT_R-qBEeeGNpM5WA6vzA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_bTT_SOqBEeeGNpM5WA6vzA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_bTT_SeqBEeeGNpM5WA6vzA"/>
+    </children>
+    <element xmi:type="uml:Class" href="Package1.uml#_bTIZEOqBEeeGNpM5WA6vzA"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_bTQ78eqBEeeGNpM5WA6vzA" x="280" y="100"/>
+  </children>
+  <styles xmi:type="notation:StringValueStyle" xmi:id="_gqBjYWIWEeWaI82ZiBQcnA" name="diagram_compatibility_version" stringValue="1.3.0"/>
+  <styles xmi:type="notation:DiagramStyle" xmi:id="_gqBjYmIWEeWaI82ZiBQcnA"/>
+  <styles xmi:type="style:PapyrusDiagramStyle" xmi:id="_aOoPIOqBEeeGNpM5WA6vzA" diagramKindId="org.eclipse.papyrus.uml.diagram.class">
+    <owner xmi:type="uml:Package" href="Package1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+  </styles>
+  <element xmi:type="uml:Package" href="Package1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+</notation:Diagram>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/left/Package1.uml b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/left/Package1.uml
new file mode 100644
index 0000000..35c382c
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/left/Package1.uml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Package xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_3BK90GIREeWuYNIEaw6oIA" name="Package1">
+  <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_6hckUOqDEeeGNpM5WA6vzA" source="http://www.eclipse.org/papyrus/2016/resource/shard">
+    <references xmi:type="uml:Model" href="model.uml#_0lgMoGIREeWuYNIEaw6oIA"/>
+  </eAnnotations>
+  <packagedElement xmi:type="uml:Class" xmi:id="_Tvs-0GISEeWuYNIEaw6oIA" name="Foo"/>
+  <packagedElement xmi:type="uml:Class" xmi:id="_bTIZEOqBEeeGNpM5WA6vzA" name="Bar"/>
+</uml:Package>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/left/model.di b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/left/model.di
new file mode 100644
index 0000000..bf9abab
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/left/model.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/left/model.notation b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/left/model.notation
new file mode 100644
index 0000000..bbbe686
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/left/model.notation
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/gmfdiag/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_0p_EAGIREeWuYNIEaw6oIA" type="PapyrusUMLClassDiagram" name="Class Diagram" measurementUnit="Pixel">
+  <children xmi:type="notation:Shape" xmi:id="_3BSSkGIREeWuYNIEaw6oIA" type="Package_Shape">
+    <children xmi:type="notation:DecorationNode" xmi:id="_3BUHwGIREeWuYNIEaw6oIA" type="Package_NameLabel"/>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_3BUHwWIREeWuYNIEaw6oIA" type="Package_PackagedElementCompartment">
+      <children xmi:type="notation:Shape" xmi:id="_Tv06oGISEeWuYNIEaw6oIA" type="Class_Shape_CN">
+        <children xmi:type="notation:DecorationNode" xmi:id="_Tv06omISEeWuYNIEaw6oIA" type="Class_NameLabel_CN"/>
+        <children xmi:type="notation:DecorationNode" xmi:id="_Tv06o2ISEeWuYNIEaw6oIA" type="Class_FloatingNameLabel_CN">
+          <layoutConstraint xmi:type="notation:Location" xmi:id="_Tv06pGISEeWuYNIEaw6oIA" y="5"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1hsGISEeWuYNIEaw6oIA" type="Class_AttributeCompartment_CN">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1hsWISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1hsmISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1hs2ISEeWuYNIEaw6oIA"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1htGISEeWuYNIEaw6oIA"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1htWISEeWuYNIEaw6oIA" type="Class_OperationCompartment_CN">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1htmISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1ht2ISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1huGISEeWuYNIEaw6oIA"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1huWISEeWuYNIEaw6oIA"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1humISEeWuYNIEaw6oIA" type="Class_NestedClassifierCompartment_CN">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1hu2ISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1hvGISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1hvWISEeWuYNIEaw6oIA"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1hvmISEeWuYNIEaw6oIA"/>
+        </children>
+        <element xmi:type="uml:Class" href="Package1.uml#_Tvs-0GISEeWuYNIEaw6oIA"/>
+        <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv06oWISEeWuYNIEaw6oIA" x="131" y="36"/>
+      </children>
+      <styles xmi:type="notation:TitleStyle" xmi:id="_3BUHwmIREeWuYNIEaw6oIA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3BUHw2IREeWuYNIEaw6oIA"/>
+    </children>
+    <element xmi:type="uml:Package" href="Package1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3BSSkWIREeWuYNIEaw6oIA" x="85" y="84" width="386" height="195"/>
+  </children>
+  <styles xmi:type="notation:StringValueStyle" xmi:id="_0p_EAWIREeWuYNIEaw6oIA" name="diagram_compatibility_version" stringValue="1.3.0"/>
+  <styles xmi:type="notation:DiagramStyle" xmi:id="_0p_EAmIREeWuYNIEaw6oIA"/>
+  <styles xmi:type="style:PapyrusDiagramStyle" xmi:id="_5jcrAOqDEeeGNpM5WA6vzA" diagramKindId="org.eclipse.papyrus.uml.diagram.class">
+    <owner xmi:type="uml:Model" href="model.uml#_0lgMoGIREeWuYNIEaw6oIA"/>
+  </styles>
+  <element xmi:type="uml:Model" href="model.uml#_0lgMoGIREeWuYNIEaw6oIA"/>
+</notation:Diagram>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/left/model.uml b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/left/model.uml
new file mode 100644
index 0000000..085e5df
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/left/model.uml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_0lgMoGIREeWuYNIEaw6oIA" name="RootElement">
+  <packagedElement xmi:type="uml:Package" href="Package1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+</uml:Model>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/origin/Package1.di b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/origin/Package1.di
new file mode 100644
index 0000000..bf9abab
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/origin/Package1.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/origin/Package1.notation b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/origin/Package1.notation
new file mode 100644
index 0000000..d8116d7
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/origin/Package1.notation
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/viewpoints/policy/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_gqBjYGIWEeWaI82ZiBQcnA" type="PapyrusUMLClassDiagram" name="ClassDiagram2" measurementUnit="Pixel">
+  <children xmi:type="notation:Shape" xmi:id="_hg79QGIWEeWaI82ZiBQcnA" type="2008">
+    <children xmi:type="notation:DecorationNode" xmi:id="_hg9ycGIWEeWaI82ZiBQcnA" type="5029"/>
+    <children xmi:type="notation:DecorationNode" xmi:id="_hg9ycWIWEeWaI82ZiBQcnA" type="8510">
+      <layoutConstraint xmi:type="notation:Location" xmi:id="_hg9ycmIWEeWaI82ZiBQcnA" y="5"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_hg9yc2IWEeWaI82ZiBQcnA" type="7017">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_hg9ydGIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_hg9ydWIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_hg9ydmIWEeWaI82ZiBQcnA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg9yd2IWEeWaI82ZiBQcnA"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_hg-ZgGIWEeWaI82ZiBQcnA" type="7018">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_hg-ZgWIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_hg-ZgmIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_hg-Zg2IWEeWaI82ZiBQcnA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg-ZhGIWEeWaI82ZiBQcnA"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_hg-ZhWIWEeWaI82ZiBQcnA" type="7019">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_hg-ZhmIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_hg-Zh2IWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_hg-ZiGIWEeWaI82ZiBQcnA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg-ZiWIWEeWaI82ZiBQcnA"/>
+    </children>
+    <element xmi:type="uml:Class" href="Package1.uml#_Tvs-0GISEeWuYNIEaw6oIA"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg79QWIWEeWaI82ZiBQcnA" x="110" y="104"/>
+  </children>
+  <styles xmi:type="notation:StringValueStyle" xmi:id="_gqBjYWIWEeWaI82ZiBQcnA" name="diagram_compatibility_version" stringValue="1.1.0"/>
+  <styles xmi:type="notation:DiagramStyle" xmi:id="_gqBjYmIWEeWaI82ZiBQcnA"/>
+  <styles xmi:type="style:PapyrusViewStyle" xmi:id="_gqBjY2IWEeWaI82ZiBQcnA">
+    <owner xmi:type="uml:Package" href="Package1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+  </styles>
+  <element xmi:type="uml:Package" href="Package1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+</notation:Diagram>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/origin/Package1.uml b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/origin/Package1.uml
new file mode 100644
index 0000000..4568041
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/origin/Package1.uml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Package xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_3BK90GIREeWuYNIEaw6oIA" name="Package1">
+  <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_3s5ZEOqDEeeGNpM5WA6vzA" source="http://www.eclipse.org/papyrus/2016/resource/shard">
+    <references xmi:type="uml:Model" href="model.uml#_0lgMoGIREeWuYNIEaw6oIA"/>
+  </eAnnotations>
+  <packagedElement xmi:type="uml:Class" xmi:id="_Tvs-0GISEeWuYNIEaw6oIA" name="Class1"/>
+</uml:Package>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/origin/model.di b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/origin/model.di
new file mode 100644
index 0000000..bf9abab
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/origin/model.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/origin/model.notation b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/origin/model.notation
new file mode 100644
index 0000000..6a43694
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/origin/model.notation
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/viewpoints/policy/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_0p_EAGIREeWuYNIEaw6oIA" type="PapyrusUMLClassDiagram" name="Class Diagram" measurementUnit="Pixel">
+  <children xmi:type="notation:Shape" xmi:id="_3BSSkGIREeWuYNIEaw6oIA" type="2007">
+    <children xmi:type="notation:DecorationNode" xmi:id="_3BUHwGIREeWuYNIEaw6oIA" type="5026"/>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_3BUHwWIREeWuYNIEaw6oIA" type="7016">
+      <children xmi:type="notation:Shape" xmi:id="_Tv06oGISEeWuYNIEaw6oIA" type="3010">
+        <children xmi:type="notation:DecorationNode" xmi:id="_Tv06omISEeWuYNIEaw6oIA" type="5014"/>
+        <children xmi:type="notation:DecorationNode" xmi:id="_Tv06o2ISEeWuYNIEaw6oIA" type="8518">
+          <layoutConstraint xmi:type="notation:Location" xmi:id="_Tv06pGISEeWuYNIEaw6oIA" y="5"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1hsGISEeWuYNIEaw6oIA" type="7011">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1hsWISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1hsmISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1hs2ISEeWuYNIEaw6oIA"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1htGISEeWuYNIEaw6oIA"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1htWISEeWuYNIEaw6oIA" type="7012">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1htmISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1ht2ISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1huGISEeWuYNIEaw6oIA"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1huWISEeWuYNIEaw6oIA"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1humISEeWuYNIEaw6oIA" type="7013">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1hu2ISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1hvGISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1hvWISEeWuYNIEaw6oIA"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1hvmISEeWuYNIEaw6oIA"/>
+        </children>
+        <element xmi:type="uml:Class" href="Package1.uml#_Tvs-0GISEeWuYNIEaw6oIA"/>
+        <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv06oWISEeWuYNIEaw6oIA" x="131" y="36"/>
+      </children>
+      <styles xmi:type="notation:TitleStyle" xmi:id="_3BUHwmIREeWuYNIEaw6oIA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3BUHw2IREeWuYNIEaw6oIA"/>
+    </children>
+    <element xmi:type="uml:Package" href="Package1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3BSSkWIREeWuYNIEaw6oIA" x="85" y="84" width="386" height="195"/>
+  </children>
+  <styles xmi:type="notation:StringValueStyle" xmi:id="_0p_EAWIREeWuYNIEaw6oIA" name="diagram_compatibility_version" stringValue="1.1.0"/>
+  <styles xmi:type="notation:DiagramStyle" xmi:id="_0p_EAmIREeWuYNIEaw6oIA"/>
+  <styles xmi:type="style:PapyrusViewStyle" xmi:id="_0p_EA2IREeWuYNIEaw6oIA">
+    <owner xmi:type="uml:Model" href="model.uml#_0lgMoGIREeWuYNIEaw6oIA"/>
+  </styles>
+  <element xmi:type="uml:Model" href="model.uml#_0lgMoGIREeWuYNIEaw6oIA"/>
+</notation:Diagram>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/origin/model.uml b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/origin/model.uml
new file mode 100644
index 0000000..085e5df
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/origin/model.uml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_0lgMoGIREeWuYNIEaw6oIA" name="RootElement">
+  <packagedElement xmi:type="uml:Package" href="Package1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+</uml:Model>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/right/Subunit1.di b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/right/Subunit1.di
new file mode 100644
index 0000000..bf9abab
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/right/Subunit1.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/right/Subunit1.notation b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/right/Subunit1.notation
new file mode 100644
index 0000000..ffcd6d2
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/right/Subunit1.notation
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/gmfdiag/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_gqBjYGIWEeWaI82ZiBQcnA" type="PapyrusUMLClassDiagram" name="ClassDiagram2" measurementUnit="Pixel">
+  <children xmi:type="notation:Shape" xmi:id="_hg79QGIWEeWaI82ZiBQcnA" type="Class_Shape">
+    <children xmi:type="notation:DecorationNode" xmi:id="_hg9ycGIWEeWaI82ZiBQcnA" type="Class_NameLabel"/>
+    <children xmi:type="notation:DecorationNode" xmi:id="_hg9ycWIWEeWaI82ZiBQcnA" type="Class_FloatingNameLabel">
+      <layoutConstraint xmi:type="notation:Location" xmi:id="_hg9ycmIWEeWaI82ZiBQcnA" y="5"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_hg9yc2IWEeWaI82ZiBQcnA" type="Class_AttributeCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_hg9ydGIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_hg9ydWIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_hg9ydmIWEeWaI82ZiBQcnA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg9yd2IWEeWaI82ZiBQcnA"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_hg-ZgGIWEeWaI82ZiBQcnA" type="Class_OperationCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_hg-ZgWIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_hg-ZgmIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_hg-Zg2IWEeWaI82ZiBQcnA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg-ZhGIWEeWaI82ZiBQcnA"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_hg-ZhWIWEeWaI82ZiBQcnA" type="Class_NestedClassifierCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_hg-ZhmIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_hg-Zh2IWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_hg-ZiGIWEeWaI82ZiBQcnA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg-ZiWIWEeWaI82ZiBQcnA"/>
+    </children>
+    <element xmi:type="uml:Class" href="Subunit1.uml#_Tvs-0GISEeWuYNIEaw6oIA"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg79QWIWEeWaI82ZiBQcnA" x="110" y="104"/>
+  </children>
+  <styles xmi:type="notation:StringValueStyle" xmi:id="_gqBjYWIWEeWaI82ZiBQcnA" name="diagram_compatibility_version" stringValue="1.3.0"/>
+  <styles xmi:type="notation:DiagramStyle" xmi:id="_gqBjYmIWEeWaI82ZiBQcnA"/>
+  <styles xmi:type="style:PapyrusDiagramStyle" xmi:id="_wurpwOqDEeeGNpM5WA6vzA" diagramKindId="org.eclipse.papyrus.uml.diagram.class">
+    <owner xmi:type="uml:Package" href="Subunit1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+  </styles>
+  <element xmi:type="uml:Package" href="Subunit1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+</notation:Diagram>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/right/Subunit1.uml b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/right/Subunit1.uml
new file mode 100644
index 0000000..d0ffebd
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/right/Subunit1.uml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Package xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_3BK90GIREeWuYNIEaw6oIA" name="Subunit1">
+  <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_1RV8oOqDEeeGNpM5WA6vzA" source="http://www.eclipse.org/papyrus/2016/resource/shard">
+    <references xmi:type="uml:Model" href="model.uml#_0lgMoGIREeWuYNIEaw6oIA"/>
+  </eAnnotations>
+  <packagedElement xmi:type="uml:Class" xmi:id="_Tvs-0GISEeWuYNIEaw6oIA" name="Class1"/>
+</uml:Package>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/right/model.di b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/right/model.di
new file mode 100644
index 0000000..bf9abab
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/right/model.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/right/model.notation b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/right/model.notation
new file mode 100644
index 0000000..8767e0c
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/right/model.notation
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/gmfdiag/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_0p_EAGIREeWuYNIEaw6oIA" type="PapyrusUMLClassDiagram" name="Class Diagram" measurementUnit="Pixel">
+  <children xmi:type="notation:Shape" xmi:id="_3BSSkGIREeWuYNIEaw6oIA" type="Package_Shape">
+    <children xmi:type="notation:DecorationNode" xmi:id="_3BUHwGIREeWuYNIEaw6oIA" type="Package_NameLabel"/>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_3BUHwWIREeWuYNIEaw6oIA" type="Package_PackagedElementCompartment">
+      <children xmi:type="notation:Shape" xmi:id="_Tv06oGISEeWuYNIEaw6oIA" type="Class_Shape_CN">
+        <children xmi:type="notation:DecorationNode" xmi:id="_Tv06omISEeWuYNIEaw6oIA" type="Class_NameLabel_CN"/>
+        <children xmi:type="notation:DecorationNode" xmi:id="_Tv06o2ISEeWuYNIEaw6oIA" type="Class_FloatingNameLabel_CN">
+          <layoutConstraint xmi:type="notation:Location" xmi:id="_Tv06pGISEeWuYNIEaw6oIA" y="5"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1hsGISEeWuYNIEaw6oIA" type="Class_AttributeCompartment_CN">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1hsWISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1hsmISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1hs2ISEeWuYNIEaw6oIA"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1htGISEeWuYNIEaw6oIA"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1htWISEeWuYNIEaw6oIA" type="Class_OperationCompartment_CN">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1htmISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1ht2ISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1huGISEeWuYNIEaw6oIA"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1huWISEeWuYNIEaw6oIA"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1humISEeWuYNIEaw6oIA" type="Class_NestedClassifierCompartment_CN">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1hu2ISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1hvGISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1hvWISEeWuYNIEaw6oIA"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1hvmISEeWuYNIEaw6oIA"/>
+        </children>
+        <element xmi:type="uml:Class" href="Subunit1.uml#_Tvs-0GISEeWuYNIEaw6oIA"/>
+        <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv06oWISEeWuYNIEaw6oIA" x="131" y="36"/>
+      </children>
+      <styles xmi:type="notation:TitleStyle" xmi:id="_3BUHwmIREeWuYNIEaw6oIA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3BUHw2IREeWuYNIEaw6oIA"/>
+    </children>
+    <element xmi:type="uml:Package" href="Subunit1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3BSSkWIREeWuYNIEaw6oIA" x="85" y="84" width="386" height="195"/>
+  </children>
+  <styles xmi:type="notation:StringValueStyle" xmi:id="_0p_EAWIREeWuYNIEaw6oIA" name="diagram_compatibility_version" stringValue="1.3.0"/>
+  <styles xmi:type="notation:DiagramStyle" xmi:id="_0p_EAmIREeWuYNIEaw6oIA"/>
+  <styles xmi:type="style:PapyrusDiagramStyle" xmi:id="_owx_EOqDEeeGNpM5WA6vzA" diagramKindId="org.eclipse.papyrus.uml.diagram.class">
+    <owner xmi:type="uml:Model" href="model.uml#_0lgMoGIREeWuYNIEaw6oIA"/>
+  </styles>
+  <element xmi:type="uml:Model" href="model.uml#_0lgMoGIREeWuYNIEaw6oIA"/>
+</notation:Diagram>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/right/model.uml b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/right/model.uml
new file mode 100644
index 0000000..363cc20
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename1/right/model.uml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_0lgMoGIREeWuYNIEaw6oIA" name="RootElement">
+  <packagedElement xmi:type="uml:Package" href="Subunit1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+</uml:Model>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/left/model.di b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/left/model.di
new file mode 100644
index 0000000..bf9abab
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/left/model.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/left/model.notation b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/left/model.notation
new file mode 100644
index 0000000..6f893bd
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/left/model.notation
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/gmfdiag/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML">
+  <notation:Diagram xmi:id="_0p_EAGIREeWuYNIEaw6oIA" type="PapyrusUMLClassDiagram" name="Class Diagram" measurementUnit="Pixel">
+    <children xmi:type="notation:Shape" xmi:id="_3BSSkGIREeWuYNIEaw6oIA" type="Package_Shape">
+      <children xmi:type="notation:DecorationNode" xmi:id="_3BUHwGIREeWuYNIEaw6oIA" type="Package_NameLabel"/>
+      <children xmi:type="notation:BasicCompartment" xmi:id="_3BUHwWIREeWuYNIEaw6oIA" type="Package_PackagedElementCompartment">
+        <children xmi:type="notation:Shape" xmi:id="_Tv06oGISEeWuYNIEaw6oIA" type="Class_Shape_CN">
+          <children xmi:type="notation:DecorationNode" xmi:id="_Tv06omISEeWuYNIEaw6oIA" type="Class_NameLabel_CN"/>
+          <children xmi:type="notation:DecorationNode" xmi:id="_Tv06o2ISEeWuYNIEaw6oIA" type="Class_FloatingNameLabel_CN">
+            <layoutConstraint xmi:type="notation:Location" xmi:id="_Tv06pGISEeWuYNIEaw6oIA" y="5"/>
+          </children>
+          <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1hsGISEeWuYNIEaw6oIA" type="Class_AttributeCompartment_CN">
+            <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1hsWISEeWuYNIEaw6oIA"/>
+            <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1hsmISEeWuYNIEaw6oIA"/>
+            <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1hs2ISEeWuYNIEaw6oIA"/>
+            <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1htGISEeWuYNIEaw6oIA"/>
+          </children>
+          <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1htWISEeWuYNIEaw6oIA" type="Class_OperationCompartment_CN">
+            <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1htmISEeWuYNIEaw6oIA"/>
+            <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1ht2ISEeWuYNIEaw6oIA"/>
+            <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1huGISEeWuYNIEaw6oIA"/>
+            <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1huWISEeWuYNIEaw6oIA"/>
+          </children>
+          <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1humISEeWuYNIEaw6oIA" type="Class_NestedClassifierCompartment_CN">
+            <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1hu2ISEeWuYNIEaw6oIA"/>
+            <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1hvGISEeWuYNIEaw6oIA"/>
+            <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1hvWISEeWuYNIEaw6oIA"/>
+            <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1hvmISEeWuYNIEaw6oIA"/>
+          </children>
+          <element xmi:type="uml:Class" href="model.uml#_Tvs-0GISEeWuYNIEaw6oIA"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv06oWISEeWuYNIEaw6oIA" x="131" y="36"/>
+        </children>
+        <styles xmi:type="notation:TitleStyle" xmi:id="_3BUHwmIREeWuYNIEaw6oIA"/>
+        <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3BUHw2IREeWuYNIEaw6oIA"/>
+      </children>
+      <element xmi:type="uml:Package" href="model.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3BSSkWIREeWuYNIEaw6oIA" x="85" y="84" width="386" height="195"/>
+    </children>
+    <styles xmi:type="notation:StringValueStyle" xmi:id="_0p_EAWIREeWuYNIEaw6oIA" name="diagram_compatibility_version" stringValue="1.3.0"/>
+    <styles xmi:type="notation:DiagramStyle" xmi:id="_0p_EAmIREeWuYNIEaw6oIA"/>
+    <styles xmi:type="style:PapyrusDiagramStyle" xmi:id="_OGLxAOsNEeeP1-vgK6VsNg" diagramKindId="org.eclipse.papyrus.uml.diagram.class">
+      <owner xmi:type="uml:Model" href="model.uml#_0lgMoGIREeWuYNIEaw6oIA"/>
+    </styles>
+    <element xmi:type="uml:Model" href="model.uml#_0lgMoGIREeWuYNIEaw6oIA"/>
+  </notation:Diagram>
+  <notation:Diagram xmi:id="_gqBjYGIWEeWaI82ZiBQcnA" type="PapyrusUMLClassDiagram" name="ClassDiagram2" measurementUnit="Pixel">
+    <children xmi:type="notation:Shape" xmi:id="_hg79QGIWEeWaI82ZiBQcnA" type="Class_Shape">
+      <children xmi:type="notation:DecorationNode" xmi:id="_hg9ycGIWEeWaI82ZiBQcnA" type="Class_NameLabel"/>
+      <children xmi:type="notation:DecorationNode" xmi:id="_hg9ycWIWEeWaI82ZiBQcnA" type="Class_FloatingNameLabel">
+        <layoutConstraint xmi:type="notation:Location" xmi:id="_hg9ycmIWEeWaI82ZiBQcnA" y="5"/>
+      </children>
+      <children xmi:type="notation:BasicCompartment" xmi:id="_hg9yc2IWEeWaI82ZiBQcnA" type="Class_AttributeCompartment">
+        <styles xmi:type="notation:TitleStyle" xmi:id="_hg9ydGIWEeWaI82ZiBQcnA"/>
+        <styles xmi:type="notation:SortingStyle" xmi:id="_hg9ydWIWEeWaI82ZiBQcnA"/>
+        <styles xmi:type="notation:FilteringStyle" xmi:id="_hg9ydmIWEeWaI82ZiBQcnA"/>
+        <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg9yd2IWEeWaI82ZiBQcnA"/>
+      </children>
+      <children xmi:type="notation:BasicCompartment" xmi:id="_hg-ZgGIWEeWaI82ZiBQcnA" type="Class_OperationCompartment">
+        <styles xmi:type="notation:TitleStyle" xmi:id="_hg-ZgWIWEeWaI82ZiBQcnA"/>
+        <styles xmi:type="notation:SortingStyle" xmi:id="_hg-ZgmIWEeWaI82ZiBQcnA"/>
+        <styles xmi:type="notation:FilteringStyle" xmi:id="_hg-Zg2IWEeWaI82ZiBQcnA"/>
+        <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg-ZhGIWEeWaI82ZiBQcnA"/>
+      </children>
+      <children xmi:type="notation:BasicCompartment" xmi:id="_hg-ZhWIWEeWaI82ZiBQcnA" type="Class_NestedClassifierCompartment">
+        <styles xmi:type="notation:TitleStyle" xmi:id="_hg-ZhmIWEeWaI82ZiBQcnA"/>
+        <styles xmi:type="notation:SortingStyle" xmi:id="_hg-Zh2IWEeWaI82ZiBQcnA"/>
+        <styles xmi:type="notation:FilteringStyle" xmi:id="_hg-ZiGIWEeWaI82ZiBQcnA"/>
+        <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg-ZiWIWEeWaI82ZiBQcnA"/>
+      </children>
+      <element xmi:type="uml:Class" href="model.uml#_Tvs-0GISEeWuYNIEaw6oIA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg79QWIWEeWaI82ZiBQcnA" x="110" y="104"/>
+    </children>
+    <styles xmi:type="notation:StringValueStyle" xmi:id="_gqBjYWIWEeWaI82ZiBQcnA" name="diagram_compatibility_version" stringValue="1.3.0"/>
+    <styles xmi:type="notation:DiagramStyle" xmi:id="_gqBjYmIWEeWaI82ZiBQcnA"/>
+    <styles xmi:type="style:PapyrusDiagramStyle" xmi:id="_PTClsOsNEeeP1-vgK6VsNg" diagramKindId="org.eclipse.papyrus.uml.diagram.class">
+      <owner xmi:type="uml:Package" href="model.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+    </styles>
+    <element xmi:type="uml:Package" href="model.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+  </notation:Diagram>
+</xmi:XMI>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/left/model.uml b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/left/model.uml
new file mode 100644
index 0000000..5e914ad
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/left/model.uml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_0lgMoGIREeWuYNIEaw6oIA" name="RootElement">
+  <packagedElement xmi:type="uml:Package" xmi:id="_3BK90GIREeWuYNIEaw6oIA" name="Package1">
+    <packagedElement xmi:type="uml:Class" xmi:id="_Tvs-0GISEeWuYNIEaw6oIA" name="Class1"/>
+  </packagedElement>
+</uml:Model>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/origin/Package1.di b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/origin/Package1.di
new file mode 100644
index 0000000..bf9abab
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/origin/Package1.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/origin/Package1.notation b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/origin/Package1.notation
new file mode 100644
index 0000000..d8116d7
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/origin/Package1.notation
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/viewpoints/policy/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_gqBjYGIWEeWaI82ZiBQcnA" type="PapyrusUMLClassDiagram" name="ClassDiagram2" measurementUnit="Pixel">
+  <children xmi:type="notation:Shape" xmi:id="_hg79QGIWEeWaI82ZiBQcnA" type="2008">
+    <children xmi:type="notation:DecorationNode" xmi:id="_hg9ycGIWEeWaI82ZiBQcnA" type="5029"/>
+    <children xmi:type="notation:DecorationNode" xmi:id="_hg9ycWIWEeWaI82ZiBQcnA" type="8510">
+      <layoutConstraint xmi:type="notation:Location" xmi:id="_hg9ycmIWEeWaI82ZiBQcnA" y="5"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_hg9yc2IWEeWaI82ZiBQcnA" type="7017">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_hg9ydGIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_hg9ydWIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_hg9ydmIWEeWaI82ZiBQcnA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg9yd2IWEeWaI82ZiBQcnA"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_hg-ZgGIWEeWaI82ZiBQcnA" type="7018">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_hg-ZgWIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_hg-ZgmIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_hg-Zg2IWEeWaI82ZiBQcnA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg-ZhGIWEeWaI82ZiBQcnA"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_hg-ZhWIWEeWaI82ZiBQcnA" type="7019">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_hg-ZhmIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_hg-Zh2IWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_hg-ZiGIWEeWaI82ZiBQcnA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg-ZiWIWEeWaI82ZiBQcnA"/>
+    </children>
+    <element xmi:type="uml:Class" href="Package1.uml#_Tvs-0GISEeWuYNIEaw6oIA"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg79QWIWEeWaI82ZiBQcnA" x="110" y="104"/>
+  </children>
+  <styles xmi:type="notation:StringValueStyle" xmi:id="_gqBjYWIWEeWaI82ZiBQcnA" name="diagram_compatibility_version" stringValue="1.1.0"/>
+  <styles xmi:type="notation:DiagramStyle" xmi:id="_gqBjYmIWEeWaI82ZiBQcnA"/>
+  <styles xmi:type="style:PapyrusViewStyle" xmi:id="_gqBjY2IWEeWaI82ZiBQcnA">
+    <owner xmi:type="uml:Package" href="Package1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+  </styles>
+  <element xmi:type="uml:Package" href="Package1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+</notation:Diagram>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/origin/Package1.uml b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/origin/Package1.uml
new file mode 100644
index 0000000..4568041
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/origin/Package1.uml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Package xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_3BK90GIREeWuYNIEaw6oIA" name="Package1">
+  <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_3s5ZEOqDEeeGNpM5WA6vzA" source="http://www.eclipse.org/papyrus/2016/resource/shard">
+    <references xmi:type="uml:Model" href="model.uml#_0lgMoGIREeWuYNIEaw6oIA"/>
+  </eAnnotations>
+  <packagedElement xmi:type="uml:Class" xmi:id="_Tvs-0GISEeWuYNIEaw6oIA" name="Class1"/>
+</uml:Package>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/origin/model.di b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/origin/model.di
new file mode 100644
index 0000000..bf9abab
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/origin/model.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/origin/model.notation b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/origin/model.notation
new file mode 100644
index 0000000..6a43694
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/origin/model.notation
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/viewpoints/policy/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_0p_EAGIREeWuYNIEaw6oIA" type="PapyrusUMLClassDiagram" name="Class Diagram" measurementUnit="Pixel">
+  <children xmi:type="notation:Shape" xmi:id="_3BSSkGIREeWuYNIEaw6oIA" type="2007">
+    <children xmi:type="notation:DecorationNode" xmi:id="_3BUHwGIREeWuYNIEaw6oIA" type="5026"/>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_3BUHwWIREeWuYNIEaw6oIA" type="7016">
+      <children xmi:type="notation:Shape" xmi:id="_Tv06oGISEeWuYNIEaw6oIA" type="3010">
+        <children xmi:type="notation:DecorationNode" xmi:id="_Tv06omISEeWuYNIEaw6oIA" type="5014"/>
+        <children xmi:type="notation:DecorationNode" xmi:id="_Tv06o2ISEeWuYNIEaw6oIA" type="8518">
+          <layoutConstraint xmi:type="notation:Location" xmi:id="_Tv06pGISEeWuYNIEaw6oIA" y="5"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1hsGISEeWuYNIEaw6oIA" type="7011">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1hsWISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1hsmISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1hs2ISEeWuYNIEaw6oIA"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1htGISEeWuYNIEaw6oIA"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1htWISEeWuYNIEaw6oIA" type="7012">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1htmISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1ht2ISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1huGISEeWuYNIEaw6oIA"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1huWISEeWuYNIEaw6oIA"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1humISEeWuYNIEaw6oIA" type="7013">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1hu2ISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1hvGISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1hvWISEeWuYNIEaw6oIA"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1hvmISEeWuYNIEaw6oIA"/>
+        </children>
+        <element xmi:type="uml:Class" href="Package1.uml#_Tvs-0GISEeWuYNIEaw6oIA"/>
+        <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv06oWISEeWuYNIEaw6oIA" x="131" y="36"/>
+      </children>
+      <styles xmi:type="notation:TitleStyle" xmi:id="_3BUHwmIREeWuYNIEaw6oIA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3BUHw2IREeWuYNIEaw6oIA"/>
+    </children>
+    <element xmi:type="uml:Package" href="Package1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3BSSkWIREeWuYNIEaw6oIA" x="85" y="84" width="386" height="195"/>
+  </children>
+  <styles xmi:type="notation:StringValueStyle" xmi:id="_0p_EAWIREeWuYNIEaw6oIA" name="diagram_compatibility_version" stringValue="1.1.0"/>
+  <styles xmi:type="notation:DiagramStyle" xmi:id="_0p_EAmIREeWuYNIEaw6oIA"/>
+  <styles xmi:type="style:PapyrusViewStyle" xmi:id="_0p_EA2IREeWuYNIEaw6oIA">
+    <owner xmi:type="uml:Model" href="model.uml#_0lgMoGIREeWuYNIEaw6oIA"/>
+  </styles>
+  <element xmi:type="uml:Model" href="model.uml#_0lgMoGIREeWuYNIEaw6oIA"/>
+</notation:Diagram>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/origin/model.uml b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/origin/model.uml
new file mode 100644
index 0000000..085e5df
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/origin/model.uml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_0lgMoGIREeWuYNIEaw6oIA" name="RootElement">
+  <packagedElement xmi:type="uml:Package" href="Package1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+</uml:Model>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/right/Subunit1.di b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/right/Subunit1.di
new file mode 100644
index 0000000..bf9abab
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/right/Subunit1.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/right/Subunit1.notation b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/right/Subunit1.notation
new file mode 100644
index 0000000..ffcd6d2
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/right/Subunit1.notation
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/gmfdiag/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_gqBjYGIWEeWaI82ZiBQcnA" type="PapyrusUMLClassDiagram" name="ClassDiagram2" measurementUnit="Pixel">
+  <children xmi:type="notation:Shape" xmi:id="_hg79QGIWEeWaI82ZiBQcnA" type="Class_Shape">
+    <children xmi:type="notation:DecorationNode" xmi:id="_hg9ycGIWEeWaI82ZiBQcnA" type="Class_NameLabel"/>
+    <children xmi:type="notation:DecorationNode" xmi:id="_hg9ycWIWEeWaI82ZiBQcnA" type="Class_FloatingNameLabel">
+      <layoutConstraint xmi:type="notation:Location" xmi:id="_hg9ycmIWEeWaI82ZiBQcnA" y="5"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_hg9yc2IWEeWaI82ZiBQcnA" type="Class_AttributeCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_hg9ydGIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_hg9ydWIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_hg9ydmIWEeWaI82ZiBQcnA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg9yd2IWEeWaI82ZiBQcnA"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_hg-ZgGIWEeWaI82ZiBQcnA" type="Class_OperationCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_hg-ZgWIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_hg-ZgmIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_hg-Zg2IWEeWaI82ZiBQcnA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg-ZhGIWEeWaI82ZiBQcnA"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_hg-ZhWIWEeWaI82ZiBQcnA" type="Class_NestedClassifierCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_hg-ZhmIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_hg-Zh2IWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_hg-ZiGIWEeWaI82ZiBQcnA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg-ZiWIWEeWaI82ZiBQcnA"/>
+    </children>
+    <element xmi:type="uml:Class" href="Subunit1.uml#_Tvs-0GISEeWuYNIEaw6oIA"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg79QWIWEeWaI82ZiBQcnA" x="110" y="104"/>
+  </children>
+  <styles xmi:type="notation:StringValueStyle" xmi:id="_gqBjYWIWEeWaI82ZiBQcnA" name="diagram_compatibility_version" stringValue="1.3.0"/>
+  <styles xmi:type="notation:DiagramStyle" xmi:id="_gqBjYmIWEeWaI82ZiBQcnA"/>
+  <styles xmi:type="style:PapyrusDiagramStyle" xmi:id="_wurpwOqDEeeGNpM5WA6vzA" diagramKindId="org.eclipse.papyrus.uml.diagram.class">
+    <owner xmi:type="uml:Package" href="Subunit1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+  </styles>
+  <element xmi:type="uml:Package" href="Subunit1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+</notation:Diagram>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/right/Subunit1.uml b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/right/Subunit1.uml
new file mode 100644
index 0000000..d0ffebd
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/right/Subunit1.uml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Package xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_3BK90GIREeWuYNIEaw6oIA" name="Subunit1">
+  <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_1RV8oOqDEeeGNpM5WA6vzA" source="http://www.eclipse.org/papyrus/2016/resource/shard">
+    <references xmi:type="uml:Model" href="model.uml#_0lgMoGIREeWuYNIEaw6oIA"/>
+  </eAnnotations>
+  <packagedElement xmi:type="uml:Class" xmi:id="_Tvs-0GISEeWuYNIEaw6oIA" name="Class1"/>
+</uml:Package>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/right/model.di b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/right/model.di
new file mode 100644
index 0000000..bf9abab
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/right/model.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/right/model.notation b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/right/model.notation
new file mode 100644
index 0000000..8767e0c
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/right/model.notation
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/gmfdiag/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_0p_EAGIREeWuYNIEaw6oIA" type="PapyrusUMLClassDiagram" name="Class Diagram" measurementUnit="Pixel">
+  <children xmi:type="notation:Shape" xmi:id="_3BSSkGIREeWuYNIEaw6oIA" type="Package_Shape">
+    <children xmi:type="notation:DecorationNode" xmi:id="_3BUHwGIREeWuYNIEaw6oIA" type="Package_NameLabel"/>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_3BUHwWIREeWuYNIEaw6oIA" type="Package_PackagedElementCompartment">
+      <children xmi:type="notation:Shape" xmi:id="_Tv06oGISEeWuYNIEaw6oIA" type="Class_Shape_CN">
+        <children xmi:type="notation:DecorationNode" xmi:id="_Tv06omISEeWuYNIEaw6oIA" type="Class_NameLabel_CN"/>
+        <children xmi:type="notation:DecorationNode" xmi:id="_Tv06o2ISEeWuYNIEaw6oIA" type="Class_FloatingNameLabel_CN">
+          <layoutConstraint xmi:type="notation:Location" xmi:id="_Tv06pGISEeWuYNIEaw6oIA" y="5"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1hsGISEeWuYNIEaw6oIA" type="Class_AttributeCompartment_CN">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1hsWISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1hsmISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1hs2ISEeWuYNIEaw6oIA"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1htGISEeWuYNIEaw6oIA"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1htWISEeWuYNIEaw6oIA" type="Class_OperationCompartment_CN">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1htmISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1ht2ISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1huGISEeWuYNIEaw6oIA"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1huWISEeWuYNIEaw6oIA"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1humISEeWuYNIEaw6oIA" type="Class_NestedClassifierCompartment_CN">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1hu2ISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1hvGISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1hvWISEeWuYNIEaw6oIA"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1hvmISEeWuYNIEaw6oIA"/>
+        </children>
+        <element xmi:type="uml:Class" href="Subunit1.uml#_Tvs-0GISEeWuYNIEaw6oIA"/>
+        <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv06oWISEeWuYNIEaw6oIA" x="131" y="36"/>
+      </children>
+      <styles xmi:type="notation:TitleStyle" xmi:id="_3BUHwmIREeWuYNIEaw6oIA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3BUHw2IREeWuYNIEaw6oIA"/>
+    </children>
+    <element xmi:type="uml:Package" href="Subunit1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3BSSkWIREeWuYNIEaw6oIA" x="85" y="84" width="386" height="195"/>
+  </children>
+  <styles xmi:type="notation:StringValueStyle" xmi:id="_0p_EAWIREeWuYNIEaw6oIA" name="diagram_compatibility_version" stringValue="1.3.0"/>
+  <styles xmi:type="notation:DiagramStyle" xmi:id="_0p_EAmIREeWuYNIEaw6oIA"/>
+  <styles xmi:type="style:PapyrusDiagramStyle" xmi:id="_owx_EOqDEeeGNpM5WA6vzA" diagramKindId="org.eclipse.papyrus.uml.diagram.class">
+    <owner xmi:type="uml:Model" href="model.uml#_0lgMoGIREeWuYNIEaw6oIA"/>
+  </styles>
+  <element xmi:type="uml:Model" href="model.uml#_0lgMoGIREeWuYNIEaw6oIA"/>
+</notation:Diagram>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/right/model.uml b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/right/model.uml
new file mode 100644
index 0000000..363cc20
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename2/right/model.uml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_0lgMoGIREeWuYNIEaw6oIA" name="RootElement">
+  <packagedElement xmi:type="uml:Package" href="Subunit1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+</uml:Model>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/left/Package1.di b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/left/Package1.di
new file mode 100644
index 0000000..bf9abab
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/left/Package1.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/left/Package1.notation b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/left/Package1.notation
new file mode 100644
index 0000000..a67eeed
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/left/Package1.notation
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/gmfdiag/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_gqBjYGIWEeWaI82ZiBQcnA" type="PapyrusUMLClassDiagram" name="ClassDiagram2" measurementUnit="Pixel">
+  <children xmi:type="notation:Shape" xmi:id="_hg79QGIWEeWaI82ZiBQcnA" type="Class_Shape">
+    <children xmi:type="notation:DecorationNode" xmi:id="_hg9ycGIWEeWaI82ZiBQcnA" type="Class_NameLabel"/>
+    <children xmi:type="notation:DecorationNode" xmi:id="_hg9ycWIWEeWaI82ZiBQcnA" type="Class_FloatingNameLabel">
+      <layoutConstraint xmi:type="notation:Location" xmi:id="_hg9ycmIWEeWaI82ZiBQcnA" y="5"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_hg9yc2IWEeWaI82ZiBQcnA" type="Class_AttributeCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_hg9ydGIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_hg9ydWIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_hg9ydmIWEeWaI82ZiBQcnA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg9yd2IWEeWaI82ZiBQcnA"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_hg-ZgGIWEeWaI82ZiBQcnA" type="Class_OperationCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_hg-ZgWIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_hg-ZgmIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_hg-Zg2IWEeWaI82ZiBQcnA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg-ZhGIWEeWaI82ZiBQcnA"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_hg-ZhWIWEeWaI82ZiBQcnA" type="Class_NestedClassifierCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_hg-ZhmIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_hg-Zh2IWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_hg-ZiGIWEeWaI82ZiBQcnA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg-ZiWIWEeWaI82ZiBQcnA"/>
+    </children>
+    <element xmi:type="uml:Class" href="Package1.uml#_Tvs-0GISEeWuYNIEaw6oIA"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg79QWIWEeWaI82ZiBQcnA" x="110" y="104"/>
+  </children>
+  <children xmi:type="notation:Shape" xmi:id="_7LtQwOscEeeP1-vgK6VsNg" type="Class_Shape">
+    <children xmi:type="notation:DecorationNode" xmi:id="_7Lt30OscEeeP1-vgK6VsNg" type="Class_NameLabel"/>
+    <children xmi:type="notation:DecorationNode" xmi:id="_7Lt30escEeeP1-vgK6VsNg" type="Class_FloatingNameLabel">
+      <layoutConstraint xmi:type="notation:Location" xmi:id="_7Lt30uscEeeP1-vgK6VsNg" y="15"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_7Lt30-scEeeP1-vgK6VsNg" type="Class_AttributeCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_7Lt31OscEeeP1-vgK6VsNg"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_7Lt31escEeeP1-vgK6VsNg"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_7Lt31uscEeeP1-vgK6VsNg"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_7Lt31-scEeeP1-vgK6VsNg"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_7Lt32OscEeeP1-vgK6VsNg" type="Class_OperationCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_7Lt32escEeeP1-vgK6VsNg"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_7Lt32uscEeeP1-vgK6VsNg"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_7Lt32-scEeeP1-vgK6VsNg"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_7Lt33OscEeeP1-vgK6VsNg"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_7Lt33escEeeP1-vgK6VsNg" type="Class_NestedClassifierCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_7Lt33uscEeeP1-vgK6VsNg"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_7Lt33-scEeeP1-vgK6VsNg"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_7Lt34OscEeeP1-vgK6VsNg"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_7Lt34escEeeP1-vgK6VsNg"/>
+    </children>
+    <element xmi:type="uml:Class" href="Package1.uml#_WhDDgOsYEeeP1-vgK6VsNg"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_7LtQwescEeeP1-vgK6VsNg" x="280" y="100"/>
+  </children>
+  <children xmi:type="notation:Shape" xmi:id="_7LywV-scEeeP1-vgK6VsNg" type="StereotypeComment">
+    <styles xmi:type="notation:TitleStyle" xmi:id="_7LywWOscEeeP1-vgK6VsNg"/>
+    <styles xmi:type="notation:EObjectValueStyle" xmi:id="_7LywWuscEeeP1-vgK6VsNg" name="BASE_ELEMENT">
+      <eObjectValue xmi:type="uml:Class" href="Package1.uml#_WhDDgOsYEeeP1-vgK6VsNg"/>
+    </styles>
+    <element xsi:nil="true"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_7LywWescEeeP1-vgK6VsNg" x="200"/>
+  </children>
+  <children xmi:type="notation:Shape" xmi:id="_7MHgcOscEeeP1-vgK6VsNg" type="Package_Shape">
+    <children xmi:type="notation:DecorationNode" xmi:id="_7MHgcuscEeeP1-vgK6VsNg" type="Package_NameLabel"/>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_7MHgc-scEeeP1-vgK6VsNg" type="Package_PackagedElementCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_7MHgdOscEeeP1-vgK6VsNg"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_7MHgdescEeeP1-vgK6VsNg"/>
+    </children>
+    <element xmi:type="uml:Package" href="Package1.uml#_cr1x0OsYEeeP1-vgK6VsNg"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_7MHgcescEeeP1-vgK6VsNg" x="120" y="260"/>
+  </children>
+  <children xmi:type="notation:Shape" xmi:id="_7MJ8uuscEeeP1-vgK6VsNg" type="StereotypeComment">
+    <styles xmi:type="notation:TitleStyle" xmi:id="_7MJ8u-scEeeP1-vgK6VsNg"/>
+    <styles xmi:type="notation:EObjectValueStyle" xmi:id="_7MJ8vescEeeP1-vgK6VsNg" name="BASE_ELEMENT">
+      <eObjectValue xmi:type="uml:Package" href="Package1.uml#_cr1x0OsYEeeP1-vgK6VsNg"/>
+    </styles>
+    <element xsi:nil="true"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_7MJ8vOscEeeP1-vgK6VsNg" x="200"/>
+  </children>
+  <styles xmi:type="notation:StringValueStyle" xmi:id="_gqBjYWIWEeWaI82ZiBQcnA" name="diagram_compatibility_version" stringValue="1.3.0"/>
+  <styles xmi:type="notation:DiagramStyle" xmi:id="_gqBjYmIWEeWaI82ZiBQcnA"/>
+  <styles xmi:type="style:PapyrusDiagramStyle" xmi:id="_6RN-cOscEeeP1-vgK6VsNg" diagramKindId="org.eclipse.papyrus.uml.diagram.class">
+    <owner xmi:type="uml:Package" href="Package1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+  </styles>
+  <element xmi:type="uml:Package" href="Package1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+  <edges xmi:type="notation:Connector" xmi:id="_7LywW-scEeeP1-vgK6VsNg" type="StereotypeCommentLink" source="_7LtQwOscEeeP1-vgK6VsNg" target="_7LywV-scEeeP1-vgK6VsNg">
+    <styles xmi:type="notation:FontStyle" xmi:id="_7LywXOscEeeP1-vgK6VsNg"/>
+    <styles xmi:type="notation:EObjectValueStyle" xmi:id="_7LzXYuscEeeP1-vgK6VsNg" name="BASE_ELEMENT">
+      <eObjectValue xmi:type="uml:Class" href="Package1.uml#_WhDDgOsYEeeP1-vgK6VsNg"/>
+    </styles>
+    <element xsi:nil="true"/>
+    <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_7LywXescEeeP1-vgK6VsNg" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/>
+    <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_7LzXYOscEeeP1-vgK6VsNg"/>
+    <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_7LzXYescEeeP1-vgK6VsNg"/>
+  </edges>
+  <edges xmi:type="notation:Connector" xmi:id="_7MKjwOscEeeP1-vgK6VsNg" type="StereotypeCommentLink" source="_7MHgcOscEeeP1-vgK6VsNg" target="_7MJ8uuscEeeP1-vgK6VsNg">
+    <styles xmi:type="notation:FontStyle" xmi:id="_7MKjwescEeeP1-vgK6VsNg"/>
+    <styles xmi:type="notation:EObjectValueStyle" xmi:id="_7MKjxescEeeP1-vgK6VsNg" name="BASE_ELEMENT">
+      <eObjectValue xmi:type="uml:Package" href="Package1.uml#_cr1x0OsYEeeP1-vgK6VsNg"/>
+    </styles>
+    <element xsi:nil="true"/>
+    <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_7MKjwuscEeeP1-vgK6VsNg" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/>
+    <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_7MKjw-scEeeP1-vgK6VsNg"/>
+    <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_7MKjxOscEeeP1-vgK6VsNg"/>
+  </edges>
+</notation:Diagram>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/left/Package1.uml b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/left/Package1.uml
new file mode 100644
index 0000000..c79211b
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/left/Package1.uml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:standard="http://www.eclipse.org/uml2/5.0.0/UML/Profile/Standard" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML">
+  <uml:Package xmi:id="_3BK90GIREeWuYNIEaw6oIA" name="Package1">
+    <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_3s5ZEOqDEeeGNpM5WA6vzA" source="http://www.eclipse.org/papyrus/2016/resource/shard">
+      <references xmi:type="uml:Model" href="model.uml#_0lgMoGIREeWuYNIEaw6oIA"/>
+    </eAnnotations>
+    <packagedElement xmi:type="uml:Class" xmi:id="_Tvs-0GISEeWuYNIEaw6oIA" name="Class1"/>
+    <packagedElement xmi:type="uml:Class" xmi:id="_WhDDgOsYEeeP1-vgK6VsNg" name="Strings"/>
+    <packagedElement xmi:type="uml:Package" xmi:id="_cr1x0OsYEeeP1-vgK6VsNg" name="jface"/>
+  </uml:Package>
+  <standard:Utility xmi:id="_YxA7AOsYEeeP1-vgK6VsNg" base_Class="_WhDDgOsYEeeP1-vgK6VsNg"/>
+  <standard:Framework xmi:id="_g1o4wOsYEeeP1-vgK6VsNg" base_Package="_cr1x0OsYEeeP1-vgK6VsNg"/>
+</xmi:XMI>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/left/model.di b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/left/model.di
new file mode 100644
index 0000000..bf9abab
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/left/model.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/left/model.notation b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/left/model.notation
new file mode 100644
index 0000000..3736abd
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/left/model.notation
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/gmfdiag/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_0p_EAGIREeWuYNIEaw6oIA" type="PapyrusUMLClassDiagram" name="Class Diagram" measurementUnit="Pixel">
+  <children xmi:type="notation:Shape" xmi:id="_3BSSkGIREeWuYNIEaw6oIA" type="Package_Shape">
+    <children xmi:type="notation:DecorationNode" xmi:id="_3BUHwGIREeWuYNIEaw6oIA" type="Package_NameLabel"/>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_3BUHwWIREeWuYNIEaw6oIA" type="Package_PackagedElementCompartment">
+      <children xmi:type="notation:Shape" xmi:id="_Tv06oGISEeWuYNIEaw6oIA" type="Class_Shape_CN">
+        <children xmi:type="notation:DecorationNode" xmi:id="_Tv06omISEeWuYNIEaw6oIA" type="Class_NameLabel_CN"/>
+        <children xmi:type="notation:DecorationNode" xmi:id="_Tv06o2ISEeWuYNIEaw6oIA" type="Class_FloatingNameLabel_CN">
+          <layoutConstraint xmi:type="notation:Location" xmi:id="_Tv06pGISEeWuYNIEaw6oIA" y="5"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1hsGISEeWuYNIEaw6oIA" type="Class_AttributeCompartment_CN">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1hsWISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1hsmISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1hs2ISEeWuYNIEaw6oIA"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1htGISEeWuYNIEaw6oIA"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1htWISEeWuYNIEaw6oIA" type="Class_OperationCompartment_CN">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1htmISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1ht2ISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1huGISEeWuYNIEaw6oIA"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1huWISEeWuYNIEaw6oIA"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1humISEeWuYNIEaw6oIA" type="Class_NestedClassifierCompartment_CN">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1hu2ISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1hvGISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1hvWISEeWuYNIEaw6oIA"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1hvmISEeWuYNIEaw6oIA"/>
+        </children>
+        <element xmi:type="uml:Class" href="Package1.uml#_Tvs-0GISEeWuYNIEaw6oIA"/>
+        <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv06oWISEeWuYNIEaw6oIA" x="9" y="8"/>
+      </children>
+      <children xmi:type="notation:Shape" xmi:id="_WhIjEOsYEeeP1-vgK6VsNg" type="Class_Shape">
+        <children xmi:type="notation:DecorationNode" xmi:id="_WhLmYOsYEeeP1-vgK6VsNg" type="Class_NameLabel"/>
+        <children xmi:type="notation:DecorationNode" xmi:id="_WhLmYesYEeeP1-vgK6VsNg" type="Class_FloatingNameLabel">
+          <layoutConstraint xmi:type="notation:Location" xmi:id="_WhLmYusYEeeP1-vgK6VsNg" y="15"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_WhMNcOsYEeeP1-vgK6VsNg" type="Class_AttributeCompartment">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_WhMNcesYEeeP1-vgK6VsNg"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_WhMNcusYEeeP1-vgK6VsNg"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_WhMNc-sYEeeP1-vgK6VsNg"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_WhMNdOsYEeeP1-vgK6VsNg"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_WhMNdesYEeeP1-vgK6VsNg" type="Class_OperationCompartment">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_WhMNdusYEeeP1-vgK6VsNg"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_WhMNd-sYEeeP1-vgK6VsNg"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_WhMNeOsYEeeP1-vgK6VsNg"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_WhMNeesYEeeP1-vgK6VsNg"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_WhMNeusYEeeP1-vgK6VsNg" type="Class_NestedClassifierCompartment">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_WhMNe-sYEeeP1-vgK6VsNg"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_WhMNfOsYEeeP1-vgK6VsNg"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_WhMNfesYEeeP1-vgK6VsNg"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_WhMNfusYEeeP1-vgK6VsNg"/>
+        </children>
+        <element xmi:type="uml:Class" href="Package1.uml#_WhDDgOsYEeeP1-vgK6VsNg"/>
+        <layoutConstraint xmi:type="notation:Bounds" xmi:id="_WhIjEesYEeeP1-vgK6VsNg" x="129" y="8"/>
+      </children>
+      <children xmi:type="notation:Shape" xmi:id="_cs7-AOsYEeeP1-vgK6VsNg" type="Package_Shape">
+        <children xmi:type="notation:DecorationNode" xmi:id="_cs8lEOsYEeeP1-vgK6VsNg" type="Package_NameLabel"/>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_cs8lEesYEeeP1-vgK6VsNg" type="Package_PackagedElementCompartment">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_cs8lEusYEeeP1-vgK6VsNg"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cs8lE-sYEeeP1-vgK6VsNg"/>
+        </children>
+        <element xmi:type="uml:Package" href="Package1.uml#_cr1x0OsYEeeP1-vgK6VsNg"/>
+        <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cs7-AesYEeeP1-vgK6VsNg" x="249" y="8"/>
+      </children>
+      <styles xmi:type="notation:TitleStyle" xmi:id="_3BUHwmIREeWuYNIEaw6oIA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3BUHw2IREeWuYNIEaw6oIA"/>
+    </children>
+    <element xmi:type="uml:Package" href="Package1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3BSSkWIREeWuYNIEaw6oIA" x="85" y="84" width="476" height="195"/>
+  </children>
+  <children xmi:type="notation:Shape" xmi:id="_Yxn_AOsYEeeP1-vgK6VsNg" type="StereotypeComment">
+    <styles xmi:type="notation:TitleStyle" xmi:id="_Yxn_AesYEeeP1-vgK6VsNg"/>
+    <styles xmi:type="notation:EObjectValueStyle" xmi:id="_YxomEOsYEeeP1-vgK6VsNg" name="BASE_ELEMENT">
+      <eObjectValue xmi:type="uml:Class" href="Package1.uml#_WhDDgOsYEeeP1-vgK6VsNg"/>
+    </styles>
+    <element xsi:nil="true"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Yxn_AusYEeeP1-vgK6VsNg" x="342" y="359"/>
+  </children>
+  <children xmi:type="notation:Shape" xmi:id="_g19o5OsYEeeP1-vgK6VsNg" type="StereotypeComment">
+    <styles xmi:type="notation:TitleStyle" xmi:id="_g19o5esYEeeP1-vgK6VsNg"/>
+    <styles xmi:type="notation:EObjectValueStyle" xmi:id="_g19o5-sYEeeP1-vgK6VsNg" name="BASE_ELEMENT">
+      <eObjectValue xmi:type="uml:Package" href="Package1.uml#_cr1x0OsYEeeP1-vgK6VsNg"/>
+    </styles>
+    <element xsi:nil="true"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g19o5usYEeeP1-vgK6VsNg" x="489" y="349"/>
+  </children>
+  <styles xmi:type="notation:StringValueStyle" xmi:id="_0p_EAWIREeWuYNIEaw6oIA" name="diagram_compatibility_version" stringValue="1.3.0"/>
+  <styles xmi:type="notation:DiagramStyle" xmi:id="_0p_EAmIREeWuYNIEaw6oIA"/>
+  <styles xmi:type="style:PapyrusDiagramStyle" xmi:id="_PmS34OsYEeeP1-vgK6VsNg" diagramKindId="org.eclipse.papyrus.uml.diagram.class">
+    <owner xmi:type="uml:Model" href="model.uml#_0lgMoGIREeWuYNIEaw6oIA"/>
+  </styles>
+  <element xmi:type="uml:Model" href="model.uml#_0lgMoGIREeWuYNIEaw6oIA"/>
+  <edges xmi:type="notation:Connector" xmi:id="_Yxs3gOsYEeeP1-vgK6VsNg" type="StereotypeCommentLink" source="_WhIjEOsYEeeP1-vgK6VsNg" target="_Yxn_AOsYEeeP1-vgK6VsNg">
+    <styles xmi:type="notation:FontStyle" xmi:id="_Yxs3gesYEeeP1-vgK6VsNg"/>
+    <styles xmi:type="notation:EObjectValueStyle" xmi:id="_YxuFousYEeeP1-vgK6VsNg" name="BASE_ELEMENT">
+      <eObjectValue xmi:type="uml:Class" href="Package1.uml#_WhDDgOsYEeeP1-vgK6VsNg"/>
+    </styles>
+    <element xsi:nil="true"/>
+    <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_Yxs3gusYEeeP1-vgK6VsNg" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/>
+    <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_YxuFoOsYEeeP1-vgK6VsNg"/>
+    <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_YxuFoesYEeeP1-vgK6VsNg"/>
+  </edges>
+  <edges xmi:type="notation:Connector" xmi:id="_g19o6OsYEeeP1-vgK6VsNg" type="StereotypeCommentLink" source="_cs7-AOsYEeeP1-vgK6VsNg" target="_g19o5OsYEeeP1-vgK6VsNg">
+    <styles xmi:type="notation:FontStyle" xmi:id="_g19o6esYEeeP1-vgK6VsNg"/>
+    <styles xmi:type="notation:EObjectValueStyle" xmi:id="_g1-P8usYEeeP1-vgK6VsNg" name="BASE_ELEMENT">
+      <eObjectValue xmi:type="uml:Package" href="Package1.uml#_cr1x0OsYEeeP1-vgK6VsNg"/>
+    </styles>
+    <element xsi:nil="true"/>
+    <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_g19o6usYEeeP1-vgK6VsNg" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/>
+    <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_g1-P8OsYEeeP1-vgK6VsNg"/>
+    <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_g1-P8esYEeeP1-vgK6VsNg"/>
+  </edges>
+</notation:Diagram>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/left/model.uml b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/left/model.uml
new file mode 100644
index 0000000..c38741a
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/left/model.uml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_0lgMoGIREeWuYNIEaw6oIA" name="RootElement">
+  <packagedElement xmi:type="uml:Package" href="Package1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+  <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_U-AjcOsYEeeP1-vgK6VsNg">
+    <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_U-CYoOsYEeeP1-vgK6VsNg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+      <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/uml2/5.0.0/UML/Profile/Standard#/"/>
+    </eAnnotations>
+    <appliedProfile xmi:type="uml:Profile" href="pathmap://UML_PROFILES/Standard.profile.uml#_0"/>
+  </profileApplication>
+</uml:Model>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/origin/Package1.di b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/origin/Package1.di
new file mode 100644
index 0000000..bf9abab
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/origin/Package1.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/origin/Package1.notation b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/origin/Package1.notation
new file mode 100644
index 0000000..d8116d7
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/origin/Package1.notation
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/viewpoints/policy/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_gqBjYGIWEeWaI82ZiBQcnA" type="PapyrusUMLClassDiagram" name="ClassDiagram2" measurementUnit="Pixel">
+  <children xmi:type="notation:Shape" xmi:id="_hg79QGIWEeWaI82ZiBQcnA" type="2008">
+    <children xmi:type="notation:DecorationNode" xmi:id="_hg9ycGIWEeWaI82ZiBQcnA" type="5029"/>
+    <children xmi:type="notation:DecorationNode" xmi:id="_hg9ycWIWEeWaI82ZiBQcnA" type="8510">
+      <layoutConstraint xmi:type="notation:Location" xmi:id="_hg9ycmIWEeWaI82ZiBQcnA" y="5"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_hg9yc2IWEeWaI82ZiBQcnA" type="7017">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_hg9ydGIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_hg9ydWIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_hg9ydmIWEeWaI82ZiBQcnA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg9yd2IWEeWaI82ZiBQcnA"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_hg-ZgGIWEeWaI82ZiBQcnA" type="7018">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_hg-ZgWIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_hg-ZgmIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_hg-Zg2IWEeWaI82ZiBQcnA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg-ZhGIWEeWaI82ZiBQcnA"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_hg-ZhWIWEeWaI82ZiBQcnA" type="7019">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_hg-ZhmIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_hg-Zh2IWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_hg-ZiGIWEeWaI82ZiBQcnA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg-ZiWIWEeWaI82ZiBQcnA"/>
+    </children>
+    <element xmi:type="uml:Class" href="Package1.uml#_Tvs-0GISEeWuYNIEaw6oIA"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg79QWIWEeWaI82ZiBQcnA" x="110" y="104"/>
+  </children>
+  <styles xmi:type="notation:StringValueStyle" xmi:id="_gqBjYWIWEeWaI82ZiBQcnA" name="diagram_compatibility_version" stringValue="1.1.0"/>
+  <styles xmi:type="notation:DiagramStyle" xmi:id="_gqBjYmIWEeWaI82ZiBQcnA"/>
+  <styles xmi:type="style:PapyrusViewStyle" xmi:id="_gqBjY2IWEeWaI82ZiBQcnA">
+    <owner xmi:type="uml:Package" href="Package1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+  </styles>
+  <element xmi:type="uml:Package" href="Package1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+</notation:Diagram>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/origin/Package1.uml b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/origin/Package1.uml
new file mode 100644
index 0000000..4568041
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/origin/Package1.uml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Package xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_3BK90GIREeWuYNIEaw6oIA" name="Package1">
+  <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_3s5ZEOqDEeeGNpM5WA6vzA" source="http://www.eclipse.org/papyrus/2016/resource/shard">
+    <references xmi:type="uml:Model" href="model.uml#_0lgMoGIREeWuYNIEaw6oIA"/>
+  </eAnnotations>
+  <packagedElement xmi:type="uml:Class" xmi:id="_Tvs-0GISEeWuYNIEaw6oIA" name="Class1"/>
+</uml:Package>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/origin/model.di b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/origin/model.di
new file mode 100644
index 0000000..bf9abab
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/origin/model.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/origin/model.notation b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/origin/model.notation
new file mode 100644
index 0000000..5efca7a
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/origin/model.notation
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/gmfdiag/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_0p_EAGIREeWuYNIEaw6oIA" type="PapyrusUMLClassDiagram" name="Class Diagram" measurementUnit="Pixel">
+  <children xmi:type="notation:Shape" xmi:id="_3BSSkGIREeWuYNIEaw6oIA" type="Package_Shape">
+    <children xmi:type="notation:DecorationNode" xmi:id="_3BUHwGIREeWuYNIEaw6oIA" type="Package_NameLabel"/>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_3BUHwWIREeWuYNIEaw6oIA" type="Package_PackagedElementCompartment">
+      <children xmi:type="notation:Shape" xmi:id="_Tv06oGISEeWuYNIEaw6oIA" type="Class_Shape_CN">
+        <children xmi:type="notation:DecorationNode" xmi:id="_Tv06omISEeWuYNIEaw6oIA" type="Class_NameLabel_CN"/>
+        <children xmi:type="notation:DecorationNode" xmi:id="_Tv06o2ISEeWuYNIEaw6oIA" type="Class_FloatingNameLabel_CN">
+          <layoutConstraint xmi:type="notation:Location" xmi:id="_Tv06pGISEeWuYNIEaw6oIA" y="5"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1hsGISEeWuYNIEaw6oIA" type="Class_AttributeCompartment_CN">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1hsWISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1hsmISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1hs2ISEeWuYNIEaw6oIA"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1htGISEeWuYNIEaw6oIA"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1htWISEeWuYNIEaw6oIA" type="Class_OperationCompartment_CN">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1htmISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1ht2ISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1huGISEeWuYNIEaw6oIA"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1huWISEeWuYNIEaw6oIA"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1humISEeWuYNIEaw6oIA" type="Class_NestedClassifierCompartment_CN">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1hu2ISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1hvGISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1hvWISEeWuYNIEaw6oIA"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1hvmISEeWuYNIEaw6oIA"/>
+        </children>
+        <element xmi:type="uml:Class" href="Package1.uml#_Tvs-0GISEeWuYNIEaw6oIA"/>
+        <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv06oWISEeWuYNIEaw6oIA" x="131" y="36"/>
+      </children>
+      <styles xmi:type="notation:TitleStyle" xmi:id="_3BUHwmIREeWuYNIEaw6oIA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3BUHw2IREeWuYNIEaw6oIA"/>
+    </children>
+    <element xmi:type="uml:Package" href="Package1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3BSSkWIREeWuYNIEaw6oIA" x="85" y="84" width="386" height="195"/>
+  </children>
+  <children xmi:type="notation:Shape" xmi:id="_WhIjEOsYEeeP1-vgK6VsNg" type="Class_Shape">
+    <children xmi:type="notation:DecorationNode" xmi:id="_WhLmYOsYEeeP1-vgK6VsNg" type="Class_NameLabel"/>
+    <children xmi:type="notation:DecorationNode" xmi:id="_WhLmYesYEeeP1-vgK6VsNg" type="Class_FloatingNameLabel">
+      <layoutConstraint xmi:type="notation:Location" xmi:id="_WhLmYusYEeeP1-vgK6VsNg" y="15"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_WhMNcOsYEeeP1-vgK6VsNg" type="Class_AttributeCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_WhMNcesYEeeP1-vgK6VsNg"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_WhMNcusYEeeP1-vgK6VsNg"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_WhMNc-sYEeeP1-vgK6VsNg"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_WhMNdOsYEeeP1-vgK6VsNg"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_WhMNdesYEeeP1-vgK6VsNg" type="Class_OperationCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_WhMNdusYEeeP1-vgK6VsNg"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_WhMNd-sYEeeP1-vgK6VsNg"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_WhMNeOsYEeeP1-vgK6VsNg"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_WhMNeesYEeeP1-vgK6VsNg"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_WhMNeusYEeeP1-vgK6VsNg" type="Class_NestedClassifierCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_WhMNe-sYEeeP1-vgK6VsNg"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_WhMNfOsYEeeP1-vgK6VsNg"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_WhMNfesYEeeP1-vgK6VsNg"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_WhMNfusYEeeP1-vgK6VsNg"/>
+    </children>
+    <element xmi:type="uml:Class" href="model.uml#_WhDDgOsYEeeP1-vgK6VsNg"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_WhIjEesYEeeP1-vgK6VsNg" x="100" y="340"/>
+  </children>
+  <children xmi:type="notation:Shape" xmi:id="_Yxn_AOsYEeeP1-vgK6VsNg" type="StereotypeComment">
+    <styles xmi:type="notation:TitleStyle" xmi:id="_Yxn_AesYEeeP1-vgK6VsNg"/>
+    <styles xmi:type="notation:EObjectValueStyle" xmi:id="_YxomEOsYEeeP1-vgK6VsNg" name="BASE_ELEMENT">
+      <eObjectValue xmi:type="uml:Class" href="model.uml#_WhDDgOsYEeeP1-vgK6VsNg"/>
+    </styles>
+    <element xsi:nil="true"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Yxn_AusYEeeP1-vgK6VsNg" x="342" y="359"/>
+  </children>
+  <children xmi:type="notation:Shape" xmi:id="_cs7-AOsYEeeP1-vgK6VsNg" type="Package_Shape">
+    <children xmi:type="notation:DecorationNode" xmi:id="_cs8lEOsYEeeP1-vgK6VsNg" type="Package_NameLabel"/>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_cs8lEesYEeeP1-vgK6VsNg" type="Package_PackagedElementCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_cs8lEusYEeeP1-vgK6VsNg"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cs8lE-sYEeeP1-vgK6VsNg"/>
+    </children>
+    <element xmi:type="uml:Package" href="model.uml#_cr1x0OsYEeeP1-vgK6VsNg"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cs7-AesYEeeP1-vgK6VsNg" x="280" y="340"/>
+  </children>
+  <children xmi:type="notation:Shape" xmi:id="_g19o5OsYEeeP1-vgK6VsNg" type="StereotypeComment">
+    <styles xmi:type="notation:TitleStyle" xmi:id="_g19o5esYEeeP1-vgK6VsNg"/>
+    <styles xmi:type="notation:EObjectValueStyle" xmi:id="_g19o5-sYEeeP1-vgK6VsNg" name="BASE_ELEMENT">
+      <eObjectValue xmi:type="uml:Package" href="model.uml#_cr1x0OsYEeeP1-vgK6VsNg"/>
+    </styles>
+    <element xsi:nil="true"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g19o5usYEeeP1-vgK6VsNg" x="489" y="349"/>
+  </children>
+  <styles xmi:type="notation:StringValueStyle" xmi:id="_0p_EAWIREeWuYNIEaw6oIA" name="diagram_compatibility_version" stringValue="1.3.0"/>
+  <styles xmi:type="notation:DiagramStyle" xmi:id="_0p_EAmIREeWuYNIEaw6oIA"/>
+  <styles xmi:type="style:PapyrusDiagramStyle" xmi:id="_PmS34OsYEeeP1-vgK6VsNg" diagramKindId="org.eclipse.papyrus.uml.diagram.class">
+    <owner xmi:type="uml:Model" href="model.uml#_0lgMoGIREeWuYNIEaw6oIA"/>
+  </styles>
+  <element xmi:type="uml:Model" href="model.uml#_0lgMoGIREeWuYNIEaw6oIA"/>
+  <edges xmi:type="notation:Connector" xmi:id="_Yxs3gOsYEeeP1-vgK6VsNg" type="StereotypeCommentLink" source="_WhIjEOsYEeeP1-vgK6VsNg" target="_Yxn_AOsYEeeP1-vgK6VsNg">
+    <styles xmi:type="notation:FontStyle" xmi:id="_Yxs3gesYEeeP1-vgK6VsNg"/>
+    <styles xmi:type="notation:EObjectValueStyle" xmi:id="_YxuFousYEeeP1-vgK6VsNg" name="BASE_ELEMENT">
+      <eObjectValue xmi:type="uml:Class" href="model.uml#_WhDDgOsYEeeP1-vgK6VsNg"/>
+    </styles>
+    <element xsi:nil="true"/>
+    <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_Yxs3gusYEeeP1-vgK6VsNg" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/>
+    <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_YxuFoOsYEeeP1-vgK6VsNg"/>
+    <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_YxuFoesYEeeP1-vgK6VsNg"/>
+  </edges>
+  <edges xmi:type="notation:Connector" xmi:id="_g19o6OsYEeeP1-vgK6VsNg" type="StereotypeCommentLink" source="_cs7-AOsYEeeP1-vgK6VsNg" target="_g19o5OsYEeeP1-vgK6VsNg">
+    <styles xmi:type="notation:FontStyle" xmi:id="_g19o6esYEeeP1-vgK6VsNg"/>
+    <styles xmi:type="notation:EObjectValueStyle" xmi:id="_g1-P8usYEeeP1-vgK6VsNg" name="BASE_ELEMENT">
+      <eObjectValue xmi:type="uml:Package" href="model.uml#_cr1x0OsYEeeP1-vgK6VsNg"/>
+    </styles>
+    <element xsi:nil="true"/>
+    <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_g19o6usYEeeP1-vgK6VsNg" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/>
+    <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_g1-P8OsYEeeP1-vgK6VsNg"/>
+    <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_g1-P8esYEeeP1-vgK6VsNg"/>
+  </edges>
+</notation:Diagram>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/origin/model.uml b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/origin/model.uml
new file mode 100644
index 0000000..1e4fcbc
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/origin/model.uml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:standard="http://www.eclipse.org/uml2/5.0.0/UML/Profile/Standard" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML">
+  <uml:Model xmi:id="_0lgMoGIREeWuYNIEaw6oIA" name="RootElement">
+    <packagedElement xmi:type="uml:Package" href="Package1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+    <packagedElement xmi:type="uml:Class" xmi:id="_WhDDgOsYEeeP1-vgK6VsNg" name="Strings"/>
+    <packagedElement xmi:type="uml:Package" xmi:id="_cr1x0OsYEeeP1-vgK6VsNg" name="jface"/>
+    <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_U-AjcOsYEeeP1-vgK6VsNg">
+      <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_U-CYoOsYEeeP1-vgK6VsNg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+        <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/uml2/5.0.0/UML/Profile/Standard#/"/>
+      </eAnnotations>
+      <appliedProfile xmi:type="uml:Profile" href="pathmap://UML_PROFILES/Standard.profile.uml#_0"/>
+    </profileApplication>
+  </uml:Model>
+  <standard:Utility xmi:id="_YxA7AOsYEeeP1-vgK6VsNg" base_Class="_WhDDgOsYEeeP1-vgK6VsNg"/>
+  <standard:Framework xmi:id="_g1o4wOsYEeeP1-vgK6VsNg" base_Package="_cr1x0OsYEeeP1-vgK6VsNg"/>
+</xmi:XMI>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/right/Subunit1.di b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/right/Subunit1.di
new file mode 100644
index 0000000..bf9abab
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/right/Subunit1.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/right/Subunit1.notation b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/right/Subunit1.notation
new file mode 100644
index 0000000..be260a5
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/right/Subunit1.notation
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/viewpoints/policy/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_gqBjYGIWEeWaI82ZiBQcnA" type="PapyrusUMLClassDiagram" name="ClassDiagram2" measurementUnit="Pixel">
+  <children xmi:type="notation:Shape" xmi:id="_hg79QGIWEeWaI82ZiBQcnA" type="2008">
+    <children xmi:type="notation:DecorationNode" xmi:id="_hg9ycGIWEeWaI82ZiBQcnA" type="5029"/>
+    <children xmi:type="notation:DecorationNode" xmi:id="_hg9ycWIWEeWaI82ZiBQcnA" type="8510">
+      <layoutConstraint xmi:type="notation:Location" xmi:id="_hg9ycmIWEeWaI82ZiBQcnA" y="5"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_hg9yc2IWEeWaI82ZiBQcnA" type="7017">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_hg9ydGIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_hg9ydWIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_hg9ydmIWEeWaI82ZiBQcnA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg9yd2IWEeWaI82ZiBQcnA"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_hg-ZgGIWEeWaI82ZiBQcnA" type="7018">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_hg-ZgWIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_hg-ZgmIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_hg-Zg2IWEeWaI82ZiBQcnA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg-ZhGIWEeWaI82ZiBQcnA"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_hg-ZhWIWEeWaI82ZiBQcnA" type="7019">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_hg-ZhmIWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_hg-Zh2IWEeWaI82ZiBQcnA"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_hg-ZiGIWEeWaI82ZiBQcnA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg-ZiWIWEeWaI82ZiBQcnA"/>
+    </children>
+    <element xmi:type="uml:Class" href="Subunit1.uml#_Tvs-0GISEeWuYNIEaw6oIA"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hg79QWIWEeWaI82ZiBQcnA" x="110" y="104"/>
+  </children>
+  <styles xmi:type="notation:StringValueStyle" xmi:id="_gqBjYWIWEeWaI82ZiBQcnA" name="diagram_compatibility_version" stringValue="1.1.0"/>
+  <styles xmi:type="notation:DiagramStyle" xmi:id="_gqBjYmIWEeWaI82ZiBQcnA"/>
+  <styles xmi:type="style:PapyrusViewStyle" xmi:id="_gqBjY2IWEeWaI82ZiBQcnA">
+    <owner xmi:type="uml:Package" href="Subunit1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+  </styles>
+  <element xmi:type="uml:Package" href="Subunit1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+</notation:Diagram>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/right/Subunit1.uml b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/right/Subunit1.uml
new file mode 100644
index 0000000..5c3db09
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/right/Subunit1.uml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Package xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_3BK90GIREeWuYNIEaw6oIA" name="Subunit1">
+  <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_3s5ZEOqDEeeGNpM5WA6vzA" source="http://www.eclipse.org/papyrus/2016/resource/shard">
+    <references xmi:type="uml:Model" href="model.uml#_0lgMoGIREeWuYNIEaw6oIA"/>
+  </eAnnotations>
+  <packagedElement xmi:type="uml:Class" xmi:id="_Tvs-0GISEeWuYNIEaw6oIA" name="Class1"/>
+</uml:Package>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/right/model.di b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/right/model.di
new file mode 100644
index 0000000..bf9abab
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/right/model.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/right/model.notation b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/right/model.notation
new file mode 100644
index 0000000..0070dd1
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/right/model.notation
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/gmfdiag/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_0p_EAGIREeWuYNIEaw6oIA" type="PapyrusUMLClassDiagram" name="Class Diagram" measurementUnit="Pixel">
+  <children xmi:type="notation:Shape" xmi:id="_3BSSkGIREeWuYNIEaw6oIA" type="Package_Shape">
+    <children xmi:type="notation:DecorationNode" xmi:id="_3BUHwGIREeWuYNIEaw6oIA" type="Package_NameLabel"/>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_3BUHwWIREeWuYNIEaw6oIA" type="Package_PackagedElementCompartment">
+      <children xmi:type="notation:Shape" xmi:id="_Tv06oGISEeWuYNIEaw6oIA" type="Class_Shape_CN">
+        <children xmi:type="notation:DecorationNode" xmi:id="_Tv06omISEeWuYNIEaw6oIA" type="Class_NameLabel_CN"/>
+        <children xmi:type="notation:DecorationNode" xmi:id="_Tv06o2ISEeWuYNIEaw6oIA" type="Class_FloatingNameLabel_CN">
+          <layoutConstraint xmi:type="notation:Location" xmi:id="_Tv06pGISEeWuYNIEaw6oIA" y="5"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1hsGISEeWuYNIEaw6oIA" type="Class_AttributeCompartment_CN">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1hsWISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1hsmISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1hs2ISEeWuYNIEaw6oIA"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1htGISEeWuYNIEaw6oIA"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1htWISEeWuYNIEaw6oIA" type="Class_OperationCompartment_CN">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1htmISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1ht2ISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1huGISEeWuYNIEaw6oIA"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1huWISEeWuYNIEaw6oIA"/>
+        </children>
+        <children xmi:type="notation:BasicCompartment" xmi:id="_Tv1humISEeWuYNIEaw6oIA" type="Class_NestedClassifierCompartment_CN">
+          <styles xmi:type="notation:TitleStyle" xmi:id="_Tv1hu2ISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:SortingStyle" xmi:id="_Tv1hvGISEeWuYNIEaw6oIA"/>
+          <styles xmi:type="notation:FilteringStyle" xmi:id="_Tv1hvWISEeWuYNIEaw6oIA"/>
+          <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv1hvmISEeWuYNIEaw6oIA"/>
+        </children>
+        <element xmi:type="uml:Class" href="Subunit1.uml#_Tvs-0GISEeWuYNIEaw6oIA"/>
+        <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tv06oWISEeWuYNIEaw6oIA" x="131" y="36"/>
+      </children>
+      <styles xmi:type="notation:TitleStyle" xmi:id="_3BUHwmIREeWuYNIEaw6oIA"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3BUHw2IREeWuYNIEaw6oIA"/>
+    </children>
+    <element xmi:type="uml:Package" href="Subunit1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3BSSkWIREeWuYNIEaw6oIA" x="85" y="84" width="386" height="195"/>
+  </children>
+  <children xmi:type="notation:Shape" xmi:id="_WhIjEOsYEeeP1-vgK6VsNg" type="Class_Shape">
+    <children xmi:type="notation:DecorationNode" xmi:id="_WhLmYOsYEeeP1-vgK6VsNg" type="Class_NameLabel"/>
+    <children xmi:type="notation:DecorationNode" xmi:id="_WhLmYesYEeeP1-vgK6VsNg" type="Class_FloatingNameLabel">
+      <layoutConstraint xmi:type="notation:Location" xmi:id="_WhLmYusYEeeP1-vgK6VsNg" y="15"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_WhMNcOsYEeeP1-vgK6VsNg" type="Class_AttributeCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_WhMNcesYEeeP1-vgK6VsNg"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_WhMNcusYEeeP1-vgK6VsNg"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_WhMNc-sYEeeP1-vgK6VsNg"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_WhMNdOsYEeeP1-vgK6VsNg"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_WhMNdesYEeeP1-vgK6VsNg" type="Class_OperationCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_WhMNdusYEeeP1-vgK6VsNg"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_WhMNd-sYEeeP1-vgK6VsNg"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_WhMNeOsYEeeP1-vgK6VsNg"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_WhMNeesYEeeP1-vgK6VsNg"/>
+    </children>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_WhMNeusYEeeP1-vgK6VsNg" type="Class_NestedClassifierCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_WhMNe-sYEeeP1-vgK6VsNg"/>
+      <styles xmi:type="notation:SortingStyle" xmi:id="_WhMNfOsYEeeP1-vgK6VsNg"/>
+      <styles xmi:type="notation:FilteringStyle" xmi:id="_WhMNfesYEeeP1-vgK6VsNg"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_WhMNfusYEeeP1-vgK6VsNg"/>
+    </children>
+    <element xmi:type="uml:Class" href="model.uml#_WhDDgOsYEeeP1-vgK6VsNg"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_WhIjEesYEeeP1-vgK6VsNg" x="100" y="340"/>
+  </children>
+  <children xmi:type="notation:Shape" xmi:id="_Yxn_AOsYEeeP1-vgK6VsNg" type="StereotypeComment">
+    <styles xmi:type="notation:TitleStyle" xmi:id="_Yxn_AesYEeeP1-vgK6VsNg"/>
+    <styles xmi:type="notation:EObjectValueStyle" xmi:id="_YxomEOsYEeeP1-vgK6VsNg" name="BASE_ELEMENT">
+      <eObjectValue xmi:type="uml:Class" href="model.uml#_WhDDgOsYEeeP1-vgK6VsNg"/>
+    </styles>
+    <element xsi:nil="true"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Yxn_AusYEeeP1-vgK6VsNg" x="342" y="359"/>
+  </children>
+  <children xmi:type="notation:Shape" xmi:id="_cs7-AOsYEeeP1-vgK6VsNg" type="Package_Shape">
+    <children xmi:type="notation:DecorationNode" xmi:id="_cs8lEOsYEeeP1-vgK6VsNg" type="Package_NameLabel"/>
+    <children xmi:type="notation:BasicCompartment" xmi:id="_cs8lEesYEeeP1-vgK6VsNg" type="Package_PackagedElementCompartment">
+      <styles xmi:type="notation:TitleStyle" xmi:id="_cs8lEusYEeeP1-vgK6VsNg"/>
+      <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cs8lE-sYEeeP1-vgK6VsNg"/>
+    </children>
+    <element xmi:type="uml:Package" href="model.uml#_cr1x0OsYEeeP1-vgK6VsNg"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cs7-AesYEeeP1-vgK6VsNg" x="280" y="340"/>
+  </children>
+  <children xmi:type="notation:Shape" xmi:id="_g19o5OsYEeeP1-vgK6VsNg" type="StereotypeComment">
+    <styles xmi:type="notation:TitleStyle" xmi:id="_g19o5esYEeeP1-vgK6VsNg"/>
+    <styles xmi:type="notation:EObjectValueStyle" xmi:id="_g19o5-sYEeeP1-vgK6VsNg" name="BASE_ELEMENT">
+      <eObjectValue xmi:type="uml:Package" href="model.uml#_cr1x0OsYEeeP1-vgK6VsNg"/>
+    </styles>
+    <element xsi:nil="true"/>
+    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g19o5usYEeeP1-vgK6VsNg" x="489" y="349"/>
+  </children>
+  <styles xmi:type="notation:StringValueStyle" xmi:id="_0p_EAWIREeWuYNIEaw6oIA" name="diagram_compatibility_version" stringValue="1.3.0"/>
+  <styles xmi:type="notation:DiagramStyle" xmi:id="_0p_EAmIREeWuYNIEaw6oIA"/>
+  <styles xmi:type="style:PapyrusDiagramStyle" xmi:id="_PmS34OsYEeeP1-vgK6VsNg" diagramKindId="org.eclipse.papyrus.uml.diagram.class">
+    <owner xmi:type="uml:Model" href="model.uml#_0lgMoGIREeWuYNIEaw6oIA"/>
+  </styles>
+  <element xmi:type="uml:Model" href="model.uml#_0lgMoGIREeWuYNIEaw6oIA"/>
+  <edges xmi:type="notation:Connector" xmi:id="_Yxs3gOsYEeeP1-vgK6VsNg" type="StereotypeCommentLink" source="_WhIjEOsYEeeP1-vgK6VsNg" target="_Yxn_AOsYEeeP1-vgK6VsNg">
+    <styles xmi:type="notation:FontStyle" xmi:id="_Yxs3gesYEeeP1-vgK6VsNg"/>
+    <styles xmi:type="notation:EObjectValueStyle" xmi:id="_YxuFousYEeeP1-vgK6VsNg" name="BASE_ELEMENT">
+      <eObjectValue xmi:type="uml:Class" href="model.uml#_WhDDgOsYEeeP1-vgK6VsNg"/>
+    </styles>
+    <element xsi:nil="true"/>
+    <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_Yxs3gusYEeeP1-vgK6VsNg" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/>
+    <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_YxuFoOsYEeeP1-vgK6VsNg"/>
+    <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_YxuFoesYEeeP1-vgK6VsNg"/>
+  </edges>
+  <edges xmi:type="notation:Connector" xmi:id="_g19o6OsYEeeP1-vgK6VsNg" type="StereotypeCommentLink" source="_cs7-AOsYEeeP1-vgK6VsNg" target="_g19o5OsYEeeP1-vgK6VsNg">
+    <styles xmi:type="notation:FontStyle" xmi:id="_g19o6esYEeeP1-vgK6VsNg"/>
+    <styles xmi:type="notation:EObjectValueStyle" xmi:id="_g1-P8usYEeeP1-vgK6VsNg" name="BASE_ELEMENT">
+      <eObjectValue xmi:type="uml:Package" href="model.uml#_cr1x0OsYEeeP1-vgK6VsNg"/>
+    </styles>
+    <element xsi:nil="true"/>
+    <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_g19o6usYEeeP1-vgK6VsNg" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/>
+    <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_g1-P8OsYEeeP1-vgK6VsNg"/>
+    <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_g1-P8esYEeeP1-vgK6VsNg"/>
+  </edges>
+</notation:Diagram>
diff --git a/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/right/model.uml b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/right/model.uml
new file mode 100644
index 0000000..9bebf0e
--- /dev/null
+++ b/plugins/compare/tests/org.eclipse.papyrus.compare.diagram.tests.git/testmodels/resourceattachmentchange/rename3/right/model.uml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:standard="http://www.eclipse.org/uml2/5.0.0/UML/Profile/Standard" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML">
+  <uml:Model xmi:id="_0lgMoGIREeWuYNIEaw6oIA" name="RootElement">
+    <packagedElement xmi:type="uml:Package" href="Subunit1.uml#_3BK90GIREeWuYNIEaw6oIA"/>
+    <packagedElement xmi:type="uml:Class" xmi:id="_WhDDgOsYEeeP1-vgK6VsNg" name="Strings"/>
+    <packagedElement xmi:type="uml:Package" xmi:id="_cr1x0OsYEeeP1-vgK6VsNg" name="jface"/>
+    <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_U-AjcOsYEeeP1-vgK6VsNg">
+      <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_U-CYoOsYEeeP1-vgK6VsNg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+        <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/uml2/5.0.0/UML/Profile/Standard#/"/>
+      </eAnnotations>
+      <appliedProfile xmi:type="uml:Profile" href="pathmap://UML_PROFILES/Standard.profile.uml#_0"/>
+    </profileApplication>
+  </uml:Model>
+  <standard:Utility xmi:id="_YxA7AOsYEeeP1-vgK6VsNg" base_Class="_WhDDgOsYEeeP1-vgK6VsNg"/>
+  <standard:Framework xmi:id="_g1o4wOsYEeeP1-vgK6VsNg" base_Package="_cr1x0OsYEeeP1-vgK6VsNg"/>
+</xmi:XMI>