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: Integerandupper: Unlimited. As upper may possibly be unlimited, EMOF even introducesUnlimitedas core primitive type, messing up any implementation. Analysis of existing models showed however that we use0..1and 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
namemust be alphanumericfullNameis dervied recursively, concatenatingowner.fullNameandnamefullNameis 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
owneris derived frompackagesuperclassis not nilsuperclassmust not be a primitivesuperclasschain may not include cyclespackagemust not be nilallAttributesis derived as union ofattributesandsuperclass.allAttributes- only one of
allAttributesmay havecontainer = true allAttributesmust have unique names- in particular, none of
attributesmay 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
owneris nilclassesmust 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
owneris derived fromclasscompositeis derived fromopposite.containercontainerimplies notmultivalued- if set,
opposite.oppositemust be self - if set,
opposite.classmust betype classmust not be niltypemust not be nil
and these semantics
containerproperty chains may not include cyclesoppositeproperties 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?