|
|
Re: closure operation [message #1073834 is a reply to message #1073774] |
Thu, 25 July 2013 15:18 |
Archevo tarek Messages: 21 Registered: July 2013 |
Junior Member |
|
|
Hi ed,
Thanks for your response.
Concerning the request, i don't really see how to do else. In my first request:
self.activity.oclAsType(Sequence).activities->closure(a:Activity| a.oclAsType(Activity))->asSequence()->size()
i cant access to the process activities without going through the sequence (of type Activity) activity and then get the "activities" property (a list of type Activity) of the Sequence class in the metamodel , then, in the closure navigate recursively for each element in the collection.
i have 13 activity in my example, it executes in my java code and it returns 12, it omitted an activity inside another sequence activity, which means that it doesn't navigate inside.
Second, when i test it, there are parsing errors, while in java code there's no exceptions:
Parsing failure
1: Unresolved Type 'Activity'
1: Ambiguous resolution:
Property : model::CompensationHandler.activity
Property : model::While.activity
Property : model::Process.activity
Property : model::TerminationHandler.activity
Property : model::CatchAll.activity
Property : model::ForEach.activity
Property : model::Source.activity
Property : model::OnAlarm.activity
Property : model::If.activity
Property : model::Catch.activity
Property : model::ElseIf.activity
Property : model::Target.activity
Property : model::Scope.activity
Property : model::OnMessage.activity
Property : model::RepeatUntil.activity
Property : model::OnEvent.activity
Property : model::Else.activity
1: Unresolved Property 'Sequence(T)::activities'
1: Unresolved Operation 'OclInvalid::oclAsType(Set(null::Activity))'
Sorry, but i don't understand
I'm just following the metamodel in the ecore file.
How to resolve this?
Thanks in advance.
|
|
|
Re: closure operation [message #1073864 is a reply to message #1073834] |
Thu, 25 July 2013 16:46 |
Ed Willink Messages: 7669 Registered: July 2009 |
Senior Member |
|
|
Hi
One of your problems is that "Sequence" is a restricted word in OCL so
you are casting to an ocl::Sequence rather than a model::Collection.
You can tell this because the Xtext OCL Console user a bold purple font
for special words.
The next problem is that you do no navigation, so you might try
self.activity.oclAsType(model::Sequence)
but that will bomb if have any non-activities ...
However the BPEL metamodel has main disparate activities containers so
you're probably better to escape from the metamodel and use
self->closure(oclContents()->select(oclIsKindOf(Activity)))->size()
Regards
Ed Willink
On 25/07/2013 16:18, Archevo tarek wrote:
> Hi ed,
> Thanks for your response.
>
> Concerning the request, i don't really see how to do else. In my first
> request:
>
> self.activity.oclAsType(Sequence).activities->closure(a:Activity|
> a.oclAsType(Activity))->asSequence()->size()
>
> i cant access to the process activities without going through the
> sequence (of type Activity) activity and then get the "activities"
> property (a list of type Activity) of the Sequence class in the
> metamodel , then, in the closure navigate recursively for each element
> in the collection.
> i have 13 activity in my example, it executes in my java code and it
> returns 12, it omitted an activity inside another sequence activity,
> which means that it doesn't navigate inside.
>
> Second, when i test it, there are parsing errors, while in java code
> there's no exceptions:
>
>
> Parsing failure
>
> 1: Unresolved Type 'Activity'
> 1: Ambiguous resolution:
> Property : model::CompensationHandler.activity
> Property : model::While.activity
> Property : model::Process.activity
> Property : model::TerminationHandler.activity
> Property : model::CatchAll.activity
> Property : model::ForEach.activity
> Property : model::Source.activity
> Property : model::OnAlarm.activity
> Property : model::If.activity
> Property : model::Catch.activity
> Property : model::ElseIf.activity
> Property : model::Target.activity
> Property : model::Scope.activity
> Property : model::OnMessage.activity
> Property : model::RepeatUntil.activity
> Property : model::OnEvent.activity
> Property : model::Else.activity
> 1: Unresolved Property 'Sequence(T)::activities'
> 1: Unresolved Operation 'OclInvalid::oclAsType(Set(null::Activity))'
>
> Sorry, but i don't understand
> I'm just following the metamodel in the ecore file.
>
> How to resolve this?
>
> Thanks in advance.
>
>
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.04000 seconds