|
|
|
Re: EMF Colliding ID - why? [message #420198 is a reply to message #420197] |
Fri, 20 June 2008 22:02 |
Ed Merks Messages: 33137 Registered: July 2009 |
Senior Member |
|
|
Yigal,
An EReference has an eKeys reference. These keys are a subset of the
EAttributes of the referenced EClass that uniquely identify the
referenced instance within the set of referenced instances. This will
result in fragment path segments of the form
@feature[key1='value1,key2='value2']. So the constraint for this is
that the combination of attribute values must be unique but only within
the one feature. Maybe that's what you were thinking of?
Yigal wrote:
> Ed,
> I remember being in an EMF session on Eclipse Con 2006 and the
> presenter indicate that you can mark an attribute as "ID" but it would
> not be unique across the whole model , but set another option and the
> ID will be uniques for the class in the model.
>
> Do you know this option?
> Otherwise I'll have to create a base class that will have the key ID
> in it and extend all classes from that single class. This will make
> sure there is only one ID.
>
> Thanks
> Yigal
>
> Ed Merks wrote:
>> Yigal,
>>
>> Comments below.
>>
>> Yigal wrote:
>>> I’m getting the following diagnostic error while saving:
>>>
>>> Diagnosis of
>>> com.accenture.tools.sd.model.domain.impl.WindowImpl@14ad296{ hibernate://?dsname=yigal_db&query1=
>>> from Window where entityname='WINTST2'#Window|id=95}
>>>
>>> The ID '35' of
>>> 'com.accenture.tools.sd.model.domain.impl.EntityDescriptionI mpl @e6529c{hibernate://?dsname=yigal_db&query1=
>>> from Window where entityname='WINTST2'#EntityDescription|id=35}'
>>> collides with that of
>>> ' com.accenture.tools.sd.model.domain.impl.ToolResourceRegistr yImpl@d9783e{hibernate://?dsname=yigal_db&query1=
>>> from Window where entityname='WINTST2'#ToolResourceRegistry|id=35}'
>>>
>>> It seems that there is a conflict between IDs on different classes
>>> that are different tables.
>> Resource.getEObject is used to look up objects and that method has
>> only the string argument with no knowledge to distinguish different
>> types of objects.
>>>
>>> I do not understand why all of a sudden I have ID conflict? (we did
>>> convert a different data set to see this issue, it does not happen
>>> with the dataset from Assembly test).
>> Like XML Schema, the constraint on ID values is that it must be
>> unique for all objects within the same document, regardless of the
>> object's type.
>>>
>>> If I have Window class that has an attribute called “WinIdKey” and
>>> it is marked in the eCore as ID=true.
>>>
>>> The Window class references two other classes:
>>> 1. ToolResourceRegistry (trrIdKey attribute with ID=true) and
>>> 2. EntityDescription (descIdKey attribute with ID=true)
>>> all the ID attributes have a different name.
>>>
>>> Why is there a conflict?
>> For each object x in the resource r,
>> r.getEObject(r.getURIFragment(x)) == x must be true. Maybe you want
>> to encode the type into the ID so it's not possible to have a
>> conflict. One could do that with a special ID type whose
>> convertToString adds the type and createFromString strips it...
>>>
>>>
>>> Thanks
>>> Yigal
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.01995 seconds