How can I monitor my application using EMF and VIATRA query language? [message #1849830] |
Thu, 03 February 2022 12:07  |
Eclipse User |
|
|
|
Hello dears,
I am new to VIATRA and modeling.
I want to implement a runtime model but I am confused. Actually I have a website and I want to monitor it using VIATRA Query.
I know how to create my model in EMF and how to generate related code. I know how to load model to .vql file and write query.
How can I monitor my model using EMF Model and VIATRA? I mean what is the steps? First I have to use my EMF Model API to create my runtime model and initialize it using my website information and then use generated VIATRA Query API to query to my model?
Please guide me :)
Thanks.
|
|
|
|
|
|
|
Re: How can I monitor my application using EMF and VIATRA query language? [message #1849891 is a reply to message #1849886] |
Mon, 07 February 2022 12:07   |
Eclipse User |
|
|
|
Hi,
looking at your code, the answer is that instead of loading the model from a resource, you could do something as follows (I did not compile it, so there might be slight issues):
ResourceSet rs = new ResourceSetImpl();
Resource resource = rs.createResource(URI.createURI("uri name")); // as long as you are not planning to save the model, it is not important what the URI is
MainPage main = ...; // Use the code you have already created
...
resource.getContents().add(main); // If I have read your metamodel correctly, this should be enough as all other model elements are reachable with containment references starting from main; if not, add them as well
After that point, the created ResourceSet can be used as the model scope for the query engine.
Best regards,
Zoltán
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.59566 seconds