Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » a derived property(how can we duplicate the content of a class (even its associations and composition))
a derived property [message #1798548] Tue, 20 November 2018 10:43 Go to next message
argaz amazigFriend
Messages: 28
Registered: November 2018
Junior Member
how can we duplicate the content of a class (even its associations and composition) rather than copiying the original elements

I want to create an instance of message class from its containing port where each message is formed by a set of parameters

I'm using OCLinEcore (a metamodel)
thanks in advance
Re: a derived property [message #1798554 is a reply to message #1798548] Tue, 20 November 2018 12:02 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6458
Registered: July 2009
Senior Member
H

I'm confused. You first duplicate classes then instances.

Class duplication is often avoided by using inheritance.

Instance duplication is hard to avoid since it is usually exactly what is necessary. Instantiation is a deliberate duplication wrt the creation protocol.

Regards

Ed Willink
Re: a derived property [message #1798666 is a reply to message #1798554] Thu, 22 November 2018 12:34 Go to previous messageGo to next message
argaz amazigFriend
Messages: 28
Registered: November 2018
Junior Member
Hi,
thanks
but what I want is to have a copy of the object when instanciating the class but being able to define defferent values for the attributes
Re: a derived property [message #1798678 is a reply to message #1798666] Thu, 22 November 2018 15:40 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6458
Registered: July 2009
Senior Member
Hi

I'm totally confused.

This is the OCL forum. OCL by itself is useless since it cannot access let alone create or modify a model.

You suggest that you are using OCLinEcore, but tghe OCL in ECore cannot create or modify, so perhaps you are using Ecore so what is wrong with EcoreUtil.copy followed by a set ZXXX() or two.

The Pivot OCL prototypes an ability to create shadow objects and you can assign properties arbitrarily during construction, but I doubt that is what you want.

I suggest you actually make clear what you want rather than assuming that we understand your hints.

Regards

Ed Willink
Re: a derived property [message #1798711 is a reply to message #1798678] Fri, 23 November 2018 06:00 Go to previous messageGo to next message
argaz amazigFriend
Messages: 28
Registered: November 2018
Junior Member
thanks,

What I want is as follows
if I have a class 1 (meta model) having a set of and messages (ordered composes) property to my class
I want to have a class1 byt being modifiable without altering the values of the original objects
that means I creat a new class 2 with property ports PortClass {derivation: self.source.ports as collection (only meaning))
when instanciating the model, I get instances of the class 1 but if I change the value, it wont work, it changes the values of the source also
Re: a derived property [message #1798720 is a reply to message #1798711] Fri, 23 November 2018 08:58 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6458
Registered: July 2009
Senior Member
Hi

You ignore my comment and perpetuate the ping-pong. See https://wiki.eclipse.org/OCL/ForumNetiquette

In particular who/what creates/modifies/instantiates and how?

And of course, without an example, what do you mean by a message? In OCL, message support means the horrible syntax kludge to support UML send/receive messages pre/post-conditions.

Regards

Ed Willink
Re: a derived property [message #1799005 is a reply to message #1798720] Wed, 28 November 2018 15:04 Go to previous message
argaz amazigFriend
Messages: 28
Registered: November 2018
Junior Member
Ed Willink, thanks
Previous Topic:Map type support in OCL?
Next Topic:Fail to correctly parse CompleteOCL constraints
Goto Forum:
  


Current Time: Fri Sep 20 03:17:56 GMT 2019

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

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

Back to the top