Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] AllInstances problem with 3.0M6
[Acceleo] AllInstances problem with 3.0M6 [message #528882] Thu, 22 April 2010 09:39 Go to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
Hi i try to use Acceleo and i want to do a "for" over a collection of
elements derived from an allInstances instruction
I use a metamodel importing another metamodel where eclasses have the
same name (i know not very clean)
this is my code and allInstances seems to return nothing. I'm working on
Eclipse galileo

[module
generate('http://org.topcased.traceability.model/1.0','http://org.topcased.requirement/1.0')/]
[template public generate(r : requirement::RequirementProject)]
[comment @main /]
[file (r.identifier, false, 'Cp1252')]
[r.identifier /]
[for (r : requirement::Requirement |
requirement::Requirement.allInstances())]
try
[/for]
[for (r : ttm::Requirement | ttm::Requirement.allInstances())]
other try
[/for]
[/file]
[/template]

my output only display the identifier of my project. Did you notice some
problems with allInstances() instruction ?

Tristan




Re: [Acceleo] AllInstances problem with 3.0M6 [message #528888 is a reply to message #528882] Thu, 22 April 2010 10:04 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020902010609090804040609
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Tristan,

I'll admit I don't use allInstances() that much (I believe I never used
it :p).

The problem might come from the classifiers having identical names, it
could be an issue with the OCL "allInstances" operation, it could be
because of the "allInstances"'s scope, ... I can't say for sure as your
template seems good to me.

What would be the result of replacing allInstances by a typed
"eAllContents" such as in :

[for (r : requirement::Requirement |
r.eAllContents(requirement::Requirement))]
try
[/for]
[for (r : ttm::Requirement | r.eAllContents(ttm::Requirement))]
other try
[/for]

Take not that the scope of my eAllContents' are your "r" variable of
type RequirementProject ... which might not be your model root. You
might need to go up to the root through "ancestors()->last()" or a
couple of "eContainer()" calls.

Laurent Goubet
Obeo

Tristan FAURE wrote:
> Hi i try to use Acceleo and i want to do a "for" over a collection of
> elements derived from an allInstances instruction
> I use a metamodel importing another metamodel where eclasses have the
> same name (i know not very clean)
> this is my code and allInstances seems to return nothing. I'm working on
> Eclipse galileo
>
> [module
> generate('http://org.topcased.traceability.model/1.0','http://org.topcased.requirement/1.0')/]
>
> [template public generate(r : requirement::RequirementProject)]
> [comment @main /]
> [file (r.identifier, false, 'Cp1252')]
> [r.identifier /]
> [for (r : requirement::Requirement |
> requirement::Requirement.allInstances())]
> try
> [/for]
> [for (r : ttm::Requirement | ttm::Requirement.allInstances())]
> other try
> [/for]
> [/file]
> [/template]
>
> my output only display the identifier of my project. Did you notice some
> problems with allInstances() instruction ?
>
> Tristan


--------------020902010609090804040609
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------020902010609090804040609--
Re: [Acceleo] AllInstances problem with 3.0M6 [message #528892 is a reply to message #528888] Thu, 22 April 2010 10:12 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
Hi !
no it doesn't work this is my full template (please note that
requirement project is the root of my model :) )

[module
generate('http://org.topcased.traceability.model/1.0','http://org.topcased.requirement/1.0')/]
[template public generate(r : requirement::RequirementProject)]
[comment @main /]
[file (r.identifier, false, 'Cp1252')]
[r.identifier /]
[for (a : requirement::Requirement |
r.eAllContents(requirement::Requirement))]
try
[/for]
[for (a : ttm::Requirement | r.eAllContents(ttm::Requirement))]
other try
[/for]
[/file]
[/template]

Regards

Tristan

Le 22/04/2010 12:04, Laurent Goubet a écrit :
> Tristan,
>
> I'll admit I don't use allInstances() that much (I believe I never
> used it :p).
>
> The problem might come from the classifiers having identical names, it
> could be an issue with the OCL "allInstances" operation, it could be
> because of the "allInstances"'s scope, ... I can't say for sure as
> your template seems good to me.
>
> What would be the result of replacing allInstances by a typed
> "eAllContents" such as in :
>
> [for (r : requirement::Requirement |
> r.eAllContents(requirement::Requirement))]
> try
> [/for]
> [for (r : ttm::Requirement | r.eAllContents(ttm::Requirement))]
> other try
> [/for]
>
> Take not that the scope of my eAllContents' are your "r" variable of
> type RequirementProject ... which might not be your model root. You
> might need to go up to the root through "ancestors()->last()" or a
> couple of "eContainer()" calls.
>
> Laurent Goubet
> Obeo
>
> Tristan FAURE wrote:
>> Hi i try to use Acceleo and i want to do a "for" over a collection of
>> elements derived from an allInstances instruction
>> I use a metamodel importing another metamodel where eclasses have the
>> same name (i know not very clean)
>> this is my code and allInstances seems to return nothing. I'm working
>> on Eclipse galileo
>>
>> [module
>> generate('http://org.topcased.traceability.model/1.0','http://org.topcased.requirement/1.0')/]
>>
>> [template public generate(r : requirement::RequirementProject)]
>> [comment @main /]
>> [file (r.identifier, false, 'Cp1252')]
>> [r.identifier /]
>> [for (r : requirement::Requirement |
>> requirement::Requirement.allInstances())]
>> try
>> [/for]
>> [for (r : ttm::Requirement | ttm::Requirement.allInstances())]
>> other try
>> [/for]
>> [/file]
>> [/template]
>>
>> my output only display the identifier of my project. Did you notice
>> some problems with allInstances() instruction ?
>>
>> Tristan
>




Re: [Acceleo] AllInstances problem with 3.0M6 [message #528927 is a reply to message #528892] Thu, 22 April 2010 12:08 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------070002060601040701060708
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Tristan,

I don't know why you don't get any "try" or "other try" in the resulting
file ... You do have Requirements in the model right? :p.

Having nothing with the typed eAllContents() rules out a problem with
allInstances() ... If you remove any mention of the two "Requirement"
classifiers and use the raw name instead such as in :

[for (r.eAllContents()->select(eClass().name == 'Requirement'))]
[self/]
[/for]

Do you get the expected classes printed out in the result file?

Laurent Goubet
Obeo

Tristan FAURE wrote:
> Hi !
> no it doesn't work this is my full template (please note that
> requirement project is the root of my model :) )
>
> [module
> generate('http://org.topcased.traceability.model/1.0','http://org.topcased.requirement/1.0')/]
>
> [template public generate(r : requirement::RequirementProject)]
> [comment @main /]
> [file (r.identifier, false, 'Cp1252')]
> [r.identifier /]
> [for (a : requirement::Requirement |
> r.eAllContents(requirement::Requirement))]
> try
> [/for]
> [for (a : ttm::Requirement | r.eAllContents(ttm::Requirement))]
> other try
> [/for]
> [/file]
> [/template]
>
> Regards
>
> Tristan
>
> Le 22/04/2010 12:04, Laurent Goubet a écrit :
>> Tristan,
>>
>> I'll admit I don't use allInstances() that much (I believe I never
>> used it :p).
>>
>> The problem might come from the classifiers having identical names, it
>> could be an issue with the OCL "allInstances" operation, it could be
>> because of the "allInstances"'s scope, ... I can't say for sure as
>> your template seems good to me.
>>
>> What would be the result of replacing allInstances by a typed
>> "eAllContents" such as in :
>>
>> [for (r : requirement::Requirement |
>> r.eAllContents(requirement::Requirement))]
>> try
>> [/for]
>> [for (r : ttm::Requirement | r.eAllContents(ttm::Requirement))]
>> other try
>> [/for]
>>
>> Take not that the scope of my eAllContents' are your "r" variable of
>> type RequirementProject ... which might not be your model root. You
>> might need to go up to the root through "ancestors()->last()" or a
>> couple of "eContainer()" calls.
>>
>> Laurent Goubet
>> Obeo
>>
>> Tristan FAURE wrote:
>>> Hi i try to use Acceleo and i want to do a "for" over a collection of
>>> elements derived from an allInstances instruction
>>> I use a metamodel importing another metamodel where eclasses have the
>>> same name (i know not very clean)
>>> this is my code and allInstances seems to return nothing. I'm working
>>> on Eclipse galileo
>>>
>>> [module
>>> generate('http://org.topcased.traceability.model/1.0','http://org.topcased.requirement/1.0')/]
>>>
>>> [template public generate(r : requirement::RequirementProject)]
>>> [comment @main /]
>>> [file (r.identifier, false, 'Cp1252')]
>>> [r.identifier /]
>>> [for (r : requirement::Requirement |
>>> requirement::Requirement.allInstances())]
>>> try
>>> [/for]
>>> [for (r : ttm::Requirement | ttm::Requirement.allInstances())]
>>> other try
>>> [/for]
>>> [/file]
>>> [/template]
>>>
>>> my output only display the identifier of my project. Did you notice
>>> some problems with allInstances() instruction ?
>>>
>>> Tristan
>>


