In SystemWeaver, sequence diagrams are configured using the configurable graph config item. With a valid sequence diagram configuration in place, users can visualize and edit object interactions arranged in the sequence. This article describes the Sequence Diagram model, and provides a configuration example.


Prerequisites


Example Required Meta Model

The below illustration shows the basic meta model supporting the Sequence Diagram graph.



Item Types

IconNameSID

Abstract DiagramSI0415
Abstract Sequence DiagramSI0343
Abstract Connection PointSI0349
Abstract Open Connection Point(s)SI0350
GateSI0347
LifelineSI0342
Sequence DiagramSI0351
EndpointSI0346
Abstract FragmentSI0352
FragmentSI0344
FrameSI0345
MessageSI0345


Part Types

IconNameSID
 Sequence Diagram(s)SP0568

Diagram Object(s)SP0485

Message(s)SP0486

Fragment(s)SP0487
FromSP0483
ToSP0484

Frame(s)SP0489

Referenced Sequence DiagramSP0488


Attribute Types

NameSIDTypeDimensionValuesRelated Item Type
Time UnitSA0092EnumerationSingles, ms, usSI0351
Fragment TypeSA0804EnumerationSingleAlternative, If, Loop, Negation, Paralell, RegionSI0344
KindSA0807EnumerationSingleCall, SignalSI0348
Return messageSA0089BooleanSingle
SI0348
SynchSA0806EnumerationSingleSynchronous, AsynchronousSI0348

Configuring the View

A sequence diagram is defined using a configurable graph. The graph is a Config item and is created using the config item Sandbox mode as described in Creating Config Item Views. By default, the Sandbox will include a few basic elements of a configuration to get you started, as shown below.  



Tip: A quick way to create a new sequence diagram is to copy a similar one that is already defined as described in Creating a New Config Item by Copying an Existing.


Explanation of the Configuration Elements

A Sequence Diagram is configured within a <Graph> and all Graph options apply. For the configuration elements specific to Sequence Diagram, see the Script Language Reference Manual in the application Help. 


Example Sequence Diagram


Example Data


Example Configuration

