how to compare elements belonging to two ResourceSet [message #476649] |
Tue, 20 November 2007 03:30  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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.
>
|
|
|
Powered by
FUDForum. Page generated in 0.04218 seconds