Page 1 of 1

OCL to ensure consistency between IBDs and Activity Diagrams

PostPosted: Wed Jun 24, 2020 12:51 pm
by ryan.hill@gtri.gatech.edu
Hello, new guy to SysML/UML here.

I have been researching validation rules for a task to check type consistency between a port type in an Internal Block Diagram to an Activity Parameter Node in an Activity Diagram to pins in the Activity Diagram.

The activity diagram is related to the IBD via an allocation relationship in a swimlane. The pin(s) I'm interested in are in a given swimlane and have inputs coming from the activity parameter node. My thought process is to start with the pin:

1) Get pin "parent"
2) Get IBD part from allocation relationship
3) Get port type(s) from IBD part
4) Get type from activity parameter node
5) Compare results from (3) and (4).

My first thought was to use OCL, but I'm not sure if the process outlined above is too complicated and should be done using a Binary file instead.

My questions/what I'm looking for are:
- Is there a good resource/tutorial for OCL and creating custom validation rules?
- What would the OCL for the above procedure look like? The resources I have found so far discuss containers and data types in OCL, but not specifics for digging into model components.

Many many thanks!

--Ryan

Re: OCL to ensure consistency between IBDs and Activity Diagrams

PostPosted: Fri Jul 17, 2020 8:57 am
by ogirdor
Hello Ryan,

not sure about the OCL, but you could visualize what you are looking for in a table:

OclValidation_table.png


Here the activity MyActivity has an input parameter called MyParameter, typed by MyOtherType. The activity is allocated to a block called MyBlock. This block has two ports, one is typed by MyPortType, the other by MyOtherType.

Using a metachain we can easily retrieve a list of all types used by the block ports:
02_OclValidation_script.png


Another one gives us the type used by the input parameter:
01_OclValidation_script.png


A script can be used to compare both and output the result of this comparison:
OclValidation_script.png