Predicate matching for entire to-many relationship
Predicate matching for entire to-many relationship
- Subject: Predicate matching for entire to-many relationship
- From: Bryan Henry <email@hidden>
- Date: Thu, 24 Sep 2009 15:05:22 -0400
Hey list -
I'm trying to determine what the best approach for writing a Core Data
fetch predicate to match objects with a specific set for a to-many
relationship is, so I'd appreciate some guidance.
A portion of my Core Data model looks like so --> http://is.gd/3Dyp4
I am attempting to fetch all Type objects with a coreExponents
relationship that equals a specific comparison set of Exponents. This
comparison set is essentially just an NSDictionary with integer keys
corresponding to the "coreType.index" key path of the Exponent entity,
and integer values corresponding to the "magnitude" key path of the
Exponent entity. This NSDictionary could be turned into an NSSet of
Exponent objects (that would not be tied to a context and would not be
saved to a store, of course) if necessary for the predicate comparison.
For example, if I have a type with a coreExponents relationship that
looks like so:
coreExponents = {(
{ coreType.index = 0, magnitude = 2 },
{ coreType.index = 1, magnitude = -1 },
{ coreType.index = 4, magnitude = 1 }
)}
And I want to fetch that Type object based on a dictionary structured
as such (of course the pairs are unordered in reality):
{
0 = 2,
1 = -1,
4 = 1
}
What would be the best approach to take for designing my
NSFetchRequest's predicate?
Thanks!
- Bryan
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden