Hi everyone,
I’m trying to create a calc that returns the documentation’s of an element. Something like this:
package Package {
part myPart {
doc /* Docs */
doc name /* Named doc */
}
calc getDocs {
in element;
(element meta KerML::Element).documentation
}
ref theDocs = getDocs(myPart);
}
What I would expect is that theDocs then holds the two documentations in myPart, however I’m getting a different result with the Syside compiler:
import syside
import syside.query
model, diag = syside.load_model(['model.sysml'])
ref_usage = syside.query.find_by_qualified_name(model, 'Package::theDocs')
value, report = syside.Compiler().evaluate_feature(syside.vm.Context(model.lib), ref_usage, ref_usage)
print(value)
for val in value:
assert isinstance(val, syside.BoundMetaclass)
print(val.element)
assert isinstance(val.element, syside.Documentation)
print(val.element.body)
It prints None, whereas I would expect:
[<_syside.core.vm.BoundMetaclass object at 0x000002175EA95C80>, <_syside.core.vm.BoundMetaclass object at 0x000002175EA95AA0>]
Package::myPart::(anonymous Documentation)
Docs
Package::myPart::name
Named doc
It seems instead it is accessing the metadata of the elements input of the calc, rather than its bound value (myPart). Or am I understanding something wrong?
Is there a way to explicitly access the bound value of an element?
Greetings,
Jasper