Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Find CrossReferences in ResourceSet including unloaded Resources
Find CrossReferences in ResourceSet including unloaded Resources [message #426118] Tue, 16 December 2008 18:19 Go to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 676
Registered: July 2009
Senior Member
Hi,

I want to use a CrossReferencer to find crossreferences from a given
ResourceSet. Some of the Resources in the ResourceSet may not have been
loaded when I invoke the CrossReferencer. However, I want to also find
CrossReferences from those unloaded resources. Do I need to manually
perform loading prior to invoking the CrossReferencer, or is there an
option that does this automatically?

Thanks,
Felix
Re: Find CrossReferences in ResourceSet including unloaded Resources [message #426120 is a reply to message #426118] Tue, 16 December 2008 21:49 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Felix,

Comments below.

Felix Dorner wrote:
> Hi,
>
> I want to use a CrossReferencer to find crossreferences from a given
> ResourceSet. Some of the Resources in the ResourceSet may not have
> been loaded when I invoke the CrossReferencer. However, I want to also
> find CrossReferences from those unloaded resources. Do I need to manually
> perform loading prior to invoking the CrossReferencer, or is there an
> option that does this automatically?
Just invoke it for the whole resource set and it will iterate over every
resource loaded into the resource set, including those that are loading
during the cross referencing process.
>
> Thanks,
> Felix


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Find CrossReferences in ResourceSet including unloaded Resources [message #426132 is a reply to message #426120] Wed, 17 December 2008 06:54 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 676
Registered: July 2009
Senior Member
> Just invoke it for the whole resource set and it will iterate over every
> resource loaded into the resource set, including those that are loading
> during the cross referencing process.

Let me be more specific. In my ResourceSet I have one Resource A, which
is loaded and many Resources B. Some of the B's are loaded, some not.
Some of the B's contain elements that reference the object I'm
interested in (a), which is in A. Elements in A never reference anything
in a B. And B's never reference elements in other B's. It looks like a
bunch of dwarves (the B's) that point with their finger to one really
big guy (the A).

I now invoke the CrossReferencer like this:

EcoreUtil.UsageCrossreferencer.find(a, ResourceSet) (or so..)

This finds all references to 'a', but only from the B's that were
already loaded before I invoked the operation.

I wanted to know whether there's something better than:

for (Resource r : resourceSet){
if (!r.isLoaded(){
// load it
}
}
EcoreUtil.UsageCrossreferencer.find(a, ResourceSet)

Thanks,
Felix
Re: Find CrossReferences in ResourceSet including unloaded Resources [message #426158 is a reply to message #426132] Wed, 17 December 2008 13:52 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

Hi, Felix,

EMF doesn't maintain any knowledge of the references between resources
after they have been unloaded (or before they are loaded). So, anything
that EMF doesn't already load by proxy resolution, you will have to load
explicitly as you are alroady doing.

There is news from ESE of a new EMF Index project proposal in the works,
which I expect would help with scenarios like yours. The idea is to
maintain an index (like JDT model) of the EMF content of the workspace,
for rapid querying of things like cross-references.

Cheers,

Christian

Felix Dorner wrote:
>
>> Just invoke it for the whole resource set and it will iterate over
>> every resource loaded into the resource set, including those that are
>> loading during the cross referencing process.
>
> Let me be more specific. In my ResourceSet I have one Resource A, which
> is loaded and many Resources B. Some of the B's are loaded, some not.
> Some of the B's contain elements that reference the object I'm
> interested in (a), which is in A. Elements in A never reference anything
> in a B. And B's never reference elements in other B's. It looks like a
> bunch of dwarves (the B's) that point with their finger to one really
> big guy (the A).
>
> I now invoke the CrossReferencer like this:
>
> EcoreUtil.UsageCrossreferencer.find(a, ResourceSet) (or so..)
>
> This finds all references to 'a', but only from the B's that were
> already loaded before I invoked the operation.
>
> I wanted to know whether there's something better than:
>
> for (Resource r : resourceSet){
> if (!r.isLoaded(){
> // load it
> }
> }
> EcoreUtil.UsageCrossreferencer.find(a, ResourceSet)
>
> Thanks,
> Felix
>
Re: Find CrossReferences in ResourceSet including unloaded Resources [message #426164 is a reply to message #426158] Wed, 17 December 2008 14:58 Go to previous message
Felix Dorner is currently offline Felix DornerFriend
Messages: 676
Registered: July 2009
Senior Member
Hi Christian,

> So, anything
> that EMF doesn't already load by proxy resolution, you will have to load
> explicitly as you are alroady doing.

I thought so. Thanks for your help.

Felix
Previous Topic:teneo 1.0.1 and DuplicateMappingException
Next Topic:Duplicate namespace error importing RuleML
Goto Forum:
  


Current Time: Thu Apr 25 11:00:12 GMT 2024

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

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

Back to the top