URI Fragments and intrinsic ID [message #874390] |
Sun, 20 May 2012 15:10  |
Eclipse User |
|
|
|
Hi,
I have model instance like this:
RootObj
name = "root"
ObjOfTypeA
name = "parent1"
ObjOfTypeB
name "child"
ObjOfTypeA
name = "parent2"
ObjOfTypeB
name "child"
If I define the 'name' attribute as an intrinsic ID on every class, can use the following URI fragments to identify the 2 child objects?
"/root/parent1/child"
"/root/parent2/child"
My understanding is that I cannot do it because the child object must be unique inside the whole Resource.
I would have hoped the requirement to be that it only had to be unique inside its container object (ie ObjOfTypeA).
Any good ways to go about it?
Should I implement my own eObjectForURIFragmentSegment() and eObjectForURIFragmentSegment()?
Thank you.
Frank
|
|
|
Re: URI Fragments and intrinsic ID [message #874554 is a reply to message #874390] |
Mon, 21 May 2012 02:29  |
Eclipse User |
|
|
|
Frank,
Comments below.
On 20/05/2012 9:10 PM, Frank Goldwin wrote:
> Hi,
>
> I have model instance like this:
>
>
> RootObj
> name = "root"
> ObjOfTypeA
> name = "parent1"
> ObjOfTypeB
> name "child"
> ObjOfTypeA
> name = "parent2"
> ObjOfTypeB
> name "child"
>
>
> If I define the 'name' attribute as an intrinsic ID on every class,
> can use the following URI fragments to identify the 2 child objects?
>
> "/root/parent1/child"
> "/root/parent2/child"
No, an ID must be unique within the resource as a whole and is used all
by itself instead of a fragment path.
>
> My understanding is that I cannot do it because the child object must
> be unique inside the whole Resource.
Yes.
> I would have hoped the requirement to be that it only had to be unique
> inside its container object (ie ObjOfTypeA).
No. EReference.eKeys is useful for that.
>
> Any good ways to go about it?
On any reference you can select which features of the referenced EClass
uniquely identify the child within that one reference. If you do that
for a containment reference, you'll get fragment segments of the form
@<feature-name>[<key1>='value1',<key2>='value2'].
> Should I implement my own eObjectForURIFragmentSegment() and
> eObjectForURIFragmentSegment()?
That's another way; then you can completely determine they syntax for
the segment; try to ensure that the default syntax is still accepted.
Look to EModelElementImpl as an example.
>
> Thank you.
> Frank
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03831 seconds