(in which parent is a syside.Element but this only applies to syside.OwningMembership, syside.NamespaceImport and syside.membership. I tried using the function with syside.Membership but this results in the following error:
Exception has occurred: TypeError
*
Invalid Membership relationship, Membership cannot have owned related elements, only OwningMembership or Annotation can.
File "C:\\Users\\OnnoSchreurs\\Documents\\sysML\\CA_models\\CA_SysML\\scripts\\utilitiestest.py", line 25, in add_element_referential new_element = parent.children.append(syside.Membership, el_type) File "C:\\Users\\OnnoSchreurs\\Documents\\sysML\\CA_models\\CA_SysML\\scripts\\utilitiestest.py", line 32, in <module> item_usage = add_element_referential(doc, "testitem", syside.ReferenceUsage, new_el) TypeError: Invalid Membership relationship, Membership cannot have owned related elements, only OwningMembership or Annotation can.
How would I create the following two Referential Usages using automator?
port def ExamplePort {
in item exampleItem;
}
part def ExamplePartDef {
perform action exampleAction;
}
The overload that accepts a type as the second parameter only works with relationships that take ownership of the related element, e.g. OwningMembership and its subtypes, so as not to create orphan elements. Other relationships, e.g. Membership, require an existing element to reference.
These lines work, but I’ve noticed that there is no difference in how the .sysml file is written based on which you use FeatureMembership or OwningMembership in the .append() function. Should this be the case?
SysML does not have member Features unlike KerML, so there is no difference in the output. The synthetic model does not return children Features via owned_features if they are owned through OwningMembership, only if they are owned through FeatureMembership and its subtypes. The biggest problem is the massive soup of types in SysML a lot of which are very similar and do not do much more than their base types.