--------------070002060601040701060708
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------070002060601040701060708--
Re: [Acceleo] AllInstances problem with 3.0M6 [message #529126 is a reply to message #528927] Fri, 23 April 2010 06:33 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
Sorry try and other try it's just to create some traces :)

I will "try" your solution

Tristan

Le 22/04/2010 14:08, Laurent Goubet a écrit :
> Tristan,
>
> I don't know why you don't get any "try" or "other try" in the
> resulting file ... You do have Requirements in the model right? :p.
>
> Having nothing with the typed eAllContents() rules out a problem with
> allInstances() ... If you remove any mention of the two "Requirement"
> classifiers and use the raw name instead such as in :
>
> [for (r.eAllContents()->select(eClass().name == 'Requirement'))]
> [self/]
> [/for]
>
> Do you get the expected classes printed out in the result file?
>
> Laurent Goubet
> Obeo
>
> Tristan FAURE wrote:
>> Hi !
>> no it doesn't work this is my full template (please note that
>> requirement project is the root of my model :) )
>>
>> [module
>> generate('http://org.topcased.traceability.model/1.0','http://org.topcased.requirement/1.0')/]
>>
>> [template public generate(r : requirement::RequirementProject)]
>> [comment @main /]
>> [file (r.identifier, false, 'Cp1252')]
>> [r.identifier /]
>> [for (a : requirement::Requirement |
>> r.eAllContents(requirement::Requirement))]
>> try
>> [/for]
>> [for (a : ttm::Requirement | r.eAllContents(ttm::Requirement))]
>> other try
>> [/for]
>> [/file]
>> [/template]
>>
>> Regards
>>
>> Tristan
>>
>> Le 22/04/2010 12:04, Laurent Goubet a écrit :
>>> Tristan,
>>>
>>> I'll admit I don't use allInstances() that much (I believe I never
>>> used it :p).
>>>
>>> The problem might come from the classifiers having identical names,
>>> it could be an issue with the OCL "allInstances" operation, it could
>>> be because of the "allInstances"'s scope, ... I can't say for sure
>>> as your template seems good to me.
>>>
>>> What would be the result of replacing allInstances by a typed
>>> "eAllContents" such as in :
>>>
>>> [for (r : requirement::Requirement |
>>> r.eAllContents(requirement::Requirement))]
>>> try
>>> [/for]
>>> [for (r : ttm::Requirement | r.eAllContents(ttm::Requirement))]
>>> other try
>>> [/for]
>>>
>>> Take not that the scope of my eAllContents' are your "r" variable of
>>> type RequirementProject ... which might not be your model root. You
>>> might need to go up to the root through "ancestors()->last()" or a
>>> couple of "eContainer()" calls.
>>>
>>> Laurent Goubet
>>> Obeo
>>>
>>> Tristan FAURE wrote:
>>>> Hi i try to use Acceleo and i want to do a "for" over a collection
>>>> of elements derived from an allInstances instruction
>>>> I use a metamodel importing another metamodel where eclasses have
>>>> the same name (i know not very clean)
>>>> this is my code and allInstances seems to return nothing. I'm
>>>> working on Eclipse galileo
>>>>
>>>> [module
>>>> generate('http://org.topcased.traceability.model/1.0','http://org.topcased.requirement/1.0')/]
>>>>
>>>> [template public generate(r : requirement::RequirementProject)]
>>>> [comment @main /]
>>>> [file (r.identifier, false, 'Cp1252')]
>>>> [r.identifier /]
>>>> [for (r : requirement::Requirement |
>>>> requirement::Requirement.allInstances())]
>>>> try
>>>> [/for]
>>>> [for (r : ttm::Requirement | ttm::Requirement.allInstances())]
>>>> other try
>>>> [/for]
>>>> [/file]
>>>> [/template]
>>>>
>>>> my output only display the identifier of my project. Did you notice
>>>> some problems with allInstances() instruction ?
>>>>
>>>> Tristan
>>>
>




Re: [Acceleo] AllInstances problem with 3.0M6 [message #529127 is a reply to message #529126] Fri, 23 April 2010 06:34 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
Oops it seems i did'nt understand what you meant :/ of course i have
requirements in my model !

Tristan

Le 23/04/2010 08:33, Tristan FAURE a écrit :
> Sorry try and other try it's just to create some traces :)
>
> I will "try" your solution
>
> Tristan
>
> Le 22/04/2010 14:08, Laurent Goubet a écrit :
>> Tristan,
>>
>> I don't know why you don't get any "try" or "other try" in the
>> resulting file ... You do have Requirements in the model right? :p.
>>
>> Having nothing with the typed eAllContents() rules out a problem with
>> allInstances() ... If you remove any mention of the two "Requirement"
>> classifiers and use the raw name instead such as in :
>>
>> [for (r.eAllContents()->select(eClass().name == 'Requirement'))]
>> [self/]
>> [/for]
>>
>> Do you get the expected classes printed out in the result file?
>>
>> Laurent Goubet
>> Obeo
>>
>> Tristan FAURE wrote:
>>> Hi !
>>> no it doesn't work this is my full template (please note that
>>> requirement project is the root of my model :) )
>>>
>>> [module
>>> generate('http://org.topcased.traceability.model/1.0','http://org.topcased.requirement/1.0')/]
>>>
>>> [template public generate(r : requirement::RequirementProject)]
>>> [comment @main /]
>>> [file (r.identifier, false, 'Cp1252')]
>>> [r.identifier /]
>>> [for (a : requirement::Requirement |
>>> r.eAllContents(requirement::Requirement))]
>>> try
>>> [/for]
>>> [for (a : ttm::Requirement | r.eAllContents(ttm::Requirement))]
>>> other try
>>> [/for]
>>> [/file]
>>> [/template]
>>>
>>> Regards
>>>
>>> Tristan
>>>
>>> Le 22/04/2010 12:04, Laurent Goubet a écrit :
>>>> Tristan,
>>>>
>>>> I'll admit I don't use allInstances() that much (I believe I never
>>>> used it :p).
>>>>
>>>> The problem might come from the classifiers having identical names,
>>>> it could be an issue with the OCL "allInstances" operation, it
>>>> could be because of the "allInstances"'s scope, ... I can't say for
>>>> sure as your template seems good to me.
>>>>
>>>> What would be the result of replacing allInstances by a typed
>>>> "eAllContents" such as in :
>>>>
>>>> [for (r : requirement::Requirement |
>>>> r.eAllContents(requirement::Requirement))]
>>>> try
>>>> [/for]
>>>> [for (r : ttm::Requirement | r.eAllContents(ttm::Requirement))]
>>>> other try
>>>> [/for]
>>>>
>>>> Take not that the scope of my eAllContents' are your "r" variable
>>>> of type RequirementProject ... which might not be your model root.
>>>> You might need to go up to the root through "ancestors()->last()"
>>>> or a couple of "eContainer()" calls.
>>>>
>>>> Laurent Goubet
>>>> Obeo
>>>>
>>>> Tristan FAURE wrote:
>>>>> Hi i try to use Acceleo and i want to do a "for" over a collection
>>>>> of elements derived from an allInstances instruction
>>>>> I use a metamodel importing another metamodel where eclasses have
>>>>> the same name (i know not very clean)
>>>>> this is my code and allInstances seems to return nothing. I'm
>>>>> working on Eclipse galileo
>>>>>
>>>>> [module
>>>>> generate('http://org.topcased.traceability.model/1.0','http://org.topcased.requirement/1.0')/]
>>>>>
>>>>> [template public generate(r : requirement::RequirementProject)]
>>>>> [comment @main /]
>>>>> [file (r.identifier, false, 'Cp1252')]
>>>>> [r.identifier /]
>>>>> [for (r : requirement::Requirement |
>>>>> requirement::Requirement.allInstances())]
>>>>> try
>>>>> [/for]
>>>>> [for (r : ttm::Requirement |
>>>>> ttm::Requirement.allInstances())]
>>>>> other try
>>>>> [/for]
>>>>> [/file]
>>>>> [/template]
>>>>>
>>>>> my output only display the identifier of my project. Did you
>>>>> notice some problems with allInstances() instruction ?
>>>>>
>>>>> Tristan
>>>>
>>




