Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Polarsys » M2Doc » Display elements associated to a Req
Display elements associated to a Req [message #1826571] Mon, 27 April 2020 10:35 Go to next message
Julien Morane is currently offline Julien MoraneFriend
Messages: 19
Registered: December 2019
Junior Member
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,
Re: Display elements associated to a Req [message #1826594 is a reply to message #1826571] Mon, 27 April 2020 14:46 Go to previous messageGo to next message
Yvan Lussaud is currently offline Yvan LussaudFriend
Messages: 63
Registered: July 2009
Member
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.
Re: Display elements associated to a Req [message #1826603 is a reply to message #1826594] Mon, 27 April 2020 15:52 Go to previous messageGo to next message
Julien Morane is currently offline Julien MoraneFriend
Messages: 19
Registered: December 2019
Junior Member
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,
Re: Display elements associated to a Req [message #1826704 is a reply to message #1826603] Wed, 29 April 2020 09:08 Go to previous messageGo to next message
Yvan Lussaud is currently offline Yvan LussaudFriend
Messages: 63
Registered: July 2009
Member
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.
Re: Display elements associated to a Req [message #1833583 is a reply to message #1826704] Mon, 19 October 2020 06:41 Go to previous message
Florian Freund is currently offline Florian FreundFriend
Messages: 5
Registered: October 2020
Junior Member
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,

[Updated on: Mon, 19 October 2020 06:42]

Report message to a moderator

Previous Topic:how to edit "Requirements Viewpoint" requirements with M2DOC
Next Topic:New Capella forum
Goto Forum:
  


Current Time: Sun Nov 27 10:17:57 GMT 2022

Powered by FUDForum. Page generated in 0.02270 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top