|
|
Re: Programmatically using EML [message #1793213 is a reply to message #1793171] |
Wed, 01 August 2018 14:51 |
Flavio Costa Messages: 23 Registered: February 2018 |
Junior Member |
|
|
Dimitris, thanks for putting this up together! This is exactly the line I was looking for:
emlModule.getContext().setMatchTrace(eclModule.getContext().getMatchTrace().getReduced());
However, once I started writing the EML program, I realize I am not sure how to implement exactly what I need to do, or even if EML is the best option to do it. Since it's a bit difficult to create a minimum example to demonstrate the requirement, let me try to explain it here in conceptual terms:
The entities in my models would be "schools", "classrooms" and "persons". I have an Xtext grammar that allows be to specify a school and its classrooms, so these are part of one single model and they are directly related. On each classroom, I have a list of student names that refer to the students that belong to that classroom.
Then I have another model including "persons". If I do person.equivalent(), it would return a Teacher, Student or SchoolStaff object, something that is easy to do with ETL transformations. What I need to have at the end is each classroom with its respective Student instances matched by the person's name, with something like this:
rule MergeClassroomAndPeople
merge c : Source!Classroom
with p : Persons!Person
into r : Target!Room {
r.type = Target!RoomType#CLASSROOM;
r.number = r.number;
r.students = p.equivalents(); // I need several students, not just one!
}
rule ConvertStudent
transform p : Persons!Person
to s: Target!Student {
s.name = p.name;
}
rule MatchClassroomWithStudents
match c : Source!Classroom
with p : Persons!Person {
compare : c.studentNames.includes(p.name);
}
How could something like this work? Without testing it, I have the impression that the line I added a comment to does not really do what I would expect.
Also, will the ConvertStudent rule transform all entities in the Persons model into Students? For processing efficiency purposes, I'd prefer that it transforms only the people that are assigned as a student in a classroom, since many records in the Persons model are actually teachers or school staff, so transforming these objects would be useless in this context.
Thanks,
Flavio
|
|
|
Re: Programmatically using EML [message #1793215 is a reply to message #1793213] |
Wed, 01 August 2018 15:06 |
|
Hi Flavio,
Merging classrooms with students doesn't sound right. If looks like your first rule should be a transformation rule from Classrooms to Room and the third statement should be as follows:
r.students = Persons!Person.all.select(p|c.studentNames.includes(p.name)).equivalent();
Cheers,
Dimitris
|
|
|
Powered by
FUDForum. Page generated in 0.04314 seconds