Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsEAnnotation references between ecore models
https://www.eclipse.org/forums/index.php/mv/msg/369981/903523/#msg_903523
TIA!]]>Al B2012-08-24T06:44:07-00:00Re: EAnnotation references between ecore models
https://www.eclipse.org/forums/index.php/mv/msg/369981/903527/#msg_903527
Yes.
Within Eclipse the true physical locations behind disparate workspace
contributions are nicely virtualized by platform:/plugin and
platform:/resource URIs allowing arbitrary inter-model references.
On 24/08/2012 07:44, AJ Ben wrote:
> Is it possible to create an eannotation that references a feature in
> another ecore model? The file containing the feature is in a
> different relative location though.
>
> TIA!]]>Ed Willink2012-08-24T06:57:41-00:00Re: EAnnotation references between ecore models
https://www.eclipse.org/forums/index.php/mv/msg/369981/903655/#msg_903655
I tried your suggestion, but the new attribute is not populated with the data referenced in the other model. Maybe I missed something, here is what I did:
Thanks!]]>Al B2012-08-24T17:36:50-00:00Re: EAnnotation references between ecore models
https://www.eclipse.org/forums/index.php/mv/msg/369981/903658/#msg_903658
Your terminology is confusing.
A reference is a reference. It references the data; it doesn't copy it.
Regards
Ed Willink
On 24/08/2012 18:36, AJ Ben wrote:
> Hi Ed#2,
>
> I tried your suggestion, but the new attribute is not populated with
> the data referenced in the other model. Maybe I missed something,
> here is what I did:
>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="stpStopDate"
> eType="ecore:EDataType
> platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EDate">
> <eAnnotations
> references="platform:/resource/org.eclipse.test/models/fdpa.ecore#//SAPInit/stpStopDate"/>
> </eStructuralFeatures>
>
> Thanks!]]>Ed Willink2012-08-24T18:10:34-00:00Re: EAnnotation references between ecore models
https://www.eclipse.org/forums/index.php/mv/msg/369981/903668/#msg_903668
Comments below.
On 24/08/2012 7:36 PM, AJ Ben wrote:
> Hi Ed#2,
>
> I tried your suggestion, but the new attribute is not populated with
> the data referenced in the other model.
Note that the generated EPackage will not generate the contents or
references features of an EAnnotation. If you set the GenPackage's
Initialize by Loading property to true, the generated package will
initialize by loading a serialized version of the Ecore model and that
will help preserve the containment and cross references of the EAnnotations.
> Maybe I missed something, here is what I did:
>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="stpStopDate"
> eType="ecore:EDataType
> platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EDate">
> <eAnnotations
> references="platform:/resource/org.eclipse.test/models/fdpa.ecore#//SAPInit/stpStopDate"/>
I would have expected this to be a relative reference within the
workspace. I imagine it will be problematic to load this at runtime if
this model isn't available in the workspace at runtime.
An alternative approach is that you record in the annotations details
map a key with the value <nsURI>#<fragmentURI> of the model you expect
will be available at runtime. So you can use
EPackage.Registry.INSTANCE.getEPackage(<nsURI>).eResource().getEObject(<fragmentURI>)
to locate the feature you're referencing.
> </eStructuralFeatures>
>
> Thanks!]]>Ed Merks2012-08-24T19:48:38-00:00