Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » VIATRA » Annotation of @Edge can't work
Annotation of @Edge can't work [message #1784454] Wed, 28 March 2018 07:42 Go to next message
zhang ph is currently offline zhang phFriend
Messages: 43
Registered: March 2017
Member
Hi,
Today, I research on the EMF-inquery example of 'emfxcel'(https://github.com/viatra/EMF-IncQuery-Examples/tree/master/emfxcel), I found it adapt to VIATRA2(My version is 1.5.1), so I modified the suffix of query file and some dependencies. Then I found in the 'Query Results' exporer I can see the the query result, and when I "reinitialize VIATRA viewer " , only seperate student and teacher nodes are displayed in the 'Zest Graph' view, but the edges cann't be shown, Did I omit any part to be modified ?
Thanks in advance!
Re: Annotation of @Edge can't work [message #1784455 is a reply to message #1784454] Wed, 28 March 2018 07:51 Go to previous messageGo to next message
Zoltan Ujhelyi is currently offline Zoltan UjhelyiFriend
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 Go to previous messageGo to next message
zhang ph is currently offline zhang phFriend
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 #1784462 is a reply to message #1784461] Wed, 28 March 2018 08:55 Go to previous messageGo to next message
Zoltan Ujhelyi is currently offline Zoltan UjhelyiFriend
Messages: 392
Registered: July 2015
Senior Member
Hi,

looking at the screenshots, I see that students are represented by IDs, e.g. 'AH2'; but there is no node named 'AH2' in the Zest graph. This means to me that there is no pattern marked with @Item that enumerates the students for the visualization; and thus the edge cannot be displayed. I see a potential pattern in https://github.com/viatra/EMF-IncQuery-Examples/blob/master/emfxcel/net.istvanrath.emfxcel.incquery/src/net/istvanrath/emfxcel/incquery/demo/SzakiranyDemo.eiq#L26 that could be used for this case.


Best regards,
Zoltán
Re: Annotation of @Edge can't work [message #1784464 is a reply to message #1784462] Wed, 28 March 2018 09:13 Go to previous messageGo to next message
zhang ph is currently offline zhang phFriend
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 #1784466 is a reply to message #1784464] Wed, 28 March 2018 09:20 Go to previous messageGo to next message
Zoltan Ujhelyi is currently offline Zoltan UjhelyiFriend
Messages: 392
Registered: July 2015
Senior Member
You are right, I have missed this pattern and the matching by name. I don't have any idea right now what might be incorrect, so I have to try it out. For that, I also have to update the example; and thus I also have to forward-port. I will try to allocate some time for that, but I don't know how soon I will be able to do that.

Best regards,
Zoltán
Re: Annotation of @Edge can't work [message #1784476 is a reply to message #1784466] Wed, 28 March 2018 12:16 Go to previous messageGo to next message
zhang ph is currently offline zhang phFriend
Messages: 43
Registered: March 2017
Member
Thanks for your attention, I try to solve the problem but fail. So hope for your modification!
Re: Annotation of @Edge can't work [message #1790139 is a reply to message #1784476] Tue, 05 June 2018 19:32 Go to previous message
Zoltan Ujhelyi is currently offline Zoltan UjhelyiFriend
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
Previous Topic:Simscape Support for Massif
Next Topic:Querying FeatureMap constructs ?
Goto Forum:
  


Current Time: Fri Dec 06 11:17:43 GMT 2024

Powered by FUDForum. Page generated in 0.04221 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top