On Nov 30, 2009, at 14:56, Yi Lin wrote:

> Let's say I have the entity mapping "DiagramToDiagram". And one of the 
> property mappings is "shape". In the Relationship Mapping panel (the third 
> column in the mapping model GUI), I set the KeyPath to "$source.shape". The 
> question is what to put in the Mapping Name field. If I put ShapeToShape, 
> then the shape property will not be set because there are no instances of 
> Shape. If I put TriangleToTriangle, then only shapes that are Triangles will 
> be migrated. There is no value I can put in this field that will set the 
> "shape" property properly for all concrete subclasses of Shape.

I believe "ShapeToShape" *is* the correct mapping. Are you saying it doesn't 
work, or just that you don't think it will work?

My earlier point is that there *are* instances of entity "Shape" -- in the 
sense that there are instances that are a kind of Shape, even though their 
actual class might be Triangle or Square. This is analogous to the difference 
between the 'isKindOfClass:' and 'isMemberOfClass:' methods in Cocoa, and the 
mapping uses a "kind of" test, not a "member of" test.

I have been successful with just such a mapping in the past. I had a tree 
structure, so the abstract Node entity had "parent" and "children" 
relationships. Using a NodeToNode mapping migrated the "children" relationship 
properly, even the the children were actually of subentities of Node.

Note that using NodeToNode did *not* mean that the objects were changed to 
entity Node on migration. They stayed as whatever they were supposed to be.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to