Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Problem xmi reference to another xmi
| |
Re: [Acceleo] Problem xmi reference to another xmi [message #985680 is a reply to message #985539] |
Thu, 15 November 2012 16:44 |
Guillaume Lincé Messages: 6 Registered: November 2012 |
Junior Member |
|
|
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 16:54 |
Ed Willink Messages: 7670 Registered: July 2009 |
Senior Member |
|
|
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 08:58 |
|
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
|
|
|
Goto Forum:
Current Time: Wed Sep 25 08:22:04 GMT 2024
Powered by FUDForum. Page generated in 0.03269 seconds
|