UML Class Diagram
Note: This is the very beginning of the discussion and in no way settled or complete.
Transforming native UML Metaclasses
The following UML elements are selected for transformation:
UML | SpecIF | OWL/RDF | local [en] |
---|---|---|---|
uml:Class | SpecIF:ModelElement | Model Element | |
uml:Operation | FMC:Actor | Actor | |
uml:Property | FMC:State | State |
… and the following relations:
UML | direction | SpecIF | OWL/RDF | local [en] |
---|---|---|---|---|
uml:Generalization | inverted | SpecIF:isSpecializationOf | specializes | |
uml:Composition | same | dcterms:hasPart | has part | |
uml:Aggregation | same | dcterms:hasPart | has part | |
uml:Association | same | SpecIF:isAssociatedWith | associated with | |
usedElements | same | SpecIF:shows | shows |
Details
A directed association in UML means that only one side knows (can navigate to) the other. In SpecIF like RDF every association is a statement with subject, predicate and object. When translating a UML/SysML class diagram to SpecIF and further on to OWL/RDF:
- In case of a composition and aggregation, the class with the rhombus is the subject and any arrow is ignored: It doesn’t matter whether there is or isn’t an arrowhead on either side.
- In case of an association, the arrow is interpreted as the direction according to RDF. Thus, the arrow póints from subject to object. UML associations with zero or two arrow-heads will become an ‘undirected’ relation in RDF.
- We are well aware that this is changing the original UML semantics. The idea is to use existing features to create a formally sound model.
Example
The following UML Class Diagram uses UML native metaclasses only:
Figure: UML Class Diagram using native metaclasses
Transform first to SpecIF
The UML Class Diagram is first transformed to SpecIF. The relations of the element General_Class are shown next. The names at the edges are the vocabulary terms SpecIF:shows, dcterms:hasPart, SpecIF:isAssociatedWith and SpecIF:isSpecializationOf translated according to the browser language; English in this case.
Figure: SpecIF Statements of element General_Class on UML Class Diagram
Examining the files and rigorously reviewing the approach is greatly appreciated:
- The Cameo model file CoCoML Class-Diagram,
- the example UML Class Diagram transformed to SpecIF,
- the relations of ‘General_Class’,
- the corresponding SpecIF file … isn’t it much cleaner than an XMI file?
- … and the generated WORD(R) file.
- Finally, here is an alpha-release of the SpecIF Model-Integrator and Editor for use with your own Cameo *.mdzip files. (Please note that only the UML class diagram, SysML Block Definition Diagram and SysML Internal Block Diagram are translated as of now. The alpha release will be updated from time to time and can have breaking changes. Please open an issue ticket, if you find unexpected or erroneous behavior.)
Transform further to OWL/RDF
… coming soon using OMG’s MOF2RDF
Discussion
Adding meaning using Ontology Terms
Two ways to add meaning to weakly defined model-elements are proposed in the example below:
- by stereotype: In the example below, two classes have a stereotype of an imported profile ‘RFLP’ defining four levels of system specification, namely Requirement, Function, Logical and Physical. In the example it is just an additional information/definition as a value of property typed dcterms:type.
- by generalization: Both concrete model elements (in fact ‘instances’) specialize a class named with an ontology term. As a consequence they are not an instance of uml:Class, but of IREB:Requirement resp. FMC:Actor.
The following UML elements are selected for transformation, where a generalization and/or stereotype adds the meaning:
UML | Generalization | Stereotype | SpecIF resource class | OWL/RDF | local [en] | Comment |
---|---|---|---|---|---|---|
uml:Class | IREB:Requirement | IREB:Requirement | Requirement | IREB:Requirement is an ontology term | ||
uml:Class | FMC:Actor | FMC:Actor | Actor | FMC:Actor is an ontology term | ||
uml:Class | «Requirement» | SpecIF:ModelElement with property dscterms:type := RFLP:Requirement | Model Element | Requirement is a stereotype defined by profile RFLP and RFLP:Requirement is an ontology term | ||
uml:Class | «Physical» | SpecIF:ModelElement with property dscterms:type := RFLP:Physical | Model Element | Physical is a stereotype defined by profile RFLP and RFLP:Physical is an ontology term |
Adding meaning to associations is simpler:
UML | Name | SpecIF statement class | OWL/RDF | local [en] | Comment |
---|---|---|---|---|---|
uml:Association | oslc_rm:satisfies | oslc_rm:satisfies | satisfies | oslc_rm:satisfies is an ontology term |
An alternative (probably better) way is to define stereotypes for the uml:Association similarly to sysml:Allocate.
How to add meaning to weakly defined elements is a choice to discuss: Any issues or ideas?
Another topic to discuss is class vs. instance:
- Heat_Pump is obviously an instance of the system model representing a concrete device. However an uml:Class is used. (The same issue arises, when a sysml:Block is used, later on …).
- At the same time Heat_Pump represents a series of identical heat pumps in the real world, so it can be considered to describe a class of real world devices.
To summarize: There is a defined set of UML elements and a defined set of ontology terms to create a clear-cut model with exact semantics. It is claimed that this is a formal subset of UML, which must be proven by creating an equivalent EBNF representation or DSL, for example.
Example
The following UML Class Diagram uses UML native metaclasses and ontology terms:
Figure: UML Class Diagram using ontology terms
Transform first to SpecIF
Figure: SpecIF Statements of element Heat_Pump on UML Class Diagram using ontology terms
Examining the files and rigorously reviewing the approach is greatly appreciated:
- The Cameo model file CoCoML Class-Diagram using ontology terms,
- the example UML Class Diagram transformed to SpecIF,
- the relations of ‘Heat_Pump’,
- the corresponding SpecIF file
- … and the generated WORD(R) file.
- Finally, here is an alpha-release of the SpecIF Model-Integrator and Editor for use with your own Cameo *.mdzip files. (Please note that only the UML class diagram, SysML Block Definition Diagram and SysML Internal Block Diagram are translated as of now. The alpha release will be updated from time to time and can have breaking changes. Please open an issue ticket, if you find unexpected or erroneous behavior.)
Transform further to OWL/RDF
… coming soon using OMG’s MOF2RDF
Adding meaning using Other Terms
… isn’t recommended.