Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343194 - [modeling] provide unique id for EMF model objects
Summary: [modeling] provide unique id for EMF model objects
Status: RESOLVED WORKSFORME
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Miles Parker CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 351886
  Show dependency tree
 
Reported: 2011-04-18 14:52 EDT by Benjamin Muskalla CLA
Modified: 2011-12-06 11:50 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Muskalla CLA 2011-04-18 14:52:43 EDT
We need to see how to identify EMF model objects within the workspace.
Not only the resource they live in is interesting, but also the path within the model and their unique id.
Comment 1 Miles Parker CLA 2011-07-11 20:05:09 EDT
There is a unique namespace URI identifying every object uniquely so no issue here.
Comment 2 Miles Parker CLA 2011-07-11 20:13:53 EDT
Resolving though of course we'll need to actually implement this, that will be part of generic EMF bridge task. (TBC)
Comment 3 Steffen Pingel CLA 2011-07-11 20:31:01 EDT
Miles, just process wise, every resolved fix bug should have a milestone set. If there is no action we usually mark bugs that turn out to be noops as duplicates or wontfix/worksforme.
Comment 4 Miles Parker CLA 2011-07-11 20:36:02 EDT
That makes perfect sense. When I do resolve, I see we only have the Eclipse release train versions, i.e. 3.7. Would I just use 3.7?
Comment 5 Steffen Pingel CLA 2011-07-12 06:33:55 EDT
The milestones are actually Mylyn versions. We finally almost caught up with the platform :). The next release is going to be Mylyn 3.7 so that's the milestone that should be used for committed bugs for the next release (tentatively planned for end of the year).
Comment 6 Miles Parker CLA 2011-07-12 17:40:07 EDT
Just a note that we have to be cautious in using namespace URI. We can use it for entities but should not use it for references to *other* model features for generated EMF editors (assuming we provide such support). This is because they are unfortunately are not "robust to element order switching". See AbstractContextStructureBridge#getHandleIdentifier. Instead references point to elements, e.g.:

<someClass someReference="//@somecontainer.0/@somItem.123 ..."
Comment 7 Cedric Brun CLA 2011-07-13 08:43:00 EDT
(In reply to comment #6)
> Just a note that we have to be cautious in using namespace URI. We can use it
> for entities but should not use it for references to *other* model features for
> generated EMF editors (assuming we provide such support). This is because they
> are unfortunately are not "robust to element order switching". See
> AbstractContextStructureBridge#getHandleIdentifier. Instead references point to
> elements, e.g.:
> 
> <someClass someReference="//@somecontainer.0/@somItem.123 ..."



This is the "default" case but some Ecore models will define ID's for their elements, (EAttribute.isID) or will use keys to identify the element from their 
containment list. One can also use XMI-ID if he relies on the XMI serialization. 

Using eKeys for instance makes it robust regarding order switching.

I would say that this choice is the domain designer/implementor choice (each identification mechanism have pros and cons) and that the mylyn bridge should not "override" this and just use EcoreUtil.getURI().
Comment 8 Miles Parker CLA 2011-07-13 12:47:40 EDT
(In reply to comment #7)
> (In reply to comment #6)
> > Just a note that we have to be cautious in using namespace URI. We can use it
> > for entities but should not use it for references to *other* model features
> for
> > generated EMF editors (assuming we provide such support). This is because they
> > are unfortunately are not "robust to element order switching". See
> > AbstractContextStructureBridge#getHandleIdentifier. Instead references point
> to
> > elements, e.g.:
> >
> > <someClass someReference="//@somecontainer.0/@somItem.123 ..."
> 
> 
> 
> This is the "default" case but some Ecore models will define ID's for their
> elements, (EAttribute.isID) or will use keys to identify the element from their
> containment list. One can also use XMI-ID if he relies on the XMI serialization.
> 
> Using eKeys for instance makes it robust regarding order switching.

Yep. In AMP for example some of the IDs are inferred from other related state and checked for semantic uniqueness. But I'm concerned about the general case because even many Eclipse EMF implementations don't support semantic and/or non-order dependent references. I'm thinking of EEF and IIR E4 for example. 

        <elements xsi:type="eef-views:ElementEditor" xmi:id="_-lyS0mbLEeCc14hltTOYmQ" name="description">
          <representation href="platform:/plugin/org.eclipse.emf.eef.views/std/SWT.toolkits#//@widgets.2"/>
        </elements>
        
        
> I would say that this choice is the domain designer/implementor choice (each
> identification mechanism have pros and cons) and that the mylyn bridge should
> not "override" this and just use EcoreUtil.getURI().

Wait, do you mean that we should just use EcoreUtil.getURI() or that we shouldn't? :)

[There's an old Saturday Night Live skit where the retiring nuclear power plant engineer leaves and on his way out he says: “Don’t forget, and this is critical! You can’t use too much cooling water.”  Followed by much discussion and eventually, mushroom cloud..]

Assuming the former, I agree that we shouldn't override the default implementation. For one thing, if the references are to external resources, we'll end up with a real hairball. In practice I can't see this as being an issue because the only real concern is the references to other objects from the source object and the only place I can think of where that might come up is in some of the more complex diagram editor implementations.
Comment 9 Cedric Brun CLA 2011-07-13 14:59:21 EDT
You're right, my sentence is not that clear, let's hope no nuclear plan is getting built on top of this discussion :p

What I meant was : IMO you should only rely on getURI and people should update their code (starting by EEF which I'll CC ;) ) . And *we* should publicize this a bit more, it's definitely one of the top ten EMF mistakes.