Function Target

Hi everyone, I want to generate target function. In ths table below you can see that i’m looking to generate the incoming function for each functional exchange. I don’t know any query to make this generation possible.

Thank for helping !

You could try:
fe.target.eInverse(ctx::SystemFunction)->asSequence()->at(1)

I did not try it on M2DOC.

I have tried this but i didn’t get any result

No error message? if you got one then share it, maybe someone else could help.

You can try:

fe.targetFunctionInputPort.eContainer()

I have tried this, here is my code :
source code
But i got nothing in return, here the output of this code :
result

1 Like

Do you have any error messages when you validate your template ?

No I didn’t have any error message, but i had nothing in the case dedicated to target function.

You can try:

fe.target.eContainer()

This should give you the same result, unless your FunctionalExchange is not connected…

You forgot m: at the beginning of the aql in the last column?
Also your "{"and “}” might have been written manually rathen than using CTRL/ALT+F9?

1 Like

I forgot the (m: ), but when i generate i have the name of the same function and not the incoming functions. Here is an exemple :
same func
for the different functional exchange i have as result the function that i look for its incoming functions.

Is there anyone who has faced the same problem ?

What are all the inputs you have tried inside your {m:…}?

fe.targetFunctionInputPort.eContainer()

fe.target.eInverse(ctx::SystemFunction)->asSequence()->at(1)

I have tried all these and none of them return the right functions.

(ctx::SystemFunction) this works only if you are inside a system analysis layer, if it’s Logical than it is la::LogicalComponent (I think)
Edit:
Little tip: try to simulate your aql codes in the sirius interpreter (Window → Show View → other → interpreter)

Yes you can use fa::AbstractFunction for a generic version.

I’m not sure to understand why source and target seems to be mixed in your model. But to get the other end you can try:

fe.source.eContainer()

I think I’m missing something here.

Thank you @YvanLussaud fe.source.eContainer() works. I have just on last question. Is that function works for the outputs case?

@YvanLussaud I have tried this query for the outgoing function but it doesn’t work. Do you know a query that could help me get the outgoig functions ?

I’m not sure what you are trying to get but you should select the element you are starting from (a FunctionalExchange ?) on a diagram then use the Sirius interpeter view and type:

aql:self.target.oclAsType(fa::FunctionalExchange)

Note the cast here is only needed so AQL known what specific type it should expect. Then you can use CTRL+SPACE to trigger the content assist and see what features are available for this element. Once you found the result you are looking for you can make this call (the expression after the oclAdType() call) on your fe variable in your M2Doc template.

You can also use the M2Doc interpreter view to be in the context of your template.

Thank you so much it helps.

1 Like