[TCS] UML 2.1.1 TCS [message #380607] |
Wed, 26 December 2007 15:11 |
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 16:58 |
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 16:58 |
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/
|
|
|
Powered by
FUDForum. Page generated in 0.02891 seconds