Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » VIATRA » ViatraQuery - API Headless(Generic API without generating code)
ViatraQuery - API Headless [message #1816856] Fri, 08 November 2019 14:40 Go to next message
Julian Barthel is currently offline Julian BarthelFriend
Messages: 6
Registered: November 2019
Location: Germany
Junior Member
Hi,

for a project I want to transfer patterns from another (meta)modelling tool in Viatra to get matches from it. Instead of translate these patterns in your specific .vql-File and then to use the generated code to get matches back, I want to ask if there is another way to do it? Maybe something like a headless mode without generating Java code?

I searched a little bit the forum and found something similar (https://www.eclipse.org/forums/index.php/m/1760314/?srch=headless#msg_1760314), where someone tried to use the generic API to use his patterns without generating code. One answer was that there is an headless example (http://git.eclipse.org/c/viatra/org.eclipse.viatra.examples.git/tree/query/headless), but since the post is more than two years old I was wondering if this is still up to date or even fits to my problem.


Regards,

Julian
Re: ViatraQuery - API Headless [message #1817098 is a reply to message #1816856] Fri, 15 November 2019 14:14 Go to previous messageGo to next message
Abel Hegedus is currently offline Abel HegedusFriend
Messages: 194
Registered: September 2015
Senior Member
HI,

there is a section in the documentation that provides up-to-date example code for parsing VQL textual definition and retrieve query specification objects to get matches: https://www.eclipse.org/viatra/documentation/query-api.html

Let us know if you need further details.
Re: ViatraQuery - API Headless [message #1817122 is a reply to message #1817098] Fri, 15 November 2019 17:19 Go to previous messageGo to next message
Zoltan Ujhelyi is currently offline Zoltan UjhelyiFriend
Messages: 379
Registered: July 2015
Senior Member
Hi Julian,

in addition to the entry Ábel mentioned, we are working on a PatternParser API that should make it easier to parse and process queries. Sadly, we have not yet provided documentation for the feature, but we have an example code using it to parse query specifications stored in MagicDraw UML models [1].

Some documentation is planned in the future, but in the meantime, feel free to ask about it if it is unclear.

Best regards,
Zoltán

[1] https://github.com/IncQueryLabs/MD_plugin_skeleton/blob/master/com.incquerylabs.magicdraw.plugin.example/src/main/java/com/incquerylabs/magicdraw/plugin/example/codegen/CodegenPatternLoader.java#L63
Re: ViatraQuery - API Headless [message #1818454 is a reply to message #1817122] Mon, 16 December 2019 15:17 Go to previous messageGo to next message
Julian Barthel is currently offline Julian BarthelFriend
Messages: 6
Registered: November 2019
Location: Germany
Junior Member
First of all thank you very much for your reply,

i looked up the code from the MagicDraw UML Models you provided. How i understood it, is that you need a VQL-File to get it working. The problem is i decided to get the step with generating Java Code from Viatra but i dont want to build a VQL-File , so i know want to ask if it is possible in Viatra to manually trigger the Java code-generation (which normally the runtime API does out of a VQL-File) only with specific objects from org.eclipse.viatra.query.patternlanguage.emf.vql (like Pattern, PatternBody, Annotations ...) ? If this is the case a little example like the MagicDraw UML Models would be very helpful for me.

Best regards,
Julian
Re: ViatraQuery - API Headless [message #1818490 is a reply to message #1818454] Tue, 17 December 2019 10:54 Go to previous messageGo to next message
Zoltan Ujhelyi is currently offline Zoltan UjhelyiFriend
Messages: 379
Registered: July 2015
Senior Member
Hi Julian,

it seems I have already created an example, only it was not included yet into the documentation about the PatternParser API: https://git.eclipse.org/c/viatra/org.eclipse.viatra.git/tree/documentation/org.eclipse.viatra.documentation.example/src/org/eclipse/viatra/documentation/example/ViatraQueryHeadless.java#n78

The idea is that you can provide your query definitions as a String and create pattern matchers from them that can be processed without relying at the code generator infrastructure in general. Can you check whether the linked example describes what you want to achieve?

Best regards,
Zoltán
Re: ViatraQuery - API Headless [message #1818559 is a reply to message #1818490] Thu, 19 December 2019 15:19 Go to previous message
Julian Barthel is currently offline Julian BarthelFriend
Messages: 6
Registered: November 2019
Location: Germany
Junior Member
Hi Zoltán,

thank you for your fast reply. Your code example helped me a lot and make thinks much easier for me. I can now continue with my project .
I wish you and the Vitra Team happy holidays.

Best regards,
Julian
Previous Topic:How to add dependencies to vql files
Next Topic:Small Tutorial Bug: HostInstance with empty IP address
Goto Forum:
  


Current Time: Fri Nov 27 14:03:51 GMT 2020

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

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

Back to the top