@Override public String eURIFragmentSegment(EStructuralFeature eStructuralFeature, EObject eObject) { if (eObject instanceof ENamedElement) { ENamedElement eNamedElement = (ENamedElement) eObject; String name = eNamedElement.getName(); if (name != null) { int count = 0; for (Object otherEObject : eContents()) { if (otherEObject == eObject) { break; } if (otherEObject instanceof ENamedElement) { ENamedElement otherENamedElement = (ENamedElement) otherEObject; if (name.equals(otherENamedElement.getName())) { ++count; } } } name = eEncodeValue(name); return count > 0 ? name + "." + count : name; } } else if (eObject instanceof EAnnotation) { EAnnotation eAnnotation = (EAnnotation) eObject; String source = eAnnotation.getSource(); if (source != null) { int count = 0; for (Object otherEObject : eContents()) { if (otherEObject == eObject) { break; } if (otherEObject instanceof EAnnotation) { EAnnotation otherEAnnotation = (EAnnotation) otherEObject; if (source.equals(otherEAnnotation.getSource())) { ++count; } } } StringBuffer result = new StringBuffer(source.length() + 5); result.append('%'); result.append(URI.encodeSegment(source, false)); result.append('%'); if (count > 0) { result.append('.'); result.append(count); } return result.toString(); } } return super.eURIFragmentSegment(eStructuralFeature, eObject); }