Hello everyone,
I try to list all the elements that are bounded to a requirement with an Incoming relation (I use the requirement VP) with M2Do.
So, starting from the requirement REQ, my command is :
{m:for relation | REQ.ownedRelations->filter(CapellaRequirements::CapellaIncomingRelation)}
I then wanted to display the name of the targeted elements with the simple command {relation.target.name}, but as the type of the âtargetâ element is Abstract Element, it does not have a ânameâ attribute.
I then tried to âforceâ the typing with a filter :
{relation.taget->filter( relation.target.eClass()).name} , but the validation file display the following error :
Expression ârelation.target- >filter(relation.target.eClass()).nameâ is invalid: missing expression
What those this error means ? How do you think will be the good way to get the name of the elements targeted by the Incoming relation ?
regards,
Hi,
There is a space between the â-â and the â>â in the error message check that your expression is â->â and not â- >â.
But the service you want to use is relation.target.oclAsType(pkg::Class) where pkg::Class is the type you are expecting that hold the name feature. Itâs a kind of cast it only help the AQL validation. At runtime it does nothing and your expression will fail to evaluate if the relation.target object doesnât have a feature name.
Hello Yvan, thank you for your help.
The problem is that I do not know in advance what will be the type of the element (As a Requirement can be linked to almost every element of the model).
That is why I tried the âtarget.eClass()â trick. It works fine when, for instance, I filter with âctx::SystemFunctionâ
rgds,
You should probably look for a common super type that hold the feature name. Or maybe ask for the
label of that EObject.
This service was introduced recently, M2Doc 3.0.0 or above.
Hello Julien,
I am using Capella and M2Doc also to document traceability between architecture and requirements. I am happy about your question, as the command/query you use made my day. But in general:
Where can I find a basic instruction about query/aql commands? Or a view of the datamodel of M2Doc in order to build up the right aql querries?
E.g. I couldnât find a working query between architecture and requirements (RE VP) until I found your command âownedRelationsâ - I can not find the notation âOwned relationâ used inside capella,
Hello Florian,
This answer come a few month after your question but better late than never
I am actually not a M2Doc expert but I mostly use the Interpreter to help me wth Aql queries. (How to query my capella model)
Rgds,
In the next version of M2Doc (3.2.0) and above, you will be able to use the M2Doc interpreter view. Itâs an interpreter that will execute in the context of a given .genconf file. It has all the M2Doc services and your own services registred as in your template and it also provide a rendering similar to the generated document (images, tables, style, âŠ).