Skip to main content



      Home
Home » Modeling » UML2 » how to compare elements belonging to two ResourceSet
how to compare elements belonging to two ResourceSet [message #476649] Tue, 20 November 2007 03:30 Go to next message
Eclipse UserFriend
Originally posted by: firstname.name.gmail.com

Hello,

I have two models loaded from the same uri (a UML file) with two different
ResourceSet.

How may I "compare" model elements of these two models. I mean, as model elements
belong to two distinct resources, I can't use the equal operator.

Element aElement; // (resource is A from ResourceSet RA)
Element bElement; // (resource is B from ResourceSet RB)

// I would like to do
if (aElement == bElement)


thanks.

--
F. Lagarde
Re: how to compare elements belonging to two ResourceSet [message #476650 is a reply to message #476649] Tue, 20 November 2007 07:40 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, François,

Equivalent instances in two resource sets should have the same URI.

So, try:

EcoreUtil.getURI(aElement).equals(EcoreUtil.getURI(bElement) )

Of course, elements only have URIs if they are actually in resources, but I
assume that's already the case. Also, you may need to normalize the URIs
before comparing them if your resource sets have different URI mappings.

HTH,

Christian


François Lagarde wrote:

> Hello,
>
> I have two models loaded from the same uri (a UML file) with two different
> ResourceSet.
>
> How may I "compare" model elements of these two models. I mean, as model
> elements belong to two distinct resources, I can't use the equal operator.
>
> Element aElement; // (resource is A from ResourceSet RA)
> Element bElement; // (resource is B from ResourceSet RB)
>
> // I would like to do
> if (aElement == bElement)
>
>
> thanks.
>
Re: how to compare elements belonging to two ResourceSet [message #625550 is a reply to message #476649] Tue, 20 November 2007 07:40 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, François,

Equivalent instances in two resource sets should have the same URI.

So, try:

EcoreUtil.getURI(aElement).equals(EcoreUtil.getURI(bElement) )

Of course, elements only have URIs if they are actually in resources, but I
assume that's already the case. Also, you may need to normalize the URIs
before comparing them if your resource sets have different URI mappings.

HTH,

Christian


François Lagarde wrote:

> Hello,
>
> I have two models loaded from the same uri (a UML file) with two different
> ResourceSet.
>
> How may I "compare" model elements of these two models. I mean, as model
> elements belong to two distinct resources, I can't use the equal operator.
>
> Element aElement; // (resource is A from ResourceSet RA)
> Element bElement; // (resource is B from ResourceSet RB)
>
> // I would like to do
> if (aElement == bElement)
>
>
> thanks.
>
Previous Topic:how to compare elements belonging to two ResourceSet
Next Topic:uml2ecore, ecore attributes marked as volatile
Goto Forum:
  


Current Time: Sat Aug 30 21:51:59 EDT 2025

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

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

Back to the top