Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » VIATRA » queries on queries in VIATRA(queries on queries in VIATRA)
queries on queries in VIATRA [message #1752926] Mon, 30 January 2017 20:57 Go to next message
Neil Mackenzie is currently offline Neil MackenzieFriend
Messages: 101
Registered: December 2013
Senior Member
Hi,
I am creating a DSL in xtext which can compile to sql queries which use as a source 'table' the results of other SQL queries defined in the DSL (i.e 'views on views' of a source table/dataset). My current target platform is apache spark and spark SQL, but that can change. I would like this to work in an incramental way so that when the source data (e.g. source tables) are updated, the resulting queries (and queries upon those query results) are recalculated in the most efficient way possible . Since VIATRA offers efficient incremental queries (using viatra query language) I was wondering if it is possible to to define viatra queries with the source of those queries being the result of another VIATRA query.
I realise this is a pretty big and complex topic, and its hard to describe my use case concisely, but if anyone has any quick pointers to previous work or advice then any hints at all would be very welcome.
Thanks,
Neil
Re: queries on queries in VIATRA [message #1752948 is a reply to message #1752926] Tue, 31 January 2017 08:19 Go to previous messageGo to next message
Zoltan Ujhelyi is currently offline Zoltan UjhelyiFriend
Messages: 335
Registered: July 2015
Senior Member
Hi Neil,

I hope I have understood your question correctly. If not, or the answer is not clear, feel free to ask for clarification.

If you are asking for how the language supports queries whose result set depends on other queries result sets, the query language provides support for that, similar to subqueries in SQL: you can write a pattern that describes the subquery, and then you can use the three kinds of 'find' constructs for composing the final result:: (1) positive pattern call constraints ('find'), (2) negative pattern call constraints ('neg find') and (3) aggregator values (such as 'count find' or 'sum find'). All these language elements take the match set of another pattern, and allow to write additional constraints to extend or limit the result set accordingly. Alternatively, you can think of this approach as a query defining a named database view that you can refer to from other queries. In such cases, the incremental engine of VIATRA manages the propagation of changes between the different patterns automatically.

Hope that helps,
Zoltán
Re: queries on queries in VIATRA [message #1752970 is a reply to message #1752948] Tue, 31 January 2017 12:55 Go to previous messageGo to next message
Neil Mackenzie is currently offline Neil MackenzieFriend
Messages: 101
Registered: December 2013
Senior Member
Hi Zoltan,

thanks for your reply, that is very helpful. To quote your message " you can think of this approach as a query defining a named database view that you can refer to from other queries" that is exactly what I want. I will try playing with a few more examples to get a better understanding.
Regards, Neil
Re: queries on queries in VIATRA [message #1752977 is a reply to message #1752970] Tue, 31 January 2017 14:15 Go to previous message
Zoltan Ujhelyi is currently offline Zoltan UjhelyiFriend
Messages: 335
Registered: July 2015
Senior Member
Hi Neil,

you may have a look at the 'badHost' and 'goodEntity' patterns in our tutorial at http://static.incquerylabs.com/projects/viatra/viatra-docs/ViatraDocs.html#_pattern_language - they use both positive and negative pattern composition for relatively simple cases.

Best regards,
Zoltán
Previous Topic:xcore and vaitra
Next Topic:vaitra queries visualised using Sirius
Goto Forum:
  


Current Time: Fri Nov 17 17:51:05 GMT 2017

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

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