Home » Modeling » VIATRA » Annotation of @Edge can't work
|
Re: Annotation of @Edge can't work [message #1784455 is a reply to message #1784454] |
Wed, 28 March 2018 07:51 |
Zoltan Ujhelyi Messages: 392 Registered: July 2015 |
Senior Member |
|
|
Hi,
in general, the annotated patterns from that example should work if the model contains corresponding matches. More precisely, an Edge is only shown when both the `source` and `target` parameters represent an EMF model object that have a corresponding match where it is used as an Item. In other words, I would look at the matches of both the Item and Edge patterns, and ensure they are in synch.
If this is not helpful, I'd look at the example if you could share somehow the current version with an example model specified.
Best regards,
Zoltán
[Updated on: Wed, 28 March 2018 07:52] Report message to a moderator
|
|
|
Re: Annotation of @Edge can't work [message #1784461 is a reply to message #1784455] |
Wed, 28 March 2018 08:48 |
zhang ph Messages: 43 Registered: March 2017 |
Member |
|
|
Sorry, it is hard for me to share my current verti with u, But I can describe my problem as detailed as possible, also you can get the example from https://github.com/viatra/EMF-IncQuery-Examples/tree/master/emfxcel.
Edge annotation is defined as follows:
@Edge(source = studentId, target = teacherName, label = "taughtBy")
pattern enrolledStudent(courseName, teacherName, studentId) {
find valueInNamedColumn("Courses", "Course", rowNum, courseName);
find valueInNamedColumn("Courses", "Teacher", rowNum, teacherName);
find valueInNamedColumn("Courses", "Student Identifier", rowNum, studentId);
}
Query result and zest graph are shown in attacnment.
|
|
| |
Re: Annotation of @Edge can't work [message #1784464 is a reply to message #1784462] |
Wed, 28 March 2018 09:13 |
zhang ph Messages: 43 Registered: March 2017 |
Member |
|
|
student Item annotation is below,
@Item(item = id, label = "$name$")
pattern student(name, id) {
find valueInNamedColumn("Students", "First name", rowNum, firstName);
find valueInNamedColumn("Students", "Last name", rowNum, lastName);
find valueInNamedColumn("Students", "Identifier", rowNum, id);
name == eval(firstName + " " + lastName);
}
we can see it just use the student's name as the label content, that will not change object of students. And above pattern also works well. refer to attachments.
|
|
| | |
Re: Annotation of @Edge can't work [message #1790139 is a reply to message #1784476] |
Tue, 05 June 2018 19:32 |
Zoltan Ujhelyi Messages: 392 Registered: July 2015 |
Senior Member |
|
|
Hi,
I am sorry for being so slow to reproduce the example and find the answer. The short answer is that this example does not work correctly; all current versions of VIATRA Viewers (including the version 1.5.1 you were using) does only support drawing edges between EObject instances, but does not work for plain Java models, such as Strings used in the current example. I have opened a bug in our issue tracker to look for the root cause of this issue: https://bugs.eclipse.org/bugs/show_bug.cgi?id=535568
For a bit more detail: when the original EMFxcel example was developed, Viewers had an older implementation that worked with Java Objects, but in the meantime, the internal behavior was replaced completely, and for some reason we have missed the case for connecting Java Objects in the visualization.
As a workaround, please write your patterns in a way that creates Items to be connected from EMF model elements instead of Java objects such as names.
Sorry for the inconvenience,
Zoltán
|
|
|
Goto Forum:
Current Time: Fri Dec 06 11:25:17 GMT 2024
Powered by FUDForum. Page generated in 0.03807 seconds
|