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 #611101] Wed, 26 December 2007 10: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
Previous Topic:[TCS] playing with km3 metamodel and syntax
Next Topic:[TCS] KM3 save bug
Goto Forum:
  


Current Time: Thu Jul 31 09:33:36 EDT 2014

Powered by FUDForum. Page generated in 0.01581 seconds