Re: [Acceleo] AllInstances problem with 3.0M6 [message #529128 is a reply to message #529127] Fri, 23 April 2010 06:48 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
I have checked your solution no result :(
i've added an output of the eallContents to check what is contained and
my requirements are displyed (to String) !! So strange ... Maybe i have
some problems with my OCL on my environment (galileo). Shoul i try on
Helios ?

[file (r.identifier, false, 'Cp1252')]
[r.identifier /]
[r.eAllContents() /]
[for (r.eAllContents()->select(eClass().name = 'Requirement')) ]
[self /]
[/for]
[/file]

Le 23/04/2010 08:34, Tristan FAURE a écrit :
> Oops it seems i did'nt understand what you meant :/ of course i have
> requirements in my model !
>
> Tristan
>
> Le 23/04/2010 08:33, Tristan FAURE a écrit :
>> Sorry try and other try it's just to create some traces :)
>>
>> I will "try" your solution
>>
>> Tristan
>>
>> Le 22/04/2010 14:08, Laurent Goubet a écrit :
>>> Tristan,
>>>
>>> I don't know why you don't get any "try" or "other try" in the
>>> resulting file ... You do have Requirements in the model right? :p.
>>>
>>> Having nothing with the typed eAllContents() rules out a problem
>>> with allInstances() ... If you remove any mention of the two
>>> "Requirement" classifiers and use the raw name instead such as in :
>>>
>>> [for (r.eAllContents()->select(eClass().name == 'Requirement'))]
>>> [self/]
>>> [/for]
>>>
>>> Do you get the expected classes printed out in the result file?
>>>
>>> Laurent Goubet
>>> Obeo
>>>
>>> Tristan FAURE wrote:
>>>> Hi !
>>>> no it doesn't work this is my full template (please note that
>>>> requirement project is the root of my model :) )
>>>>
>>>> [module
>>>> generate('http://org.topcased.traceability.model/1.0','http://org.topcased.requirement/1.0')/]
>>>>
>>>> [template public generate(r : requirement::RequirementProject)]
>>>> [comment @main /]
>>>> [file (r.identifier, false, 'Cp1252')]
>>>> [r.identifier /]
>>>> [for (a : requirement::Requirement |
>>>> r.eAllContents(requirement::Requirement))]
>>>> try
>>>> [/for]
>>>> [for (a : ttm::Requirement |
>>>> r.eAllContents(ttm::Requirement))]
>>>> other try
>>>> [/for]
>>>> [/file]
>>>> [/template]
>>>>
>>>> Regards
>>>>
>>>> Tristan
>>>>
>>>> Le 22/04/2010 12:04, Laurent Goubet a écrit :
>>>>> Tristan,
>>>>>
>>>>> I'll admit I don't use allInstances() that much (I believe I never
>>>>> used it :p).
>>>>>
>>>>> The problem might come from the classifiers having identical
>>>>> names, it could be an issue with the OCL "allInstances" operation,
>>>>> it could be because of the "allInstances"'s scope, ... I can't say
>>>>> for sure as your template seems good to me.
>>>>>
>>>>> What would be the result of replacing allInstances by a typed
>>>>> "eAllContents" such as in :
>>>>>
>>>>> [for (r : requirement::Requirement |
>>>>> r.eAllContents(requirement::Requirement))]
>>>>> try
>>>>> [/for]
>>>>> [for (r : ttm::Requirement | r.eAllContents(ttm::Requirement))]
>>>>> other try
>>>>> [/for]
>>>>>
>>>>> Take not that the scope of my eAllContents' are your "r" variable
>>>>> of type RequirementProject ... which might not be your model root.
>>>>> You might need to go up to the root through "ancestors()->last()"
>>>>> or a couple of "eContainer()" calls.
>>>>>
>>>>> Laurent Goubet
>>>>> Obeo
>>>>>
>>>>> Tristan FAURE wrote:
>>>>>> Hi i try to use Acceleo and i want to do a "for" over a
>>>>>> collection of elements derived from an allInstances instruction
>>>>>> I use a metamodel importing another metamodel where eclasses have
>>>>>> the same name (i know not very clean)
>>>>>> this is my code and allInstances seems to return nothing. I'm
>>>>>> working on Eclipse galileo
>>>>>>
>>>>>> [module
>>>>>> generate('http://org.topcased.traceability.model/1.0','http://org.topcased.requirement/1.0')/]
>>>>>>
>>>>>> [template public generate(r : requirement::RequirementProject)]
>>>>>> [comment @main /]
>>>>>> [file (r.identifier, false, 'Cp1252')]
>>>>>> [r.identifier /]
>>>>>> [for (r : requirement::Requirement |
>>>>>> requirement::Requirement.allInstances())]
>>>>>> try
>>>>>> [/for]
>>>>>> [for (r : ttm::Requirement |
>>>>>> ttm::Requirement.allInstances())]
>>>>>> other try
>>>>>> [/for]
>>>>>> [/file]
>>>>>> [/template]
>>>>>>
>>>>>> my output only display the identifier of my project. Did you
>>>>>> notice some problems with allInstances() instruction ?
>>>>>>
>>>>>> Tristan
>>>>>
>>>




