Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » MOFScript » Problem with creating instances
Problem with creating instances [message #638514] Thu, 11 November 2010 09:47 Go to next message
No real name is currently offline No real name
Messages: 1
Registered: November 2010
Junior Member
Hi,
I am trying to create instances of classes of the model I use.

texttransformation GenerateObjects (in
mdl:"http://www.eclipse.org/uml2/3.0.0/UML",
out uml:"http://www.eclipse.org/uml2/3.0./UML"(uml.Model)) {

mdl.Class::main () {
var obj : uml.InstanceSpecification =
new uml.InstanceSpecification(classifier=self)
// | what goes here?
}
}

I don't want to clone objects. I would like to create instances from scratch.
Any ideas or pointers to documentation (the user guide is not helpful in this respect).

Thanks,

Robert Amthor
Re: Problem with creating instances [message #639889 is a reply to message #638514] Thu, 18 November 2010 04:44 Go to previous message
Gøran K. Olsen is currently offline Gøran K. Olsen
Messages: 184
Registered: July 2009
Senior Member
Hi Robert,

from what I can see in your example you are taking a uml model containing
classes as input and then you want to create instances of the classes.

In your out model example I can not see any uml.Model/uml.Package etc.

You will have to investigate the uml metamodel to see how
uml.InstanceSpecifications are stored. You need to contain them, similar to
for example uml.Properties that are contained by a class.
aClass.ownedAttributes.

A good start is to manually create an example model in uml (e.g. use the
tree editor) with similar structure as your output, then it will be easier
to see what you need to create and how the structure should be to make the
model "valid".

Cheers,
G
Previous Topic:Feature not found
Next Topic:Looking for a working example
Goto Forum:
  


Current Time: Mon Apr 21 08:59:43 EDT 2014

Powered by FUDForum. Page generated in 0.09331 seconds