program megamodelPopulation using { ecore : !MetaMetamodel = OclUndefined familiesMetamodel : !Metamodel = OclUndefined personsMetamodel : !Metamodel = OclUndefined } do{ -- Removes all the identified elements form the megamodel for(identifiedElement in !IdentifiedElement.allInstances()->select(ie | not (ie.identifier = OclUndefined) )) { identifiedElement.remove(); } -- Creates the Ecore metametamodel element in the megamodel thisModule.register( thisModule.metametamodel( thisModule.identifier('identifier', 'http://www.eclipse.org/emf/2002/Ecore', 'GlobalModelManagement::URI') ,thisModule.locator('locator', 'http://www.eclipse.org/emf/2002/Ecore', 'GlobalModelManagement::EPackagesRegistryLocator') ) ); ecore <- !Model.allInstances()->any(m | m.identifier.value = 'http://www.eclipse.org/emf/2002/Ecore'); -- Creates the Families metamodel element in the megamodel thisModule.register( thisModule.metamodel( thisModule.identifier('identifier', '/Families2Persons/Families.ecore', 'GlobalModelManagement::URI'), thisModule.locator('locator', '/Families2Persons/Families.ecore', 'GlobalModelManagement::EFSLocator'), ecore ) ); -- Creates the Persons metamodel element in the megamodel thisModule.register( thisModule.metamodel( thisModule.identifier('identifier', '/Families2Persons/Persons.ecore', 'GlobalModelManagement::URI'), thisModule.locator('locator', '/Families2Persons/Persons.ecore', 'GlobalModelManagement::EFSLocator'), ecore ) ); familiesMetamodel <- !Model.allInstances()->any(m | m.identifier.value = '/Families2Persons/Families.ecore'); -- Registers the Families metamodel in the EMF package register familiesMetamodel.registerInEMFpkgReg(); -- Creates the Families model element in the megamodel thisModule.register( thisModule.terminalmodel( thisModule.identifier('identifier', '/Families2Persons/sample-Families.xmi', 'GlobalModelManagement::URI'), thisModule.locator('locator', '/Families2Persons/sample-Families.xmi', 'GlobalModelManagement::EFSLocator'), familiesMetamodel ) ); personsMetamodel <- !Model.allInstances()->any(m | m.identifier.value = '/Families2Persons/Persons.ecore'); -- Registers the Persons metamodel in the EMF package register personsMetamodel.registerInEMFpkgReg(); -- Creates the Families model element in the megamodel thisModule.register( thisModule.terminalmodel( thisModule.identifier('identifier', '/Families2Persons/sample-Persons.xmi', 'GlobalModelManagement::URI'), thisModule.locator('locator', '/Families2Persons/sample-Persons.xmi', 'GlobalModelManagement::EFSLocator'), personsMetamodel ) ); -- Registers the Families2Person.atl transformations in the megamodel thisModule.register( thisModule.atlModule( thisModule.identifier('identifier', '/Families2Persons/Families2Persons.atl', 'GlobalModelManagement::URI'), thisModule.locator('locator', '/Families2Persons/Families2Persons.atl', 'GlobalModelManagement::EFSLocator') ) ); } -- *********** Helper for creating the tuple for the element type -- *********** Metametamodel helper def: metametamodel(identifier : TupleType(name: String, concreteType: String, value :OclAny) ,locator : TupleType(name: String, concreteType: String, value :OclAny)) :TupleType(name: String, concreteType: String, value :OclAny) = let id: String = identifier.value.asSequence()->first().value in let concreteType: String = 'GlobalModelManagement::Metametamodel' in let creationId: String = '@' + concreteType + '#' + id in let attributes : Set(TupleType(name: String, concreteType: String, value :OclAny)) = Set{ Tuple{name = '__id', concreteType = 'String', value = id}, identifier, locator, Tuple{name = 'conformsTo', concreteType = 'GlobalModelManagement::ReferenceModel', value = creationId} } in Tuple{creationId = creationId, concreteType = concreteType, value = attributes} ; -- *********** Helper for creating the tuple for the element type -- *********** Metamodel helper def: metamodel(identifier : TupleType(name: String, concreteType: String, value :OclAny), locator : TupleType(name: String, concreteType: String, value :OclAny), referenceModel : !ReferenceModel) : TupleType(name: String, concreteType: String, value :OclAny) = let attributes : Set(TupleType(name: String, concreteType: String, value :OclAny)) = Set{ Tuple{name = '__id', concreteType = 'String', value = identifier.value.asSequence()->first().value}, identifier, locator, Tuple{name = 'conformsTo', concreteType = 'GlobalModelManagement::ReferenceModel', value = referenceModel} } in Tuple{concreteType = 'GlobalModelManagement::Metamodel', value = attributes} ; -- *********** Helper for creating the tuple for the element type -- *********** TerminalModel helper def: terminalmodel(identifier : TupleType(name: String, concreteType: String, value :OclAny), locator : TupleType(name: String, concreteType: String, value :OclAny), referenceModel : !ReferenceModel): TupleType(name: String, concreteType: String, value :OclAny) = let attributes : Set(TupleType(name: String, concreteType: String, value :OclAny)) = Set{ Tuple{name = '__id', concreteType = 'String', value = identifier.value.asSequence()->first().value}, identifier, locator, Tuple{name = 'conformsTo', concreteType = 'GlobalModelManagement::ReferenceModel', value = referenceModel} } in Tuple{concreteType = 'GlobalModelManagement::TerminalModel', value = attributes} ; -- *********** Helper for creating the tuple for the element type -- *********** ATLModule helper def: atlModule(identifier : TupleType(name: String, concreteType: String, value :OclAny), locator : TupleType(name: String, concreteType: String, value :OclAny)): TupleType(name: String, concreteType: String, value :OclAny) = let attributes : Set(TupleType(name: String, concreteType: String, value :OclAny)) = Set{ Tuple{name = '__id', concreteType = 'String', value = identifier.value.asSequence()->first().value}, identifier, locator } in Tuple{concreteType = 'GMM4ATL::ATLModule', value = attributes} ; -- *********** Helper for creating the tuple for the element type -- *********** Identifier helper def: identifier(attrName: String, value: String, concreteType: String) :TupleType(name: String, concreteType: String, value :OclAny) = let elementAttribute : Set(TupleType(name: String, concreteType: String, value :OclAny)) = Set{Tuple{name = 'value', concreteType = 'String', value = value}} in Tuple{name = attrName, concreteType = concreteType, value = elementAttribute} ; -- *********** Helper for creating the tuple for the element type -- *********** Locator helper def: locator(attrName: String, value: String, concreteType: String) :TupleType(name: String, concreteType: String, value :OclAny) = let elementAttribute : Set(TupleType(name: String, concreteType: String, value :OclAny)) = Set{Tuple{name = 'value', concreteType = 'String', value = value}} in Tuple{name = attrName, concreteType = concreteType, value = elementAttribute} ;