Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Customizing serialized reference formats
Customizing serialized reference formats [message #414490] Thu, 08 November 2007 21:25 Go to next message
Jan Joseph Kratky is currently offline Jan Joseph KratkyFriend
Messages: 19
Registered: July 2009
Junior Member
Hi, I have the same problem described by this poster:

http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg1 7280.html

.... however, I am not generating my ecore from schema. Rather, I am
generating it from a Rational Software Architect model. Is there any
similary clean solution for ensuring that ID/IDREF-like syntax is used
in the serialization of references? I was hoping that something in
ExtendedMetaData would permit me to make type customizations similar to
what Ed describes in his response(s), but I'm not seeing it ...

Thanks!
Re: Customizing serialized reference formats [message #414493 is a reply to message #414490] Thu, 08 November 2007 22:11 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Jan,

I think if you just set isResolveProxies to false on your EReference,
that should be sufficient. If the referenced object has an EAttribute
with isID true, that value will be used as the ID in the reference.


Jan J Kratky wrote:
> Hi, I have the same problem described by this poster:
>
> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg1 7280.html
>
> .... however, I am not generating my ecore from schema. Rather, I am
> generating it from a Rational Software Architect model. Is there any
> similary clean solution for ensuring that ID/IDREF-like syntax is used
> in the serialization of references? I was hoping that something in
> ExtendedMetaData would permit me to make type customizations similar
> to what Ed describes in his response(s), but I'm not seeing it ...
>
> Thanks!


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Customizing serialized reference formats [message #414499 is a reply to message #414493] Fri, 09 November 2007 14:44 Go to previous messageGo to next message
Jan Joseph Kratky is currently offline Jan Joseph KratkyFriend
Messages: 19
Registered: July 2009
Junior Member
Thanks Ed. I should have inferred that from your responses in the thread
I referenced. That gets me most of the way there. However, I am left
with a couple of pesky issues:

1) It seems that, regardless of the value of resolveProxies on the
EReference, the reference values are written out *with* the leading '#'.
Curiously, the deserializer seems able to resolve the references from
the XML regardless of whether the attribute values contain the leading '#'.

2) The ECore profile for RSA models doesn't seem to include the ability
to add any sort of 'isId' stereotype to class attributes in the model.
This seems to mean that I will have to make the changes in the generated
..ecore file. Doing this every time the .ecore is generated could end up
being a bit tedious and error-prone -- would manipulating the EAttribute
and EReference properties in Java code prior to initiating save/load
accomplish the same things? (I've made an attempt at this without success).

Thanks again!


Ed Merks wrote:
> Jan,
>
> I think if you just set isResolveProxies to false on your EReference,
> that should be sufficient. If the referenced object has an EAttribute
> with isID true, that value will be used as the ID in the reference.
>
>
> Jan J Kratky wrote:
>> Hi, I have the same problem described by this poster:
>>
>> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg1 7280.html
>>
>> .... however, I am not generating my ecore from schema. Rather, I am
>> generating it from a Rational Software Architect model. Is there any
>> similary clean solution for ensuring that ID/IDREF-like syntax is used
>> in the serialization of references? I was hoping that something in
>> ExtendedMetaData would permit me to make type customizations similar
>> to what Ed describes in his response(s), but I'm not seeing it ...
>>
>> Thanks!
Re: Customizing serialized reference formats [message #414500 is a reply to message #414499] Fri, 09 November 2007 15:29 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Jan,

Are you using the encoded attribute style option? That has an effect
too. Try removing it.


Jan J Kratky wrote:
> Thanks Ed. I should have inferred that from your responses in the
> thread I referenced. That gets me most of the way there. However, I am
> left with a couple of pesky issues:
>
> 1) It seems that, regardless of the value of resolveProxies on the
> EReference, the reference values are written out *with* the leading
> '#'. Curiously, the deserializer seems able to resolve the references
> from the XML regardless of whether the attribute values contain the
> leading '#'.
>
> 2) The ECore profile for RSA models doesn't seem to include the
> ability to add any sort of 'isId' stereotype to class attributes in
> the model. This seems to mean that I will have to make the changes in
> the generated ..ecore file. Doing this every time the .ecore is
> generated could end up being a bit tedious and error-prone -- would
> manipulating the EAttribute and EReference properties in Java code
> prior to initiating save/load accomplish the same things? (I've made
> an attempt at this without success).
>
> Thanks again!
>
>
> Ed Merks wrote:
>> Jan,
>>
>> I think if you just set isResolveProxies to false on your EReference,
>> that should be sufficient. If the referenced object has an
>> EAttribute with isID true, that value will be used as the ID in the
>> reference.
>>
>>
>> Jan J Kratky wrote:
>>> Hi, I have the same problem described by this poster:
>>>
>>> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg1 7280.html
>>>
>>> .... however, I am not generating my ecore from schema. Rather, I am
>>> generating it from a Rational Software Architect model. Is there any
>>> similary clean solution for ensuring that ID/IDREF-like syntax is
>>> used in the serialization of references? I was hoping that something
>>> in ExtendedMetaData would permit me to make type customizations
>>> similar to what Ed describes in his response(s), but I'm not seeing
>>> it ...
>>>
>>> Thanks!


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Customizing serialized reference formats [message #414506 is a reply to message #414500] Fri, 09 November 2007 16:19 Go to previous messageGo to next message
Jan Joseph Kratky is currently offline Jan Joseph KratkyFriend
Messages: 19
Registered: July 2009
Junior Member
Hi Ed:

No, I'm not aware of having used that option. But I admit that I'm not
quite sure what you're referring to. I don't see any such option on my
..ecore properties for either the EAttribute or the EReference. Do you
mean the option on ECoreXMLSchemaBuilder? How would that ever play a
part when serializing my data instance?

Thanks!


Ed Merks wrote:
> Jan,
>
> Are you using the encoded attribute style option? That has an effect
> too. Try removing it.
>
>
> Jan J Kratky wrote:
>> Thanks Ed. I should have inferred that from your responses in the
>> thread I referenced. That gets me most of the way there. However, I am
>> left with a couple of pesky issues:
>>
>> 1) It seems that, regardless of the value of resolveProxies on the
>> EReference, the reference values are written out *with* the leading
>> '#'. Curiously, the deserializer seems able to resolve the references
>> from the XML regardless of whether the attribute values contain the
>> leading '#'.
>>
>> 2) The ECore profile for RSA models doesn't seem to include the
>> ability to add any sort of 'isId' stereotype to class attributes in
>> the model. This seems to mean that I will have to make the changes in
>> the generated ..ecore file. Doing this every time the .ecore is
>> generated could end up being a bit tedious and error-prone -- would
>> manipulating the EAttribute and EReference properties in Java code
>> prior to initiating save/load accomplish the same things? (I've made
>> an attempt at this without success).
>>
>> Thanks again!
>>
>>
>> Ed Merks wrote:
>>> Jan,
>>>
>>> I think if you just set isResolveProxies to false on your EReference,
>>> that should be sufficient. If the referenced object has an
>>> EAttribute with isID true, that value will be used as the ID in the
>>> reference.
>>>
>>>
>>> Jan J Kratky wrote:
>>>> Hi, I have the same problem described by this poster:
>>>>
>>>> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg1 7280.html
>>>>
>>>> .... however, I am not generating my ecore from schema. Rather, I am
>>>> generating it from a Rational Software Architect model. Is there any
>>>> similary clean solution for ensuring that ID/IDREF-like syntax is
>>>> used in the serialization of references? I was hoping that something
>>>> in ExtendedMetaData would permit me to make type customizations
>>>> similar to what Ed describes in his response(s), but I'm not seeing
>>>> it ...
>>>>
>>>> Thanks!
Re: Customizing serialized reference formats [message #414508 is a reply to message #414506] Fri, 09 November 2007 16:27 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080109030004030301010303
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Jan,

Sorry for being vague. :-(

I'm kind of guessing you are using
XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE because otherwise I'd
expect you'd take this path in XMLSaveImpl and end up down the
saveIDRefSingle branch (there's one like it for MANY as well):

case OBJECT_HREF_SINGLE:
{
if (useEncodedAttributeStyle)
{
saveEObjectSingle(o, f);
continue LOOP;
}
else
{
switch (sameDocSingle(o, f))
{
case SAME_DOC:
{
saveIDRefSingle(o, f);
continue LOOP;
}
case CROSS_DOC:
{
break;
}
default:
{
continue LOOP;
}
}
}
break;
}



Jan J Kratky wrote:
> Hi Ed:
>
> No, I'm not aware of having used that option. But I admit that I'm not
> quite sure what you're referring to. I don't see any such option on my
> ..ecore properties for either the EAttribute or the EReference. Do you
> mean the option on ECoreXMLSchemaBuilder? How would that ever play a
> part when serializing my data instance?
>
> Thanks!
>
>
> Ed Merks wrote:
>> Jan,
>>
>> Are you using the encoded attribute style option? That has an effect
>> too. Try removing it.
>>
>>
>> Jan J Kratky wrote:
>>> Thanks Ed. I should have inferred that from your responses in the
>>> thread I referenced. That gets me most of the way there. However, I
>>> am left with a couple of pesky issues:
>>>
>>> 1) It seems that, regardless of the value of resolveProxies on the
>>> EReference, the reference values are written out *with* the leading
>>> '#'. Curiously, the deserializer seems able to resolve the
>>> references from the XML regardless of whether the attribute values
>>> contain the leading '#'.
>>>
>>> 2) The ECore profile for RSA models doesn't seem to include the
>>> ability to add any sort of 'isId' stereotype to class attributes in
>>> the model. This seems to mean that I will have to make the changes
>>> in the generated ..ecore file. Doing this every time the .ecore is
>>> generated could end up being a bit tedious and error-prone -- would
>>> manipulating the EAttribute and EReference properties in Java code
>>> prior to initiating save/load accomplish the same things? (I've made
>>> an attempt at this without success).
>>>
>>> Thanks again!
>>>
>>>
>>> Ed Merks wrote:
>>>> Jan,
>>>>
>>>> I think if you just set isResolveProxies to false on your
>>>> EReference, that should be sufficient. If the referenced object
>>>> has an EAttribute with isID true, that value will be used as the ID
>>>> in the reference.
>>>>
>>>>
>>>> Jan J Kratky wrote:
>>>>> Hi, I have the same problem described by this poster:
>>>>>
>>>>> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg1 7280.html
>>>>>
>>>>> .... however, I am not generating my ecore from schema. Rather, I
>>>>> am generating it from a Rational Software Architect model. Is
>>>>> there any similary clean solution for ensuring that ID/IDREF-like
>>>>> syntax is used in the serialization of references? I was hoping
>>>>> that something in ExtendedMetaData would permit me to make type
>>>>> customizations similar to what Ed describes in his response(s),
>>>>> but I'm not seeing it ...
>>>>>
>>>>> Thanks!


--------------080109030004030301010303
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Jan,<br>
<br>
Sorry for being vague. :-(<br>
<br>
I'm kind of guessing you are using
XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE because otherwise I'd
expect you'd take this path in XMLSaveImpl and end up down the
saveIDRefSingle branch (there's one like it for MANY as well):<br>
<br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case OBJECT_HREF_SINGLE:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (useEncodedAttributeStyle)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; saveEObjectSingle(o, f);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; continue LOOP;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; switch (sameDocSingle(o, f))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case SAME_DOC:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; saveIDRefSingle(o, f);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; continue LOOP;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case CROSS_DOC:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; default:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; continue LOOP;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
</small><br>
<br>
<br>
Jan J Kratky wrote:
<blockquote cite="mid:fh21a3$p1f$1@build.eclipse.org" type="cite">Hi
Ed:
<br>
<br>
No, I'm not aware of having used that option. But I admit that I'm not
quite sure what you're referring to. I don't see any such option on my
...ecore properties for either the EAttribute or the EReference. Do you
mean the option on ECoreXMLSchemaBuilder? How would that ever play a
part when serializing my data instance?
<br>
<br>
Thanks!
<br>
<br>
<br>
Ed Merks wrote:
<br>
<blockquote type="cite">Jan,
<br>
<br>
Are you using the encoded attribute style option?&nbsp; That has an effect
too.&nbsp; Try removing it.
<br>
<br>
<br>
Jan J Kratky wrote:
<br>
<blockquote type="cite">Thanks Ed. I should have inferred that from
your responses in the thread I referenced. That gets me most of the way
there. However, I am left with a couple of pesky issues:
<br>
<br>
1) It seems that, regardless of the value of resolveProxies on the
EReference, the reference values are written out *with* the leading
'#'. Curiously, the deserializer seems able to resolve the references
from the XML regardless of whether the attribute values contain the
leading '#'.
<br>
<br>
2) The ECore profile for RSA models doesn't seem to include the ability
to add any sort of 'isId' stereotype to class attributes in the model.
This seems to mean that I will have to make the changes in the
generated ..ecore file. Doing this every time the .ecore is generated
could end up being a bit tedious and error-prone -- would manipulating
the EAttribute and EReference properties in Java code prior to
initiating save/load accomplish the same things? (I've made an attempt
at this without success).
<br>
<br>
Thanks again!
<br>
<br>
<br>
Ed Merks wrote:
<br>
<blockquote type="cite">Jan,
<br>
<br>
I think if you just set isResolveProxies to false on your EReference,
that should be sufficient.&nbsp; If the referenced object has an EAttribute
with isID true, that value will be used as the ID in the reference.
<br>
<br>
<br>
Jan J Kratky wrote:
<br>
<blockquote type="cite">Hi, I have the same problem described
by this poster:
<br>
<br>
<a class="moz-txt-link-freetext" href=" http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg1 7280.html"> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg1 7280.html</a>
<br>
<br>
..... however, I am not generating my ecore from schema. Rather, I am
generating it from a Rational Software Architect model. Is there any
similary clean solution for ensuring that ID/IDREF-like syntax is used
in the serialization of references? I was hoping that something in
ExtendedMetaData would permit me to make type customizations similar to
what Ed describes in his response(s), but I'm not seeing it ...
<br>
<br>
Thanks!
<br>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<br>
</body>
</html>

--------------080109030004030301010303--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Customizing serialized reference formats [message #414510 is a reply to message #414508] Fri, 09 November 2007 17:29 Go to previous messageGo to next message
Jan Joseph Kratky is currently offline Jan Joseph KratkyFriend
Messages: 19
Registered: July 2009
Junior Member
Thanks, Ed! By explicitly setting that option to false, I get the result
I want. I had not set the option explicitly to true before, but it's
clear in the debugger that the 'useEncodedAttributeStyle' value was
being set to true.

That leaves just one nit -- my question 2) below. I've tried (in my Java
code) setting ID to true on the EAttribute and setting resolveProxies to
false on the EReference before invoking serialization/deserialization.
It seems to have no effect. Any thoughts on how to enable the ID/IDREF
style without explicitly setting these properties in my .ecore file
every time I regenerate it?



