Import of objects/data from Excel to Capella

Hello, everyone

I was wondering whether I could seek some assistance on some current Capella object rules.

In the context of my studies, I am developing a system that should allow the import of objects/data from Excel to Capella, but I’ve recently encountered some difficulties.

First issue:
So I manage to import objects into Capella so that they appear in my Project Explorer. However, as I try to use these same objects on a Diagram, I cannot instantiate them on the page, there seems to be an issue with the representation of the object. To solve this issue for Logical Components (the first object I made an import tool for) in the model, I tried to use a part type object and it worked. however, when I try to use the same method for elements other than logical components, it makes the program crash…

Second Issue:

Secondly, I’m trying to import allocation links between functions and components: we retrieve the Logical Component (if it exists) by doing a name search on all previously imported Logical Components, then on this Logical Component we seek for “getAllocatedLogicalFunctions()” then “add(…)” the logical function being imported.
The problem I encountered, that I find myself with an unsupported operation exception “unmodifiable random access list”.

  • Please, find attached the screenshot (// Create part ) of using a part object to fix the display problem. Do you have an idea on the use of a part object or another Capella aspect that i’m forgetting to solve this display issue?

  • Please find attached two screenshot corresponding to second problem.

Any help on these issues would be greatly appreciated,

Kind Regards,
Meziane

Many reference in Capella EMF model are derived one and can’t be modifyed.
Yout need to find base reference name and use it.

Look at example.

AbstractFunction element
it has a container reference ownedFunctions that returns all subchilds of type AbstractFunction.

Let’s inherit LogicalFunction from AbstractFunction
and define derived reference containedLogicalFunctions
it will return all subchild converting ittoi the type LogicalFunctions

If you will try to modify ownedLogicalFunction you will receive the same error.

You should use real containment reference. In most cases it start from “owned”.

You can use Show EClass information context menu (open on the Capella element in browser) to find the correct reference you need

For example you can see that allocatedLogicalFunction is derived and can’t be modifyed

image

You can try to find correct reference in super classed of the element.
In case of LogicalComponent you will find reference
ownedFunctionalAllocation in AbstractFunctionalBlock

It’s used to save allocation links. All other derived properties are based on this reference.

1 Like

To import components you need to create in model two element Component and part and connect part to component.

For other elements you don’t need parts.

There is good add-on for capella that helps in creating excel imports/exports.

1 Like