In search for Item properties/ Accessing items properties

Hello,

I have been adding some properties to my Capella items such as:
image

When it comes to already existing features such as “Visible in doc” then i found out that it can be identified through at least 2 methods:

  1. Directly in the Semantic tab:
  2. Or, using
aql:self.eClass().eAllStructuralFeatures

Indeed, the feature can be valued using:

aql:self.visibleInDoc
aql:self.target.visibleInDoc

Question:
Do you think it is possible to access a newly added property (through Sirius), and modify it/get its value etc… eventhough it does not exist as a feature?
Let’s say i want to generate through M2DOC the value of “Fully Decomposed” the new property shown in the first image.
Thanks

Last note: I am studying EMF right now, i wonder if that could ever help with this.

visibleInDoc and visibleInLM are two EAttribute defined by the Capella metamodel and that’s why you can access them like any other EStructuralFeature (EAttribute and EReference) via AQL.

Property value is an other mecanism of Capella and the PVMT add-on. You should be able to retrieve applied values like this:

self.appliedPropertyValues

Then you can cast depending on the type of the value (Boolean, Enumeraion, Float, Integer, String):

self.appliedPropertyValues->select(pv | pv.name = 'MyProperty').oclAsType(capellacore::BooleanPropertyValue).value

You need the cast here because the AbstractPropertyValue doesn’t have the value EStructuralFeature.

If they are in a group:

self.appliedPropertyValueGroups.valuedElements

I guess this should return a list of AbstractPropertyValue…

Hello YvanLussaud,
Unfortunately i am afraid this is not the property i am pointing at.
Indeed, i did not use the “right click → add property value group”, nor did I download the PVMT add-on.
Instead i created a new property using SIRIUS, specifically Sirius Specifier. As you can see the propery shows in a newly created tab (Extended properties), See first image of my first post. The usual property value groups would not show there.

I am afraid that this Sirius Specifier does only create “graphical” variables, which cannot be accessed by our M2DOC. I am not sure if there is any “real” variables created… that can be retrieved with M2DOC.

I am not sure where are my Sirius specifier variables (new properties) created / stored. And hence, how could i get access to their values and use them with M2DOC.


Maybe I am wrong, and all of this is related to “appliedPropertyValues”? However, It would not work nor show my 2 properties on the interpreter :


Finally if it is really impossible to access these properties, I am wondering what other solution could be done. (Creating new variables automatically? that would match the ones i made with sirius?)

It’s seems to be something different. I think you should check to PVMT add-on to add properties to Capella elements.

PS: I asked the Sirius team more information about this…

1 Like

Ok i just checked it, and i got a little problem.
I would like to fill the values of the PVMT properties automaticaly. Let’s say with… AQL queries.

Example:
Property: “LogicalFunctionParentAndGrandparentComponents”
Value by default: "Sequence{FirstParentComponent,FirstGrandParentComponent}"

Or more simple, without a sequence, the following image illustrates it:
Property: “LogicalFunctionParentComponent”
Value by default: “FirstParentComponent”

My goal ultimately, is to GENERATE BACK this values with M2DOC.

  1. Is there a way to use AQL with PVMT? (To fill some values automatically and dynamically)
  2. Instead, would be possible to use Java functions with PVMT?

Finally,
3) Did the Sirius team give you any insight on how to retrieve/ STORE the newly added “graphical” properties (through the sirius specifier), in hope of using the retrieved property with M2DOC or not yet/not really?
image

Thanks again.

You can use the ancestors() service:

self.ancestors(la::LogicalComponent)

For the PVMT add-on, I don’t know if it’s possible. You can ask this question in the general Capella forum to have an answer.

Did you create a property view in your .odesign ? because this is not enough to store the corresponding values. If you want to attach new values to the Capella model, you should use the PVMT add-on. The use case you describe here is a bit weird though. You probably don’t want to store something you can compute unless you have a way to update that stored value when the model change.

Alright, I will try.

Yes I know, now, how to use the AQL queries (ancestor, or container etc…), I was wondering if AQL can be used at all or not, indeed.

Please keep me in touch, if you ever get an answer from Sirius people.
Or Anything related to this issue/matter. → (“generating data with M2DOC/or other, from automaticly filled “NEW” properties”, properties that can still be edited later on" → voila that’s how i would summerize my goal/challenge, and finally, thank you.)

I just saw your edit:

Yes I did create it in .odesign.
Yes I just tried PVMT add-on, HOWEVER, its values are not dependent on aql. Hence, I can only fill the PVMT default values manually. I want my values to have default values that depend on aql computations.

I would like only, the default value, to be computed.
You raise a real issue, are right it is a real problem, because, as soon as the info is “manually” edited, i don’t want it to be updated AGAIN. So i Want a dynamic automation (aql computation) that isn’t triggered/computed later on necessarily.
So to summarize:

  1. Default value must be computed. Once.
  2. New values are obtained manually.
  3. New values are stored.
  4. New values should not be computed again unless a manual change is done.

Extra point (optional?):
5) Maybe exceptionnaly, a button, could allow new values to be computed again (new values are no longer dependent on manual edits). So in the end, values should be manually editable + can be computed if need arises + while having their very first default value be computed.

To store the value I would use PVMT, To initialize the value:

  • in batch something like Python4Capella
    • you will need to distinguish a default value from a manual value…
  • live you will have to code some listener in Java and attach it when the Capella/Sirius session opens.
    • it should set the value of the created property

That’s beyond M2Doc for sure. I hope you will find a solution.

1 Like

1) Python4Capella:

What do you mean exaclty? “in batch”?
I really like P4C and I would like to work with it in the future, however my prerequesite would be to have my “properties”/new attributes" interactive with a regular capella user.
Here:
image

Here my properties are instantly accessible to the user.


Is what you are thinking about/suggesting with P4C something that needs the user to “leave” Capella View, and go into the Python Scripts/menus?

If there is anything that can be done and that does not involve having the user “leaving” Capella, then I am all for it!


2) Coding Java:
I am still learning about EMF, not sure i could attain this coding level yet (Check Capella or even Sirius sessions).
Question about your proposition: would such java code/method, as you imagine it, be attached to some add-on/viewpoint I created → and Then if “activated”, then whenever i create a PVMT attribute (or sirius property), the default value would be edited by my additional “activate” java code? (never used that yet).

Optional:

I don’t want to create something that requires the user to leave the capella view/diagrams, but here is a side question, out of curiosity let’s say, does P4C allow using UI libraries? Which would allow us to create our own “capella side views” based on Python UI libraries, theoretically? Thanks

Edit

Edit: If you really think about it, one solution would be to create my own capella class that would be inherited from some other capella Class. (Default values can be controlled, editable manually, accessible with M2DOC, i can add as many attributes as I need)

Batch mode would be when you modify a model from time to time no on the fly on each modification.

To use this, you would need to create your own Capella add-on:

  • metamodel to staore values and attach them to Capella
  • create your property view
    And for this you will need to create Eclpise plugins and the maven build that goes with it. It can be done but it’s not the same cost as using PVMT…

Yes in batch mode you will need a command (menu) to run your script. This command can be contributed on a Capella element, there are examples script doing that on Python4Capella.

  1. That similar to the beginning of this message.