import ecore # Creando un metamodelo companyPkg = ecore.createEPackage() companyPkg.set_name("company") companyPkg.set_nsPrefix("company") companyPkg.set_nsURI("http://com.example.company") # Creando clases company = ecore.createEClass() company.set_name("Company") department = ecore.createEClass() department.set_name("Department") employee = ecore.createEClass() employee.set_name("Employee") # Creando referencias companyDepartments = ecore.createEReference() companyDepartments.set_name("departments") companyDepartments.set_eType(department) departmentEmployees = ecore.createEReference() departmentEmployees.set_name("employees") departmentEmployees.set_eType(employee) departmentManager = ecore.createEReference() departmentManager.set_name("manager") departmentManager.set_eType(employee)
import ecore print ecore.NsURI print ecore.__dict__ a = ecore.createEClass() print a a.set_name("hola") name = a.get_name() print name a.set_name("adios") print a.get_name() # print ecore.package # print ecore.package.get_name() # print ecore.package.get_nsURI() # print ecore.package.get_nsPrefix() # print ecore.factory
import ecore print ecore.__dict__ print ecore.createEClass() print ecore.EClass.__dict__ i = ecore.createEClass() print i i.set_name("hola") print i.get_name()