|
Re: [TCS] referTo by subtype property [message #12403 is a reply to message #12393] |
Fri, 25 April 2008 06:41 |
Frédéric Jouault Messages: 572 Registered: July 2009 |
Senior Member |
|
|
Hello,
TCS has a constraint that checks if the "name" attribute exists in the
referred element (class Parent here).
However, if you only add ChildOne elements to contexts, then all
possible referred elements would have a name attribute.
I am not sure that this case makes a lot of sense (as you said, this
situation is not very nice). However, it seems that if we relaxed this
constraint (e.g., make it a warning instead of an error), this may work.
You may try modifying the TCS2Problem.atl transformation that is in the
TCS project (in the WFR folder): changing the severity from #error to
#warning in rule AtLeastOneStructuralFeatureByRefersToPArg.
Note that you may also need to do something about rule
PrimitiveTypesCannotBeReferredTo.
Once the modification done, and the program recompiled you can put the
new TCS2Problem.asm in plugin org.eclipse.gmt.tcs.dsls, folder
resources/TCS/WFR, then restart Eclipse.
If you try this, please let us know what happens ;-).
Thanks,
Frédéric Jouault
Thibault a écrit :
> Hi,
>
> assuming I have a metamodel like this:
>
> class Referer {
> reference parent[1-*] container : Parent;
> }
>
> abstract class Parent {
> }
>
> class ChildOne extends Parent {
> attribute name : String;
> }
>
> class ChildTwo extends Parent {
> }
>
>
> and I had a metamodel constraint that whenever Referer refers to a
> Parent, then it really refers to ChildOne. (This is not very nice, one
> could refer to ChildOne directly, but there are cases where this is so).
> Is there any way i could still in the TCS do something like
>
> template Referer
> : parent{refersTo=name}
> ;
>
> Is anything like that planned?
>
|
|
|
Powered by
FUDForum. Page generated in 0.01460 seconds