Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » VIATRA » Querying FeatureMap constructs ?
Querying FeatureMap constructs ? [message #1789953] Fri, 01 June 2018 07:44 Go to next message
 is currently offline Friend
Messages: 23
Registered: September 2015
Junior Member
Hello !

I was wondering whether querying a model containing EMF feature maps was possible ?
I got one, not created by my hands, but generated from XSD2Ecore importer.
My first tries were unsuccessful :
- I'm unable to navigate down features typed EFeatureMapEntry : no way to access key or value
- The objects stored in a containment branch beneath a FeatureMap are not considered even with a simple unary type pattern

By the way, I was quite happy that the generated derived features created for each kind of element in the feature map are well-behaving.

I could conclude that FeatureMap are not fully supported by Viatra queries, am I right ?

Cheers,
--Eric
Re: Querying FeatureMap constructs ? [message #1789958 is a reply to message #1789953] Fri, 01 June 2018 08:06 Go to previous messageGo to next message
Zoltan Ujhelyi is currently offline Zoltan UjhelyiFriend
Messages: 392
Registered: July 2015
Senior Member
Hi,

you are right that the query language does not allow referencing the feature maps directly, but as far as I know the underlying elements should be visible with through the underlying features.

However, I am not entirely familiar with the usage of feature maps, which makes it hard for me to understand your existing experiences, especially your second issue ('The objects stored in a containment branch beneath a FeatureMap are not considered even with a simple unary type pattern'). Could you provide an example for me to check (incl. what is visible and what is not considered with a simple unary pattern)? It would help me to understand whether or not this is a bug in VIATRA. Furthermore, maybe I could suggest you an alternative to handle this case.

Best regards,
Zoltán
Re: Querying FeatureMap constructs ? [message #1790130 is a reply to message #1789958] Tue, 05 June 2018 15:18 Go to previous messageGo to next message
 is currently offline Friend
Messages: 23
Registered: September 2015
Junior Member
Hi Zoltán,

According to the example in the EMF document here: https://www.eclipse.org/modeling/emf/docs/overviews/FeatureMap.pdf
index.php/fa/33015/0/
preferredOrders and standardOrders are the two derived features, orders is the EFeatureMapEntry containment attribute.

Let's imagine a root Model element classically containing suppliers.

As expected:
Model.suppliers(m, s);
matches the model and each of its owned suppliers
Suppliers(s);
matches all the Supplier objects

Using derived features:
Supplier.preferredOrders(s, po);
matches suppliers and their preferred orders, meaning that the generated implementation is well behaving. Great !
As the global orders list is not usable, I could write an OR pattern combining all the derived features.
=> For the sake of simplicity, we could imagine Viatra Query to give the same matches when querying an EFeatureMapEntry[0..*] attribute: some kind of:
Supplier.orders.value(s, po);
but I guess nor orders nor value would notify any change.

On the dark side of the FeatureMap:
PurchaseOrder(o);
doesn't match any object, that's the case I mentioned as being contained beneath a feature map. The containment is not a classical composition, but the composition of EFeatureMapEntry-ies containing PurchaseOrder-s as their value java property.
PurchaseOrder.anotherFeature(po, sth);
wouldn't match anything. I can only suppose that it's because no PurchaseOrder is found, as stated in the previous point.

=>These two last points definitely make Viatra Query unefficient with feature maps.

Hope this helps to clarify the problem.
Please tell me if you want me to write a bug report.

Cheers,
--Eric

[Updated on: Tue, 05 June 2018 15:19]

Report message to a moderator

Re: Querying FeatureMap constructs ? [message #1790137 is a reply to message #1790130] Tue, 05 June 2018 18:27 Go to previous messageGo to next message
Zoltan Ujhelyi is currently offline Zoltan UjhelyiFriend
Messages: 392
Registered: July 2015
Senior Member
Hi Eric,

thanks for the more detailed description, it is somewhat clearer to me what your issue is. Yes, given VIATRA does not allow you to specify edges around EFeatureMaps; I'd go with the or pattern construct you have mentioned earlier as a workaround. I'd mention that you could create a library (basically a separate file with these queries), so you don't have to pollute your main query definitions with these helper patterns.

The second case on the other hand clearly feels like a major issue in VIATRA that we should fix as soon as possible. Given the way the issue manifests itself, I believe you are using an older version of VIATRA (older than 1.6), because in newer versions with default settings Suppliers.preferredOrders(s, o) should also not return anything if PurchaseOrder(o) result in an empty match set as well.

A bug report would really be helpful; and if you could at least point us to a metamodel that has such a problematic construct included that would help a great deal of finding the issue in our codebase, as we would not need to create a domain that demonstrates the issue before we could check anything. Looking at the domains I am familiar with I did not find any containment-based feature map usage like this.

Thanks again for the detailed explanation and your willingness to help,
Zoltán
Re: Querying FeatureMap constructs ? [message #1790471 is a reply to message #1790137] Mon, 11 June 2018 12:59 Go to previous messageGo to next message
Eric Lépicier is currently offline Eric LépicierFriend
Messages: 25
Registered: October 2013
Junior Member
Hi Zoltán,

I didn't make explicitly fail the example I gave, I just transposed the problem I got on my own DSL to the public "orders" model in order to provide you with a better explanation.

I'm gonna get it, write the queries and submit a bug report for those not working.
I'm currently working with Viatra Queries 1.5.3 on Neon, I'll let you manage to test on newer versions?

Cheers,
--Eric
Re: Querying FeatureMap constructs ? [message #1790472 is a reply to message #1790471] Mon, 11 June 2018 13:03 Go to previous messageGo to next message
Zoltan Ujhelyi is currently offline Zoltan UjhelyiFriend
Messages: 392
Registered: July 2015
Senior Member
Hi Eric,

having a working example with VIATRA 1.5.3 would be more than helpful. To be honest, I did look for the source code of this "orders" domain, but did not find it. This is the reason I have asked for an available example, but if you could point to the orders metamodel the queries/constraints you have already shared should be enough for us to reproduce the issue.

Thanks again for contacting us,
Zoltán
Re: Querying FeatureMap constructs ? [message #1790514 is a reply to message #1790472] Tue, 12 June 2018 08:47 Go to previous message
Gabor Bergmann is currently offline Gabor BergmannFriend
Messages: 36
Registered: July 2009
Member
Hi Eric,

it would be very helpful if you could provide a public example where VIATRA is failing in the way you described, because the issue seems to be difficult to reproduce.

Specifically, I started from the usual library.xsd example, and wrapped the 'books' and 'writers' containment references into an xsd:choice. Viatra Query seemed to work well (or at least the v2.0 RC that I tried it with, though I do not expect that this functionality was impacted between 1.5 and 2.0).

Just a stray thought: is it perhaps possible that in your orders example, the `preferredOrders` EReference is, mistakenly, not set as containment, and therefore the referred PurchaseOrder object could be out of the EMFScope that was defined for your query engine?

thanks,
Gábor
Previous Topic:Annotation of @Edge can't work
Next Topic:tutorial: creating a ui plugin
Goto Forum:
  


Current Time: Wed Nov 13 07:59:45 GMT 2024

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

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

Back to the top