Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMT (Generative Modeling Technologies) » [TCS] UML 2.1.1 TCS
[TCS] UML 2.1.1 TCS [message #380607] Wed, 26 December 2007 10:11 Go to next message
Eclipse User
Originally posted by: awiede01.univ-lr.fr

Hi all.

I have a problem building a TCS syntax file for an UML-like metamodel.
Below is a simpler metamodel based on UML 2.1.1 where I replicated the
modelization problem I have: I wonder how to specify the "type"
reference of "Property" instances in a km3 style syntax.

The simplified metamodel:
package LAST {
class Root extends {
reference elements[*] container : Element ;
}
abstract class Element {
attribute name : String;
}
abstract class Type {
}
class Property extends Element {
reference type[0-1] : Type;
}
class Classifier extends Element, Type {
reference properties[*] container : Property;
}
datatype String;
}

Let's take a simple syntax like the one below:
template Root main
: elements ;
template Element abstract ;
template Type abstract ;
template Classifier
: "Classifier" name "{" properties "}" ;
template Property
: "Property" name (isDefined(type) ? ":" type ) ";" ;

then I can textually specify something like:

Classifier caramba {
Property one: Classifier byjove { Property two ; } ;
}

which is correct but not very convenient. I would prefer specifying it
this way

Classifier caramba {
Property one : byjove ;
}
Classifier byjove {
Property two ;
}

in a "km3 style" manner.
So I tried to modify my TCS syntax i.e. add the Classifier template to
and give the "Property" template a different definition:

template Classifier addToContext
: "Classifier" name "{" properties "}" ;
template Property
: "Property" name (isDefined(type) ? ":" type{refersTo = name} ) ";" ;

Indeed, 'I' know that actual instances used as types in my models will
necessarily be "Classifier" instances, hence will have a name. But the
system doesn't and logically complains, underlining the "refersTo =
name" part of the "Property" template, indicating that "There is no
metamodel StructuralFeature corresponding to referredTo property name in
Type".
So my question is: how should I do to reference existing "Classifier"
instances of a given model to bind it to the "type" reference of
"Property" instances, using a TCS template? I can't modify the
metamodel, since the abstract class "Type" is defined this way in UML 2.1.1.
Any ideas?

Regards,
Antoine Wiedemann
Re: [TCS] UML 2.1.1 TCS [message #380840 is a reply to message #380607] Tue, 08 January 2008 11:58 Go to previous message
Eclipse User
Originally posted by: mikael.barbero.gmail.com

Hi Antoine,

First, thanks for the detailed description of your problem. I see that
you have well understood TCS ;) Unfortunately, the system "logically
complains" as you say and there is no real workaround except changing
the metamodel. You can not refer to an element which has no attribute
and then no means to be identified.

Best regards,
Mikael

Antoine Wiedemann wrote:
> Hi all.
>
> I have a problem building a TCS syntax file for an UML-like metamodel.
> Below is a simpler metamodel based on UML 2.1.1 where I replicated the
> modelization problem I have: I wonder how to specify the "type"
> reference of "Property" instances in a km3 style syntax.
>
> The simplified metamodel:
> package LAST {
> class Root extends {
> reference elements[*] container : Element ;
> }
> abstract class Element {
> attribute name : String;
> }
> abstract class Type {
> }
> class Property extends Element {
> reference type[0-1] : Type;
> }
> class Classifier extends Element, Type {
> reference properties[*] container : Property;
> }
> datatype String;
> }
>
> Let's take a simple syntax like the one below:
> template Root main
> : elements ;
> template Element abstract ;
> template Type abstract ;
> template Classifier
> : "Classifier" name "{" properties "}" ;
> template Property
> : "Property" name (isDefined(type) ? ":" type ) ";" ;
>
> then I can textually specify something like:
>
> Classifier caramba {
> Property one: Classifier byjove { Property two ; } ;
> }
>
> which is correct but not very convenient. I would prefer specifying it
> this way
>
> Classifier caramba {
> Property one : byjove ;
> }
> Classifier byjove {
> Property two ;
> }
>
> in a "km3 style" manner.
> So I tried to modify my TCS syntax i.e. add the Classifier template to
> and give the "Property" template a different definition:
>
> template Classifier addToContext
> : "Classifier" name "{" properties "}" ;
> template Property
> : "Property" name (isDefined(type) ? ":" type{refersTo = name} )
> ";" ;
>
> Indeed, 'I' know that actual instances used as types in my models will
> necessarily be "Classifier" instances, hence will have a name. But the
> system doesn't and logically complains, underlining the "refersTo =
> name" part of the "Property" template, indicating that "There is no
> metamodel StructuralFeature corresponding to referredTo property name in
> Type".
> So my question is: how should I do to reference existing "Classifier"
> instances of a given model to bind it to the "type" reference of
> "Property" instances, using a TCS template? I can't modify the
> metamodel, since the abstract class "Type" is defined this way in UML
> 2.1.1.
> Any ideas?
>
> Regards,
> Antoine Wiedemann



--
Mikaël Barbero - PhD Candidate
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssinière
44322 Nantes Cedex 3 - France
tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00
email: Mikael.Barbero@{gmail.com, univ-nantes.fr}
http://www.sciences.univ-nantes.fr/lina/atl/
Re: [TCS] UML 2.1.1 TCS [message #611156 is a reply to message #380607] Tue, 08 January 2008 11:58 Go to previous message
Eclipse User
Originally posted by: mikael.barbero.gmail.com

Hi Antoine,

First, thanks for the detailed description of your problem. I see that
you have well understood TCS ;) Unfortunately, the system "logically
complains" as you say and there is no real workaround except changing
the metamodel. You can not refer to an element which has no attribute
and then no means to be identified.

Best regards,
Mikael

Antoine Wiedemann wrote:
> Hi all.
>
> I have a problem building a TCS syntax file for an UML-like metamodel.
> Below is a simpler metamodel based on UML 2.1.1 where I replicated the
> modelization problem I have: I wonder how to specify the "type"
> reference of "Property" instances in a km3 style syntax.
>
> The simplified metamodel:
> package LAST {
> class Root extends {
> reference elements[*] container : Element ;
> }
> abstract class Element {
> attribute name : String;
> }
> abstract class Type {
> }
> class Property extends Element {
> reference type[0-1] : Type;
> }
> class Classifier extends Element, Type {
> reference properties[*] container : Property;
> }
> datatype String;
> }
>
> Let's take a simple syntax like the one below:
> template Root main
> : elements ;
> template Element abstract ;
> template Type abstract ;
> template Classifier
> : "Classifier" name "{" properties "}" ;
> template Property
> : "Property" name (isDefined(type) ? ":" type ) ";" ;
>
> then I can textually specify something like:
>
> Classifier caramba {
> Property one: Classifier byjove { Property two ; } ;
> }
>
> which is correct but not very convenient. I would prefer specifying it
> this way
>
> Classifier caramba {
> Property one : byjove ;
> }
> Classifier byjove {
> Property two ;
> }
>
> in a "km3 style" manner.
> So I tried to modify my TCS syntax i.e. add the Classifier template to
> and give the "Property" template a different definition:
>
> template Classifier addToContext
> : "Classifier" name "{" properties "}" ;
> template Property
> : "Property" name (isDefined(type) ? ":" type{refersTo = name} )
> ";" ;
>
> Indeed, 'I' know that actual instances used as types in my models will
> necessarily be "Classifier" instances, hence will have a name. But the
> system doesn't and logically complains, underlining the "refersTo =
> name" part of the "Property" template, indicating that "There is no
> metamodel StructuralFeature corresponding to referredTo property name in
> Type".
> So my question is: how should I do to reference existing "Classifier"
> instances of a given model to bind it to the "type" reference of
> "Property" instances, using a TCS template? I can't modify the
> metamodel, since the abstract class "Type" is defined this way in UML
> 2.1.1.
> Any ideas?
>
> Regards,
> Antoine Wiedemann



--
Mikaël Barbero - PhD Candidate
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssinière
44322 Nantes Cedex 3 - France
tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00
email: Mikael.Barbero@{gmail.com, univ-nantes.fr}
http://www.sciences.univ-nantes.fr/lina/atl/
Previous Topic:[TCS] More than one syntax construction per class AND optional keywords
Next Topic:[AM3] Am3 installation problem
Goto Forum:
  


Current Time: Fri Aug 01 05:54:16 EDT 2014

Powered by FUDForum. Page generated in 0.08724 seconds