Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » URI Fragments and intrinsic ID
URI Fragments and intrinsic ID [message #874390] Sun, 20 May 2012 19:10 Go to next message
Frank Goldwin is currently offline Frank GoldwinFriend
Messages: 10
Registered: May 2012
Junior Member
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 06:29 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
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
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:EMF Teneo 2.0: support for JPA 2.0 and Hibernate 4.1
Next Topic:[CDO 4.0] Durable Lock + CDOBranch + Connection aware URI
Goto Forum:
  


Current Time: Tue Apr 16 13:10:44 GMT 2024

Powered by FUDForum. Page generated in 0.06032 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top