Re: [Acceleo] AllInstances problem with 3.0M6 [message #529138 is a reply to message #529128] Fri, 23 April 2010 07:48 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------030009080909030300080908
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Hi Tristan,

Humm ... You have "Requirement" instances returned by "eAllContents" but
a static check on "eClass().name = 'Requirement'" doesn't return
anything ???

Can you confirm that the eClass name is indeed "Requirement" (or
whatever you put in the "select" operation)?

Other than that, if "r.eAllContents()" returns a list that indeed
contains the elements you wish to iterate on, you will need to try a
step by step to see where the "select" condition fails.

For example, you could use the following :

[file (r.identifier, false, 'Cp1252')]
[r.identifier /]
[r.eAllContents() /] // Unfiltered contents
[r.eAllContents().eClass()->asSet().name /] // Names of the contents'
eClasses, without duplicates
[r.eAllContents().eClass()->asSet()->collect(ePackage.name.concat('::').concat(name))
/] // Qualified names of these eClasses
[r.eAllContents().eClass()->asSet().name->includes('Requirement') /] //
Is there an eClass named 'Requirement' in this set?
[/file]

To try and determine what goes wrong, and where it does.

Laurent Goubet
Obeo

Tristan FAURE wrote:
> I have checked your solution no result :(
> i've added an output of the eallContents to check what is contained and
> my requirements are displyed (to String) !! So strange ... Maybe i have
> some problems with my OCL on my environment (galileo). Shoul i try on
> Helios ?
>
> [file (r.identifier, false, 'Cp1252')]
> [r.identifier /]
> [r.eAllContents() /]
> [for (r.eAllContents()->select(eClass().name = 'Requirement')) ]
> [self /]
> [/for]
> [/file]
>
> Le 23/04/2010 08:34, Tristan FAURE a écrit :
>> Oops it seems i did'nt understand what you meant :/ of course i have
>> requirements in my model !
>>
>> Tristan
>>
>> Le 23/04/2010 08:33, Tristan FAURE a écrit :
>>> Sorry try and other try it's just to create some traces :)
>>>
>>> I will "try" your solution
>>>
>>> Tristan
>>>
>>> Le 22/04/2010 14:08, Laurent Goubet a écrit :
>>>> Tristan,
>>>>
>>>> I don't know why you don't get any "try" or "other try" in the
>>>> resulting file ... You do have Requirements in the model right? :p.
>>>>
>>>> Having nothing with the typed eAllContents() rules out a problem
>>>> with allInstances() ... If you remove any mention of the two
>>>> "Requirement" classifiers and use the raw name instead such as in :
>>>>
>>>> [for (r.eAllContents()->select(eClass().name == 'Requirement'))]
>>>> [self/]
>>>> [/for]
>>>>
>>>> Do you get the expected classes printed out in the result file?
>>>>
>>>> Laurent Goubet
>>>> Obeo
>>>>
>>>> Tristan FAURE wrote:
>>>>> Hi !
>>>>> no it doesn't work this is my full template (please note that
>>>>> requirement project is the root of my model :) )
>>>>>
>>>>> [module
>>>>> generate('http://org.topcased.traceability.model/1.0','http://org.topcased.requirement/1.0')/]
>>>>>
>>>>> [template public generate(r : requirement::RequirementProject)]
>>>>> [comment @main /]
>>>>> [file (r.identifier, false, 'Cp1252')]
>>>>> [r.identifier /]
>>>>> [for (a : requirement::Requirement |
>>>>> r.eAllContents(requirement::Requirement))]
>>>>> try
>>>>> [/for]
>>>>> [for (a : ttm::Requirement |
>>>>> r.eAllContents(ttm::Requirement))]
>>>>> other try
>>>>> [/for]
>>>>> [/file]
>>>>> [/template]
>>>>>
>>>>> Regards
>>>>>
>>>>> Tristan
>>>>>
>>>>> Le 22/04/2010 12:04, Laurent Goubet a écrit :
>>>>>> Tristan,
>>>>>>
>>>>>> I'll admit I don't use allInstances() that much (I believe I never
>>>>>> used it :p).
>>>>>>
>>>>>> The problem might come from the classifiers having identical
>>>>>> names, it could be an issue with the OCL "allInstances" operation,
>>>>>> it could be because of the "allInstances"'s scope, ... I can't say
>>>>>> for sure as your template seems good to me.
>>>>>>
>>>>>> What would be the result of replacing allInstances by a typed
>>>>>> "eAllContents" such as in :
>>>>>>
>>>>>> [for (r : requirement::Requirement |
>>>>>> r.eAllContents(requirement::Requirement))]
>>>>>> try
>>>>>> [/for]
>>>>>> [for (r : ttm::Requirement | r.eAllContents(ttm::Requirement))]
>>>>>> other try
>>>>>> [/for]
>>>>>>
>>>>>> Take not that the scope of my eAllContents' are your "r" variable
>>>>>> of type RequirementProject ... which might not be your model root.
>>>>>> You might need to go up to the root through "ancestors()->last()"
>>>>>> or a couple of "eContainer()" calls.
>>>>>>
>>>>>> Laurent Goubet
>>>>>> Obeo
>>>>>>
>>>>>> Tristan FAURE wrote:
>>>>>>> Hi i try to use Acceleo and i want to do a "for" over a
>>>>>>> collection of elements derived from an allInstances instruction
>>>>>>> I use a metamodel importing another metamodel where eclasses have
>>>>>>> the same name (i know not very clean)
>>>>>>> this is my code and allInstances seems to return nothing. I'm
>>>>>>> working on Eclipse galileo
>>>>>>>
>>>>>>> [module
>>>>>>> generate('http://org.topcased.traceability.model/1.0','http://org.topcased.requirement/1.0')/]
>>>>>>>
>>>>>>> [template public generate(r : requirement::RequirementProject)]
>>>>>>> [comment @main /]
>>>>>>> [file (r.identifier, false, 'Cp1252')]
>>>>>>> [r.identifier /]
>>>>>>> [for (r : requirement::Requirement |
>>>>>>> requirement::Requirement.allInstances())]
>>>>>>> try
>>>>>>> [/for]
>>>>>>> [for (r : ttm::Requirement |
>>>>>>> ttm::Requirement.allInstances())]
>>>>>>> other try
>>>>>>> [/for]
>>>>>>> [/file]
>>>>>>> [/template]
>>>>>>>
>>>>>>> my output only display the identifier of my project. Did you
>>>>>>> notice some problems with allInstances() instruction ?
>>>>>>>
>>>>>>> Tristan
>>>>>>
>>>>


--------------030009080909030300080908
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------030009080909030300080908--
Re: [Acceleo] AllInstances problem with 3.0M6 [message #529163 is a reply to message #529138] Fri, 23 April 2010 09:04 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
I understand anything ...
in all your cases it works I list the eclasses Requirement
in this case :

[for (e : ecore::EObject | r.eAllContents()->select(e |
e.oclAsType(ecore::EObject).eClass().name = 'Requirement')) ]

[e.eClass().ePackage.name.concat('::').concat(e.eClass().nam e) /]
[/for]

it works too. I see the qualified name

but the next case ... no result
[for (e : requirement::Requirement | r.eAllContents()->select(e |
e.oclAsType(ecore::EObject).eClass().name = 'Requirement')) ]
[e.identifier /]
[/for]

but allInstances or previous cases don't work ...

Le 23/04/2010 09:48, Laurent Goubet a écrit :
> Hi Tristan,
>
> Humm ... You have "Requirement" instances returned by "eAllContents"
> but a static check on "eClass().name = 'Requirement'" doesn't return
> anything ???
>
> Can you confirm that the eClass name is indeed "Requirement" (or
> whatever you put in the "select" operation)?
>
> Other than that, if "r.eAllContents()" returns a list that indeed
> contains the elements you wish to iterate on, you will need to try a
> step by step to see where the "select" condition fails.
>
> For example, you could use the following :
>
> [file (r.identifier, false, 'Cp1252')]
> [r.identifier /]
> [r.eAllContents() /] // Unfiltered contents
> [r.eAllContents().eClass()->asSet().name /] // Names of the
> contents' eClasses, without duplicates
> [r.eAllContents().eClass()->asSet()->collect(ePackage.name.concat('::').concat(name))
> /] // Qualified names of these eClasses
> [r.eAllContents().eClass()->asSet().name->includes('Requirement')
> /] // Is there an eClass named 'Requirement' in this set?
> [/file]
>
> To try and determine what goes wrong, and where it does.
>
> Laurent Goubet
> Obeo
>
> Tristan FAURE wrote:
>> I have checked your solution no result :(
>> i've added an output of the eallContents to check what is contained
>> and my requirements are displyed (to String) !! So strange ... Maybe
>> i have some problems with my OCL on my environment (galileo). Shoul i
>> try on Helios ?
>>
>> [file (r.identifier, false, 'Cp1252')]
>> [r.identifier /]
>> [r.eAllContents() /]
>> [for (r.eAllContents()->select(eClass().name = 'Requirement')) ]
>> [self /]
>> [/for]
>> [/file]
>>
>> Le 23/04/2010 08:34, Tristan FAURE a écrit :
>>> Oops it seems i did'nt understand what you meant :/ of course i have
>>> requirements in my model !
>>>
>>> Tristan
>>>
>>> Le 23/04/2010 08:33, Tristan FAURE a écrit :
>>>> Sorry try and other try it's just to create some traces :)
>>>>
>>>> I will "try" your solution
>>>>
>>>> Tristan
>>>>
>>>> Le 22/04/2010 14:08, Laurent Goubet a écrit :
>>>>> Tristan,
>>>>>
>>>>> I don't know why you don't get any "try" or "other try" in the
>>>>> resulting file ... You do have Requirements in the model right? :p.
>>>>>
>>>>> Having nothing with the typed eAllContents() rules out a problem
>>>>> with allInstances() ... If you remove any mention of the two
>>>>> "Requirement" classifiers and use the raw name instead such as in :
>>>>>
>>>>> [for (r.eAllContents()->select(eClass().name == 'Requirement'))]
>>>>> [self/]
>>>>> [/for]
>>>>>
>>>>> Do you get the expected classes printed out in the result file?
>>>>>
>>>>> Laurent Goubet
>>>>> Obeo
>>>>>
>>>>> Tristan FAURE wrote:
>>>>>> Hi !
>>>>>> no it doesn't work this is my full template (please note that
>>>>>> requirement project is the root of my model :) )
>>>>>>
>>>>>> [module
>>>>>> generate('http://org.topcased.traceability.model/1.0','http://org.topcased.requirement/1.0')/]
>>>>>>
>>>>>> [template public generate(r : requirement::RequirementProject)]
>>>>>> [comment @main /]
>>>>>> [file (r.identifier, false, 'Cp1252')]
>>>>>> [r.identifier /]
>>>>>> [for (a : requirement::Requirement |
>>>>>> r.eAllContents(requirement::Requirement))]
>>>>>> try
>>>>>> [/for]
>>>>>> [for (a : ttm::Requirement |
>>>>>> r.eAllContents(ttm::Requirement))]
>>>>>> other try
>>>>>> [/for]
>>>>>> [/file]
>>>>>> [/template]
>>>>>>
>>>>>> Regards
>>>>>>
>>>>>> Tristan
>>>>>>
>>>>>> Le 22/04/2010 12:04, Laurent Goubet a écrit :
>>>>>>> Tristan,
>>>>>>>
>>>>>>> I'll admit I don't use allInstances() that much (I believe I
>>>>>>> never used it :p).
>>>>>>>
>>>>>>> The problem might come from the classifiers having identical
>>>>>>> names, it could be an issue with the OCL "allInstances"
>>>>>>> operation, it could be because of the "allInstances"'s scope,
>>>>>>> ... I can't say for sure as your template seems good to me.
>>>>>>>
>>>>>>> What would be the result of replacing allInstances by a typed
>>>>>>> "eAllContents" such as in :
>>>>>>>
>>>>>>> [for (r : requirement::Requirement |
>>>>>>> r.eAllContents(requirement::Requirement))]
>>>>>>> try
>>>>>>> [/for]
>>>>>>> [for (r : ttm::Requirement | r.eAllContents(ttm::Requirement))]
>>>>>>> other try
>>>>>>> [/for]
>>>>>>>
>>>>>>> Take not that the scope of my eAllContents' are your "r"
>>>>>>> variable of type RequirementProject ... which might not be your
>>>>>>> model root. You might need to go up to the root through
>>>>>>> "ancestors()->last()" or a couple of "eContainer()" calls.
>>>>>>>
>>>>>>> Laurent Goubet
>>>>>>> Obeo
>>>>>>>
>>>>>>> Tristan FAURE wrote:
>>>>>>>> Hi i try to use Acceleo and i want to do a "for" over a
>>>>>>>> collection of elements derived from an allInstances instruction
>>>>>>>> I use a metamodel importing another metamodel where eclasses
>>>>>>>> have the same name (i know not very clean)
>>>>>>>> this is my code and allInstances seems to return nothing. I'm
>>>>>>>> working on Eclipse galileo
>>>>>>>>
>>>>>>>> [module
>>>>>>>> generate('http://org.topcased.traceability.model/1.0','http://org.topcased.requirement/1.0')/]
>>>>>>>>
>>>>>>>> [template public generate(r : requirement::RequirementProject)]
>>>>>>>> [comment @main /]
>>>>>>>> [file (r.identifier, false, 'Cp1252')]
>>>>>>>> [r.identifier /]
>>>>>>>> [for (r : requirement::Requirement |
>>>>>>>> requirement::Requirement.allInstances())]
>>>>>>>> try
>>>>>>>> [/for]
>>>>>>>> [for (r : ttm::Requirement |
>>>>>>>> ttm::Requirement.allInstances())]
>>>>>>>> other try
>>>>>>>> [/for]
>>>>>>>> [/file]
>>>>>>>> [/template]
>>>>>>>>
>>>>>>>> my output only display the identifier of my project. Did you
>>>>>>>> notice some problems with allInstances() instruction ?
>>>>>>>>
>>>>>>>> Tristan
>>>>>>>
>>>>>
>