<Graph>

	<Mappings>
		<MappingItem id="1" leftCaption="Send Message ? " rightCaption="Receive Message ? " distinctMappingPerPair="true" multipleDistinctMappingPerPair="true">
			<PathFromMainToMappingContainer select="."/>
			<MappingItem itemType="SI0348" partType="SP0486"/>
			<LeftMapping itemType="SI0350" partType="SP0483"/>
			<RightMapping itemType="SI0349" partType="SP0484"/>
		</MappingItem>
	</Mappings>

	<NodeStyles>
		<NodeStyle name="LifeLine" fillColor="#ffffff" fillColor2="#ffffff">
			<Shape>
				<Rectangle/>
				<!--Rectangle width="120" height="80"/-->
			</Shape>
		</NodeStyle>
		<NodeStyle name="Boundary" fillColor="#ffffff" fillColor2="#ffffff">
			<Shape>
				<Boundary/>
				<!--Boundary width="100" height="100"/-->
			</Shape>
		</NodeStyle>
		<NodeStyle name="Control" fillColor="#ffffff" fillColor2="#ffffff">
			<Shape>
				<Control/>
				<!--Control width="100" height="100"/-->
			</Shape>
		</NodeStyle>
		<NodeStyle name="Entity" fillColor="#ffffff" fillColor2="#ffffff">
			<Shape>
				<Entity/>
				<!--Entity width="100" height="100"/-->
			</Shape>
		</NodeStyle>
		<NodeStyle name="Actor" fillColor="#ffffff" fillColor2="#ffffff">
			<Shape>
				<Actor/>
				<!--Actor width="50" height="100"/-->
			</Shape>
		</NodeStyle>
		<NodeStyle name="Gate" fillColor="#ffff00" fillColor2="#ffffff">
			<Shape>
				<Rectangle width="40" height="40"/>
			</Shape>
		</NodeStyle>
		<NodeStyle name="EndPoint" fillColor="#000000" fillColor2="#000000">
			<Shape>
				<Circle diameter="40"/>
			</Shape>
		</NodeStyle>
		<NodeStyle name="Ref" fillColor="#87cefa" fillColor2="#ffffff">
			<Shape>
				<Package/>
			</Shape>
		</NodeStyle>
	</NodeStyles>

	<EdgeStyles>
		<EdgeStyle name="Message" color="#000000" thickness="1" lineType="solid" fromArrowType="none" toArrowType="default"/>
		<EdgeStyle name="ReturnMessage" color="#000000" thickness="2" lineType="dash" fromArrowType="none" toArrowType="default"/>
		<EdgeStyle name="LifeLineEdge" color="#000000" thickness="1" lineType="dash"/>
	</EdgeStyles>

	<SequenceDiagram>
		<AddPart owner="." partType="SP0485"/>
		<AddPart owner="." partType="SP0487"/>
		<AddPart owner="." partType="SP0488"/>
		<ForEach select="/part::SP0485.OrderBy(PartNo)">
			<Variable name="currentPart" as="Part" select="."/>
			<DefObj>
				<Choose>
					<!--Gate-->
					<When test="SID='SI0347'">
						<Gate>
							<RemovePart part="$currentPart" caption="Remove #{? /defobj::.Join('')}"/>
						</Gate>
					</When>
					<!--EndPoint-->
					<When test="SID='SI0346'">
						<Endpoint>
							<RemovePart part="$currentPart" caption="Remove #{? /defobj::.Join('')}"/>
						</Endpoint>
					</When>
					<!--Actor-->
					<When test="@SA0803 = 'Actor'">
						<Lifeline headStyle="Actor" lineStyle="LifeLineEdge">
							<RemovePart part="$currentPart" caption="Remove  #{? /defobj::.Join('')}"/>
						</Lifeline>
					</When>
					<!--Lifeline -->
					<When test="@SA0803 = 'Lifeline'">
						<Lifeline headStyle="LifeLine" lineStyle="LifeLineEdge">
							<RemovePart part="$currentPart" caption="Remove #{? /defobj::.Join('')}"/>
						</Lifeline>
					</When>
					<!--Boundary-->
					<When test="@SA0803 = 'Boundary'">
						<Lifeline headStyle="Boundary" lineStyle="LifeLineEdge">
							<RemovePart part="$currentPart" caption="Remove #{? /defobj::.Join('')}"/>
						</Lifeline>
					</When>
					<!--Control-->
					<When test="@SA0803 = 'Control'">
						<Lifeline headStyle="Control" lineStyle="LifeLineEdge">
							<RemovePart part="$currentPart" caption="Remove #{? /defobj::.Join('')}"/>
						</Lifeline>
					</When>
					<!--Entity-->
					<When test="@SA0803 = 'Entity'">
						<Lifeline headStyle="Entity" lineStyle="LifeLineEdge">
							<RemovePart part="$currentPart" caption="Remove #{? /defobj::.Join('')}"/>
                        </Lifeline>
                    </When>
                    <Otherwise>
                    <Lifeline headStyle="LifeLine" lineStyle="LifeLineEdge">
							<RemovePart part="$currentPart" caption="Remove #{? /defobj::.Join('')}"/>
						</Lifeline>
    </Otherwise>
                </Choose>
            </DefObj>
        </ForEach>
        <ForEach select="/part::SP0486.OrderBy(PartNo)">
            <Variable name="part" select="." as="Part"/>
            <DefObj>
                <Message from="/SP0483" to="/SP0484" style="#{? if @SA0089 = true then 'ReturnMessage' else 'Message'}">
                    <RemovePart part="$part" caption="Remove Message"/>
                </Message>
            </DefObj>
        </ForEach>
        <ForEach select="/part::SP0487">
            <Fragment caption="#{Name} ">
                <RemovePart part="." caption="Remove Fragment"/>
                <DefObj>
                    <AddPart owner="." partType="SP0489"/>
                    <RemovePart part="/part::SP0489" caption="Remove (->) #{Name}"/>
                    <ForEach select="/part::SP0489">
                        <Variable name="frame" select="." as="Part"/>
                        <DefObj>
                            <AddPart owner="." partType="SP0490" caption="Add a message to #{Name}" pathToOwner="[$frame]"/>
                        </DefObj>
                    </ForEach>
                    <ForEach select="/SP0489">
                        <AddPart owner="." partType="SP0491" caption="Nested Fragment to #{Name}"/>
                    </ForEach>
                    <ForEach select="/PIFFS union /PELSE union /PSDLF  union /SP0489 union /PSDNF union /PSDPF union /PSDRFF union /PSDRF">
                        <Frame caption="#{Name}">
                            <ForEach select="/part::SP0490">
                                <MessageRef id="/defobj::"/>
                            </ForEach>
                        </Frame>
                    </ForEach>
                </DefObj>
            </Fragment>
        </ForEach>
        <ForEach select="/SP0488">
            <Endpoint style="Ref"/>
        </ForEach>
    </SequenceDiagram>
</Graph>


Example Result