Skip to main content



      Home
Home » Modeling » EMF » Dependency graph between resources in a resourceSet
Dependency graph between resources in a resourceSet [message #1828690] Tue, 16 June 2020 11:46 Go to next message
Eclipse UserFriend
Hi,
In my ResourceA I have object that references an object in the resource B inside may resourceSet.

So my ResourceA depends of ResourceB.
Do you know if exist a method or a simple process to find directly between dependencies between resources?

Thanks for your response.
Re: Dependency graph between resources in a resourceSet [message #1828691 is a reply to message #1828690] Tue, 16 June 2020 11:53 Go to previous messageGo to next message
Eclipse UserFriend
Hi, Patrick,

GMF provides the CrossReferenceAdapter API for this purpose. Its getImports(Resource) and getExports(Resource) APIs could serve your need.

HTH,
Christian
Re: Dependency graph between resources in a resourceSet [message #1828693 is a reply to message #1828691] Tue, 16 June 2020 12:14 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Christian ;D
Re: Dependency graph between resources in a resourceSet [message #1828725 is a reply to message #1828693] Wed, 17 June 2020 11:58 Go to previous messageGo to next message
Eclipse UserFriend
This class could be inside EMF, because it is very useful. It is sad to that a project depends of GMF only to have this utilitary class to manipulate EMF, is'nt it?
Re: Dependency graph between resources in a resourceSet [message #1828745 is a reply to message #1828725] Thu, 18 June 2020 00:54 Go to previous messageGo to next message
Eclipse UserFriend
HI

There are a variety of cross-referencets inside EcoreUtil; almost too many to choose from. Once you have used EMF for a bit you should study EcoreUtil; there are a lot of useful things there.

Refards

Ed Willink
Re: Dependency graph between resources in a resourceSet [message #1832022 is a reply to message #1828745] Sat, 05 September 2020 17:42 Go to previous messageGo to next message
Eclipse UserFriend
Ed, I'd challenge you to name just one method in EcoreUtil that can produce a topological sort (by dependency) of a ResourceSet or a collection of Resources ;-)

I'm struggling with a similar problem as Patrick, and I'm close to just writing my one implementation based on JGraphT and org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil (which uses the CrossReferenceAdapter suggested by Christian).

Coming up with a linear sorting of Resources by order of dependency seems just such a fundamental thing, and I have a hard time believing that this functionality is not already implemented somewhere in EMF (but then again, I've been looking for a while now, and I could not find any suitable methods).

Can anyone suggest a specific method in EMF that takes a ResourceSet or collection of Resources and returns an iterator or collection of the Resources that is sorted by dependency?
Re: Dependency graph between resources in a resourceSet [message #1832023 is a reply to message #1832022] Sun, 06 September 2020 01:42 Go to previous messageGo to next message
Eclipse UserFriend
Given that resource dependencies can be circular in general, I assert that such a thing cannot be implemented in general.
Re: Dependency graph between resources in a resourceSet [message #1832150 is a reply to message #1832023] Thu, 10 September 2020 04:26 Go to previous message
Eclipse UserFriend
Hi

I think the challenge was to Ed W rather than Ed M.

Graph algorithms are a huge area for which it would be impossible and very undesirable to include every possible algorithm in EMF.

Your challenge doesn't define what you mean by dependency, so it is hard to answer.

Ed M has sensibly answered for a Resource-to-Resource dependency.

In my code I am often concerned with Type-Use-to-Type-Declaration dependency and providing forward declarations to avoid forward references. This is often requires type declarations to be intermingled Resource-wise. Templated operations can make life quite complex.

If you are able to produce generally useful routines, publicising them on this forum may be useful. If you can step back or or get a colleague to give an objective assessment of the utility, it may be worth raising a Bugzilla.

After 20 years of usage, it could make a very interesting research project to mine EMF clients for general purpose routines that could be considered for promotion to EcoreUtil. But that requires not just the time and familiarity to do the mining, but also the time and skill to rationalize each candidate into a uniform general purpose style suitable for EMF. Almost every candidate will be at least to some extent dependent on the design policies of the EMF client which often exclude the generality of EMF. Many other candidates may be useful with the derived type system of the client, but become a troublesome once templated into a 're-usable' form. Just take a look at the 10-long template parameters in org.eclipse.ocl that supported use in conjunction with both Ecore and UML metamodels. Sometimes more re-usable means less useable, so a library of code for clone and edit is often the best re-use.

Regards

Ed Willink
Previous Topic:Avoid generated editor code in Xcore
Next Topic:Downsides to bi-directional references?
Goto Forum:
  


Current Time: Wed Sep 10 19:38:57 EDT 2025

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

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

Back to the top