|
Re: [EMF Query]Query on multiple models. [message #430744 is a reply to message #430731] |
Sun, 07 June 2009 12:54 |
Ed Merks Messages: 33141 Registered: July 2009 |
Senior Member |
|
|
Bastien,
Yes, EMF will generally use == when dealing with EObjects, especially
given that clients are advised not to override hashCode or equals on
their EObject implementations.
bastien wrote:
> Hello,
>
> I try to compose a query on two models, I want to know which elements
> of a model A (sourceModelElement) are in a second model B (trace).
> This second model just references A elements.
>
> This is the query :
> SELECT statement = new SELECT(
> new FROM(sourceModelElement),
> new WHERE(new IN(trace.getAllSources())));
>
> This request returns an empty set, though it shouldn't.
> For exemple, both contain this element (this is the sysout output):
> in sourceModelElement :
> org.eclipse.emf.ecore.impl.EClassImpl@153c375 (name: B) ...
> in trace :
> org.eclipse.emf.ecore.impl.EClassImpl@12a55aa (name: B) ...
>
> They are not the same "memory address", but EcoreUtil.equals() return
> true with this two objects.
>
> Maybe the IN operator use a reference equality instead of a "structure
> and value" equality.
>
> Have you any idea to deal with this issue ?
> Thanks !
>
> Bastien.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02506 seconds