Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Polarsys » M2Doc » Problems accessing fields(I try to access several fields using Capella & M2DOC templates)
Problems accessing fields [message #1834764] Tue, 17 November 2020 13:38 Go to next message
Pierre Campan is currently offline Pierre CampanFriend
Messages: 4
Registered: November 2020
Junior Member
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 :

{ m:for k | self.eAllContents()}
{ m:for rep | k.representationByDescriptionName('Logical Data Flow Blank')}
{ m:if rep.name.lastlndex('[Overview]')> O}
{ m:rep.name }
{ m:rep.aslmage().fit(500,400)}
{ m:rep.name }
{ m:endif }
{ m:endfor }
{m:endfor }

it works ... allmost ... I select only file containing [Overview] in the title

but

1) 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

2) I whould like to select on a more suitable element like aql:self.visibleInDoc

3) 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 ...

Pierre
Re: Problems accessing fields [message #1834768 is a reply to message #1834764] Tue, 17 November 2020 16:03 Go to previous messageGo to next message
Yvan Lussaud is currently offline Yvan LussaudFriend
Messages: 63
Registered: July 2009
Member
Hi Pierre,

1)
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.

2)
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

3)
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.

Hope this help.

Yvan.
Re: Problems accessing fields [message #1834821 is a reply to message #1834768] Wed, 18 November 2020 15:21 Go to previous messageGo to next message
Pierre Campan is currently offline Pierre CampanFriend
Messages: 4
Registered: November 2020
Junior Member
Thank you for your quick awnser !

The first point is solved and it enlight me for the usage of nsURI
Iboke several template in the process, but it worth the effort !

The other two question I was not able to solve, because the target was not recognize, may be another missing nsURI

I installed the http://www.polarsys.org/capella/common/core/1.4.0
and the core/common but it did not seems to have effect

if you have any hints ?

Tanks by advance

Pierre
Re: Problems accessing fields [message #1834904 is a reply to message #1834821] Fri, 20 November 2020 08:28 Go to previous messageGo to next message
Yvan Lussaud is currently offline Yvan LussaudFriend
Messages: 63
Registered: July 2009
Member
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.
Re: Problems accessing fields [message #1834912 is a reply to message #1834904] Fri, 20 November 2020 10:24 Go to previous messageGo to next message
Pierre Campan is currently offline Pierre CampanFriend
Messages: 4
Registered: November 2020
Junior Member
Hi Yvan

I am pretty sur you are right, looking at the template =>

{ m:for k | self.eAllContents()}
{ m:for rep | k.representationByDescriptionName('Logical Data Flow Blank')}
{ m:if rep.name.lastlndex('[Overview]')> O}
{ m:rep<---Couldn't find the 'target(org.eclipse.sirius.viewpoint.DRepresentation)' service.target().eClass()}

it is this org.eclipse.sirius.viewpoint.DRepresentation that is missing

but looking in the template configuration nsURI (expert)

I see no http://www.eclipse.org/sirius/viewpoint/....

only a polarsys.org/kitalpha/ad/viewpoint/1.0.0 I tried but that does not give me the good result

of coruse looking in the Add I see no viewpoint ...

I procedded to the standard installation ... Am I missing something ? (hum ... probably yes)

Thank you for your help and understanding !!
Re: Problems accessing fields [message #1834920 is a reply to message #1834912] Fri, 20 November 2020 14:56 Go to previous messageGo to next message
Yvan Lussaud is currently offline Yvan LussaudFriend
Messages: 63
Registered: July 2009
Member
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:

https://ibb.co/6FYj1V8

Re: Problems accessing fields [message #1835007 is a reply to message #1834920] Mon, 23 November 2020 09:48 Go to previous message
Pierre Campan is currently offline Pierre CampanFriend
Messages: 4
Registered: November 2020
Junior Member
Hello

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

So I started again from the LA_Complete.docx
Previous Topic:New Capella forum
Next Topic:M2DOC: How to access features of DRepresentationDescriptor?
Goto Forum:
  


Current Time: Fri Apr 19 23:26:03 GMT 2024

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

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

Back to the top