labs4capella / python4capella

Python for Capella
Eclipse Public License 2.0
52 stars 10 forks source link

Get Capability from Abstract Capability Generalization or another Capability #214

Closed Nelson1905 closed 1 month ago

Nelson1905 commented 5 months ago

Hello,

Hello I would like to get with my python code Associated Capability 1 and 2 or associated Abstract Capability Generalisations directly from Capability A, B and C. I search solutions on forums and the documentation but I didn't found functions, solutions to do that. I tried to cast Capabilities and Abstract Capability Generalisations (which are traited like EObject in python code) by other types (like Mission, Relation, ...) to use more functions but it doesn’t work either.

Could you share me any leads to resolve that please ?

help5
ylussaud commented 5 months ago

You can use the semantic browser query to do this:

myOperationalCapability = ...
for capa in capella_query_by_name(myOperationalCapability, "Generalizing Elements", OperationalCapability):
    print(capa, capa.get_java_object())
Nelson1905 commented 5 months ago

Yes, it works thank you !!