Displaying diagrams starting from requirements

Hi all!

I am looking for a way to display diagrams that contains requirements previously filtered.
The solution I used works like a charm on capella 5.0 running with on,e of the last version of M2Doc, unfortunately I have to make it work on Capella 1.3.2 and on this version, it does not work.
I use the following line to loops through the diagrams owned by the requirements:

{m:for Rep | viewpoint::DRepresentation.allInstances() -> select(r | r.representationElements -> select(re | if re.oclIsKindOf(diagram::DDiagramElement) then re.visible else true endif).target -> collect(e| if e.oclIsKindOf(cs::Part) then e.type else e endif) -> includes(Req))}

Req being defined as :
{m:for Req | self.containedSystemAnalysis.eAllContents()-> filter(Requirements::Requirement) -> select(r|r.ownedAttributes -> size() <>0)}

The loop through the requirements doesn’t give any errors, I have used this loop before. The problem only lies with the representation part. I also tried to go with a self.eAllContents( viewpoint::DRepresentation) but it does not work either, the error message is very similar.
This is what the validation file gives me:

If someone has an idea I would be really grateful !
Thanks in advance

Yes I think some context was missing to use eInverse() and allInstances() in the version of M2Doc you are using. That’s something I fixed later.

Yeap I thought so, but would you have an idea of how to do this research without allInstances() ? Knowing that trying this research with eAllContents() does not work either ? Thanks for your answer !

With rep being a DRepresentation, you can try something like this:

rep.oclAsType(viewpoint::DRepresentation).precedingSiblings(viewpoint::DAnalysis).eAllContents(viewpoint::DRepresentationDescriptor).representation

Thanks again, but the root of my problem is actually there, how do I get the rep you use as the starting point ? (Also, in this version, does includes() work ?)

I’m not sure, but if it doesn’t, you can use the + operator:

a.asSequence() + b.asSequence()
1 Like
Copyright © Eclipse Capella, the Eclipse Capella logo, Eclipse and the Eclipse logo are Trademarks of The Eclipse Foundation.