Fame
Fame is the meta-meta-model of Famix. In the following, we mainly present the Pharo implementation and usage of Fame.
Meta-model
Section titled “Meta-model”Main concepts
Section titled “Main concepts”It consists of 6 main entities:
- Element --- the root of the meta-model
- Package --- a container that can contain Class, Trait, and Properties
- Type --- an abstraction of Class and Trait
- Class --- contained by Package. A Class might contains several Properties. A Class can have a superclass, subclasses, and use traits. Some Class are Constants.
- Trait --- contained by Package. A Trait might contains several Properties. A Trait can be used by other Types and can use other Trait.
- Property --- attached to a Type. Property has a value and a value type. It can have an opposite property that will be my miror. The type of a property is a Class
Constants
Section titled “Constants”Fame defines 4 constants:
- Boolean --- value can be
true
orfalse
- Number --- value is a number. When exporting, consider using a float
- String --- a common string.
- Object --- a complex structure which is not part of any metamodel
Implementations
Section titled “Implementations”Fame is implemented in the following programming languages:
Installation
Section titled “Installation”The last stable version of Fame is always includeds in Moose.
The project can be found in the packages prefixed with Fame-
.
It is also possible to install Fame in a fresh Pharo image. To do so, execute the following script:
Metacello new githubUser: 'moosetechnology' project: 'Fame' commitish: 'v1.x.x' path: 'src'; baseline: 'Fame'; load
Export / Import
Section titled “Export / Import”Export
Section titled “Export”Fame supports two file formats to export meta-models: MSE, and JSON.
The new JSON file format should be chosen preferably. It can use with the following script:
String streamContents: [ :writeStream | MyModel metamodel exportOn: writeStream usingPrinter: FMJSONPrinter ]
To export a model (or meta-model) in the mse format (for example, to use FameJava and VerveineJ), execute the following code:
'/path/to/file.mse' asFileReference writeStreamDo: [ :writeStream | MyModel metamodel exportOn: writeStream ]
Import
Section titled “Import”It is also possible to import a Fame model from a JSON and a MSE file.
To import a model please use the following script:
"aMetamodel is a Fame Metamodel""Considering you want to import a FamixJavaModel""aMetamodel := FamixJavaModel new metamodel."model := FMModel withMetamodel: aMetamodel.importer := aBlock value: ((FMImporter model: model) autorizeDandlingReferencesAtEnd"Replace FMJSONParser with FMMSEParser when importing a model stored in a MSE file" parser: FMJSONParser; stream: aStream; yourself).importer run.
When using a Moose image, some methods are implemented to simplify the script.
For instance, one can use FamixJavaModel>>#importFromJSONStream:
and FamixJavaModel>>#importFromMSEStream:
.