Home » Modeling » EMF » [SOLVED] Use paths with names in the references of the XMI
[SOLVED] Use paths with names in the references of the XMI [message #876358] |
Thu, 24 May 2012 12:49 |
Iban Ayestaran Messages: 58 Registered: September 2011 |
Member |
|
|
Hello,
I created my own meta-model using ecore, and I am now able to generate models compliant with it succesfully. However, when I open my model with a notepad, the xmi shows some things like this:
<Mode Name="Mode" Period="0.1" tasks="SubSystem1 SubSystem2">
<connection Source="//@task.0/@outputs.0" Destiny="//@task.1/@inputs.0" Name="RegularMode_conn_0"/>
...
<task Name="SubSystem1" Frequency="1">
<output Name="1" connection="//@Mode/@connection.0"/>
</task>
<task Name="SubSystem1" Frequency="1">
<input Name="1" connection="//@Mode/@connection.0"/>
</task>
...
</Mode>
What I would like to have the references as paths using the names of the elements, that is, something like this:
<Mode Name="Mode" Period="0.1" tasks="SubSystem1 SubSystem2">
<connection Source="//SubSystem1/1" Destiny="//SubSystem1/1" Name="RegularMode_conn_0"/>
...
<task Name="SubSystem1" Frequency="1">
<output Name="1" connection="//Mode/RegularMode_conn_0"/>
</task>
<task Name="SubSystem1" Frequency="1">
<input Name="1" connection="//Mode/RegularMode_conn_0"/>
</task>
...
</Mode>
I tried setting ID=true in the properties of the "Name" attributes, but then the xmi does not show the following path, but only the name, so it gets unusable for me because some names are repeated and I cannot differentiate them.
Does any of you know how to face the problem?
Thanks in advance.
[Updated on: Fri, 25 May 2012 09:57] Report message to a moderator
|
|
|
Re: Use paths with names in the references of the XMI [message #876398 is a reply to message #876358] |
Thu, 24 May 2012 14:13 |
Ed Merks Messages: 33141 Registered: July 2009 |
Senior Member |
|
|
Iban,
Comments below.
On 24/05/2012 2:49 PM, Iban Ayestaran wrote:
> Hello,
>
> I created my own meta-model using ecore, and I am now able to generate
> models compliant with it succesfully. However, when I open my model
> with a notepad, the xmi shows some things like this:
>
> <Mode Name="Mode" Period="0.1" tasks="SubSystem1 SubSystem2">
> <connection Source="//@task.0/@outputs.0"
> Destiny="//@task.1/@inputs.0" Name="RegularMode_conn_0"/>
> ...
> <task Name="SubSystem1" Frequency="1">
> <output Name="1" connection="//@Mode/@connection.0"/>
> </task>
> <task Name="SubSystem1" Frequency="1">
> <input Name="1" connection="//@Mode/@connection.0"/>
> </task>
> ...
> </Mode>
>
>
> What I would like to have the references as paths using the names of
> the elements, that is, something like this:
>
> <Mode Name="Mode" Period="0.1" tasks="SubSystem1 SubSystem2">
> <connection Source="//SubSystem1/1" Destiny="//SubSystem1/1"
> Name="RegularMode_conn_0"/>
You could specialize eURIFragmentSegment and
eObjectForURIFragmentSegment (like we do in EModelElementImpl) or you
can set the eKeys feature of your references to specify the attributes
of the referenced type that uniquely identify an object within that
reference.
> ...
> <task Name="SubSystem1" Frequency="1">
> <output Name="1" connection="//Mode/RegularMode_conn_0"/>
> </task>
> <task Name="SubSystem1" Frequency="1">
> <input Name="1" connection="//Mode/RegularMode_conn_0"/>
> </task>
> ...
> </Mode>
>
> I tried setting ID=true in the properties of the "Name" attributes,
> but then the xmi does not show the following path, but only the name,
> so it gets unusable for me because some names are repeated and I
> cannot differentiate them.
>
> Does any of you know how to face the problem?
>
> Thanks in advance.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Use paths with names in the references of the XMI [message #876420 is a reply to message #876398] |
Thu, 24 May 2012 15:01 |
Iban Ayestaran Messages: 58 Registered: September 2011 |
Member |
|
|
Hello Ed,
I tried setting the eKeys feature of the references, and now I get this:
<Mode Name="Mode" Period="0.1" tasks="SubSystem1 SubSystem2">
<connection Source="//@task.0/@outputs[Name='1']" Destiny="//@task.1/@inputs[Name='1']" Name="RegularMode_conn_0"/>
...
<task Name="SubSystem1" Frequency="1">
<output Name="1" connection="//@Mode/@connection.0"/>
</task>
<task Name="SubSystem1" Frequency="1">
<input Name="1" connection="//@Mode/@connection.0"/>
</task>
...
</Mode>
That it is almost acceptable for me, but I still find two problems:
1. The connections should be defined like this:
<connection Source="//@task[Name='SubSystem1']/@outputs[Name='1']" Destiny="//@task[Name='SubSystem2']/@inputs[Name='1']" Name="RegularMode_conn_0"/>
that is, the task should also be identified by its name, which is not by now, although I set the eKeys of the references between the Task and the inputs and outputs (Containment is set to 'true', could that be the problem?).
2. The outputs/inputs should be defined like this:
<output Name="1" connection="//@Mode/@connection[Name='RegularMode_conn_0']"/>
that is, the connection should be identigied by its name, which is not now, although I set the eKeys of the references between the output/inputs and the connections (the reference of between input/outputs and connections are opposite to the references between connections and input/outputs. Could that be the problem? (I set both eKeys features)).
Thanks in advance,
Iban
|
|
|
Re: Use paths with names in the references of the XMI [message #876423 is a reply to message #876420] |
Thu, 24 May 2012 15:09 |
Ed Merks Messages: 33141 Registered: July 2009 |
Senior Member |
|
|
Iban,
Comments below.
On 24/05/2012 5:01 PM, Iban Ayestaran wrote:
> Hello Ed, I tried setting the eKeys feature of the references, and now
> I get this:
>
> <Mode Name="Mode" Period="0.1" tasks="SubSystem1 SubSystem2">
> <connection Source="//@task.0/@outputs[Name='1']"
> Destiny="//@task.1/@inputs[Name='1']" Name="RegularMode_conn_0"/>
> ...
> <task Name="SubSystem1" Frequency="1">
> <output Name="1" connection="//@Mode/@connection.0"/>
> </task>
> <task Name="SubSystem1" Frequency="1">
> <input Name="1" connection="//@Mode/@connection.0"/>
> </task>
> ...
> </Mode>
>
> That it is almost acceptable for me, but I still find two problems:
>
> 1. The connections should be defined like this:
> <connection Source="//@task[Name='SubSystem1']/@outputs[Name='1']"
> Destiny="//@task[Name='SubSystem2']/@inputs[Name='1']"
> Name="RegularMode_conn_0"/>
> that is, the task should also be identified by its name, which is not
> by now, although I set the eKeys of the references between the Task
> and the inputs and outputs (Containment is set to 'true', could that
> be the problem?).
You need to set the eKeys for the tasks feature; you've obviously done
it for the @outputs feature.
>
> 2. The outputs/inputs should be defined like this:
> <output Name="1"
> connection="//@Mode/@connection[Name='RegularMode_conn_0']"/>
> that is, the connection should be identigied by its name, which is not
> now, although I set the eKeys of the references between the
> output/inputs and the connections (the reference of between
> input/outputs and connections are opposite to the references between
> connections and input/outputs. Could that be the problem? (I set both
> eKeys features)).
Here you need to set the eKeys for the "connection" feature. Note that
setting eKeys for non-containment references will have no effect on the
serialization (though it does introduce a constraint that will be
validated). In the case of a containment reference, there is also such
a constraint that's checked, AND references will be of the form
@<feature-name>[<key1>='<value1>,<key2>='<value2>'] instead of
@<feature-name>.<index>.
>
> Thanks in advance,
> Iban
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
| |
Goto Forum:
Current Time: Thu Apr 25 16:57:52 GMT 2024
Powered by FUDForum. Page generated in 0.03712 seconds
|