FM3
FM3 or Fame meta-metamodel is a model to describe metamodels.
- FM3 is self-described in itself.
- FM3 is a superset of a subset of EMOF.
- FM3 is small and simple.
- FM3 is extendable.
FM3 applies lessons learned and best practices from using EMOF in the Moose and Famix project:
- FM3 allows packages to weave methods into existing classes of other packages. Using this, Famix extensions may extend the core specification of the model.
- FM3 is EMOF reduced to the max. We removed anything that was not used by Famix. For example, EMOF specifies multiplicity of properties using
lower: Integer
andupper: Unlimited
. As upper may possibly be unlimited, EMOF even introducesUnlimited
as core primitive type, messing up any implementation. Analysis of existing models showed however that we use0..1
and 0..* only! Hence, FM3 models multiplicity of properties usingmultivalued: Boolean
, simple and no need for fancy primitives.
See also:
FM3.Element
is an abstract class with attributes
- Element
owner
(derived) - String
fullName
(derived) - String
name
with these constraints
name
must be alphanumericfullName
is dervied recursively, concatenatingowner.fullName
andname
fullName
is seperated by dots, egFAMIX.Class.allAttributes
FM3.Class
subclasses NamedElement with attributes
- Boolean
abstract
- Boolean
primitive
(derived) - Boolean
root
(derived) - Class
superclass
- Package
package
(container, opposite Package.classes) - Property
allAttributes
(derived, multivalued) - Property
attributes
(multivalued, opposite Property.class)
with these reserved instances
OBJECT := (FM3.Class (name 'Object') (root true))
BOOLEAN := (FM3.Class (name 'Boolean') (primitive true) (superclass (ref: Object)))
NUMBER := (FM3.Class (name 'Number') (primitive true) (superclass (ref: Object)))
STRING := (FM3.Class (name 'String') (primitive true) (superclass (ref: Object)))
for any other instance of MF3.Class, these constraints apply
owner
is derived frompackage
superclass
is not nilsuperclass
must not be a primitivesuperclass
chain may not include cyclespackage
must not be nilallAttributes
is derived as union ofattributes
andsuperclass.allAttributes
- only one of
allAttributes
may havecontainer = true
allAttributes
must have unique names- in particular, none of
attributes
may have the name of any ofsuperclass.allAttributes
// TODO, I am not sure about this ... it does not allow overloading of attributes, does anyone need overloading?
FM3.Package
subclasses NamedElement with attributes
- Class
classes
(multivalued, opposite Class.package) - Property
extensions
(multivalued, opposite Property.package)
with these constraints
owner
is nilclasses
must have unique names- for each element of
extentions
, it class is not inclasses
FM3.Property
subclasses NamedElement with attributes
- Boolean
composite
(derived) - Boolean
container
- Boolean
derived
- Boolean
multivalued
- Class
class
(container, opposite Class.attributes) - Class
type
- Package
package
(opposite Package.extensions) - Property
opposite
(opposite Property.opposite)
with these constraints
owner
is derived fromclass
composite
is derived fromopposite.container
container
implies notmultivalued
- if set,
opposite.opposite
must be self - if set,
opposite.class
must betype
class
must not be niltype
must not be nil
and these semantics
container
property chains may not include cyclesopposite
properties must refer to each other- any multivalued property defaults to empty
- boolean properties default to
false
- non primitive properties default to
null
- string and number properties not have a default value // TODO is this wise?