[Acceleo] Problem xmi reference to another xmi [message #985539] |
Thu, 15 November 2012 08:32  |
Eclipse User |
|
|
|
Hello,
As I have already explained in this topic (http://www.eclipse.org/forums/index.php/t/430863/), we use Acceleo to generate html from two models (TVL and FCSS). The FCSS xmi has references to the TVL xmi. We load the TVL model as an argument to the project then load the FCSS model programmatically (using an invoke to a java method). We have to load the TVL xmi firt since the FCSS model is optional. We managed to resolve the references from the FCSS XMI to the TVL XMI. However, it seems that the acceleo project uses another instance of the TVL xmi and therefore the references used in FCSS XMI instance don't match with TVL XMI elements loaded by Acceleo. For example, when we try to compare a Hierarchical_Feature (a model element in TVL) and the reference to this model element in FCSS:
<p>reference: [feature.feature.head/]</p>
<p>hierarchical: [aHierarchicalFeature/]</p>
<p>Equals? [feature.feature.head = aHierarchicalFeature/]</p>
We get this result:
reference: be.ac.fundp.info.tVL.impl.Hierarchical_FeatureImpl@66fe372d (name: SWR) (optional: false)
hierarchical: be.ac.fundp.info.tVL.impl.Hierarchical_FeatureImpl@3f328d2e (name: SWR) (optional: false)
Equals? false
As you can see, they are not equal although they should be.
What can we do to solve this issue?
Thanks for you help,
Guillaume
|
|
|
|
Re: [Acceleo] Problem xmi reference to another xmi [message #985680 is a reply to message #985539] |
Thu, 15 November 2012 11:44   |
Eclipse User |
|
|
|
Thanks for your reply. Since the problem comes from the ResourceSet, I tried to load both models in the same java service with the same ResourceSet. I get both models and the references match de TVL model elements. However, as this service returns an ArrayList of EObject, I don't know how to get it when invoking the java service in acceleo.
Here is the query:
[query public getBothModels(filePathTVL:String,filePathFCSS:String) :Sequence(EObject)
= invoke('TVLtoHTML5.main.FCSSModelGetter', 'getTVLModel(java.lang.String,java.lang.String)', Sequence{filePathTVL,filePathFCSS}) /]
As you can see, I try to get it as a Sequence but it doesn't work, the result is empty. I also tried with a Collection, Bag, OrderedSet and Set without success. Is there a type in acceleo that matches the ArrayList? Or should I use another type of collection in my java service?
Thanks,
Guillaume
|
|
|
Re: [Acceleo] Problem xmi reference to another xmi [message #985684 is a reply to message #985680] |
Thu, 15 November 2012 11:54   |
Eclipse User |
|
|
|
Hi
I've successfully used HashSet for an OCL Set, LinkedHashSet for an OCL
OrderedSet. ARe you sure you're using the right ArrayList?
No idea what you mean by the acceleo service.
You don't provide the Java function or the Acceleo error message so
those cannot be commented on.
Generally these problems are always a declaration mismatch;
unfortunately, the Bug requesting Acceleo diagnosis of inconsistent
declarations is still open.
Regards
Ed Willink
On 15/11/2012 16:44, Guillaume Lincé wrote:
> Thanks for your reply. Since the problem comes from the ResourceSet, I
> tried to load both models in the same java service with the same
> ResourceSet. I get both models and the references match de TVL model
> elements. However, as this service returns an ArrayList of EObject, I
> don't know how to get it when invoking the java service in acceleo.
> Here is the query:
>
>
> [query public getBothModels(filePathTVL:String,filePathFCSS:String)
> :Sequence(EObject)
> = invoke('TVLtoHTML5.main.FCSSModelGetter',
> 'getTVLModel(java.lang.String,java.lang.String)',
> Sequence{filePathTVL,filePathFCSS}) /]
>
>
> As you can see, I try to get it as a Sequence but it doesn't work, the
> result is empty. I also tried with a Collection, Bag, OrderedSet and
> Set without success. Is there a type in acceleo that matches the
> ArrayList? Or should I use another type of collection in my java service?
>
> Thanks,
>
> Guillaume
>
|
|
|
|
Re: [Acceleo] Problem xmi reference to another xmi [message #985806 is a reply to message #985727] |
Fri, 16 November 2012 03:58  |
Eclipse User |
|
|
|
Guillaume,
A question would be : why are you manually loading the second model through a Java service? As long as EMF can resolve the reference from one model to the next (the URIs are good), Acceleo will simply follow that reference (which is what it does since you give an example where you get the results of both (java service and acceleo navigation) printed correctly.
Please make sure that you really need to load your model twice. Otherwise, simply reuse the one that's loaded by EMF through simple navigation. When you look at the content of your resource set, you should only have a single resource for a given URI, which is not the case in your example if I am not mistaken on what you are doing. Having multiple resources loaded for one URI is much too error prone (as you could realize with the "==" returning false...).
Laurent Goubet
Obeo
|
|
|
Powered by
FUDForum. Page generated in 0.05051 seconds