Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » [Alf Editor] Why does it create a Comment instead of an OpaqueBehavior ?(Question to developers concerning the "Edit Operation -> Using Alf Editor" feature)
[Alf Editor] Why does it create a Comment instead of an OpaqueBehavior ? [message #849859] Thu, 19 April 2012 14:08 Go to next message
Erwan Bousse is currently offline Erwan BousseFriend
Messages: 3
Registered: February 2012
Location: Rennes, France
Junior Member
Hi !


I am testing the Alf Editor that one can install alongside Papyrus core, which allows to right click on an operation of a class, and to do "Edit Operation -> Using Alf Editor". This shows a little popup with a nice Alf Editor (with color syntax and syntax errors), allowing to easily define the behavior of the operation in Alf.

But then, I wondered what does this Alf code means from the model point of view. After some grep in the model.uml file, I found out that adding a behavior with this feature creates a Comment instance inside the ownedComment property of the Operation instance, with the Alf code inside the body property of the ownedComment.

So, the behavior defined in Alf is indeed stored within the model. But I wonder : why is it stored inside a Comment instance, and not inside an OpaqueBehavior instance ? This would be semantically more accurate, and would allow to tag this behavior as being written in Alf (as allows the language property of the OpaqueBehavior metaclass).


Thanks in advance for some insight on this point, which is quite crucial when implementing algorithms that explore and transform a UML model designed with Papyrus.
Re: [Alf Editor] Why does it create a Comment instead of an OpaqueBehavior ? [message #849941 is a reply to message #849859] Thu, 19 April 2012 15:45 Go to previous messageGo to next message
Arnaud Cuccuru is currently offline Arnaud CuccuruFriend
Messages: 18
Registered: April 2010
Junior Member
Hi Erwan,

Thanks for your comments.

You are right, the current way of serializing Alf statements (when editing an operation signature and body) is not completely clean, but it is valid according to the spec.

The main thing which is not clean here is that we have not yet implemented the ActionLanguage profile defined in the Alf specification, which introduces the single stereotype TextualRepresentation (cf. clause 11.1 of the spec), which applies to metaclass Comment. This is why you have probably noticed that comments' bodies start with the string <<TextualRepresentation>>.

As you suggest, serializing the body of the operation inside an OpaqueBehavior is a valid (and probably better) option identified in the Alf spec. Nevertheless, the serialization currently supported in Papyrus is also a valid option (expect the String <<TextualRepresentation>> of course...), as suggested by clause 6.1 of the Alf specification.

The thing is that the Operation editor in Papyrus enables to edit not only the body of the operation, but also the signature. At least the signature needs to be serialized in a <<TextualRepresentation>> comment because there are some textual information that cannot be automatically reproduced from the corresponding Operation instance, such as user formatting of the text (e.g., in the text, you can use the alias given in an element import as the type name for a parameter, but in the corresponding model, the type of the parameter is the imported type). Moreover, if you look at the Alf grammar for Operation (clause 10.5.3), inlining the body of the operation is possible.

Nevertheless (and at least), we could complete the current serialization as follows:
- Implement the ActionLanguage profile, and use the <<TextualRepresentation>> stereotype
- When serializing the Operation, generate (or update) an OpaqueBehavior as a method for the Operation, with a signature matching the signature of the Operation, and a corresponding Alf body,
- In the TextualRepresentation comment associated with the Operation, only serialize the Operation signature.

We can try to do that for the release of Papyrus 0.9 (normally scheduled for end of June).

Cheers,

Arnaud
Re: [Alf Editor] Why does it create a Comment instead of an OpaqueBehavior ? [message #850850 is a reply to message #849941] Fri, 20 April 2012 11:43 Go to previous messageGo to next message
Erwan Bousse is currently offline Erwan BousseFriend
Messages: 3
Registered: February 2012
Location: Rennes, France
Junior Member
Thanks for your fast reply. I hadn't read sections 6.1 and 11.1 of the Alf spec (I discovered Alf very recently), and this issue is indeed quite documented !

Nontheless, I might have a different interpretation of these paragraphs. If I am not mistaken, section 6.1, they recommend the use of the TextualRepresentation stereotype only when some Alf text has been processed into a UML abstract representation, in order (quote) "to also store the original Alf text in the model, since it would not otherwise be possible to exactly reproduce that text". Following this recommendation, I understand that a TextualRepresentation shouldn't exist alone without the abstract representation it corresponds to. And right now, this is what Papyrus does, keeping a TextualRepresentation without the UML model elements representing the behavior of the Operation.

But being able to edit the signature using Alf is a very good point, and I don't see any other option than using a TextualRepresentation... which would be a good compromise to the use of an OpaqueBehavior.


On this subject, a question : do you eventually plan to make it possible to "compile" Alf text added using the Alf Editor into UML model elements, which would be automatically be linked to other referenced elements of the model, and which could of course keep their Alf representation using a TextualRepresentation ? This is more or less what is described section 6.6 of the Alf spec.


In any case, i'm looking forward to the 0.9 release ! Smile

Thanks alot,
Erwan
Re: [Alf Editor] Why does it create a Comment instead of an OpaqueBehavior ? [message #854108 is a reply to message #850850] Mon, 23 April 2012 17:17 Go to previous messageGo to next message
Arnaud Cuccuru is currently offline Arnaud CuccuruFriend
Messages: 18
Registered: April 2010
Junior Member
Erwan Bousse wrote on Fri, 20 April 2012 07:43

On this subject, a question : do you eventually plan to make it possible to "compile" Alf text added using the Alf Editor into UML model elements, which would be automatically be linked to other referenced elements of the model, and which could of course keep their Alf representation using a TextualRepresentation ? This is more or less what is described section 6.6 of the Alf spec.


Hi Erwan,

Regarding the Alf to fUML mapping, we are indeed working on compiling Alf statements to equivalent fUML activities. This is however a work in progress, and it is still a bit prematurate to talk about release dates.

For the moment, the only kind of "compiling" which is supported in the current release of the editor is the generation of the Operation (name, parameters' type and multiplicity, etc.) from the Alf description.

Cheers,

Arnaud
Re: [Alf Editor] Why does it create a Comment instead of an OpaqueBehavior ? [message #857061 is a reply to message #854108] Thu, 26 April 2012 08:03 Go to previous message
Erwan Bousse is currently offline Erwan BousseFriend
Messages: 3
Registered: February 2012
Location: Rennes, France
Junior Member
Good to hear ; Alf to fUML mapping will really make it an interesting language.

Thank you for your answers.
Previous Topic:What is the best strategy to solve my Papyrus Model errors
Next Topic:Papyrus in RCP
Goto Forum:
  


Current Time: Thu Dec 18 04:12:26 GMT 2014

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

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