Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » MOFScript » Problem with creating instances
Problem with creating instances [message #638514] Thu, 11 November 2010 14:47 Go to next message
No real name is currently offline No real nameFriend
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 09:44 Go to previous message
Gøran K. Olsen is currently offline Gøran K. OlsenFriend
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: Fri Apr 26 05:24:51 GMT 2024

Powered by FUDForum. Page generated in 0.03502 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top