Requirement Relationship


#1

Hello,
is it possible to export with Doc Composer also a relationship between requirements for example the composition ?
I tried also with XML template but it doesn’t work, in the document the relationships are never exported.
Could you give me a DCTL example to export?
Thanks in advance
BR,
Sabrina


#2

Sorry for late reply.

Composition / Aggregation is a kind of “Association”
You can use <ForEachRelationship modelType="Association"> to get the compositions.

You can reference to General/Relationships, to know how to use <ForEachRelationship>, <FromEnd>, and <ToEnd>


More details,
there are 2 kind of relationships: SimpleRelationship, EndRelationship
SimpleRelationship
.from -> ModelElement (Requirement is a kind of ModelElement)
.to -> ModelElement
EndRelationship
.from -> RelationshipEnd (I call it ‘End’ here)
.to -> End
End
.modelElement -> ModelElement

from the above screenshot
Association is a kind of RelationshipEnd, <FromEnd> returns the End
Derive is a kind of SimpleRelationship, <FromEnd> returns the ModelElement (Requirement) directly.


But, I am sorry about that,
in fact, we prefer the General/Relationships template can show the From/To ModelElement from the association (not showing From/To End).

We will fix the General/Relationships asap.
and I will try to provide a sample to you. Please wait.


#3

Bug Fix of General/Relationships

The General/Relationships is fixed.
We supported 2 new nodes (<FromElement> and <ToElement>) for getting From/To ModelElement of SimpleRelationship/EndRelationship
In order to use <FromElement> and <ToElement> in your Template XML(s), please update to latest patch.

About how to update to patch, you may reference to following knowhow page:


Sample DCTL for Requirements’ Compositions.

On requirement diagram, there is a simple way to get the compositions. You just need to for-each Association from the requirement. As screenshot.


This simple way works, because Requirement Diagram support Composition only.

If one day, you need to handle the Association completely (e.g. for Class Diagram)
You may need to check the .aggreationKind of the FromEnd or ToEnd of the Association. as following:


Simple Compositions

<?xml version="1.0" encoding="UTF-8"?>
<ElementBaseInitiationBlock>
			
	<!-- Basic -->
	<Inline template="Basic (with anchor mark)"/>
	
	<!-- Requirement's Compositions -->
	<HasRelationshipChecker modelType="Association">
		<Text style="@heading+">Compositions</Text>
		<ParagraphBreak/>
		
		<ForEachRelationship modelType="Association">
			<FromElement>
				<Icon/>
				<Property property="name"/>
			</FromElement>
			
			<Text> connects to </Text>
			
			<ToElement>
				<Icon/>
				<Property property="name"/>
			</ToElement>
			
			<ParagraphBreak/>
			
		</ForEachRelationship>
	</HasRelationshipChecker>
	
</ElementBaseInitiationBlock>

Complex Associations

<?xml version="1.0" encoding="UTF-8"?>
<ElementBaseInitiationBlock>
			
	<!-- Basic -->
	<Inline template="Basic (with anchor mark)"/>
	
	<!-- Composition -->
	<ForEachRelationshipConditionChecker modelType="Association">
		<Conditions>
			<FromEndConditionChecker>
				<Conditions>
					<ValueChecker property="aggregationKind" value="Composited"/>
				</Conditions>
			</FromEndConditionChecker>
		</Conditions>
		
		<Text style="@heading+">Compositions</Text>
		<ParagraphBreak/>
		
		<ForEachRelationship modelType="Association" direction="from">
			<Conditions>
				<FromEndConditionChecker>
					<Conditions>
						<ValueChecker property="aggregationKind" value="Composited"/>
					</Conditions>
				</FromEndConditionChecker>
			</Conditions>
			
			<FromEnd><Icon/></FromEnd>
			<Property property="name"/>
			
			<Text> connect to </Text>
			
			<ToElement>
				<Icon/>
				<Property property="name"/>
			</ToElement>
			
			<ParagraphBreak/>
			
		</ForEachRelationship>
		
		<ForEachRelationship modelType="Association" direction="to">
			<Conditions>
				<FromEndConditionChecker>
					<Conditions>
						 <ValueChecker property="aggregationKind" value="Composited"/>
					</Conditions>
				</FromEndConditionChecker>
			</Conditions>
			
			<FromEnd><Icon/></FromEnd>
			<Property property="name"/>
			
			<Text> connect from </Text>
			
			<FromElement>
				<Icon/>
				<Property property="name"/>
			</FromElement>
			
			<ParagraphBreak/>
			
		</ForEachRelationship>
		
	</ForEachRelationshipConditionChecker>
	
	
	<!-- Aggregation -->
	<ForEachRelationshipConditionChecker modelType="Association">
		<Conditions>
			<FromEndConditionChecker>
				<Conditions>
					 <ValueChecker property="aggregationKind" value="Shared"/>
				</Conditions>
			</FromEndConditionChecker>
		</Conditions>
		
		<Text style="@heading+">Aggregations</Text>
		<ParagraphBreak/>
		
		<ForEachRelationship modelType="Association" direction="from">
			<Conditions>
				<FromEndConditionChecker>
					<Conditions>
						 <ValueChecker property="aggregationKind" value="Shared"/>
					</Conditions>
				</FromEndConditionChecker>
			</Conditions>
			
			<FromEnd><Icon/></FromEnd>
			<Property property="name"/>
			
			<Text> connect to </Text>
			
			<ToElement>
				<Icon/>
				<Property property="name"/>
			</ToElement>
			
			<ParagraphBreak/>
			
		</ForEachRelationship>
		
		<ForEachRelationship modelType="Association" direction="to">
			<Conditions>
				<FromEndConditionChecker>
					<Conditions>
						 <ValueChecker property="aggregationKind" value="Shared"/>
					</Conditions>
				</FromEndConditionChecker>
			</Conditions>
			
			<FromEnd><Icon/></FromEnd>
			<Property property="name"/>
			
			<Text> connect from </Text>
			
			<FromElement>
				<Icon/>
				<Property property="name"/>
			</FromElement>
			
			<ParagraphBreak/>
			
		</ForEachRelationship>
		
	</ForEachRelationshipConditionChecker>
	
</ElementBaseInitiationBlock>