Skip to main content



      Home
Home » Modeling » Papyrus » Derived Property(compute derived Property based on other Properties)
Derived Property [message #1869645] Tue, 20 August 2024 10:15 Go to next message
Eclipse UserFriend
Hi all,

I created a new uml Profile and defined a new Stereotype within this Profile. The Stereotype has three Properties, all of them are typed as Integer.

index.php/fa/45039/0/

Property 3 is a derived property and my goal is that this derived property is computed based on Property 1 and Property 2. For example "Property3 = Property1 + Property2". I applied the Profile to a SysML 1.6 Model and was able to create an element and apply the new Stereotype.

index.php/fa/45042/0/

But I was not able to compute the derived Property "Property3". So far I tried to use the computation of a derived relation between the Properties, or to create an Operation of the Stereotyp for the computation, but i was not able to reach the desired behavior. Does anyone know how to define the computation of a derived Property and can explain it to me or give me an example project?

Any help or examples would be greatly appreciated.

Thank you!


Re: Derived Property [message #1869726 is a reply to message #1869645] Thu, 22 August 2024 10:46 Go to previous messageGo to next message
Eclipse UserFriend
Hello,
you need to create a static profile (so to convert your UML2 profile into an EMF model with the UML2Ecore tools (installable with the feature UML2 Extender).
Once you generated the Ecore file, you can edit the calculus of Property3.

One of the way to achieve this behavior is the usage of EAnnotation like done for Profile AAS (line 47 à 52) in the class
https://gitlab.eclipse.org/eclipse/papyrus/org.eclipse.papyrus-manufacturing/-/blob/master/aas/plugins/modeling/org.eclipse.papyrus.aas.profile/resources/aas.ecore?ref_type=heads

In these lines you will find the java code embedded inside an EAnnotation to get the calculus of the property Referable#idShort.

After the Ecore generation, you will find this code inside the generated class ReferableImpl#getIdShort() line 127 in https://gitlab.eclipse.org/eclipse/papyrus/org.eclipse.papyrus-manufacturing/-/blob/master/aas/plugins/modeling/org.eclipse.papyrus.aas.profile/src/org/eclipse/papyrus/aas/impl/ReferableImpl.java?ref_type=heads.

HTH,
Vincent
Re: Derived Property [message #1870413 is a reply to message #1869726] Tue, 27 August 2024 04:37 Go to previous messageGo to next message
Eclipse UserFriend
Hi Vincent,

thank you for your reply. We greatly appreciate your help. I collaborate with the thread opener Florian Randlkofer. Since he is on leave I continue this issue.

May you can explain a bit more in detail how Java code can be embedded for computation. So far I was able to copy the .profile-file into a EMF-project (under model as parent). Then I generated a Ecore-file by right click on the uml-file > New... > Other... > Ecore Model (then following the guidance selecting "EPackage"). When opening the XML-represented content (Ecore-file) I have to realize that there is no content that represents the profile content just a XML-head.

May you explain the procedure more in detail how we can perform and implement a behavior described by Florian Randlkofer. Thank you in advance.

PS: We use Eclipse 06-2024. All subpackages are updated to the latest.
Re: Derived Property [message #1870494 is a reply to message #1869726] Fri, 30 August 2024 06:25 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Now I understood what Vincent's answer aimed at. To clearify our fundamental plan I repeat it in other words. The way you described probably targets the topic "Code generation from UML".

Generally speaking we want to create a profile which can be applied to UML models afterwards. Numerical data values shall be calculated and determined based on different kind of inputs. (Value propertys in referenced elements, enumeration choices...) No code shall be generated from the UML. So it is more about determination of values (which can be called "derived" in context of other modeling tools) based on manual value setting.

To achieve the goal we thought it might be good to proceed in small steps. First, we want to calculate a numerical property as the output of a simple summation function, which has two other numerical propertys as inputs. Then we want to achieve the same logic, but inputs shall come from a property which is owned by a second element in reference with the first. (With elements I mean stereotypes since this taked place in a profile creation context.)

Can somebody who is familiar with stuff like this give a estimation about the feasability and subsequently give a short instruction on how to create a profile that includes such behaviors.

Thank you all in advance.

Best
Florian
Re: Derived Property [message #1870695 is a reply to message #1870494] Thu, 05 September 2024 07:51 Go to previous messageGo to next message
Eclipse UserFriend
Hi Florian,
my answer was about derived property calculation and was not about "Code generation from UML". In my answer we generate code in order to get a "static profile" and manage the derived properties.
The "Code generation from UML" is another subject targeted by specific Papyrus components, not required here.

/Vincent
Re: Derived Property [message #1870698 is a reply to message #1870695] Thu, 05 September 2024 08:47 Go to previous messageGo to next message
Eclipse UserFriend
Hi Vincent,

Thanks for clarification. So far I was able to generate a static profile (by using the uml as input for the EMF Generator Model).

Could you please elaborate the instructions on where to embed the code and making the behavior work after applying the profile to a normal model.

Thank you in advance.

Florian
Re: Derived Property [message #1871289 is a reply to message #1870698] Thu, 19 September 2024 09:10 Go to previous message
Eclipse UserFriend
Hello Florian,
you will find documentation about the usage of static profile in your environment in the Eclipse documentation at this location https://help.eclipse.org/2024-06/index.jsp?topic=%2Forg.eclipse.papyrus.uml.diagram.profile.doc%2Ftarget%2Fgenerated-eclipse-help%2Fusers%2FgeneratingStaticProfiles.html&cp%3D64_0_1_8_5


HTH,
Vincent

[Updated on: Thu, 19 September 2024 09:14] by Moderator

Previous Topic:Papyrus 6.7.0 and Moka 4.1.0?
Next Topic:Papyrus for Manufacturing (P4M)
Goto Forum:
  


Current Time: Fri Nov 07 13:38:47 EST 2025

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

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

Back to the top