|
Re: OCL Constraint in ecore model [message #1027795 is a reply to message #1027762] |
Wed, 27 March 2013 12:24 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi
You can augment the behaviour of an Xtext editor by Loading a Complete
OCL Resource, so you could get diagnosis of an unwanted state.
However the OCL uis purely observational. It cannot repair your 'broken'
grammar.
In my experience such a grammar is not broken, because if the grammar
has insufficient precision, your user has insuiffocient understand too.
Therefpre the grammar should allow what seems sensible and give warnings
on the wing input.
Warnings can come from Java/CHECKS built-in to the editor, Complete OCL
added manually to the edit session, or OCLinEcore/Xcore built-in to the
model.
Regards
Ed Willink
On 27/03/2013 11:39, Günther Fiedler wrote:
> Hello comunity,
>
> The past few days i´ve been working on an activity diagram editor
> using Xtext to design the meta-model and GMF. It´s not like the usual
> UML diagram, because of domain specific requirements. The editor works
> fine, but still there are some issues which need to be fixed.
> Here is my DSL:
>
> ActivityDiagram:
> {ActivityDiagram}
> 'ActivityDiagram: '
> (nodes += Node*)
> (pins += Pin*)
> 'AEND';
>
> Flow:
> (ControlFlow|ObjectFlow) //represents ControlFlow or ObjectFlow
> ;
> ControlFlow:
> ('[' label=STRING ']')? '=>'(aim=[Node])
> ;
> ObjectFlow:
> ('[' label=STRING ']')? '>>' target=[SourceNodes]
> ;
>
> Pin:
> 'Pin' name=ID '{' type=STRING objectflows += ObjectFlow (','
> objectflows += ObjectFlow)* '}';
>
> Node:
> ( FinalNode|SourceNodes)
> ;
>
> SourceNodes:
> ( InitialNode | ActionNode | ForkNode | JoinNode)
> ('{' flows+=ControlFlow (','flows+=ControlFlow )* '}')
> ;
>
> InitialNode:
> 'Initial' name=ID ;
>
> FinalNode:
> 'Final' name=ID
> ;
>
> ActionNode:
> 'Action' name=ID
> ( 'Pin' pin = [Pin])? ;
>
> ForkNode:
> 'Fork' name=ID;
>
> JoinNode:
> 'Join' name=ID;
>
> As you can see, i allow adding a Pin which (contains an ObjectFlow) to
> an ActionNode. Furthermore i also need ControlFlows. The Problem is,
> that the editor requests both flows after i added a Pin.
>
> I was thinking that maybe an OCL Constraint could help to solve this
> Problem.
>
> What do you think?
>
>
> kind regards,
> Günther
|
|
|
|
Powered by
FUDForum. Page generated in 0.03825 seconds