Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » MDT (Model Development Tools) » Using instances inside model from another model(Problem with interrelating different instances of two or more metamodels)
icon5.gif  Using instances inside model from another model [message #645754] Mon, 20 December 2010 12:21 Go to next message
Stefan Mijatov is currently offline Stefan MijatovFriend
Messages: 59
Registered: March 2010
Location: Vienna, Austria
Member
I have two meta models built in e-core. I have created two models of these meta models, where elements in one model are related with elements of another model.
I use 'Load Resource' option in eclipse and it works fine, until I close e-core model editor. When I open it, editor can not read references to elements which are in referenced model.
However when I look at the xmi, references look alright.

For example:
Type xsi:type="ecore:EDataType" href=" ../../generatorMetamodels/instances/ECOREPrimitives.xmi#//@e Classifiers.0 "/>)

The same thing happens when I use QVT for model to model transformation.
The same thing happens when I use Xpand to generate code.

I just dont have a clue what am I doing wrong? Please help...
Re: Using instances inside model from another model [message #645855 is a reply to message #645754] Mon, 20 December 2010 19:24 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Stefan,

It looks okay. A proxy resolve will always cause a resource to be
loaded, even if that resource fails to load properly. So you're saying
the wrong resource ends up in the list of loaded resources? Or perhaps
you've not done anything that causes the proxies to resolve?


Stefan Mijatov wrote:
> I have two meta models built in e-core. I have created two models of
> these meta models, where elements in one model are related with
> elements of another model.
> I use 'Load Resource' option in eclipse and it works fine, until I
> close e-core model editor. When I open it, editor can not read
> references to elements which are in referenced model.
> However when I look at the xmi, references look alright.
> For example: Type xsi:type="ecore:EDataType" href="
> ../../generatorMetamodels/instances/ECOREPrimitives.xmi#//@e
> Classifiers.0 "/>)
>
> The same thing happens when I use QVT for model to model transformation.
> The same thing happens when I use Xpand to generate code.
>
> I just dont have a clue what am I doing wrong? Please help...


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Using instances inside model from another model [message #645989 is a reply to message #645855] Tue, 21 December 2010 13:40 Go to previous messageGo to next message
Stefan Mijatov is currently offline Stefan MijatovFriend
Messages: 59
Registered: March 2010
Location: Vienna, Austria
Member
When I open model in e-core editor, in properties tab for the referenced attribute of some element, type which is say EDataType, is not loaded properly.
That is the name is missing, and instead of being 'EDataType String' the editor shows only 'EDataType'.
I am keeping primitive types in separate model as i described in previous post.
Maybe it has something to do with the proxy resolving as you say, but I don't know what I have to do in order for this to work...
How do I "make" editor to resolve proxies?

And not only editor, I have this problem also when I am running some qvt transformation for this type of situation!? (and also xpand Confused )
Re: Using instances inside model from another model [message #646046 is a reply to message #645989] Tue, 21 December 2010 17:22 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Stefan,

Comments below.

Stefan Mijatov wrote:
> When I open model in e-core editor, in properties tab for the
> referenced attribute of some element, type which is say EDataType, is
> not loaded properly.
> That is the name is missing, and instead of being 'EDataType String'
> the editor shows only 'EDataType'.
Yes, that sounds like an unresolved proxy.
> I am keeping primitive types in separate model as i described in
> previous post.
> Maybe it has something to do with the proxy resolving as you say, but
> I don't know what I have to do in order for this to work...
When there's a proxy, any normal attempt to access it will try to
resolve it.
> How do I "make" editor to resolve proxies?
It will do that on its own.
> And not only editor, I have this problem also when I am running some
> qvt transformation for this type of situation!? (and also xpand :? )
As I mentioned already, any attempt to resolve a proxy (and it's hard to
prevent such attempts) will cause a resource to be loaded. So if you
have broken proxies you should see a resource in the resource set with
the URI of that broken proxy. Isn't that the case?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Using instances inside model from another model [message #646148 is a reply to message #646046] Wed, 22 December 2010 11:16 Go to previous messageGo to next message
Stefan Mijatov is currently offline Stefan MijatovFriend
Messages: 59
Registered: March 2010
Location: Vienna, Austria
Member
When I validate model it shows a bunch of errors that look like this:

The feature 'eType' of 'Business Method findLekar' contains an unresolved proxy 'org.eclipse.emf.ecore.impl.DynamicEObjectImpl/http:/www.example.com/ejb3#EntityBean@168ad51{platform:/resource/generatorOutput/model/OrganizacijaEntities.xmi#//@eClassifiers.2}'


In the list of loaded resources when I open the model with the editor, there is no link to model that holds instances that are causing the problem!!

This model that has the problem is generated through qvt not by hand...

[Updated on: Wed, 22 December 2010 14:15]

Report message to a moderator

Re: Using instances inside model from another model [message #646225 is a reply to message #646148] Wed, 22 December 2010 18:32 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Stefan,

Is there a project called generatorOutput in your workspace?


Stefan Mijatov wrote:
> When I validate model it shows a bunch of errors that look like this:
>
> The feature 'eType' of 'Business Method findLekar' contains an
> unresolved proxy
> ' org.eclipse.emf.ecore.impl.DynamicEObjectImpl/http://www.dor ius-soft.com/ejb3#EntityBean@168ad51{platform:/resource/gene ratorOutput/model/OrganizacijaEntities.xmi#//@eClassifiers.2 }'
>
>
> In the list of loaded resources when I open the model with the editor,
> there is no link to model that holds instances that are causing the
> problem!!
>
> This model that has the problem is generated through qvt not by hand.
> But even when I create it by hand I have the same problem...
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Using instances inside model from another model [message #646255 is a reply to message #646225] Wed, 22 December 2010 22:06 Go to previous messageGo to next message
Stefan Mijatov is currently offline Stefan MijatovFriend
Messages: 59
Registered: March 2010
Location: Vienna, Austria
Member
I have created 4 projects into which I divided my whole generator. In one project I keep meta models and instances of primitive types for each of them, in second project I keep QVT transformations, in third one I have Xpand templates and work-flow files, and in the forth project I have the output of QVT transformations which are models that are input for Xpand transformations (which is named "generatorOutput").

[Updated on: Wed, 22 December 2010 22:07]

Report message to a moderator

Re: Using instances inside model from another model [message #646264 is a reply to message #646255] Wed, 22 December 2010 23:45 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Stefan,

You're seeing these validation errors using which editor? At the risk of
repeating myself, when a proxy is resolved, a resource will definitely
be loaded into the resource set. EMF's generated editors will show that
resource. So if you're saying you have a validation diagnostic about an
unresolved proxy with URI
platform:/resource/generatorOutput/model/OrganizacijaEntitie s.xmi#//@eClassifiers.2
I most certainly expect a resource with URI
platform:/resource/generatorOutput/model/OrganizacijaEntitie s.xmi to
appear in the resource set. You're not seeing that?


Stefan Mijatov wrote:
> I have created 4 projects into which I separated my whole generator.
> In one project I keep meta models and instances of primitive types for
> each of them, in second project I keep QVT transformations, in third
> one I have Xpand templates and work-flow files, and in the forth
> project I have the output of QVT transformations which are models that
> are input for Xpand transformations (which is named "generatorOutput").


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Using instances inside model from another model [message #646295 is a reply to message #646264] Thu, 23 December 2010 08:33 Go to previous messageGo to next message
Stefan Mijatov is currently offline Stefan MijatovFriend
Messages: 59
Registered: March 2010
Location: Vienna, Austria
Member
Here is the picture of workspace and model instance opened in sample reflective ecore editor which i use for editing and validation.

[Updated on: Thu, 23 December 2010 08:34]

Report message to a moderator

Re: Using instances inside model from another model [message #646364 is a reply to message #646295] Thu, 23 December 2010 14:34 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Stefan,

I don't see the picture. I'm not sure you can attach pictures with the
web forum; with Thunderbird you can.


Stefan Mijatov wrote:
> Here is the picture of workspace and model instance opened in sample
> reflective ecore editor which i use for editing and validation:
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Using instances inside model from another model [message #646369 is a reply to message #646364] Thu, 23 December 2010 14:53 Go to previous messageGo to next message
Stefan Mijatov is currently offline Stefan MijatovFriend
Messages: 59
Registered: March 2010
Location: Vienna, Austria
Member
http://img339.imageshack.us/i/generatorl.jpg/
Re: Using instances inside model from another model [message #646384 is a reply to message #646369] Thu, 23 December 2010 15:41 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Stefan,

So the resource is definitely there in the resource set, as expected.
Does that resource have //@eClassifiers.2 in it? Apparently not. I see
it has a Java Package at the root---the / will find that---but does that
object have a reference called eClassifiers and does that reference have
an object at index 2? It seems not.

Have you used the debugger to try to figure out what's going on?


Stefan Mijatov wrote:
> http://img339.imageshack.us/i/generatorl.jpg/


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Using instances inside model from another model [message #646388 is a reply to message #646384] Thu, 23 December 2010 16:22 Go to previous messageGo to next message
Stefan Mijatov is currently offline Stefan MijatovFriend
Messages: 59
Registered: March 2010
Location: Vienna, Austria
Member
As much as I can understand, the resource that is needed is OrganizacijaEntities.xmi, and it is not being loaded into resource set at all. Furthermore, there is 7 eClassifiers in OrganizacijaEntities.xmi and the reference to them is by position in xmi starting from zero (0, 1, 2...6).
My conclusion is that some how editor is having trouble to resolve this references, and I don't know what is the reason.

Anyway, thank you for the effort in trying to help me.
Re: Using instances inside model from another model [message #646400 is a reply to message #646388] Thu, 23 December 2010 17:51 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Stefan,

Oh sorry, the names are very similar...

So in the picture you're showing, you've invoked Validate and gotten the
diagnostic about an unresolved proxy that you described? Can you show
me the lines of the XML with the serialized reference that's not
resolving. Is the corresponding EReference in which this reference
appears one that is a non-containment reference with resolveProxies set
to true? Can you open the resource being referenced directly in an
editor without any problems?


Stefan Mijatov wrote:
> As much as I can understand, the resource that is needed is
> OrganizacijaEntities.xmi, and it is not being loaded into resource set
> at all. Furthermore, there is 7 eClassifiers in
> OrganizacijaEntities.xmi and the reference to them is by position in
> xmi starting from zero (0, 1, 2...6). My conclusion is that some how
> editor is having trouble to resolve this references, and I don't know
> what is the reason.
>
> Anyway, thank you for the effort in trying to help me.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Using instances inside model from another model [message #646447 is a reply to message #646400] Fri, 24 December 2010 10:43 Go to previous messageGo to next message
Stefan Mijatov is currently offline Stefan MijatovFriend
Messages: 59
Registered: March 2010
Location: Vienna, Austria
Member
1. So in the picture you're showing, you've invoked Validate and gotten the diagnostic about an unresolved proxy that you described?

Yes. 40+ errors about proxies not being resolved.

2. Can you show me the lines of the XML with the serialized reference that's not resolving. Is the corresponding EReference in which this reference appears one that is a on-containment reference with resolveProxies set to true?

Here is the XMI with the references not being resolved: (all this references are containment) (I GAVE HERE ONLY THE PIECE OF XMI BECAUSE OF THE SPACE)
<?xml version="1.0" encoding="UTF-8"?>
<java:JavaPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ejb3="http://example/ejb3" xmlns:java="http://example/java" xmlns:ocore="http://example/ocore" xsi:schemaLocation="http://example/ejb3 ../../generatorMetamodels/model/ejb3.ecore http://example/java ../../generatorMetamodels/model/java.ecore http://example/ocore ../../generatorMetamodels/model/ocore.ecore" name="ModelOrganizacijeManagers">
  <eClassifiers xsi:type="ejb3:StatelessSessionBean" name="MestoManager" implementsInterfaces="//@eClassifiers.1">
    <fields name="mesto">
      <eType xsi:type="ejb3:EntityBean" href="OrganizacijaEntities.xmi#//@eClassifiers.3"/>
    </fields>
    <methods xsi:type="ejb3:BusinessMethod" name="saveMesto">
      <eParameters xsi:type="java:JavaParameter" name="mesto">
        <eType xsi:type="ejb3:EntityBean" href="OrganizacijaEntities.xmi#//@eClassifiers.3"/>
      </eParameters>
    </methods>
    <methods xsi:type="ejb3:BusinessMethod" name="deleteMesto">
      <eParameters xsi:type="java:JavaParameter" name="mesto">
        <eType xsi:type="ejb3:EntityBean" href="OrganizacijaEntities.xmi#//@eClassifiers.3"/>
      </eParameters>
    </methods>
    <methods xsi:type="ejb3:BusinessMethod" name="findMesto">
      <eType xsi:type="ejb3:EntityBean" href="OrganizacijaEntities.xmi#//@eClassifiers.3"/>
      <eParameters xsi:type="java:JavaParameter" name="naziv">
        <eType xsi:type="ocore:ODataType" href="../../generatorMetamodels/instances/OCOREPrimitives.xmi#//@eClassifiers.1"/>
      </eParameters>
    </methods>
  </eClassifiers>
</java:JavaPackage>


4. Can you open the resource being referenced directly in an editor without any problems?

Yes. When I open OrganizacijaEntities.xmi (which is being referenced) with sample reflective ecore editor it works just fine.

[Updated on: Fri, 24 December 2010 10:45]

Report message to a moderator

Re: Using instances inside model from another model [message #646468 is a reply to message #646447] Fri, 24 December 2010 15:17 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Stefan,

Is the EReference for eType containment? (I doubt it.) Is
resolveProxies true? It being false would explain a lot. If it's true,
set a breakpoint in the getEType method and use the debugger to trace
why the proxy is failing to resolve (or even to cause a resource to be
loaded, which is inexplicable to me).


Stefan Mijatov wrote:
> 1. So in the picture you're showing, you've invoked Validate and
> gotten the diagnostic about an unresolved proxy that you described?
>
> Yes. 40+ errors about proxies not being resolved.
> 2. Can you show me the lines of the XML with the serialized reference
> that's not resolving. Is the corresponding EReference in which this
> reference appears one that is a on-containment reference with
> resolveProxies set to true?
>
> Here is the XMI with the references not being resolved: (all this
> references are containment)
>
> <?xml version="1.0" encoding="UTF-8"?>
> <java:JavaPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ejb3="http://example/ejb3" xmlns:java="http://example/java"
> xmlns:ocore="http://example/ocore"
> xsi:schemaLocation="http://example/ejb3
> ../../generatorMetamodels/model/ejb3.ecore http://example/java
> ../../generatorMetamodels/model/java.ecore http://example/ocore
> ../../generatorMetamodels/model/ocore.ecore"
> name="ModelOrganizacijeManagers">
> <eClassifiers xsi:type="ejb3:StatelessSessionBean"
> name="MestoManager" implementsInterfaces="//@eClassifiers.1">
> <fields name="mesto">
> <eType xsi:type="ejb3:EntityBean"
> href="OrganizacijaEntities.xmi#//@eClassifiers.3"/>
> </fields>
> <methods xsi:type="ejb3:BusinessMethod" name="saveMesto">
> <eParameters xsi:type="java:JavaParameter" name="mesto">
> <eType xsi:type="ejb3:EntityBean"
> href="OrganizacijaEntities.xmi#//@eClassifiers.3"/>
> </eParameters>
> </methods>
> <methods xsi:type="ejb3:BusinessMethod" name="deleteMesto">
> <eParameters xsi:type="java:JavaParameter" name="mesto">
> <eType xsi:type="ejb3:EntityBean"
> href="OrganizacijaEntities.xmi#//@eClassifiers.3"/>
> </eParameters>
> </methods>
> <methods xsi:type="ejb3:BusinessMethod" name="findMesto">
> <eType xsi:type="ejb3:EntityBean"
> href="OrganizacijaEntities.xmi#//@eClassifiers.3"/>
> <eParameters xsi:type="java:JavaParameter" name="naziv">
> <eType xsi:type="ocore:ODataType"
> href=" ../../generatorMetamodels/instances/OCOREPrimitives.xmi#//@e Classifiers.1 "/>
>
> </eParameters>
> </methods>
> </eClassifiers>
> </java:JavaPackage>
>
>
> 4. Can you open the resource being referenced directly in an editor
> without any problems?
>
> Yes. When I open OrganizacijaEntities.xmi (which is being referenced)
> with sample reflective ecore editor it works just fine.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Using instances inside model from another model [message #646488 is a reply to message #646468] Sat, 25 December 2010 13:08 Go to previous message
Stefan Mijatov is currently offline Stefan MijatovFriend
Messages: 59
Registered: March 2010
Location: Vienna, Austria
Member
EType reference is not containment, and Resolve Proxies for EType is set to true, I have checked. I have to confess that I don't know how to debug e-core editor?

Doesn't matter any more, most probably the problem is somewhere in my meta-models since I have three of them, each one extending the other. That is, I have ejb3 which extends java which extends ocore which is instance of e-core meta-meta-model. So the source of my bug is who knows where... I am giving up since I am not obligated to make this work for my MSc diploma work.
Anyway, thank you very much for trying to help.
Previous Topic:Problems during loading my own Profile in standalone mode
Next Topic:[MDT-OCL] Defining OCL constraints
Goto Forum:
  


Current Time: Thu Mar 28 09:44:01 GMT 2024

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

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

Back to the top