Alex,
Extending the Famix meta model has 2 difficulties:
- put the right pragmas in the right place to extend the meta-model There was a presentation done by Steph. and Andre Hora, I will send it to you. (basically, you must put a pragma on the class side to describe the class itself + put pragmas in the getters of the properties that you want to be recognized in the meta model)
- putting in place the mechanism so that you don't have to take care of both ends of an association (eg if you say that a method has for parent a given class, you don't need to say to the class that it owns this method) This is where MultiLinks come in place. For this to work, you typically need to put something in the initialize (at both ends of the association), and in the setters of the properties (at both ends of the association). And because associations are known by the metamodel, you actually have three classes to deal with (association + both ends of it, like method and class in the example above) and four properties (instance variables): two in the association and one in each class at the end of the association.
This is indeed a bit cumbersome and error prone :-)
What I typically do for both problems (pragms, multilinks) is that I look at something existing, I open several nautilus and I replicate exactly hwat was done before. As Guillaume explained, you have to take care of chossing the right example: 1-to-* or *-to-* links.
nicolas
On 02/07/2016 00:16, Alexandre Bergel wrote:
Vincent, can you put this in the class comments?
It would be fantastic to have a Help on this. Googling before using Fame is really not optimal...
Alexandre
On Jul 1, 2016, at 12:10 PM, Blondeau Vincent vincent.blondeau@worldline.com wrote:
Hi,
I am afraid that the documentation about fame (and few other moose things like the moose algorithms) has vanished with the old Moose website… If someone can make it available again, it will be nice.
But, to give more usage examples:
- FMMultivalueLink
Used to create 1 to n links between famix elements. Example with inheritance where a FAMIXInheritance has a link to 1 FAMIXType and where FAMIXType have 1 link to n FAMIXInheritances:
In FAMIXInheritance (subclass is an instance variable):
FAMIXInheritance >>subclass <MSEProperty: #subclass type: #FAMIXType opposite: #superInheritances> <MSEComment: 'Subclass linked to in this relationship. from-side of the association'> ^subclass FAMIXInheritance >> subclass: aType subclass := FMMultivalueLink on: self update: #superInheritances from: self subclass to: aType
In: FAMIXType (superInheritances is an instance variable) FAMIXType >>initialize superInheritances := FMNullMultivalueLink on: self opposite: #subclass: selector: #superInheritances.
FAMIXType >>superInheritances <MSEProperty: #superInheritances type: #FAMIXInheritance opposite: #subclass> <multivalued> <derived> <MSEComment: 'Superinheritance relationships, i.e. known superclasses of this type.'> ^superInheritances FAMIXType >> superInheritances: anInheritance superInheritances value: anInheritance
- FMMultiMultivalueLink. To create n to n associations. Example:
In FAMIXInvocations (candidates is an instance variable): FAMIXInvocations >> initialize candidates := FMMultiMultivalueLink on: self opposite: #incomingInvocations.
FAMIXInvocations >> candidates <MSEProperty: #candidates type: #FAMIXBehaviouralEntity opposite: #incomingInvocations> <multivalued> <MSEComment: 'List of candidate behavioural entities for receiving the invocation'>
^candidates FAMIXInvocations >> candidates: aCollection candidates value: aCollection
In FAMIXBehaviouralEntity (incomingInvocations is an instance variable): FAMIXBehaviouralEntity >> initialize incomingInvocations := FMMultiMultivalueLink on: self opposite: #candidates. FAMIXBehaviouralEntity >> incomingInvocations <MSEProperty: #incomingInvocations type: #FAMIXInvocation opposite: #candidates> <multivalued> <derived> <MSEComment: 'Incoming invocations from other behaviours computed by the candidate operator.'>
^incomingInvocations FAMIXBehaviouralEntity >> incomingInvocations: anInvocation incomingInvocations value: anInvocation
- FMNullMultivalueLink: used to reduce memory consumption (see other answers)
- <multivalued>: used to describe in the meta model that the return value is a collection of entities and no only one entity.
- <derived>: as said by Guillaume: “is for things that don't require to be stored in the .mse for example because you can derive it (compute) from other data”
Example: numberOfAccesses <MSEProperty: #numberOfAccesses type: #Number> <derived> <MSEComment: 'The number of accesses from a method'>
^ self lookUpPropertyNamed: #numberOfAccesses computedAs: [ self accesses size ]
I know that the colors are flashy but it is to better understand the links between the names.
All these pragmas are mandatory to describe relations in Fame Meta Meta Model and should be provided accurately.
And you should put something like: annotation <MSEClass: #BehaviouralEntity super: #FAMIXContainerEntity> <package: #FAMIX> ^self
On class side of your Moose classes to reference them in the meta model.
After a change in the pragmas, do : MooseModel resetMeta It avoid a lots of problems ;)
Don’t hesitate if you have more questions,
Cheers, Vincent
-----Message d'origine----- De : moose-dev-bounces@list.inf.unibe.ch [mailto:moose-dev- bounces@list.inf.unibe.ch] De la part de Anne Etien Envoyé : vendredi 1 juillet 2016 17:10 À : Moose-related development Objet : [Moose-dev] Re: Documentation about Fame?
Hi,
We asked for an engineer to modify it. We do not know yet if we got it or not.
What I do is that I use the example of Famix for ST to create my own FAMIX. <mutivalued> means that the maximal multiplicity is *. In that case, you need FMMultiValueLink. But when you want to initiate one FMMultivalueLink to null, you create a FMNullMultiValueLink. I don’t really know when there is <derived> or not.
Anne
Le 1 juil. 2016 à 16:47, Alexandre Bergel alexandre.bergel@me.com a écrit :
hi
Is there at least a bit of documentation about Fame? I am trying to meta-describes some C elements, but it is very difficult. All these are very mysterious: FMNullMultivalueLink, FMMultivalueLink FMMultiMultivalueLink
<multivalued> <derived>
I feel Fame is very powerful, but very hard to understand.
Alexandre
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Moose-dev mailing list Moose-dev@list.inf.unibe.ch https://www.list.inf.unibe.ch/listinfo/moose-dev
Moose-dev mailing list Moose-dev@list.inf.unibe.ch https://www.list.inf.unibe.ch/listinfo/moose-dev
!!!************************************************************************************* "Ce message et les pièces jointes sont confidentiels et réservés à l'usage exclusif de ses destinataires. Il peut également être protégé par le secret professionnel. Si vous recevez ce message par erreur, merci d'en avertir immédiatement l'expéditeur et de le détruire. L'intégrité du message ne pouvant être assurée sur Internet, la responsabilité de Worldline ne pourra être recherchée quant au contenu de ce message. Bien que les meilleurs efforts soient faits pour maintenir cette transmission exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard et sa responsabilité ne saurait être recherchée pour tout dommage résultant d'un virus transmis.
This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Worldline liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.!!!" _______________________________________________ Moose-dev mailing list Moose-dev@list.inf.unibe.ch https://www.list.inf.unibe.ch/listinfo/moose-dev