Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Hawk » How to convert GraphNodeWrapper to EObject
How to convert GraphNodeWrapper to EObject [message #1840908] Wed, 28 April 2021 15:49 Go to next message
jo ber is currently offline jo berFriend
Messages: 94
Registered: August 2018
Member
Hi

Given the following eol query:
Object res = queryEngine.query(indexer, "return Company.all;", null);

How can I convert the GraphNodeWrapper object into EObject. An example would be welcome.

Kind regards,
Re: How to convert GraphNodeWrapper to EObject [message #1840915 is a reply to message #1840908] Wed, 28 April 2021 17:26 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 597
Registered: January 2010
Location: Birmingham, UK
Senior Member

Hi Jo,

The EOLQueryEngine class is EMF-agnostic, as well as GraphNodeWrapper: you cannot directly turn GNWs into EObjects. Instead, you should use .localhawkmodel files to expose a Hawk graph as an EMF resource, if you are using a local Hawk running in the same JVM. If you are accessing a remote model through the Thrift API, you will need to use a .hawkmodel file instead. For details on how to create .localhawkmodel files, check this page:

https://www.eclipse.org/hawk/advanced-use/graph-as-emf/

I can set up an example if you provide more details of your use case. Are you using Hawk from a pure Java program, or from an Eclipse plugin?

Best,
Antonio
Re: How to convert GraphNodeWrapper to EObject [message #1840917 is a reply to message #1840915] Wed, 28 April 2021 19:01 Go to previous message
jo ber is currently offline jo berFriend
Messages: 94
Registered: August 2018
Member
thank you very much!
Your answer put me on track. Looking at the documentation and at the generated '.localhawmodel' helped to figure out how to setup the resource:

		LocalHawkResourceImpl resource = new LocalHawkResourceImpl(URI.createURI("models"), indexer, false, patterns, patterns);
		resource.basicSetResourceSet(rs, null);
		resource.load(Collections.EMPTY_MAP);
Previous Topic:Queries to get deleted elements
Next Topic:How to force hawk to follow package structure
Goto Forum:
  


Current Time: Fri May 24 19:37:48 GMT 2024

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

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

Back to the top