How do I configure the Requirement label

I am using the Requirements Viewpoint. I would like some aql expressions that would make a good label. The expression could contain the Prefix (i.e. the ReqID). The expression could also contain the Name or Long name. I cannot write or interpret aql myself - I can only copy-paste.

Does anyone have some good aql queries which can be used in the Requirement elements?

To customise it, I would first right-click my system under the .aird in the Project Explorer > Requirements Viewpoint > “Configure Requirements’ Labels in Diagram”.

Requirement’s label:
Expression: ??? The one I have is worthless and returns nothing. It would be nice if it said “REQ-123” or “REQ-123 Temperature Control”.

Requirement’s context
Expression: aql:OrderedSet{self.ReqIFLongName, self.ReqIFName, self.ReqIFChapterName, self.ReqIFText}->select(s | s != 'null' and s.size() > 0).prefix('- ')->sep('\n')

This is okay but it doesn’t use line break, and it might be better if there were clearer labels before each value; e.g. something like

Title: Temperature Control
Text: "The System shall maintain each Temperature_Reference_Point within the range specified in ICD-123"

Maybe if you cannot write AQL expressions, you can contract with Obeo for that?

Looking for 1 line of aql which will add labels to a requirements object. I imagine it would be like 50 characters or less. Why would that require a contract with this company?

Hi Epictetus,

Totally fair — I just meant to suggest a direction for those not comfortable with AQL or needing more tailored support. I won’t be able to provide a ready-made solution here, but hopefully others in the community can chime in.

Cheers,
Stéphane

I recall a video somewhere, which shows exactly this: Someone writing a short aql expression which adds a label to the requirement object. Cannot for the life of me find it.

I found only this page showing some aql queries for some other use cases, capella/doc/plugins/org.polarsys.capella.ui.doc/html/12. Model Analysis/12.5.2 Acceleo 2 Queries.mediawiki at master · eclipse-capella/capella · GitHub

You have to know the fields of your ReqIf you want to show.

->sep('\n') is still not working. It is an old bug… :expressionless:

You can try these AQL querries. The Long Name (or the Name if the Long Name is empty) will be displayed after the “requirement logo”. The Text will be displayed below.

Requirement’s label expression :

aql:Sequence{self.ReqIFLongName, self.ReqIFName}->any(str | str.size() <> 0)

Requirement’s content expression :

aql:self.ReqIFText

I hope it will answer your question :grinning:

1 Like

That worked, thanks!

I added self.ReqIFPrefix, so by default just the Requirement ID is shown. If the Prefix field is blank, one of the names is shown instead.

aql:Sequence{self.ReqIFPrefix, self.ReqIFLongName, self.ReqIFName}->any(str | str.size() <> 0)

1 Like

I can confirm that the ->sep(‘\n’) doesn’t add a line break.
Thanks for mentioning it’s an open bug. Trying to add a line break was going to drive me crazy.