Exemplo n.º 1
0
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)
Exemplo n.º 2
0
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


Exemplo n.º 3
0
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()


Exemplo n.º 4
0
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)