Ed Merks wrote:
> Jan,
>
> Sorry for being vague. :-(
>
> I'm kind of guessing you are using
> XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE because otherwise I'd
> expect you'd take this path in XMLSaveImpl and end up down the
> saveIDRefSingle branch (there's one like it for MANY as well):
>
> case OBJECT_HREF_SINGLE:
> {
> if (useEncodedAttributeStyle)
> {
> saveEObjectSingle(o, f);
> continue LOOP;
> }
> else
> {
> switch (sameDocSingle(o, f))
> {
> case SAME_DOC:
> {
> saveIDRefSingle(o, f);
> continue LOOP;
> }
> case CROSS_DOC:
> {
> break;
> }
> default:
> {
> continue LOOP;
> }
> }
> }
> break;
> }
>
>
>
> Jan J Kratky wrote:
>> Hi Ed:
>>
>> No, I'm not aware of having used that option. But I admit that I'm not
>> quite sure what you're referring to. I don't see any such option on my
>> ..ecore properties for either the EAttribute or the EReference. Do you
>> mean the option on ECoreXMLSchemaBuilder? How would that ever play a
>> part when serializing my data instance?
>>
>> Thanks!
>>
>>
>> Ed Merks wrote:
>>> Jan,
>>>
>>> Are you using the encoded attribute style option? That has an effect
>>> too. Try removing it.
>>>
>>>
>>> Jan J Kratky wrote:
>>>> Thanks Ed. I should have inferred that from your responses in the
>>>> thread I referenced. That gets me most of the way there. However, I
>>>> am left with a couple of pesky issues:
>>>>
>>>> 1) It seems that, regardless of the value of resolveProxies on the
>>>> EReference, the reference values are written out *with* the leading
>>>> '#'. Curiously, the deserializer seems able to resolve the
>>>> references from the XML regardless of whether the attribute values
>>>> contain the leading '#'.
>>>>
>>>> 2) The ECore profile for RSA models doesn't seem to include the
>>>> ability to add any sort of 'isId' stereotype to class attributes in
>>>> the model. This seems to mean that I will have to make the changes
>>>> in the generated ..ecore file. Doing this every time the .ecore is
>>>> generated could end up being a bit tedious and error-prone -- would
>>>> manipulating the EAttribute and EReference properties in Java code
>>>> prior to initiating save/load accomplish the same things? (I've made
>>>> an attempt at this without success).
>>>>
>>>> Thanks again!
>>>>
>>>>
>>>> Ed Merks wrote:
>>>>> Jan,
>>>>>
>>>>> I think if you just set isResolveProxies to false on your
>>>>> EReference, that should be sufficient. If the referenced object
>>>>> has an EAttribute with isID true, that value will be used as the ID
>>>>> in the reference.
>>>>>
>>>>>
>>>>> Jan J Kratky wrote:
>>>>>> Hi, I have the same problem described by this poster:
>>>>>>
>>>>>> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg1 7280.html
>>>>>>
>>>>>> .... however, I am not generating my ecore from schema. Rather, I
>>>>>> am generating it from a Rational Software Architect model. Is
>>>>>> there any similary clean solution for ensuring that ID/IDREF-like
>>>>>> syntax is used in the serialization of references? I was hoping
>>>>>> that something in ExtendedMetaData would permit me to make type
>>>>>> customizations similar to what Ed describes in his response(s),
>>>>>> but I'm not seeing it ...
>>>>>>
>>>>>> Thanks!
>
Re: Customizing serialized reference formats [message #414512 is a reply to message #414510] Fri, 09 November 2007 22:44 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Jan,

Do you know which resource factory impl is being used to create your
resource? The resource factory sets the options when it creates the
resource, so you'd typically modify the generated one for that.
There's a GenPackage option for controlling what type of resource
factory to generate. I'm not sure how that's set in your case. (Note
that the plugin.xml will not update, so if you generate a resource
factory when you didn't have one before, you have to delete it and
regenerate it or update it by hand.)


Jan J Kratky wrote:
> Thanks, Ed! By explicitly setting that option to false, I get the
> result I want. I had not set the option explicitly to true before, but
> it's clear in the debugger that the 'useEncodedAttributeStyle' value
> was being set to true.
>
> That leaves just one nit -- my question 2) below. I've tried (in my
> Java code) setting ID to true on the EAttribute and setting
> resolveProxies to false on the EReference before invoking
> serialization/deserialization. It seems to have no effect. Any
> thoughts on how to enable the ID/IDREF style without explicitly
> setting these properties in my .ecore file every time I regenerate it?
>
>
>
> Ed Merks wrote:
>> Jan,
>>
>> Sorry for being vague. :-(
>>
>> I'm kind of guessing you are using
>> XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE because otherwise I'd
>> expect you'd take this path in XMLSaveImpl and end up down the
>> saveIDRefSingle branch (there's one like it for MANY as well):
>>
>> case OBJECT_HREF_SINGLE:
>> {
>> if (useEncodedAttributeStyle)
>> {
>> saveEObjectSingle(o, f);
>> continue LOOP;
>> }
>> else
>> {
>> switch (sameDocSingle(o, f))
>> {
>> case SAME_DOC:
>> {
>> saveIDRefSingle(o, f);
>> continue LOOP;
>> }
>> case CROSS_DOC:
>> {
>> break;
>> }
>> default:
>> {
>> continue LOOP;
>> }
>> }
>> }
>> break;
>> }
>>
>>
>>
>> Jan J Kratky wrote:
>>> Hi Ed:
>>>
>>> No, I'm not aware of having used that option. But I admit that I'm
>>> not quite sure what you're referring to. I don't see any such option
>>> on my ..ecore properties for either the EAttribute or the
>>> EReference. Do you mean the option on ECoreXMLSchemaBuilder? How
>>> would that ever play a part when serializing my data instance?
>>>
>>> Thanks!
>>>
>>>
>>> Ed Merks wrote:
>>>> Jan,
>>>>
>>>> Are you using the encoded attribute style option? That has an
>>>> effect too. Try removing it.
>>>>
>>>>
>>>> Jan J Kratky wrote:
>>>>> Thanks Ed. I should have inferred that from your responses in the
>>>>> thread I referenced. That gets me most of the way there. However,
>>>>> I am left with a couple of pesky issues:
>>>>>
>>>>> 1) It seems that, regardless of the value of resolveProxies on the
>>>>> EReference, the reference values are written out *with* the
>>>>> leading '#'. Curiously, the deserializer seems able to resolve the
>>>>> references from the XML regardless of whether the attribute values
>>>>> contain the leading '#'.
>>>>>
>>>>> 2) The ECore profile for RSA models doesn't seem to include the
>>>>> ability to add any sort of 'isId' stereotype to class attributes
>>>>> in the model. This seems to mean that I will have to make the
>>>>> changes in the generated ..ecore file. Doing this every time the
>>>>> .ecore is generated could end up being a bit tedious and
>>>>> error-prone -- would manipulating the EAttribute and EReference
>>>>> properties in Java code prior to initiating save/load accomplish
>>>>> the same things? (I've made an attempt at this without success).
>>>>>
>>>>> Thanks again!
>>>>>
>>>>>
>>>>> Ed Merks wrote:
>>>>>> Jan,
>>>>>>
>>>>>> I think if you just set isResolveProxies to false on your
>>>>>> EReference, that should be sufficient. If the referenced object
>>>>>> has an EAttribute with isID true, that value will be used as the
>>>>>> ID in the reference.
>>>>>>
>>>>>>
>>>>>> Jan J Kratky wrote:
>>>>>>> Hi, I have the same problem described by this poster:
>>>>>>>
>>>>>>> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg1 7280.html
>>>>>>>
>>>>>>>
>>>>>>> .... however, I am not generating my ecore from schema. Rather,
>>>>>>> I am generating it from a Rational Software Architect model. Is
>>>>>>> there any similary clean solution for ensuring that
>>>>>>> ID/IDREF-like syntax is used in the serialization of references?
>>>>>>> I was hoping that something in ExtendedMetaData would permit me
>>>>>>> to make type customizations similar to what Ed describes in his
>>>>>>> response(s), but I'm not seeing it ...
>>>>>>>
>>>>>>> Thanks!
>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Customizing serialized reference formats [message #414513 is a reply to message #414512] Fri, 09 November 2007 22:45 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Jan,

I guess I didn't answer all of your question. Are you defining your
model in UML? It sounds like RAD has some missing features or perhaps
some features you haven't noticed. You're using an Ecore profile?


Ed Merks wrote:
> Jan,
>
> Do you know which resource factory impl is being used to create your
> resource? The resource factory sets the options when it creates the
> resource, so you'd typically modify the generated one for that.
> There's a GenPackage option for controlling what type of resource
> factory to generate. I'm not sure how that's set in your case. (Note
> that the plugin.xml will not update, so if you generate a resource
> factory when you didn't have one before, you have to delete it and
> regenerate it or update it by hand.)
>
>
> Jan J Kratky wrote:
>> Thanks, Ed! By explicitly setting that option to false, I get the
>> result I want. I had not set the option explicitly to true before,
>> but it's clear in the debugger that the 'useEncodedAttributeStyle'
>> value was being set to true.
>>
>> That leaves just one nit -- my question 2) below. I've tried (in my
>> Java code) setting ID to true on the EAttribute and setting
>> resolveProxies to false on the EReference before invoking
>> serialization/deserialization. It seems to have no effect. Any
>> thoughts on how to enable the ID/IDREF style without explicitly
>> setting these properties in my .ecore file every time I regenerate it?
>>
>>
>>
>> Ed Merks wrote:
>>> Jan,
>>>
>>> Sorry for being vague. :-(
>>>
>>> I'm kind of guessing you are using
>>> XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE because otherwise I'd
>>> expect you'd take this path in XMLSaveImpl and end up down the
>>> saveIDRefSingle branch (there's one like it for MANY as well):
>>>
>>> case OBJECT_HREF_SINGLE:
>>> {
>>> if (useEncodedAttributeStyle)
>>> {
>>> saveEObjectSingle(o, f);
>>> continue LOOP;
>>> }
>>> else
>>> {
>>> switch (sameDocSingle(o, f))
>>> {
>>> case SAME_DOC:
>>> {
>>> saveIDRefSingle(o, f);
>>> continue LOOP;
>>> }
>>> case CROSS_DOC:
>>> {
>>> break;
>>> }
>>> default:
>>> {
>>> continue LOOP;
>>> }
>>> }
>>> }
>>> break;
>>> }
>>>
>>>
>>>
>>> Jan J Kratky wrote:
>>>> Hi Ed:
>>>>
>>>> No, I'm not aware of having used that option. But I admit that I'm
>>>> not quite sure what you're referring to. I don't see any such
>>>> option on my ..ecore properties for either the EAttribute or the
>>>> EReference. Do you mean the option on ECoreXMLSchemaBuilder? How
>>>> would that ever play a part when serializing my data instance?
>>>>
>>>> Thanks!
>>>>
>>>>
>>>> Ed Merks wrote:
>>>>> Jan,
>>>>>
>>>>> Are you using the encoded attribute style option? That has an
>>>>> effect too. Try removing it.
>>>>>
>>>>>
>>>>> Jan J Kratky wrote:
>>>>>> Thanks Ed. I should have inferred that from your responses in the
>>>>>> thread I referenced. That gets me most of the way there. However,
>>>>>> I am left with a couple of pesky issues:
>>>>>>
>>>>>> 1) It seems that, regardless of the value of resolveProxies on
>>>>>> the EReference, the reference values are written out *with* the
>>>>>> leading '#'. Curiously, the deserializer seems able to resolve
>>>>>> the references from the XML regardless of whether the attribute
>>>>>> values contain the leading '#'.
>>>>>>
>>>>>> 2) The ECore profile for RSA models doesn't seem to include the
>>>>>> ability to add any sort of 'isId' stereotype to class attributes
>>>>>> in the model. This seems to mean that I will have to make the
>>>>>> changes in the generated ..ecore file. Doing this every time the
>>>>>> .ecore is generated could end up being a bit tedious and
>>>>>> error-prone -- would manipulating the EAttribute and EReference
>>>>>> properties in Java code prior to initiating save/load accomplish
>>>>>> the same things? (I've made an attempt at this without success).
>>>>>>
>>>>>> Thanks again!
>>>>>>
>>>>>>
>>>>>> Ed Merks wrote:
>>>>>>> Jan,
>>>>>>>
>>>>>>> I think if you just set isResolveProxies to false on your
>>>>>>> EReference, that should be sufficient. If the referenced object
>>>>>>> has an EAttribute with isID true, that value will be used as the
>>>>>>> ID in the reference.
>>>>>>>
>>>>>>>
>>>>>>> Jan J Kratky wrote:
>>>>>>>> Hi, I have the same problem described by this poster:
>>>>>>>>
>>>>>>>> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg1 7280.html
>>>>>>>>
>>>>>>>>
>>>>>>>> .... however, I am not generating my ecore from schema. Rather,
>>>>>>>> I am generating it from a Rational Software Architect model. Is
>>>>>>>> there any similary clean solution for ensuring that
>>>>>>>> ID/IDREF-like syntax is used in the serialization of
>>>>>>>> references? I was hoping that something in ExtendedMetaData
>>>>>>>> would permit me to make type customizations similar to what Ed
>>>>>>>> describes in his response(s), but I'm not seeing it ...
>>>>>>>>
>>>>>>>> Thanks!
>>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Customizing serialized reference formats [message #414550 is a reply to message #414513] Mon, 12 November 2007 16:59 Go to previous messageGo to next message
Jan Joseph Kratky is currently offline Jan Joseph KratkyFriend
Messages: 19
Registered: July 2009
Junior Member
Hi Ed:

I'm using RSA 7.0.0, and yes, my model is defined in UML (their .emx
format). There is an ECore profile bundled with RSA. When I import it
into my model, it makes only two stereotypes available on attributes:
boolean 'EAttribute' and 'EReference'. If 'id' and 'resolveProxies'
stereotypes were made available, then I guess we'd be in business.

P.S. In response to your other question, I'm using
XMLResourceFactoryImpl. Do you have a different suggestion?



Ed Merks wrote:
> Jan,
>
> I guess I didn't answer all of your question. Are you defining your
> model in UML? It sounds like RAD has some missing features or perhaps
> some features you haven't noticed. You're using an Ecore profile?
>
>
> Ed Merks wrote:
>> Jan,
>>
>> Do you know which resource factory impl is being used to create your
>> resource? The resource factory sets the options when it creates the
>> resource, so you'd typically modify the generated one for that.
>> There's a GenPackage option for controlling what type of resource
>> factory to generate. I'm not sure how that's set in your case. (Note
>> that the plugin.xml will not update, so if you generate a resource
>> factory when you didn't have one before, you have to delete it and
>> regenerate it or update it by hand.)
>>
>>
>> Jan J Kratky wrote:
>>> Thanks, Ed! By explicitly setting that option to false, I get the
>>> result I want. I had not set the option explicitly to true before,
>>> but it's clear in the debugger that the 'useEncodedAttributeStyle'
>>> value was being set to true.
>>>
>>> That leaves just one nit -- my question 2) below. I've tried (in my
>>> Java code) setting ID to true on the EAttribute and setting
>>> resolveProxies to false on the EReference before invoking
>>> serialization/deserialization. It seems to have no effect. Any
>>> thoughts on how to enable the ID/IDREF style without explicitly
>>> setting these properties in my .ecore file every time I regenerate it?
>>>
>>>
>>>
>>> Ed Merks wrote:
>>>> Jan,
>>>>
>>>> Sorry for being vague. :-(
>>>>
>>>> I'm kind of guessing you are using
>>>> XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE because otherwise I'd
>>>> expect you'd take this path in XMLSaveImpl and end up down the
>>>> saveIDRefSingle branch (there's one like it for MANY as well):
>>>>
>>>> case OBJECT_HREF_SINGLE:
>>>> {
>>>> if (useEncodedAttributeStyle)
>>>> {
>>>> saveEObjectSingle(o, f);
>>>> continue LOOP;
>>>> }
>>>> else
>>>> {
>>>> switch (sameDocSingle(o, f))
>>>> {
>>>> case SAME_DOC:
>>>> {
>>>> saveIDRefSingle(o, f);
>>>> continue LOOP;
>>>> }
>>>> case CROSS_DOC:
>>>> {
>>>> break;
>>>> }
>>>> default:
>>>> {
>>>> continue LOOP;
>>>> }
>>>> }
>>>> }
>>>> break;
>>>> }
>>>>
>>>>
>>>>
>>>> Jan J Kratky wrote:
>>>>> Hi Ed:
>>>>>
>>>>> No, I'm not aware of having used that option. But I admit that I'm
>>>>> not quite sure what you're referring to. I don't see any such
>>>>> option on my ..ecore properties for either the EAttribute or the
>>>>> EReference. Do you mean the option on ECoreXMLSchemaBuilder? How
>>>>> would that ever play a part when serializing my data instance?
>>>>>
>>>>> Thanks!
>>>>>
>>>>>
>>>>> Ed Merks wrote:
>>>>>> Jan,
>>>>>>
>>>>>> Are you using the encoded attribute style option? That has an
>>>>>> effect too. Try removing it.
>>>>>>
>>>>>>
>>>>>> Jan J Kratky wrote:
>>>>>>> Thanks Ed. I should have inferred that from your responses in the
>>>>>>> thread I referenced. That gets me most of the way there. However,
>>>>>>> I am left with a couple of pesky issues:
>>>>>>>
>>>>>>> 1) It seems that, regardless of the value of resolveProxies on
>>>>>>> the EReference, the reference values are written out *with* the
>>>>>>> leading '#'. Curiously, the deserializer seems able to resolve
>>>>>>> the references from the XML regardless of whether the attribute
>>>>>>> values contain the leading '#'.
>>>>>>>
>>>>>>> 2) The ECore profile for RSA models doesn't seem to include the
>>>>>>> ability to add any sort of 'isId' stereotype to class attributes
>>>>>>> in the model. This seems to mean that I will have to make the
>>>>>>> changes in the generated ..ecore file. Doing this every time the
>>>>>>> .ecore is generated could end up being a bit tedious and
>>>>>>> error-prone -- would manipulating the EAttribute and EReference
>>>>>>> properties in Java code prior to initiating save/load accomplish
>>>>>>> the same things? (I've made an attempt at this without success).
>>>>>>>
>>>>>>> Thanks again!
>>>>>>>
>>>>>>>
>>>>>>> Ed Merks wrote:
>>>>>>>> Jan,
>>>>>>>>
>>>>>>>> I think if you just set isResolveProxies to false on your
>>>>>>>> EReference, that should be sufficient. If the referenced object
>>>>>>>> has an EAttribute with isID true, that value will be used as the
>>>>>>>> ID in the reference.
>>>>>>>>
>>>>>>>>
>>>>>>>> Jan J Kratky wrote:
>>>>>>>>> Hi, I have the same problem described by this poster:
>>>>>>>>>
>>>>>>>>> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg1 7280.html
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> .... however, I am not generating my ecore from schema. Rather,
>>>>>>>>> I am generating it from a Rational Software Architect model. Is
>>>>>>>>> there any similary clean solution for ensuring that
>>>>>>>>> ID/IDREF-like syntax is used in the serialization of
>>>>>>>>> references? I was hoping that something in ExtendedMetaData
>>>>>>>>> would permit me to make type customizations similar to what Ed
>>>>>>>>> describes in his response(s), but I'm not seeing it ...
>>>>>>>>>
>>>>>>>>> Thanks!
>>>>
Re: Customizing serialized reference formats [message #414551 is a reply to message #414550] Mon, 12 November 2007 17:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Jan,

I can't do anything about missing things from the profiles. I think the
more recent stuff uses UML2 more directly and I'm pretty sure their
Ecore profile is more complete. XMLResourceFactoryImpl doesn't set
XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE so where is that
setting coming from?


Jan J Kratky wrote:
> Hi Ed:
>
> I'm using RSA 7.0.0, and yes, my model is defined in UML (their .emx
> format). There is an ECore profile bundled with RSA. When I import it
> into my model, it makes only two stereotypes available on attributes:
> boolean 'EAttribute' and 'EReference'. If 'id' and 'resolveProxies'
> stereotypes were made available, then I guess we'd be in business.
>
> P.S. In response to your other question, I'm using
> XMLResourceFactoryImpl. Do you have a different suggestion?
>
>
>
> Ed Merks wrote:
>> Jan,
>>
>> I guess I didn't answer all of your question. Are you defining your
>> model in UML? It sounds like RAD has some missing features or
>> perhaps some features you haven't noticed. You're using an Ecore
>> profile?
>>
>>
>> Ed Merks wrote:
>>> Jan,
>>>
>>> Do you know which resource factory impl is being used to create your
>>> resource? The resource factory sets the options when it creates the
>>> resource, so you'd typically modify the generated one for that.
>>> There's a GenPackage option for controlling what type of resource
>>> factory to generate. I'm not sure how that's set in your case.
>>> (Note that the plugin.xml will not update, so if you generate a
>>> resource factory when you didn't have one before, you have to delete
>>> it and regenerate it or update it by hand.)
>>>
>>>
>>> Jan J Kratky wrote:
>>>> Thanks, Ed! By explicitly setting that option to false, I get the
>>>> result I want. I had not set the option explicitly to true before,
>>>> but it's clear in the debugger that the 'useEncodedAttributeStyle'
>>>> value was being set to true.
>>>>
>>>> That leaves just one nit -- my question 2) below. I've tried (in my
>>>> Java code) setting ID to true on the EAttribute and setting
>>>> resolveProxies to false on the EReference before invoking
>>>> serialization/deserialization. It seems to have no effect. Any
>>>> thoughts on how to enable the ID/IDREF style without explicitly
>>>> setting these properties in my .ecore file every time I regenerate it?
>>>>
>>>>
>>>>
>>>> Ed Merks wrote:
>>>>> Jan,
>>>>>
>>>>> Sorry for being vague. :-(
>>>>>
>>>>> I'm kind of guessing you are using
>>>>> XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE because otherwise
>>>>> I'd expect you'd take this path in XMLSaveImpl and end up down the
>>>>> saveIDRefSingle branch (there's one like it for MANY as well):
>>>>>
>>>>> case OBJECT_HREF_SINGLE:
>>>>> {
>>>>> if (useEncodedAttributeStyle)
>>>>> {
>>>>> saveEObjectSingle(o, f);
>>>>> continue LOOP;
>>>>> }
>>>>> else
>>>>> {
>>>>> switch (sameDocSingle(o, f))
>>>>> {
>>>>> case SAME_DOC:
>>>>> {
>>>>> saveIDRefSingle(o, f);
>>>>> continue LOOP;
>>>>> }
>>>>> case CROSS_DOC:
>>>>> {
>>>>> break;
>>>>> }
>>>>> default:
>>>>> {
>>>>> continue LOOP;
>>>>> }
>>>>> }
>>>>> }
>>>>> break;
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>> Jan J Kratky wrote:
>>>>>> Hi Ed:
>>>>>>
>>>>>> No, I'm not aware of having used that option. But I admit that
>>>>>> I'm not quite sure what you're referring to. I don't see any such
>>>>>> option on my ..ecore properties for either the EAttribute or the
>>>>>> EReference. Do you mean the option on ECoreXMLSchemaBuilder? How
>>>>>> would that ever play a part when serializing my data instance?
>>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>>
>>>>>> Ed Merks wrote:
>>>>>>> Jan,
>>>>>>>
>>>>>>> Are you using the encoded attribute style option? That has an
>>>>>>> effect too. Try removing it.
>>>>>>>
>>>>>>>
>>>>>>> Jan J Kratky wrote:
>>>>>>>> Thanks Ed. I should have inferred that from your responses in
>>>>>>>> the thread I referenced. That gets me most of the way there.
>>>>>>>> However, I am left with a couple of pesky issues:
>>>>>>>>
>>>>>>>> 1) It seems that, regardless of the value of resolveProxies on
>>>>>>>> the EReference, the reference values are written out *with* the
>>>>>>>> leading '#'. Curiously, the deserializer seems able to resolve
>>>>>>>> the references from the XML regardless of whether the attribute
>>>>>>>> values contain the leading '#'.
>>>>>>>>
>>>>>>>> 2) The ECore profile for RSA models doesn't seem to include the
>>>>>>>> ability to add any sort of 'isId' stereotype to class
>>>>>>>> attributes in the model. This seems to mean that I will have to
>>>>>>>> make the changes in the generated ..ecore file. Doing this
>>>>>>>> every time the .ecore is generated could end up being a bit
>>>>>>>> tedious and error-prone -- would manipulating the EAttribute
>>>>>>>> and EReference properties in Java code prior to initiating
>>>>>>>> save/load accomplish the same things? (I've made an attempt at
>>>>>>>> this without success).
>>>>>>>>
>>>>>>>> Thanks again!
>>>>>>>>
>>>>>>>>
>>>>>>>> Ed Merks wrote:
>>>>>>>>> Jan,
>>>>>>>>>
>>>>>>>>> I think if you just set isResolveProxies to false on your
>>>>>>>>> EReference, that should be sufficient. If the referenced
>>>>>>>>> object has an EAttribute with isID true, that value will be
>>>>>>>>> used as the ID in the reference.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Jan J Kratky wrote:
>>>>>>>>>> Hi, I have the same problem described by this poster:
>>>>>>>>>>
>>>>>>>>>> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg1 7280.html
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> .... however, I am not generating my ecore from schema.
>>>>>>>>>> Rather, I am generating it from a Rational Software Architect
>>>>>>>>>> model. Is there any similary clean solution for ensuring that
>>>>>>>>>> ID/IDREF-like syntax is used in the serialization of
>>>>>>>>>> references? I was hoping that something in ExtendedMetaData
>>>>>>>>>> would permit me to make type customizations similar to what
>>>>>>>>>> Ed describes in his response(s), but I'm not seeing it ...
>>>>>>>>>>
>>>>>>>>>> Thanks!
>>>>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Customizing serialized reference formats [message #414568 is a reply to message #414551] Tue, 13 November 2007 14:09 Go to previous messageGo to next message
Jan Joseph Kratky is currently offline Jan Joseph KratkyFriend
Messages: 19
Registered: July 2009
Junior Member
Hi Ed:

The default save options, when merged into the explicitly-specified
options, contain the value
{XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, true}. The setting of
this value happens in ECoreResourceFactoryImpl#createResource(URI) the
first time I grab the eInstance of my generated EPackage class. I am of
course grabbing the eInstance prior to load in order to access
EClassifiers and EStructuralFeatures to which I set ExtendedMetaData.

As for the profile, I figured as much ... thought I'd go fishing for a
solution anyhow :). I'm still a little puzzled as to why it doesn't work
when I manipulate the relevant ID and resolveProxies properties directly
from within my Java code, but I'll keep exploring that ...


Ed Merks wrote:
> Jan,
>
> I can't do anything about missing things from the profiles. I think the
> more recent stuff uses UML2 more directly and I'm pretty sure their
> Ecore profile is more complete. XMLResourceFactoryImpl doesn't set
> XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE so where is that
> setting coming from?
>
>
> Jan J Kratky wrote:
>> Hi Ed:
>>
>> I'm using RSA 7.0.0, and yes, my model is defined in UML (their .emx
>> format). There is an ECore profile bundled with RSA. When I import it
>> into my model, it makes only two stereotypes available on attributes:
>> boolean 'EAttribute' and 'EReference'. If 'id' and 'resolveProxies'
>> stereotypes were made available, then I guess we'd be in business.
>>
>> P.S. In response to your other question, I'm using
>> XMLResourceFactoryImpl. Do you have a different suggestion?
>>
>>
>>
>> Ed Merks wrote:
>>> Jan,
>>>
>>> I guess I didn't answer all of your question. Are you defining your
>>> model in UML? It sounds like RAD has some missing features or
>>> perhaps some features you haven't noticed. You're using an Ecore
>>> profile?
>>>
>>>
>>> Ed Merks wrote:
>>>> Jan,
>>>>
>>>> Do you know which resource factory impl is being used to create your
>>>> resource? The resource factory sets the options when it creates the
>>>> resource, so you'd typically modify the generated one for that.
>>>> There's a GenPackage option for controlling what type of resource
>>>> factory to generate. I'm not sure how that's set in your case.
>>>> (Note that the plugin.xml will not update, so if you generate a
>>>> resource factory when you didn't have one before, you have to delete
>>>> it and regenerate it or update it by hand.)
>>>>
>>>>
>>>> Jan J Kratky wrote:
>>>>> Thanks, Ed! By explicitly setting that option to false, I get the
>>>>> result I want. I had not set the option explicitly to true before,
>>>>> but it's clear in the debugger that the 'useEncodedAttributeStyle'
>>>>> value was being set to true.
>>>>>
>>>>> That leaves just one nit -- my question 2) below. I've tried (in my
>>>>> Java code) setting ID to true on the EAttribute and setting
>>>>> resolveProxies to false on the EReference before invoking
>>>>> serialization/deserialization. It seems to have no effect. Any
>>>>> thoughts on how to enable the ID/IDREF style without explicitly
>>>>> setting these properties in my .ecore file every time I regenerate it?
>>>>>
>>>>>
>>>>>
>>>>> Ed Merks wrote:
>>>>>> Jan,
>>>>>>
>>>>>> Sorry for being vague. :-(
>>>>>>
>>>>>> I'm kind of guessing you are using
>>>>>> XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE because otherwise
>>>>>> I'd expect you'd take this path in XMLSaveImpl and end up down the
>>>>>> saveIDRefSingle branch (there's one like it for MANY as well):
>>>>>>
>>>>>> case OBJECT_HREF_SINGLE:
>>>>>> {
>>>>>> if (useEncodedAttributeStyle)
>>>>>> {
>>>>>> saveEObjectSingle(o, f);
>>>>>> continue LOOP;
>>>>>> }
>>>>>> else
>>>>>> {
>>>>>> switch (sameDocSingle(o, f))
>>>>>> {
>>>>>> case SAME_DOC:
>>>>>> {
>>>>>> saveIDRefSingle(o, f);
>>>>>> continue LOOP;
>>>>>> }
>>>>>> case CROSS_DOC:
>>>>>> {
>>>>>> break;
>>>>>> }
>>>>>> default:
>>>>>> {
>>>>>> continue LOOP;
>>>>>> }
>>>>>> }
>>>>>> }
>>>>>> break;
>>>>>> }
>>>>>>
>>>>>>
>>>>>>
>>>>>> Jan J Kratky wrote:
>>>>>>> Hi Ed:
>>>>>>>
>>>>>>> No, I'm not aware of having used that option. But I admit that
>>>>>>> I'm not quite sure what you're referring to. I don't see any such
>>>>>>> option on my ..ecore properties for either the EAttribute or the
>>>>>>> EReference. Do you mean the option on ECoreXMLSchemaBuilder? How
>>>>>>> would that ever play a part when serializing my data instance?
>>>>>>>
>>>>>>> Thanks!
>>>>>>>
>>>>>>>
>>>>>>> Ed Merks wrote:
>>>>>>>> Jan,
>>>>>>>>
>>>>>>>> Are you using the encoded attribute style option? That has an
>>>>>>>> effect too. Try removing it.
>>>>>>>>
>>>>>>>>
>>>>>>>> Jan J Kratky wrote:
>>>>>>>>> Thanks Ed. I should have inferred that from your responses in
>>>>>>>>> the thread I referenced. That gets me most of the way there.
>>>>>>>>> However, I am left with a couple of pesky issues:
>>>>>>>>>
>>>>>>>>> 1) It seems that, regardless of the value of resolveProxies on
>>>>>>>>> the EReference, the reference values are written out *with* the
>>>>>>>>> leading '#'. Curiously, the deserializer seems able to resolve
>>>>>>>>> the references from the XML regardless of whether the attribute
>>>>>>>>> values contain the leading '#'.
>>>>>>>>>
>>>>>>>>> 2) The ECore profile for RSA models doesn't seem to include the
>>>>>>>>> ability to add any sort of 'isId' stereotype to class
>>>>>>>>> attributes in the model. This seems to mean that I will have to
>>>>>>>>> make the changes in the generated ..ecore file. Doing this
>>>>>>>>> every time the .ecore is generated could end up being a bit
>>>>>>>>> tedious and error-prone -- would manipulating the EAttribute
>>>>>>>>> and EReference properties in Java code prior to initiating
>>>>>>>>> save/load accomplish the same things? (I've made an attempt at
>>>>>>>>> this without success).
>>>>>>>>>
>>>>>>>>> Thanks again!
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Ed Merks wrote:
>>>>>>>>>> Jan,
>>>>>>>>>>
>>>>>>>>>> I think if you just set isResolveProxies to false on your
>>>>>>>>>> EReference, that should be sufficient. If the referenced
>>>>>>>>>> object has an EAttribute with isID true, that value will be
>>>>>>>>>> used as the ID in the reference.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Jan J Kratky wrote:
>>>>>>>>>>> Hi, I have the same problem described by this poster:
>>>>>>>>>>>
>>>>>>>>>>> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg1 7280.html
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> .... however, I am not generating my ecore from schema.
>>>>>>>>>>> Rather, I am generating it from a Rational Software Architect
>>>>>>>>>>> model. Is there any similary clean solution for ensuring that
>>>>>>>>>>> ID/IDREF-like syntax is used in the serialization of
>>>>>>>>>>> references? I was hoping that something in ExtendedMetaData
>>>>>>>>>>> would permit me to make type customizations similar to what
>>>>>>>>>>> Ed describes in his response(s), but I'm not seeing it ...
>>>>>>>>>>>
>>>>>>>>>>> Thanks!
>>>>>>
Re: Customizing serialized reference formats [message #414569 is a reply to message #414568] Tue, 13 November 2007 14:23 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Jan,

I'm a bit confused. How is the resource factory used for the Ecore
model itself related to the one you are using for your own instance
data? How are you creating the resource that you used serialize your
own instance data?


Jan J Kratky wrote:
> Hi Ed:
>
> The default save options, when merged into the explicitly-specified
> options, contain the value
> {XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, true}. The setting of
> this value happens in ECoreResourceFactoryImpl#createResource(URI) the
> first time I grab the eInstance of my generated EPackage class. I am
> of course grabbing the eInstance prior to load in order to access
> EClassifiers and EStructuralFeatures to which I set ExtendedMetaData.
>
> As for the profile, I figured as much ... thought I'd go fishing for a
> solution anyhow :). I'm still a little puzzled as to why it doesn't
> work when I manipulate the relevant ID and resolveProxies properties
> directly from within my Java code, but I'll keep exploring that ...
>
>
> Ed Merks wrote:
>> Jan,
>>
>> I can't do anything about missing things from the profiles. I think
>> the more recent stuff uses UML2 more directly and I'm pretty sure
>> their Ecore profile is more complete. XMLResourceFactoryImpl doesn't
>> set XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE so where is that
>> setting coming from?
>>
>>
>> Jan J Kratky wrote:
>>> Hi Ed:
>>>
>>> I'm using RSA 7.0.0, and yes, my model is defined in UML (their .emx
>>> format). There is an ECore profile bundled with RSA. When I import
>>> it into my model, it makes only two stereotypes available on
>>> attributes: boolean 'EAttribute' and 'EReference'. If 'id' and
>>> 'resolveProxies' stereotypes were made available, then I guess we'd
>>> be in business.
>>>
>>> P.S. In response to your other question, I'm using
>>> XMLResourceFactoryImpl. Do you have a different suggestion?
>>>
>>>
>>>
>>> Ed Merks wrote:
>>>> Jan,
>>>>
>>>> I guess I didn't answer all of your question. Are you defining
>>>> your model in UML? It sounds like RAD has some missing features or
>>>> perhaps some features you haven't noticed. You're using an Ecore
>>>> profile?
>>>>
>>>>
>>>> Ed Merks wrote:
>>>>> Jan,
>>>>>
>>>>> Do you know which resource factory impl is being used to create
>>>>> your resource? The resource factory sets the options when it
>>>>> creates the resource, so you'd typically modify the generated one
>>>>> for that. There's a GenPackage option for controlling what type
>>>>> of resource factory to generate. I'm not sure how that's set in
>>>>> your case. (Note that the plugin.xml will not update, so if you
>>>>> generate a resource factory when you didn't have one before, you
>>>>> have to delete it and regenerate it or update it by hand.)
>>>>>
>>>>>
>>>>> Jan J Kratky wrote:
>>>>>> Thanks, Ed! By explicitly setting that option to false, I get the
>>>>>> result I want. I had not set the option explicitly to true
>>>>>> before, but it's clear in the debugger that the
>>>>>> 'useEncodedAttributeStyle' value was being set to true.
>>>>>>
>>>>>> That leaves just one nit -- my question 2) below. I've tried (in
>>>>>> my Java code) setting ID to true on the EAttribute and setting
>>>>>> resolveProxies to false on the EReference before invoking
>>>>>> serialization/deserialization. It seems to have no effect. Any
>>>>>> thoughts on how to enable the ID/IDREF style without explicitly
>>>>>> setting these properties in my .ecore file every time I
>>>>>> regenerate it?
>>>>>>
>>>>>>
>>>>>>
>>>>>> Ed Merks wrote:
>>>>>>> Jan,
>>>>>>>
>>>>>>> Sorry for being vague. :-(
>>>>>>>
>>>>>>> I'm kind of guessing you are using
>>>>>>> XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE because otherwise
>>>>>>> I'd expect you'd take this path in XMLSaveImpl and end up down
>>>>>>> the saveIDRefSingle branch (there's one like it for MANY as well):
>>>>>>>
>>>>>>> case OBJECT_HREF_SINGLE:
>>>>>>> {
>>>>>>> if (useEncodedAttributeStyle)
>>>>>>> {
>>>>>>> saveEObjectSingle(o, f);
>>>>>>> continue LOOP;
>>>>>>> }
>>>>>>> else
>>>>>>> {
>>>>>>> switch (sameDocSingle(o, f))
>>>>>>> {
>>>>>>> case SAME_DOC:
>>>>>>> {
>>>>>>> saveIDRefSingle(o, f);
>>>>>>> continue LOOP;
>>>>>>> }
>>>>>>> case CROSS_DOC:
>>>>>>> {
>>>>>>> break;
>>>>>>> }
>>>>>>> default:
>>>>>>> {
>>>>>>> continue LOOP;
>>>>>>> }
>>>>>>> }
>>>>>>> }
>>>>>>> break;
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Jan J Kratky wrote:
>>>>>>>> Hi Ed:
>>>>>>>>
>>>>>>>> No, I'm not aware of having used that option. But I admit that
>>>>>>>> I'm not quite sure what you're referring to. I don't see any
>>>>>>>> such option on my ..ecore properties for either the EAttribute
>>>>>>>> or the EReference. Do you mean the option on
>>>>>>>> ECoreXMLSchemaBuilder? How would that ever play a part when
>>>>>>>> serializing my data instance?
>>>>>>>>
>>>>>>>> Thanks!
>>>>>>>>
>>>>>>>>
>>>>>>>> Ed Merks wrote:
>>>>>>>>> Jan,
>>>>>>>>>
>>>>>>>>> Are you using the encoded attribute style option? That has an
>>>>>>>>> effect too. Try removing it.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Jan J Kratky wrote:
>>>>>>>>>> Thanks Ed. I should have inferred that from your responses in
>>>>>>>>>> the thread I referenced. That gets me most of the way there.
>>>>>>>>>> However, I am left with a couple of pesky issues:
>>>>>>>>>>
>>>>>>>>>> 1) It seems that, regardless of the value of resolveProxies
>>>>>>>>>> on the EReference, the reference values are written out
>>>>>>>>>> *with* the leading '#'. Curiously, the deserializer seems
>>>>>>>>>> able to resolve the references from the XML regardless of
>>>>>>>>>> whether the attribute values contain the leading '#'.
>>>>>>>>>>
>>>>>>>>>> 2) The ECore profile for RSA models doesn't seem to include
>>>>>>>>>> the ability to add any sort of 'isId' stereotype to class
>>>>>>>>>> attributes in the model. This seems to mean that I will have
>>>>>>>>>> to make the changes in the generated ..ecore file. Doing this
>>>>>>>>>> every time the .ecore is generated could end up being a bit
>>>>>>>>>> tedious and error-prone -- would manipulating the EAttribute
>>>>>>>>>> and EReference properties in Java code prior to initiating
>>>>>>>>>> save/load accomplish the same things? (I've made an attempt
>>>>>>>>>> at this without success).
>>>>>>>>>>
>>>>>>>>>> Thanks again!
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Ed Merks wrote:
>>>>>>>>>>> Jan,
>>>>>>>>>>>
>>>>>>>>>>> I think if you just set isResolveProxies to false on your
>>>>>>>>>>> EReference, that should be sufficient. If the referenced
>>>>>>>>>>> object has an EAttribute with isID true, that value will be
>>>>>>>>>>> used as the ID in the reference.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Jan J Kratky wrote:
>>>>>>>>>>>> Hi, I have the same problem described by this poster:
>>>>>>>>>>>>
>>>>>>>>>>>> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg1 7280.html
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> .... however, I am not generating my ecore from schema.
>>>>>>>>>>>> Rather, I am generating it from a Rational Software
>>>>>>>>>>>> Architect model. Is there any similary clean solution for
>>>>>>>>>>>> ensuring that ID/IDREF-like syntax is used in the
>>>>>>>>>>>> serialization of references? I was hoping that something in
>>>>>>>>>>>> ExtendedMetaData would permit me to make type
>>>>>>>>>>>> customizations similar to what Ed describes in his
>>>>>>>>>>>> response(s), but I'm not seeing it ...
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks!
>>>>>>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Customizing serialized reference formats [message #414574 is a reply to message #414569] Tue, 13 November 2007 15:17 Go to previous message
Jan Joseph Kratky is currently offline Jan Joseph KratkyFriend
Messages: 19
Registered: July 2009
Junior Member
Bah, sloppy coding on my part ... I was using
GenericXMLResourceFactoryImpl in one place, and XMLResourceFactoryImpl
in another. When I unify the code to ensure that I just use
XMLResourceFactoryImpl, I no longer need to set the
encoded-attribute-style option. Thanks again.


Ed Merks wrote:
> Jan,
>
> I'm a bit confused. How is the resource factory used for the Ecore
> model itself related to the one you are using for your own instance
> data? How are you creating the resource that you used serialize your
> own instance data?
>
>
> Jan J Kratky wrote:
>> Hi Ed:
>>
>> The default save options, when merged into the explicitly-specified
>> options, contain the value
>> {XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, true}. The setting of
>> this value happens in ECoreResourceFactoryImpl#createResource(URI) the
>> first time I grab the eInstance of my generated EPackage class. I am
>> of course grabbing the eInstance prior to load in order to access
>> EClassifiers and EStructuralFeatures to which I set ExtendedMetaData.
>>
>> As for the profile, I figured as much ... thought I'd go fishing for a
>> solution anyhow :). I'm still a little puzzled as to why it doesn't
>> work when I manipulate the relevant ID and resolveProxies properties
>> directly from within my Java code, but I'll keep exploring that ...
>>
>>
>> Ed Merks wrote:
>>> Jan,
>>>
>>> I can't do anything about missing things from the profiles. I think
>>> the more recent stuff uses UML2 more directly and I'm pretty sure
>>> their Ecore profile is more complete. XMLResourceFactoryImpl doesn't
>>> set XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE so where is that
>>> setting coming from?
>>>
>>>
>>> Jan J Kratky wrote:
>>>> Hi Ed:
>>>>
>>>> I'm using RSA 7.0.0, and yes, my model is defined in UML (their .emx
>>>> format). There is an ECore profile bundled with RSA. When I import
>>>> it into my model, it makes only two stereotypes available on
>>>> attributes: boolean 'EAttribute' and 'EReference'. If 'id' and
>>>> 'resolveProxies' stereotypes were made available, then I guess we'd
>>>> be in business.
>>>>
>>>> P.S. In response to your other question, I'm using
>>>> XMLResourceFactoryImpl. Do you have a different suggestion?
>>>>
>>>>
>>>>
>>>> Ed Merks wrote:
>>>>> Jan,
>>>>>
>>>>> I guess I didn't answer all of your question. Are you defining
>>>>> your model in UML? It sounds like RAD has some missing features or
>>>>> perhaps some features you haven't noticed. You're using an Ecore
>>>>> profile?
>>>>>
>>>>>
>>>>> Ed Merks wrote:
>>>>>> Jan,
>>>>>>
>>>>>> Do you know which resource factory impl is being used to create
>>>>>> your resource? The resource factory sets the options when it
>>>>>> creates the resource, so you'd typically modify the generated one
>>>>>> for that. There's a GenPackage option for controlling what type
>>>>>> of resource factory to generate. I'm not sure how that's set in
>>>>>> your case. (Note that the plugin.xml will not update, so if you
>>>>>> generate a resource factory when you didn't have one before, you
>>>>>> have to delete it and regenerate it or update it by hand.)
>>>>>>
>>>>>>
>>>>>> Jan J Kratky wrote:
>>>>>>> Thanks, Ed! By explicitly setting that option to false, I get the
>>>>>>> result I want. I had not set the option explicitly to true
>>>>>>> before, but it's clear in the debugger that the
>>>>>>> 'useEncodedAttributeStyle' value was being set to true.
>>>>>>>
>>>>>>> That leaves just one nit -- my question 2) below. I've tried (in
>>>>>>> my Java code) setting ID to true on the EAttribute and setting
>>>>>>> resolveProxies to false on the EReference before invoking
>>>>>>> serialization/deserialization. It seems to have no effect. Any
>>>>>>> thoughts on how to enable the ID/IDREF style without explicitly
>>>>>>> setting these properties in my .ecore file every time I
>>>>>>> regenerate it?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Ed Merks wrote:
>>>>>>>> Jan,
>>>>>>>>
>>>>>>>> Sorry for being vague. :-(
>>>>>>>>
>>>>>>>> I'm kind of guessing you are using
>>>>>>>> XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE because otherwise
>>>>>>>> I'd expect you'd take this path in XMLSaveImpl and end up down
>>>>>>>> the saveIDRefSingle branch (there's one like it for MANY as well):
>>>>>>>>
>>>>>>>> case OBJECT_HREF_SINGLE:
>>>>>>>> {
>>>>>>>> if (useEncodedAttributeStyle)
>>>>>>>> {
>>>>>>>> saveEObjectSingle(o, f);
>>>>>>>> continue LOOP;
>>>>>>>> }
>>>>>>>> else
>>>>>>>> {
>>>>>>>> switch (sameDocSingle(o, f))
>>>>>>>> {
>>>>>>>> case SAME_DOC:
>>>>>>>> {
>>>>>>>> saveIDRefSingle(o, f);
>>>>>>>> continue LOOP;
>>>>>>>> }
>>>>>>>> case CROSS_DOC:
>>>>>>>> {
>>>>>>>> break;
>>>>>>>> }
>>>>>>>> default:
>>>>>>>> {
>>>>>>>> continue LOOP;
>>>>>>>> }
>>>>>>>> }
>>>>>>>> }
>>>>>>>> break;
>>>>>>>> }
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Jan J Kratky wrote:
>>>>>>>>> Hi Ed:
>>>>>>>>>
>>>>>>>>> No, I'm not aware of having used that option. But I admit that
>>>>>>>>> I'm not quite sure what you're referring to. I don't see any
>>>>>>>>> such option on my ..ecore properties for either the EAttribute
>>>>>>>>> or the EReference. Do you mean the option on
>>>>>>>>> ECoreXMLSchemaBuilder? How would that ever play a part when
>>>>>>>>> serializing my data instance?
>>>>>>>>>
>>>>>>>>> Thanks!
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Ed Merks wrote:
>>>>>>>>>> Jan,
>>>>>>>>>>
>>>>>>>>>> Are you using the encoded attribute style option? That has an
>>>>>>>>>> effect too. Try removing it.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Jan J Kratky wrote:
>>>>>>>>>>> Thanks Ed. I should have inferred that from your responses in
>>>>>>>>>>> the thread I referenced. That gets me most of the way there.
>>>>>>>>>>> However, I am left with a couple of pesky issues:
>>>>>>>>>>>
>>>>>>>>>>> 1) It seems that, regardless of the value of resolveProxies
>>>>>>>>>>> on the EReference, the reference values are written out
>>>>>>>>>>> *with* the leading '#'. Curiously, the deserializer seems
>>>>>>>>>>> able to resolve the references from the XML regardless of
>>>>>>>>>>> whether the attribute values contain the leading '#'.
>>>>>>>>>>>
>>>>>>>>>>> 2) The ECore profile for RSA models doesn't seem to include
>>>>>>>>>>> the ability to add any sort of 'isId' stereotype to class
>>>>>>>>>>> attributes in the model. This seems to mean that I will have
>>>>>>>>>>> to make the changes in the generated ..ecore file. Doing this
>>>>>>>>>>> every time the .ecore is generated could end up being a bit
>>>>>>>>>>> tedious and error-prone -- would manipulating the EAttribute
>>>>>>>>>>> and EReference properties in Java code prior to initiating
>>>>>>>>>>> save/load accomplish the same things? (I've made an attempt
>>>>>>>>>>> at this without success).
>>>>>>>>>>>
>>>>>>>>>>> Thanks again!
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Ed Merks wrote:
>>>>>>>>>>>> Jan,
>>>>>>>>>>>>
>>>>>>>>>>>> I think if you just set isResolveProxies to false on your
>>>>>>>>>>>> EReference, that should be sufficient. If the referenced
>>>>>>>>>>>> object has an EAttribute with isID true, that value will be
>>>>>>>>>>>> used as the ID in the reference.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Jan J Kratky wrote:
>>>>>>>>>>>>> Hi, I have the same problem described by this poster:
>>>>>>>>>>>>>
>>>>>>>>>>>>> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg1 7280.html
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> .... however, I am not generating my ecore from schema.
>>>>>>>>>>>>> Rather, I am generating it from a Rational Software
>>>>>>>>>>>>> Architect model. Is there any similary clean solution for
>>>>>>>>>>>>> ensuring that ID/IDREF-like syntax is used in the
>>>>>>>>>>>>> serialization of references? I was hoping that something in
>>>>>>>>>>>>> ExtendedMetaData would permit me to make type
>>>>>>>>>>>>> customizations similar to what Ed describes in his
>>>>>>>>>>>>> response(s), but I'm not seeing it ...
>>>>>>>>>>>>>
>>>>>>>>>>>>> Thanks!
>>>>>>>>
Previous Topic:Nullpointer in sdo in multithreaded environment.
Next Topic:Subtle Error detected?
Goto Forum:
  


Current Time: Sat Apr 27 02:37:34 GMT 2024

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

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

Back to the top