Syntax for use of ecore types within HUTN [message #878747] |
Tue, 29 May 2012 17:21  |
Eclipse User |
|
|
|
I have a minimal model expressed in EMF:
package ThingWrappers;
class ThingWrapper {
attr String name = "";
val ecore.EClassifier thing;
}
I define the attribute 'thing' on class ThingWrapper to be of type ecore.EClassifier such that it may accommodate actual things of any type within the EClassifier hierarchy. I would like to create a test model using HUTN to instantiate the model:
@Spec {
metamodel "ThingWrappers" {
nsUri: "ThingWrappers"
}
metamodel "ecore" {
nsUri: "<link to ecore metamodel>"
}
}
ThingWrappers {
ThingWrapper "TW1" {
name: "My Thing Wrapper"
thing: EBoolean#true
}
}
What's the correct syntax for assigning the Boolean value 'true' to 'thing'?
Thanks in advance ...
|
|
|
|
|
Re: Syntax for use of ecore types within HUTN [message #880964 is a reply to message #879264] |
Sun, 03 June 2012 10:03  |
Eclipse User |
|
|
|
Hi Chris,
Thanks a lot for the clarification; I think that I understand now.
Unfortunately, I'm almost certain that EMF doesn't have an equivalent of the "thing" type. In fact, I think that primitive and model element types are disjoint in Ecore. One possible way to approach this would be to have a slightly less elegant metamodel, that provides separate wrappers for the primitives and for model elements:
class BooleanWrapper {
attr Boolean[1] value;
}
class IntegerWrapper {
attr Integer[1] value;
}
// etc, for other primitive values
class ThingWrapper {
val EObject[1] thing;
}
With this metamodel, the HUTN would be as follows:
@Spec {
<blah>
}
ThingWrappers {
ThingWrapper "TW1" {
thing: BooleanWrapper { value: true }
}
ThingWrapper "TW2" {
thing: BoxOfChocolates "Chocs" {
name: "Milk Chocolates"
}
}
}
I hope this (slightly clunky) solution will work for you. If not, then we should perhaps ask for some help on the EMF forum.
Cheers,
Louis.
|
|
|
Powered by
FUDForum. Page generated in 0.10420 seconds