Re: [Acceleo] AllInstances problem with 3.0M6 [message #529167 is a reply to message #529163] Fri, 23 April 2010 09:16 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------030704060802000609050908
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Tristan,

Do you get anything in the error log or console when trying to evaluate
the expression that fails (your second case in the previous mail)? And
when you say "no result" : do you get absolutely nothing (empty String)
or "invalid" dynamic EObjects (OCL's invalid result)?

I can only think of a ClassCastException happening under the hood and
pruning your results ... but that would mean you'd get something looged
in the error log.

Laurent Goubet
Obeo

Tristan FAURE wrote:
> I understand anything ...
> in all your cases it works I list the eclasses Requirement
> in this case :
>
> [for (e : ecore::EObject | r.eAllContents()->select(e |
> e.oclAsType(ecore::EObject).eClass().name = 'Requirement')) ]
>
> [e.eClass().ePackage.name.concat('::').concat(e.eClass().nam e) /]
> [/for]
>
> it works too. I see the qualified name
>
> but the next case ... no result
> [for (e : requirement::Requirement | r.eAllContents()->select(e |
> e.oclAsType(ecore::EObject).eClass().name = 'Requirement')) ]
> [e.identifier /]
> [/for]
>
> but allInstances or previous cases don't work ...
>
> Le 23/04/2010 09:48, Laurent Goubet a écrit :
>> Hi Tristan,
>>
>> Humm ... You have "Requirement" instances returned by "eAllContents"
>> but a static check on "eClass().name = 'Requirement'" doesn't return
>> anything ???
>>
>> Can you confirm that the eClass name is indeed "Requirement" (or
>> whatever you put in the "select" operation)?
>>
>> Other than that, if "r.eAllContents()" returns a list that indeed
>> contains the elements you wish to iterate on, you will need to try a
>> step by step to see where the "select" condition fails.
>>
>> For example, you could use the following :
>>
>> [file (r.identifier, false, 'Cp1252')]
>> [r.identifier /]
>> [r.eAllContents() /] // Unfiltered contents
>> [r.eAllContents().eClass()->asSet().name /] // Names of the
>> contents' eClasses, without duplicates
>>
>> [r.eAllContents().eClass()->asSet()->collect(ePackage.name.concat('::').concat(name))
>> /] // Qualified names of these eClasses
>> [r.eAllContents().eClass()->asSet().name->includes('Requirement')
>> /] // Is there an eClass named 'Requirement' in this set?
>> [/file]
>>
>> To try and determine what goes wrong, and where it does.
>>
>> Laurent Goubet
>> Obeo
>>
>> Tristan FAURE wrote:
>>> I have checked your solution no result :(
>>> i've added an output of the eallContents to check what is contained
>>> and my requirements are displyed (to String) !! So strange ... Maybe
>>> i have some problems with my OCL on my environment (galileo). Shoul i
>>> try on Helios ?
>>>
>>> [file (r.identifier, false, 'Cp1252')]
>>> [r.identifier /]
>>> [r.eAllContents() /]
>>> [for (r.eAllContents()->select(eClass().name = 'Requirement')) ]
>>> [self /]
>>> [/for]
>>> [/file]
>>>
>>> Le 23/04/2010 08:34, Tristan FAURE a écrit :
>>>> Oops it seems i did'nt understand what you meant :/ of course i have
>>>> requirements in my model !
>>>>
>>>> Tristan
>>>>
>>>> Le 23/04/2010 08:33, Tristan FAURE a écrit :
>>>>> Sorry try and other try it's just to create some traces :)
>>>>>
>>>>> I will "try" your solution
>>>>>
>>>>> Tristan
>>>>>
>>>>> Le 22/04/2010 14:08, Laurent Goubet a écrit :
>>>>>> Tristan,
>>>>>>
>>>>>> I don't know why you don't get any "try" or "other try" in the
>>>>>> resulting file ... You do have Requirements in the model right? :p.
>>>>>>
>>>>>> Having nothing with the typed eAllContents() rules out a problem
>>>>>> with allInstances() ... If you remove any mention of the two
>>>>>> "Requirement" classifiers and use the raw name instead such as in :
>>>>>>
>>>>>> [for (r.eAllContents()->select(eClass().name == 'Requirement'))]
>>>>>> [self/]
>>>>>> [/for]
>>>>>>
>>>>>> Do you get the expected classes printed out in the result file?
>>>>>>
>>>>>> Laurent Goubet
>>>>>> Obeo
>>>>>>
>>>>>> Tristan FAURE wrote:
>>>>>>> Hi !
>>>>>>> no it doesn't work this is my full template (please note that
>>>>>>> requirement project is the root of my model :) )
>>>>>>>
>>>>>>> [module
>>>>>>> generate('http://org.topcased.traceability.model/1.0','http://org.topcased.requirement/1.0')/]
>>>>>>>
>>>>>>> [template public generate(r : requirement::RequirementProject)]
>>>>>>> [comment @main /]
>>>>>>> [file (r.identifier, false, 'Cp1252')]
>>>>>>> [r.identifier /]
>>>>>>> [for (a : requirement::Requirement |
>>>>>>> r.eAllContents(requirement::Requirement))]
>>>>>>> try
>>>>>>> [/for]
>>>>>>> [for (a : ttm::Requirement |
>>>>>>> r.eAllContents(ttm::Requirement))]
>>>>>>> other try
>>>>>>> [/for]
>>>>>>> [/file]
>>>>>>> [/template]
>>>>>>>
>>>>>>> Regards
>>>>>>>
>>>>>>> Tristan
>>>>>>>
>>>>>>> Le 22/04/2010 12:04, Laurent Goubet a écrit :
>>>>>>>> Tristan,
>>>>>>>>
>>>>>>>> I'll admit I don't use allInstances() that much (I believe I
>>>>>>>> never used it :p).
>>>>>>>>
>>>>>>>> The problem might come from the classifiers having identical
>>>>>>>> names, it could be an issue with the OCL "allInstances"
>>>>>>>> operation, it could be because of the "allInstances"'s scope,
>>>>>>>> ... I can't say for sure as your template seems good to me.
>>>>>>>>
>>>>>>>> What would be the result of replacing allInstances by a typed
>>>>>>>> "eAllContents" such as in :
>>>>>>>>
>>>>>>>> [for (r : requirement::Requirement |
>>>>>>>> r.eAllContents(requirement::Requirement))]
>>>>>>>> try
>>>>>>>> [/for]
>>>>>>>> [for (r : ttm::Requirement | r.eAllContents(ttm::Requirement))]
>>>>>>>> other try
>>>>>>>> [/for]
>>>>>>>>
>>>>>>>> Take not that the scope of my eAllContents' are your "r"
>>>>>>>> variable of type RequirementProject ... which might not be your
>>>>>>>> model root. You might need to go up to the root through
>>>>>>>> "ancestors()->last()" or a couple of "eContainer()" calls.
>>>>>>>>
>>>>>>>> Laurent Goubet
>>>>>>>> Obeo
>>>>>>>>
>>>>>>>> Tristan FAURE wrote:
>>>>>>>>> Hi i try to use Acceleo and i want to do a "for" over a
>>>>>>>>> collection of elements derived from an allInstances instruction
>>>>>>>>> I use a metamodel importing another metamodel where eclasses
>>>>>>>>> have the same name (i know not very clean)
>>>>>>>>> this is my code and allInstances seems to return nothing. I'm
>>>>>>>>> working on Eclipse galileo
>>>>>>>>>
>>>>>>>>> [module
>>>>>>>>> generate('http://org.topcased.traceability.model/1.0','http://org.topcased.requirement/1.0')/]
>>>>>>>>>
>>>>>>>>> [template public generate(r : requirement::RequirementProject)]
>>>>>>>>> [comment @main /]
>>>>>>>>> [file (r.identifier, false, 'Cp1252')]
>>>>>>>>> [r.identifier /]
>>>>>>>>> [for (r : requirement::Requirement |
>>>>>>>>> requirement::Requirement.allInstances())]
>>>>>>>>> try
>>>>>>>>> [/for]
>>>>>>>>> [for (r : ttm::Requirement |
>>>>>>>>> ttm::Requirement.allInstances())]
>>>>>>>>> other try
>>>>>>>>> [/for]
>>>>>>>>> [/file]
>>>>>>>>> [/template]
>>>>>>>>>
>>>>>>>>> my output only display the identifier of my project. Did you
>>>>>>>>> notice some problems with allInstances() instruction ?
>>>>>>>>>
>>>>>>>>> Tristan
>>>>>>>>
>>>>>>
>>


--------------030704060802000609050908
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------030704060802000609050908--
Re: [Acceleo] AllInstances problem with 3.0M6 [message #529176 is a reply to message #529167] Fri, 23 April 2010 09:44 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
I had a log because I have two type of requirements
ttm::Requirement
requirement::Requirement and my iterator had some cast problems

but in this loop :
[for (e : requirement::Requirement | r.eAllContents()->select(e |
e.oclIsTypeOf(requirement::Requirement))) ]
[e.identifier /]
[/for]
no log, no entry in my result file :(

anyway this case works . It is a workaround for me but I think there is
a problem in Acceleo
[for (e : ttm::Requirement | r.eAllContents()->select(e |
e.oclAsType(ecore::EObject).eClass().name = 'Requirement' and
e.oclAsType(ecore::EObject).eClass().ePackage.name = 'ttm')) ]
[e.ident /]
[/for]

Le 23/04/2010 11:16, Laurent Goubet a écrit :
> Tristan,
>
> Do you get anything in the error log or console when trying to
> evaluate the expression that fails (your second case in the previous
> mail)? And when you say "no result" : do you get absolutely nothing
> (empty String) or "invalid" dynamic EObjects (OCL's invalid result)?
>
> I can only think of a ClassCastException happening under the hood and
> pruning your results ... but that would mean you'd get something
> looged in the error log.
>
> Laurent Goubet
> Obeo
>
> Tristan FAURE wrote:
>> I understand anything ...
>> in all your cases it works I list the eclasses Requirement
>> in this case :
>>
>> [for (e : ecore::EObject | r.eAllContents()->select(e |
>> e.oclAsType(ecore::EObject).eClass().name = 'Requirement')) ]
>>
>> [e.eClass().ePackage.name.concat('::').concat(e.eClass().nam e) /]
>> [/for]
>>
>> it works too. I see the qualified name
>>
>> but the next case ... no result
>> [for (e : requirement::Requirement | r.eAllContents()->select(e |
>> e.oclAsType(ecore::EObject).eClass().name = 'Requirement')) ]
>> [e.identifier /]
>> [/for]
>>
>> but allInstances or previous cases don't work ...
>>
>> Le 23/04/2010 09:48, Laurent Goubet a écrit :
>>> Hi Tristan,
>>>
>>> Humm ... You have "Requirement" instances returned by "eAllContents"
>>> but a static check on "eClass().name = 'Requirement'" doesn't return
>>> anything ???
>>>
>>> Can you confirm that the eClass name is indeed "Requirement" (or
>>> whatever you put in the "select" operation)?
>>>
>>> Other than that, if "r.eAllContents()" returns a list that indeed
>>> contains the elements you wish to iterate on, you will need to try a
>>> step by step to see where the "select" condition fails.
>>>
>>> For example, you could use the following :
>>>
>>> [file (r.identifier, false, 'Cp1252')]
>>> [r.identifier /]
>>> [r.eAllContents() /] // Unfiltered contents
>>> [r.eAllContents().eClass()->asSet().name /] // Names of the
>>> contents' eClasses, without duplicates
>>>
>>> [r.eAllContents().eClass()->asSet()->collect(ePackage.name.concat('::').concat(name))
>>> /] // Qualified names of these eClasses
>>>
>>> [r.eAllContents().eClass()->asSet().name->includes('Requirement') /]
>>> // Is there an eClass named 'Requirement' in this set?
>>> [/file]
>>>
>>> To try and determine what goes wrong, and where it does.
>>>
>>> Laurent Goubet
>>> Obeo
>>>
>>> Tristan FAURE wrote:
>>>> I have checked your solution no result :(
>>>> i've added an output of the eallContents to check what is contained
>>>> and my requirements are displyed (to String) !! So strange ...
>>>> Maybe i have some problems with my OCL on my environment (galileo).
>>>> Shoul i try on Helios ?
>>>>
>>>> [file (r.identifier, false, 'Cp1252')]
>>>> [r.identifier /]
>>>> [r.eAllContents() /]
>>>> [for (r.eAllContents()->select(eClass().name =
>>>> 'Requirement')) ]
>>>> [self /]
>>>> [/for]
>>>> [/file]
>>>>
>>>> Le 23/04/2010 08:34, Tristan FAURE a écrit :
>>>>> Oops it seems i did'nt understand what you meant :/ of course i
>>>>> have requirements in my model !
>>>>>
>>>>> Tristan
>>>>>
>>>>> Le 23/04/2010 08:33, Tristan FAURE a écrit :
>>>>>> Sorry try and other try it's just to create some traces :)
>>>>>>
>>>>>> I will "try" your solution
>>>>>>
>>>>>> Tristan
>>>>>>
>>>>>> Le 22/04/2010 14:08, Laurent Goubet a écrit :
>>>>>>> Tristan,
>>>>>>>
>>>>>>> I don't know why you don't get any "try" or "other try" in the
>>>>>>> resulting file ... You do have Requirements in the model right? :p.
>>>>>>>
>>>>>>> Having nothing with the typed eAllContents() rules out a problem
>>>>>>> with allInstances() ... If you remove any mention of the two
>>>>>>> "Requirement" classifiers and use the raw name instead such as in :
>>>>>>>
>>>>>>> [for (r.eAllContents()->select(eClass().name == 'Requirement'))]
>>>>>>> [self/]
>>>>>>> [/for]
>>>>>>>
>>>>>>> Do you get the expected classes printed out in the result file?
>>>>>>>
>>>>>>> Laurent Goubet
>>>>>>> Obeo
>>>>>>>
>>>>>>> Tristan FAURE wrote:
>>>>>>>> Hi !
>>>>>>>> no it doesn't work this is my full template (please note that
>>>>>>>> requirement project is the root of my model :) )
>>>>>>>>
>>>>>>>> [module
>>>>>>>> generate('http://org.topcased.traceability.model/1.0','http://org.topcased.requirement/1.0')/]
>>>>>>>>
>>>>>>>> [template public generate(r : requirement::RequirementProject)]
>>>>>>>> [comment @main /]
>>>>>>>> [file (r.identifier, false, 'Cp1252')]
>>>>>>>> [r.identifier /]
>>>>>>>> [for (a : requirement::Requirement |
>>>>>>>> r.eAllContents(requirement::Requirement))]
>>>>>>>> try
>>>>>>>> [/for]
>>>>>>>> [for (a : ttm::Requirement |
>>>>>>>> r.eAllContents(ttm::Requirement))]
>>>>>>>> other try
>>>>>>>> [/for]
>>>>>>>> [/file]
>>>>>>>> [/template]
>>>>>>>>
>>>>>>>> Regards
>>>>>>>>
>>>>>>>> Tristan
>>>>>>>>
>>>>>>>> Le 22/04/2010 12:04, Laurent Goubet a écrit :
>>>>>>>>> Tristan,
>>>>>>>>>
>>>>>>>>> I'll admit I don't use allInstances() that much (I believe I
>>>>>>>>> never used it :p).
>>>>>>>>>
>>>>>>>>> The problem might come from the classifiers having identical
>>>>>>>>> names, it could be an issue with the OCL "allInstances"
>>>>>>>>> operation, it could be because of the "allInstances"'s scope,
>>>>>>>>> ... I can't say for sure as your template seems good to me.
>>>>>>>>>
>>>>>>>>> What would be the result of replacing allInstances by a typed
>>>>>>>>> "eAllContents" such as in :
>>>>>>>>>
>>>>>>>>> [for (r : requirement::Requirement |
>>>>>>>>> r.eAllContents(requirement::Requirement))]
>>>>>>>>> try
>>>>>>>>> [/for]
>>>>>>>>> [for (r : ttm::Requirement | r.eAllContents(ttm::Requirement))]
>>>>>>>>> other try
>>>>>>>>> [/for]
>>>>>>>>>
>>>>>>>>> Take not that the scope of my eAllContents' are your "r"
>>>>>>>>> variable of type RequirementProject ... which might not be
>>>>>>>>> your model root. You might need to go up to the root through
>>>>>>>>> "ancestors()->last()" or a couple of "eContainer()" calls.
>>>>>>>>>
>>>>>>>>> Laurent Goubet
>>>>>>>>> Obeo
>>>>>>>>>
>>>>>>>>> Tristan FAURE wrote:
>>>>>>>>>> Hi i try to use Acceleo and i want to do a "for" over a
>>>>>>>>>> collection of elements derived from an allInstances instruction
>>>>>>>>>> I use a metamodel importing another metamodel where eclasses
>>>>>>>>>> have the same name (i know not very clean)
>>>>>>>>>> this is my code and allInstances seems to return nothing. I'm
>>>>>>>>>> working on Eclipse galileo
>>>>>>>>>>
>>>>>>>>>> [module
>>>>>>>>>> generate('http://org.topcased.traceability.model/1.0','http://org.topcased.requirement/1.0')/]
>>>>>>>>>>
>>>>>>>>>> [template public generate(r : requirement::RequirementProject)]
>>>>>>>>>> [comment @main /]
>>>>>>>>>> [file (r.identifier, false, 'Cp1252')]
>>>>>>>>>> [r.identifier /]
>>>>>>>>>> [for (r : requirement::Requirement |
>>>>>>>>>> requirement::Requirement.allInstances())]
>>>>>>>>>> try
>>>>>>>>>> [/for]
>>>>>>>>>> [for (r : ttm::Requirement |
>>>>>>>>>> ttm::Requirement.allInstances())]
>>>>>>>>>> other try
>>>>>>>>>> [/for]
>>>>>>>>>> [/file]
>>>>>>>>>> [/template]
>>>>>>>>>>
>>>>>>>>>> my output only display the identifier of my project. Did you
>>>>>>>>>> notice some problems with allInstances() instruction ?
>>>>>>>>>>
>>>>>>>>>> Tristan
>>>>>>>>>
>>>>>>>
>>>
>




Re: [Acceleo] AllInstances problem with 3.0M6 [message #529191 is a reply to message #529176] Fri, 23 April 2010 11:09 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------030507090206050209040203
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Tristan,

Looking at this last example, I'd say OCL or Acceleo confuses the two
classifiers, even though you use a qualified name. I'll try and check
some more on this.

Laurent Goubet
Obeo

Tristan FAURE wrote:
> I had a log because I have two type of requirements
> ttm::Requirement
> requirement::Requirement and my iterator had some cast problems
>
> but in this loop :
> [for (e : requirement::Requirement | r.eAllContents()->select(e |
> e.oclIsTypeOf(requirement::Requirement))) ]
> [e.identifier /]
> [/for]
> no log, no entry in my result file :(
>
> anyway this case works . It is a workaround for me but I think there is
> a problem in Acceleo
> [for (e : ttm::Requirement | r.eAllContents()->select(e |
> e.oclAsType(ecore::EObject).eClass().name = 'Requirement' and
> e.oclAsType(ecore::EObject).eClass().ePackage.name = 'ttm')) ]
> [e.ident /]
> [/for]
>
> Le 23/04/2010 11:16, Laurent Goubet a écrit :
>> Tristan,
>>
>> Do you get anything in the error log or console when trying to
>> evaluate the expression that fails (your second case in the previous
>> mail)? And when you say "no result" : do you get absolutely nothing
>> (empty String) or "invalid" dynamic EObjects (OCL's invalid result)?
>>
>> I can only think of a ClassCastException happening under the hood and
>> pruning your results ... but that would mean you'd get something
>> looged in the error log.
>>
>> Laurent Goubet
>> Obeo
>>
>> Tristan FAURE wrote:
>>> I understand anything ...
>>> in all your cases it works I list the eclasses Requirement
>>> in this case :
>>>
>>> [for (e : ecore::EObject | r.eAllContents()->select(e |
>>> e.oclAsType(ecore::EObject).eClass().name = 'Requirement')) ]
>>>
>>> [e.eClass().ePackage.name.concat('::').concat(e.eClass().nam e) /]
>>> [/for]
>>>
>>> it works too. I see the qualified name
>>>
>>> but the next case ... no result
>>> [for (e : requirement::Requirement | r.eAllContents()->select(e |
>>> e.oclAsType(ecore::EObject).eClass().name = 'Requirement')) ]
>>> [e.identifier /]
>>> [/for]
>>>
>>> but allInstances or previous cases don't work ...
>>>
>>> Le 23/04/2010 09:48, Laurent Goubet a écrit :
>>>> Hi Tristan,
>>>>
>>>> Humm ... You have "Requirement" instances returned by "eAllContents"
>>>> but a static check on "eClass().name = 'Requirement'" doesn't return
>>>> anything ???
>>>>
>>>> Can you confirm that the eClass name is indeed "Requirement" (or
>>>> whatever you put in the "select" operation)?
>>>>
>>>> Other than that, if "r.eAllContents()" returns a list that indeed
>>>> contains the elements you wish to iterate on, you will need to try a
>>>> step by step to see where the "select" condition fails.
>>>>
>>>> For example, you could use the following :
>>>>
>>>> [file (r.identifier, false, 'Cp1252')]
>>>> [r.identifier /]
>>>> [r.eAllContents() /] // Unfiltered contents
>>>> [r.eAllContents().eClass()->asSet().name /] // Names of the
>>>> contents' eClasses, without duplicates
>>>>
>>>> [r.eAllContents().eClass()->asSet()->collect(ePackage.name.concat('::').concat(name))
>>>> /] // Qualified names of these eClasses
>>>>
>>>> [r.eAllContents().eClass()->asSet().name->includes('Requirement') /]
>>>> // Is there an eClass named 'Requirement' in this set?
>>>> [/file]
>>>>
>>>> To try and determine what goes wrong, and where it does.
>>>>
>>>> Laurent Goubet
>>>> Obeo
>>>>
>>>> Tristan FAURE wrote:
>>>>> I have checked your solution no result :(
>>>>> i've added an output of the eallContents to check what is contained
>>>>> and my requirements are displyed (to String) !! So strange ...
>>>>> Maybe i have some problems with my OCL on my environment (galileo).
>>>>> Shoul i try on Helios ?
>>>>>
>>>>> [file (r.identifier, false, 'Cp1252')]
>>>>> [r.identifier /]
>>>>> [r.eAllContents() /]
>>>>> [for (r.eAllContents()->select(eClass().name =
>>>>> 'Requirement')) ]
>>>>> [self /]
>>>>> [/for]
>>>>> [/file]
>>>>>
>>>>> Le 23/04/2010 08:34, Tristan FAURE a écrit :
>>>>>> Oops it seems i did'nt understand what you meant :/ of course i
>>>>>> have requirements in my model !
>>>>>>
>>>>>> Tristan
>>>>>>
>>>>>> Le 23/04/2010 08:33, Tristan FAURE a écrit :
>>>>>>> Sorry try and other try it's just to create some traces :)
>>>>>>>
>>>>>>> I will "try" your solution
>>>>>>>
>>>>>>> Tristan
>>>>>>>
>>>>>>> Le 22/04/2010 14:08, Laurent Goubet a écrit :
>>>>>>>> Tristan,
>>>>>>>>
>>>>>>>> I don't know why you don't get any "try" or "other try" in the
>>>>>>>> resulting file ... You do have Requirements in the model right? :p.
>>>>>>>>
>>>>>>>> Having nothing with the typed eAllContents() rules out a problem
>>>>>>>> with allInstances() ... If you remove any mention of the two
>>>>>>>> "Requirement" classifiers and use the raw name instead such as in :
>>>>>>>>
>>>>>>>> [for (r.eAllContents()->select(eClass().name == 'Requirement'))]
>>>>>>>> [self/]
>>>>>>>> [/for]
>>>>>>>>
>>>>>>>> Do you get the expected classes printed out in the result file?
>>>>>>>>
>>>>>>>> Laurent Goubet
>>>>>>>> Obeo
>>>>>>>>
>>>>>>>> Tristan FAURE wrote:
>>>>>>>>> Hi !
>>>>>>>>> no it doesn't work this is my full template (please note that
>>>>>>>>> requirement project is the root of my model :) )
>>>>>>>>>
>>>>>>>>> [module
>>>>>>>>> generate('http://org.topcased.traceability.model/1.0','http://org.topcased.requirement/1.0')/]
>>>>>>>>>
>>>>>>>>> [template public generate(r : requirement::RequirementProject)]
>>>>>>>>> [comment @main /]
>>>>>>>>> [file (r.identifier, false, 'Cp1252')]
>>>>>>>>> [r.identifier /]
>>>>>>>>> [for (a : requirement::Requirement |
>>>>>>>>> r.eAllContents(requirement::Requirement))]
>>>>>>>>> try
>>>>>>>>> [/for]
>>>>>>>>> [for (a : ttm::Requirement |
>>>>>>>>> r.eAllContents(ttm::Requirement))]
>>>>>>>>> other try
>>>>>>>>> [/for]
>>>>>>>>> [/file]
>>>>>>>>> [/template]
>>>>>>>>>
>>>>>>>>> Regards
>>>>>>>>>
>>>>>>>>> Tristan
>>>>>>>>>
>>>>>>>>> Le 22/04/2010 12:04, Laurent Goubet a écrit :
>>>>>>>>>> Tristan,
>>>>>>>>>>
>>>>>>>>>> I'll admit I don't use allInstances() that much (I believe I
>>>>>>>>>> never used it :p).
>>>>>>>>>>
>>>>>>>>>> The problem might come from the classifiers having identical
>>>>>>>>>> names, it could be an issue with the OCL "allInstances"
>>>>>>>>>> operation, it could be because of the "allInstances"'s scope,
>>>>>>>>>> ... I can't say for sure as your template seems good to me.
>>>>>>>>>>
>>>>>>>>>> What would be the result of replacing allInstances by a typed
>>>>>>>>>> "eAllContents" such as in :
>>>>>>>>>>
>>>>>>>>>> [for (r : requirement::Requirement |
>>>>>>>>>> r.eAllContents(requirement::Requirement))]
>>>>>>>>>> try
>>>>>>>>>> [/for]
>>>>>>>>>> [for (r : ttm::Requirement | r.eAllContents(ttm::Requirement))]
>>>>>>>>>> other try
>>>>>>>>>> [/for]
>>>>>>>>>>
>>>>>>>>>> Take not that the scope of my eAllContents' are your "r"
>>>>>>>>>> variable of type RequirementProject ... which might not be
>>>>>>>>>> your model root. You might need to go up to the root through
>>>>>>>>>> "ancestors()->last()" or a couple of "eContainer()" calls.
>>>>>>>>>>
>>>>>>>>>> Laurent Goubet
>>>>>>>>>> Obeo
>>>>>>>>>>
>>>>>>>>>> Tristan FAURE wrote:
>>>>>>>>>>> Hi i try to use Acceleo and i want to do a "for" over a
>>>>>>>>>>> collection of elements derived from an allInstances instruction
>>>>>>>>>>> I use a metamodel importing another metamodel where eclasses
>>>>>>>>>>> have the same name (i know not very clean)
>>>>>>>>>>> this is my code and allInstances seems to return nothing. I'm
>>>>>>>>>>> working on Eclipse galileo
>>>>>>>>>>>
>>>>>>>>>>> [module
>>>>>>>>>>> generate('http://org.topcased.traceability.model/1.0','http://org.topcased.requirement/1.0')/]
>>>>>>>>>>>
>>>>>>>>>>> [template public generate(r : requirement::RequirementProject)]
>>>>>>>>>>> [comment @main /]
>>>>>>>>>>> [file (r.identifier, false, 'Cp1252')]
>>>>>>>>>>> [r.identifier /]
>>>>>>>>>>> [for (r : requirement::Requirement |
>>>>>>>>>>> requirement::Requirement.allInstances())]
>>>>>>>>>>> try
>>>>>>>>>>> [/for]
>>>>>>>>>>> [for (r : ttm::Requirement |
>>>>>>>>>>> ttm::Requirement.allInstances())]
>>>>>>>>>>> other try
>>>>>>>>>>> [/for]
>>>>>>>>>>> [/file]
>>>>>>>>>>> [/template]
>>>>>>>>>>>
>>>>>>>>>>> my output only display the identifier of my project. Did you
>>>>>>>>>>> notice some problems with allInstances() instruction ?
>>>>>>>>>>>
>>>>>>>>>>> Tristan
>>>>>>>>>>
>>>>>>>>
>>>>
>>


--------------030507090206050209040203
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------030507090206050209040203--
Previous Topic:[xpand] how to get input model from xmi
Next Topic:[Xpand] Write an example conforming to model ?
Goto Forum:
  


Current Time: Fri Mar 29 01:58:38 GMT 2024

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

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

Back to the top