moosetechnology / Fame

Fame is a meta-modeling framework for executable models.
MIT License
4 stars 10 forks source link

exportOn: gives an MSE file with `ref: String` instead of a `ref: <integer>` #19

Open fuhrmanator opened 3 years ago

fuhrmanator commented 3 years ago

I'm experimenting with generating metamodels using FamixNG. I generated an MSE from it using 'FamixTypeScriptMetamodel.mse' asFileReference writeStreamDo: [ :writeStream | FamixTSModel metamodel exportOn: writeStream ], and got some results that don't look like they respect the grammar (see the (type: (ref: String))) line below). Because of this, my parser can't read it. Is this a bug? Maybe my metamodel is missing some entities (I can't find anything with (name 'String'))?

(
    (FM3.Package (id: 1)
        (name 'Tagging')
        (classes
            (FM3.Class (id: 2)
                (name 'Category')
                (abstract false)
                (package (ref: 1))
                (superclass (ref: 3))
                (properties
                    (FM3.Property (id: 4)
                        (name 'name')
                        (class (ref: 2))
                        (container false)
                        (derived false)
                        (multivalued false)
                        (type (ref: String)))
                    (FM3.Property (id: 5)
                        (name 'markedTags')
                        (class (ref: 2))
                        (container false)
                        (derived false)
                        (multivalued true)
                        (opposite (ref: 6))
                        (type (ref: 7)))))

I'm attaching the entire MSE file of the Metamodel for more info (there are other cases where ref: is Number, etc. FamixTypeScriptMetamodel.mse.txt

fuhrmanator commented 3 years ago

I've worked around this by adding a third reference type at https://github.com/profcfuhrmanets/mse-tools/commit/7a4bbc41cdb0195b305b5260beecfd4489bbf1bf#diff-396fec23ee78598e7f93579e822b7c0b4c5ab540d5a8916da6f26d6e3851ff0cR13

I was using the EBNF I found in https://www.researchgate.net/publication/265428652_MSE_and_FAMIX_30_an_Interexchange_Format_and_Source_Code_Model_Family

Is there a newer version of the MSE Grammar specified like this (easy to use with PEG tools in Javascript)?

badetitou commented 3 years ago

Hello,

No, I think you find the fix. There are several types that are not exported but exist in the format.

Those types are used for the Fame Properties (not a relation between two models entities) So, the ones generated with:

defineProperties
    myEntity property: #propertyName type: #String
badetitou commented 3 years ago

(Still, we should document this better in format description, and in the metamodel generation)

badetitou commented 3 years ago

Also,

Note that this kind of problem only happens when you want to generate the mse of a metamodel.

'FamixTypeScriptMetamodel.mse' asFileReference writeStreamDo: [ :writeStream | FamixTSModel metamodel exportOn: writeStream ]

When generating the mse of a model, those types are used to determine how to export the value of the properties

fuhrmanator commented 3 years ago

Thanks for the info. I will update my MSE parser.

NicolasAnquetil commented 3 years ago

hummmm AFAIK, there are only 3 (or 4?) known types in Fame:

jecisc commented 3 years ago

The metamodel knows only those 4.

Number can be a fraction in the model and String can be a symbol in the model. Don't know for characters.