Capella Webinar Q&A - Python4Capella

The 16th of December 2021, Sophie Plazanet and Arnaud Dieumegard presented a Capella webinar about Python4Capella: https://bit.ly/capella_webinar_211216_playlist
Some questions were not answered during the live session. Here is a wrap-up of all the questions with their answers.

Q: What are the differences/benefits of Python4Capella compared to py-capellambse from DB Netz available at github (it is not using Java) ?

What do you think about it? We will be glad to hear from you.
Python4Capella aims to be more system engineer oriented by hiding part of the complexity of the Capella technical meta-model. It relies on Capella workbench (online or off-line through command lines) where py-capellambse does not rely on Java but on Jupyter and the parsing of Capella files.


Q: Currently, you are using the Python 3.7 version in Python4Capella; do you plan to package it with a more recent version of Python (3.8 and greater) ?

EASE 0.7.0 limits the version of Python we can use. This would imply updating EASE and it’s a bit of work. This is not planned yet.
It can be extended on demand, by your contribution or funding.


Q: Are you able to access online tools or just local software installed on PC?

Accessing online tools is only a matter of having access to these online tools from a classical python script. So yes, for example Jenkins (see in the documentation).


Q: Can Python4capella be applied to an existing capella project?

Yes.


Q: Is the Python4Capella add-on able to interact with (read/modify) requirement elements?

Yes, it’s compatible with requirement add on, with a sample script available.


Q: Is Python a replacement for Acceleo, Gendoc, QVTo and other DSLs/Tools for model-related tasks? Will scripting in Capella be mostly implemented using Python?

All these solutions are still available and have their advantages and inconvenients following the objectives you may have. Hence it is not a replacement.


Q: Is the metamodel pre-implemented in the Python library? Do you plan to develop some tooling to support arbitrary metamodels?

Python API is generated from Capella Light Metamodel available as well in GitHub.
The Python library provides an API (= “specific methods to access and modify values on a Capella model”), this API is high level and at the moment focuses on the manipulation of Capella/Arcadia-core-concepts.
The Capella API also relies on an EMF API (which can be found in the EMF_API.py file in the Python4Capella project) allowing some direct manipulation of EMF concepts and objects. Direct and generic manipulation of metamodels elements (Ecore ones for example) will require additional work but may be possible.
There is a generator (not up to date) to generate Python API compatible with Python4Capella from an Ecore metamodel: https://github.com/labs4capella/python4capella/blob/master/plugins/org.eclipse.python4capella.gen/src/org/eclipse/python4capella/gen/handlers/ProduceCapellaPythonAPIFromEcoreHandler.java
It can be extended on demand, by your contribution or funding.


Q: If you export to an Excel file stored in the workspace, is the file updated (=old file deleted) when re-launching the extract (if the name has not been changed)?

File management by your Python4Capella script depends only on how you actually choose to handle the export of the Excel file. So both behaviors (update, overwrite) are possible.


Q: Can the import include several model elements, like Node PC + their Parent + their Deployed PC?

Yes.


Q: Can we import model elements together with their Property Values (PVMT), including ENUM ones? Or is PVMT data only accessible as exported data?

The current implementation of the PVMT API is a read only implementation, it allows retrieving PVMT-defined elements values allocated on model elements. But you can fully manipulate (create/modify/read) classical PropertyValuesGroup and PropertyValue elements on a Capella model relying on the pure Capella API.
It can be extended on demand, by your contribution or funding.


Q: Can we export only the data activated in a given diagram?

If by "activated’ you mean elements represented on a diagram, then you will find in the Python4Capella project, a Sirius_API.py script containing methods allowing retrieval of diagrams and elements displayed in the diagrams.
It’s possible to extract elements of interest, contextual elements and represented elements.


Q: Do you have any open add-on to import data from Open Modelica Editor?

Not yet, we haven’t considered this usage. It can be extended on demand, by your contribution or funding.


Q: Do you think the tool is appropriate to implement connectors between Capella and other tools? - e.g. to transform a Capella model to another tool model.

Yes, assuming that a Python API is available for the other tool, under the limits of this API, which is not complete, but can be extended at demand and funding.


Q: Is Python4Capella compatible with filtering?

Not for the moment. It can be extended on demand, by your contribution or funding.


Q: Can I use python for Capella outside Capella, for example from a Jupyter notebook and get all the model information I would like to have ?

You can execute scripts outside Capella by using the Capella command line. But this solution will not allow you to directly connect with a Jupyter notebook.


Q: Why is the metamodel called “simplified”, does that mean it does not cover all the Capella elements?

It doesn’t cover all the elements. But most importantly, it intends to provide an API that is usable by engineers, hiding part of the complexity of the Capella technical meta-model.


Q: Is it possible to modify diagrams, such as setting element location coordinates or adding new elements?

No.It can be extended on demand, by your contribution or funding.


Q: Hello, is Python4Capella able to work bidirectionally? What I mean: Collect the data from the model through python, do some magic in another tool, and write it back (editing the components for examples).

Yes.


Q: Do you already have any experiences about how your work with Python can support and benefit an extended MBSE ecosystem formed by Capella, Open Modelica, FreeCAD and maybe some testing tools or V&V? All of which have Python APIs …

Yes, under the limits of the current implementation of the simplified metamodel API, which is not complete, but can be extended at demand and funding.


Q: What is the impact of Python4Capella on OSLC model linking?

Using Python4Capella for OSLC model linking may be possible as some OSLC Python libraries already exist. But it will require some additional assessment on the amount of work necessary to get it working and integrated into Capella. It can be extended on demand, by your contribution or funding.


Q: Can Python4Capella work in a team mode? (Capella in a multi user mode)

Yes.


Q: We saw the possibility to add menu entries in the Capella explorer. Is this also possible (maybe directly by adapter) to make menu entries appearing in a Capella diagram?

It can be extended on demand, by your contribution or funding, meanwhile, Eclipse capabilities are maybe a better option.


Q: Can we deploy python scripts (including personal scripts) in the platform (accessible only with menus) instead of deploying them in the workspace?

It can be extended on demand, by your contribution or funding.

4 Likes