-
Notifications
You must be signed in to change notification settings - Fork 2
opcua_to_uml
In this representation transformation a OPC UA NodeSet model is read and iterated over all entries. This produces overhead as probably not all elements will change when the NodeSet file was changed, but the plugin cannot detect which elements have changed.
Transformation is done in the following order:
- Namespaces
- AliasTable
- Delete removed elements
- UATypes
- UAInstances
- References between ReferencesTypes
- Remaining References
- Set UML References to Elements
- Transform Role Permissions
- Transform DataTypeDefinitions
First it is determined which Namespaces exist in the NodeSet, which need to be created in the UML and which need to be deleted from the UML model. As a Namespace is only defined via its URI this the Element has to match any URI already defined in the UML model.
Then all no longer existing Namespaces will get delted from the UML model, at least for now there is difference made between removing a Namespace and renaming a Namespace.
Next all missing Namespaces are checked against a list of registered Companion Specifications, if the namespace URI provides a match, the linked library will be imported, if not the missing namespace gets created.
Finally to get a consistent mapping between the UML Model and the NodeSet Model, the Namespaces of the UML Model get brought into the same order as the Namespaces of the NodeSet Model.
Even not internally used and not generated, a NodeSet can contain a AliasTable, therefore it is paresed and added to the internal data structures.
As there were maybe some elements removed from the NodeSet these need also be removed from the UML Model and the plugins internal data structures
The transformation is essentially the same for each UAType element.
First it is searched if the element already, otherwise it will be created. If the element already exists the element in the map will replaced with the new instance.
In the next step it will be checked if the matching stereotype is applied to the found UML element, if not we found some rouge element which needs to be removed.
The next step is to read out the attribute which were inherited by UAType, which reads out the attributes additionally inherited by UANode. To get a valid entry each UANode needs to have at least the BrowseName and the NodeID set. Most entries get transformed in this stage, only References to other elements get transformed later, because during this step the tool can't be sure if the element was not transformed or does not exist.
These work essentially like UATypes, but are parsed afterwards as they have references to types.
ReferencesTypes have a special property called "isHierachical"(!sic) which defines if this RefernceType is used to create a hierarchy or not. If this property is set, one element will be declared as the parent of the other and the structure inside the model explorer will be adapted. Because of this the References between the ReferrenceTypes are transformed first.
Now all References between the other Elements of the NodeSet will be parsed and the structure will be migrated to the Model Explorer.
As some Elements reference others via their NodeId, in the UML model UML Reference are created for that.