Logical Component PKG inside Another LC_Pkg

Hello,
I had trouble with the LC pkg getter function.
This is how what the interpreter shows:

This LC_Pkg Contains 47 elements, 2 of which are also LC_Pkg:

46th element:

47th element:

Using: aql:self.ownedLogicalComponentPkgs, shows the 2 LG_Pkg above.
__
Now, in P4C side:
I obtained the very first LC_Pkg named “Structure” (the one containing “Component” and “Analysis”) inside a variable:

print(LC_pkg)
print(LC_pkg.get_java_object())

<__main__.LogicalComponentPkg object at 0x0000021500195288>
org.polarsys.capella.core.data.la.impl.LogicalComponentPkgImpl@7bdc7404 (id: 0e2214c0-232c-4197-965a-d5584a0fa304, sid: null) (name: Structure) (visibleInDoc: true, visibleInLM: true, summary: null, review: null)

Now to obtain the LC_Pkg:
AA=LC_pkg.get_owned_logical_component_pkgs()
→ Error:

Here is the definition of the function:

def get_owned_logical_component_pkgs(self):
        """
        """
        value =  self.get_java_object().getOwnedLogicalComponentPkgs()
        if value is None:
            return value
        else:
            e_object_class = getattr(sys.modules["__main__"], "EObject")
            specific_cls = e_object_class.get_class(value)
            return specific_cls(value)

Oddly enough, using simply "

.get_java_object().getOwnedLogicalComponentPkgs()

", works → [JavaObject id=o104, JavaObject id=o105].
Whereas (get_owned_logical_component_pkgs) does not.
Maybe there is a problem with the function (get_owned_logical_component_pkgs)?

1 Like

Yes the cardinality in the specification is 1-1 it should be 0-*. I fixed it. Until the release you can change the code to:

    def get_owned_logical_component_pkgs(self):
        """
        """
        return create_e_list(self.get_java_object().getOwnedLogicalComponentPkgs(), LogicalComponentPkg)
1 Like

Ahah I might be one of your bigger non official testers (at this particular time).

1 Like

Yes Python4Capella is mainly improving thanks to people like you. BTW a new release is available that fix this issue and more. Most of the fixed issues comes from this forum:

I will open a new thread for the new release.

2 Likes

Wonderful, I am very happy to help back, you are the one who allowed all of this, because of your availability, thanks again.
Let’s be honest in the last 34 threads I contributed in like 24 of them or so hahaa, half of it was me lmao.
I wonder if I should apply as an official Beta Tester… if that post ever exists, which I suppose does not.
Anyway, I hope more people contributed In order to have diversity in the profils making posts in the forum, again thank you again for the help.

2 Likes