My objective is to fetch all incoming links and outgoing links to and from any class. These links could include exchange items, associations, compositions, generalizations etc.
I use the semantic browser for simple models but for a general solution or larger models, it is impractical. For example, “Roles”, “Typing Elements” etc. are not consistent enough. It is hard to identify the parent and child of an element.
I tried fetching all contents of the data package folder but I am unable to differentiate between the different types of relationships. For example, in the following image, vce is a composition and class 3 is an aggregation.
association = get_enum_literal("http://www.polarsys.org/capella/core/information/" + capella_version(), "AggregationKind", "ASSOCIATION")
prt.getAggregationKind() = association
For a complete description of Capella metamodels (EPackages) you can have a look here.
I hope this will get you started with your script.