Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » References by key only.
References by key only. [message #489513] Sun, 04 October 2009 11:22 Go to next message
Thomas Hallgren is currently offline Thomas HallgrenFriend
Messages: 3240
Registered: July 2009
Senior Member
Hi,
I'm working on an ecore model that describes the Buckminster RMAP. It needs to serialize/parse according to an already
existing XSD. The XSD is however far from ideal as a good base for my model so I want to turn things around and use the
ecore model as base and then generate a compatible XSD from there.

Here is one problem that I've encountered that I would like some advice on:

The 'locator' element of the RMAP has a reference to a 'searchPath' element which is required to be in the same
document. This reference is using the 'name' attribute of the searchPath. It typically looks like this:

<searchPath name="eclipse.platform"> ... </searchPath>
...
<locator pattern="..." searchPathRef="eclipse.platform"/>

I.e. it's not a strict reference per se, it's just a match where Locator.searchPathRef == SearchPath.name. Nevertheless,
I want to model this as a 0..1, non-containing reference, from Locator to SearchPath so that I get all nice lookup
functionality etc. that the generated editor provides. What tweaks do I need to make this happen?

Regards,
Thomas Hallgren
Re: References by key only. [message #489516 is a reply to message #489513] Sun, 04 October 2009 11:45 Go to previous messageGo to next message
Thomas Hallgren is currently offline Thomas HallgrenFriend
Messages: 3240
Registered: July 2009
Senior Member
I've figured this out. Well almost. It seems to be as simple as just defining the SearchPath.name attribute as an ID.
The remaining question is how to get rid of the leading hash. I.e. the serializer writes
searchPathRef="#eclipse.platform" but I want just searchPathRef="eclipse.platform".


On 10/04/2009 01:22 PM, Thomas Hallgren wrote:
> Hi,
> I'm working on an ecore model that describes the Buckminster RMAP. It
> needs to serialize/parse according to an already existing XSD. The XSD
> is however far from ideal as a good base for my model so I want to turn
> things around and use the ecore model as base and then generate a
> compatible XSD from there.
>
> Here is one problem that I've encountered that I would like some advice on:
>
> The 'locator' element of the RMAP has a reference to a 'searchPath'
> element which is required to be in the same document. This reference is
> using the 'name' attribute of the searchPath. It typically looks like this:
>
> <searchPath name="eclipse.platform"> ... </searchPath>
> ...
> <locator pattern="..." searchPathRef="eclipse.platform"/>
>
> I.e. it's not a strict reference per se, it's just a match where
> Locator.searchPathRef == SearchPath.name. Nevertheless, I want to model
> this as a 0..1, non-containing reference, from Locator to SearchPath so
> that I get all nice lookup functionality etc. that the generated editor
> provides. What tweaks do I need to make this happen?
>
> Regards,
> Thomas Hallgren
Re: References by key only. [message #489518 is a reply to message #489516] Sun, 04 October 2009 11:54 Go to previous messageGo to next message
Thomas Hallgren is currently offline Thomas HallgrenFriend
Messages: 3240
Registered: July 2009
Senior Member
Some more digging and this one got resolved too. Just set save/load option OPTION_USE_ENCODED_ATTRIBUTE_STYLE to false
in the xxxResourceFactoryImpl.createResource(URI uri) method.

Sorry for the noise.

Regards,
Thomas Hallgren


On 10/04/2009 01:45 PM, Thomas Hallgren wrote:
> I've figured this out. Well almost. It seems to be as simple as just
> defining the SearchPath.name attribute as an ID. The remaining question
> is how to get rid of the leading hash. I.e. the serializer writes
> searchPathRef="#eclipse.platform" but I want just
> searchPathRef="eclipse.platform".
>
>
> On 10/04/2009 01:22 PM, Thomas Hallgren wrote:
>> Hi,
>> I'm working on an ecore model that describes the Buckminster RMAP. It
>> needs to serialize/parse according to an already existing XSD. The XSD
>> is however far from ideal as a good base for my model so I want to turn
>> things around and use the ecore model as base and then generate a
>> compatible XSD from there.
>>
>> Here is one problem that I've encountered that I would like some
>> advice on:
>>
>> The 'locator' element of the RMAP has a reference to a 'searchPath'
>> element which is required to be in the same document. This reference is
>> using the 'name' attribute of the searchPath. It typically looks like
>> this:
>>
>> <searchPath name="eclipse.platform"> ... </searchPath>
>> ...
>> <locator pattern="..." searchPathRef="eclipse.platform"/>
>>
>> I.e. it's not a strict reference per se, it's just a match where
>> Locator.searchPathRef == SearchPath.name. Nevertheless, I want to model
>> this as a 0..1, non-containing reference, from Locator to SearchPath so
>> that I get all nice lookup functionality etc. that the generated editor
>> provides. What tweaks do I need to make this happen?
>>
>> Regards,
>> Thomas Hallgren
>
Re: References by key only. [message #490604 is a reply to message #489518] Fri, 09 October 2009 11:15 Go to previous messageGo to next message
Thomas Hallgren is currently offline Thomas HallgrenFriend
Messages: 3240
Registered: July 2009
Senior Member
Hi,
The problem with the leading '#' bites me again and I cannot understand what it is that has been changed. I still have
the OPTION_USE_ENCODED_ATTRIBUTE_STYLE set to false but for some reason, it doesn't help.

Is there some other mechanism that is involved in this too?

Thanks,
Thomas Hallgen


On 10/04/2009 01:54 PM, Thomas Hallgren wrote:
> Some more digging and this one got resolved too. Just set save/load
> option OPTION_USE_ENCODED_ATTRIBUTE_STYLE to false in the
> xxxResourceFactoryImpl.createResource(URI uri) method.
>
> Sorry for the noise.
>
> Regards,
> Thomas Hallgren
>
>
> On 10/04/2009 01:45 PM, Thomas Hallgren wrote:
>> I've figured this out. Well almost. It seems to be as simple as just
>> defining the SearchPath.name attribute as an ID. The remaining question
>> is how to get rid of the leading hash. I.e. the serializer writes
>> searchPathRef="#eclipse.platform" but I want just
>> searchPathRef="eclipse.platform".
>>
>>
>> On 10/04/2009 01:22 PM, Thomas Hallgren wrote:
>>> Hi,
>>> I'm working on an ecore model that describes the Buckminster RMAP. It
>>> needs to serialize/parse according to an already existing XSD. The XSD
>>> is however far from ideal as a good base for my model so I want to turn
>>> things around and use the ecore model as base and then generate a
>>> compatible XSD from there.
>>>
>>> Here is one problem that I've encountered that I would like some
>>> advice on:
>>>
>>> The 'locator' element of the RMAP has a reference to a 'searchPath'
>>> element which is required to be in the same document. This reference is
>>> using the 'name' attribute of the searchPath. It typically looks like
>>> this:
>>>
>>> <searchPath name="eclipse.platform"> ... </searchPath>
>>> ...
>>> <locator pattern="..." searchPathRef="eclipse.platform"/>
>>>
>>> I.e. it's not a strict reference per se, it's just a match where
>>> Locator.searchPathRef == SearchPath.name. Nevertheless, I want to model
>>> this as a 0..1, non-containing reference, from Locator to SearchPath so
>>> that I get all nice lookup functionality etc. that the generated editor
>>> provides. What tweaks do I need to make this happen?
>>>
>>> Regards,
>>> Thomas Hallgren
>>
>
Re: References by key only. [message #490650 is a reply to message #490604] Fri, 09 October 2009 15:05 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Thomas,

If the reference can cross documents, EReference.resolveProxies is true,
then generally you'll need the #; otherwise, try setting it to false.


Thomas Hallgren wrote:
> Hi,
> The problem with the leading '#' bites me again and I cannot
> understand what it is that has been changed. I still have the
> OPTION_USE_ENCODED_ATTRIBUTE_STYLE set to false but for some reason,
> it doesn't help.
>
> Is there some other mechanism that is involved in this too?
>
> Thanks,
> Thomas Hallgen
>
>
> On 10/04/2009 01:54 PM, Thomas Hallgren wrote:
>> Some more digging and this one got resolved too. Just set save/load
>> option OPTION_USE_ENCODED_ATTRIBUTE_STYLE to false in the
>> xxxResourceFactoryImpl.createResource(URI uri) method.
>>
>> Sorry for the noise.
>>
>> Regards,
>> Thomas Hallgren
>>
>>
>> On 10/04/2009 01:45 PM, Thomas Hallgren wrote:
>>> I've figured this out. Well almost. It seems to be as simple as just
>>> defining the SearchPath.name attribute as an ID. The remaining question
>>> is how to get rid of the leading hash. I.e. the serializer writes
>>> searchPathRef="#eclipse.platform" but I want just
>>> searchPathRef="eclipse.platform".
>>>
>>>
>>> On 10/04/2009 01:22 PM, Thomas Hallgren wrote:
>>>> Hi,
>>>> I'm working on an ecore model that describes the Buckminster RMAP. It
>>>> needs to serialize/parse according to an already existing XSD. The XSD
>>>> is however far from ideal as a good base for my model so I want to
>>>> turn
>>>> things around and use the ecore model as base and then generate a
>>>> compatible XSD from there.
>>>>
>>>> Here is one problem that I've encountered that I would like some
>>>> advice on:
>>>>
>>>> The 'locator' element of the RMAP has a reference to a 'searchPath'
>>>> element which is required to be in the same document. This
>>>> reference is
>>>> using the 'name' attribute of the searchPath. It typically looks like
>>>> this:
>>>>
>>>> <searchPath name="eclipse.platform"> ... </searchPath>
>>>> ...
>>>> <locator pattern="..." searchPathRef="eclipse.platform"/>
>>>>
>>>> I.e. it's not a strict reference per se, it's just a match where
>>>> Locator.searchPathRef == SearchPath.name. Nevertheless, I want to
>>>> model
>>>> this as a 0..1, non-containing reference, from Locator to
>>>> SearchPath so
>>>> that I get all nice lookup functionality etc. that the generated
>>>> editor
>>>> provides. What tweaks do I need to make this happen?
>>>>
>>>> Regards,
>>>> Thomas Hallgren
>>>
>>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:How can i get all parameters of an EObject?
Next Topic:CDO - TransactionTimeout
Goto Forum:
  


Current Time: Thu Apr 25 05:23:11 GMT 2024

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

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

Back to the top