Hi,
I am a newbie using Capella & M2DOC to generate of Doc export using templates and all the stuff.
Thanks to the mass of examples I was able to do my first steps with the tool,
but I am facing several problems that I am not able to solve after several (lot’s) hours of work.
I want to export in the Word file several Pictures from the Logical Architecture
Inspire by examples given on this topic I started like that :
it works … allmost … I select only file containing [Overview] in the title
but
I have a strange warning …
{ m:for rep | k.representationByDescriptionName(‘Logical Data Flow Blank’) <–EClassifier=ElementExtension is not registered in the current environment}
I hardly understand it
I whould like to select on a more suitable element like aql:self.visibleInDoc
I would like to add the picture description text but I was not able to have the k.description working : Invalid query statement: Feature description not found in EClass DRepresentation
I cannot find the methodes and properties associate to this EClass DRepresentation !!! How can I find it
Thank in advance and sorry for these clumsy first step in the tool …
The collection self.eAllContents() can contains element of type ElementExtension which are the top level element to create extensions to the Capella model. You can avoid this warning by adding the following nsURI to your template: http://www.polarsys.org/kitalpha/emde/1.0.0 (might be a different version)
This way M2Doc will have the type definition of ElementExtension.
The EStructuralFeature visibleInDoc is available on PublishableElement. You can try:
- add the nsURI http://www.polarsys.org/capella/common/core/1.4.2 (or your version)
- rep.target.oclAsType(modellingcore::PublishableElement).visibleInDoc
The EClass DRepresentation comes from Sirius. In your case it should be a DDiagram that represent the diagram and not the root element of the diagram. You can use rep.target to get the root element of the diagram (an element from your Capella model). The target type is EObject, so you will have to cast is to the type of element root of the diagram for instance rep.target.oclAsType(modellingcore::PublishableElement) as in the last point.
If you get stuck a some point writing an AQL expression, you can try to call the .eClass() service that will return the EClass of the element to help you with .oclAsType() and .eClass().eAllStructuralFeatures to list available EStructuralFeatures.
Do you have any new error message ? Maybe you don’t have the Sirius nsURI referenced ? Try to add *sirius* from the nsURI dialog. See template properties wizard for more details.
In the code you pasted I see rep.target() instead of rep.target
It’s a feature not a service. But you will need Sirius nsURIs to use it.
You should see the *sirius* nsURIs in the dialog for selecting nsURIs since Capella is build on top of Sirius:
sorry for the target(), I also made the test without Brackets and it neither works …
{m:rep.target.eClass()}
Invalid query statement: Feature target not found in EClass DRepresentation
Juste to explain, I started my template using the LA_Complete.docx, it comes with plenty of capella and sirius nsURI
Please find hereafter a copy of all my nsURI in the Template nsURI list file
You can see at the bottom the kitalpha/emde you asked me to add and that solve the warning problem.
I also tried to include all nsURI using the Package Tab (2 entry : capella and sirius) but it seems to add to much things that are uncompatible together
Hi !
Even if I have improve and found several things (eClass().eAllStructuralFeatures is great)
I am still stuck with my Description …
{ m:for k | self.eAllContents(la::LogicalComponent)}
{m:if lc.oclAsType(modellingcore::PublishableElement).visibleInDoc.toString() == ‘false’}
// I put false because it is more simple to set one or two element visibleInDoc to false
// in order to display them … but it is non intuitive
{ m:for rep | k.representationByDescriptionName(‘Logical Data Flow Blank’)}
{ m:rep.name }
{ m:rep.aslmage().fit(500,400)}
{ m:rep.name }
// there I would like to have access to the rep description texte to
// but the target does not work
There is a DRepresentation.documentation but Capella stores the content of the rich text editor in the DRepresentationDescriptor.documentation. You can retrieve it like this:
m:rep.precedingSiblings()->filter(viewpoint::DAnalysis).ownedViews.ownedRepresentationDescriptors->select(descriptor | descriptor.representation = rep).documentation
<—Empty collection: Nothing will be left after calling precedingSiblings: Only EClass can have preceding siblings not org.eclipse.sirius.viewpoint.DRepresentation
<—Empty collection: Nothing will be left after calling filter: Nothing will be left after calling precedingSiblings: Only EClass can have preceding siblings not org.eclipse.sirius.viewpoint.DRepresentation
<—Couldn’t find the ‘aqlFeatureAccess(Nothing(Nothing will be left after calling filter: Nothing will be left after calling precedingSiblings: Only EClass can have preceding siblings not org.eclipse.sirius.viewpoint.DRepresentation),java.lang.String)’ service<—The descriptor variable has no type
As it says the DRepresentation as no preceding Sibilings …
Could it be that the orginal wrongness it getting the object from
{ m:for rep | k.representationByDescriptionName(‘Logical Data Flow Blank’)}
that stuck us in a Drepresentation type that is limited ?
Do you have the sirius nsURI imported in your template ? because a DRepresentation should be recognized as an EClass, here it seems to be recognized as a Java Class.
I used the M2Doc for Capella 1.4.1 but users are working with 1.4.2
Is it compatible (I do not think so) and do you know when we will have the future version 1.4.2 (roughly speaking)
It should be compatible since it’s a minor version. But it has not been tested with Capella 1.4.2. The main reason the M2Doc Capella extension follows the Capella releases is the IFE example model and few specific services used in the example templates. If you don’t need them you can use a version of M2Doc directly.
But as said in the beginning more tests are preformed for the compatibility between M2Doc and Capella when a version of the M2Doc Capella extension is released.
For the moment I didn’t has a look at Capella 1.4.2, but I should have some time to release a new version of the M2Doc Capella extension at the beginning of 2021 hopefully.
When I realized that it was available only for 1.4.1, I just copied the model under 1.4.2 and opened it with a 1.4.1 Capella. It works, as you said the differences are minimal