How to export an Allocating Actor/Component (computed) to a logical function

Hi,
I think it is a very touchy issue … but I try.

Could it be possible to export Allocating Actor/Component (computed) to logical functions with Py4C? or by another mean?

Capture

thanks!
dvd

To get the allocating actor/component, you can use:

myFunction.get_allocating_component()

There is also an API to call a query from the Semantic Browser:

capella_query_by_name(myFunction, "Allocating Actor/Component")

It seems that “myFunction.get_allocating_component()” exports the components which has been manually allocating to the function (using Allocation Management).

I would like to export every components “computingly” allocating by capella (Allocating Actor/Component (computed)) et not only (Allocating LogicalComponent).

Any Idea?

Did you try:

capella_query_by_name(myFunction, "Allocating Actor/Component")

or

capella_query_by_name(myFunction, "Allocating Actor/Component (computed)")

Not sure what’s the real query name.

There is also an API to call a query from the Semantic Browser:
capella_query_by_name(myFunction, “Allocating Actor/Component”):

In fact I don’t know how to call this type of query? is it with python4capella with the aql interpreter ? something else?

With Python4Capella, myFunction is a variable referencing function that you can populate using the Python API. And of course you can get the result in a variable:

allocating_components = capella_query_by_name(myFunction, “Allocating Actor/Component”)

or directly loop over the resulting collection:

for allocating_component in capella_query_by_name(myFunction, “Allocating Actor/Component”):
    print(allocating_component.get_name())

You can have a look at the definition of capella_query_by_name() for more details. For instance you can provide a default class for returned elements. This class will be used if the mapping form the Java class to the Python class can’t be done automatically.

cool!
the script to export all the allocating component (manually and computed) is:

see you soon on the forum!
dvd

1 Like