• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CoreData modeling a mutable attribute set for an entity
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CoreData modeling a mutable attribute set for an entity


  • Subject: Re: CoreData modeling a mutable attribute set for an entity
  • From: Jesse Grosjean <email@hidden>
  • Date: Wed, 11 Jan 2006 14:01:44 -0500

I'm picking up this older thread with a new related question:

	"CoreData modeling a mutable attribute set for an entity"
	http://www.cocoabuilder.com/archive/message/cocoa/2006/1/3/153637

I'm looking for the best way to do AND queries on attributes that are added to my Entry objects. My data model is generic in that it allows users to add their own attributes to my entry objects. I'm now using this basic design:

EntryClass
	extendedAttributes (to many relationship)

ExtendedAttributeClass
	entry (to one relationship)
	name (string)
	type (int)
	stringValue (string)
	numberValue (int/float/double/whatever)
	dateValue (date)
	dataValue (binary)

Each entry has a relationship to a collection of attributes. These attributes have a key field and then a number of value fields, most of which will be empty for any given attributes. So a typical instance of this model would be:

MyEntry1
	attribute key="name" stringValue="John"
	attribute key="age" numberValue=29
MyEntry2
	attribute key="name" stringValue="Jane"
	attribute key="age" numberValue=29

... which represents two entries, each representing a different person. To query this model I run my query on the ExtendedAttributeClass and then iterate over the results following the 'entry' relationship back to find the corresponding EntryClass object. This all seems to be working, but I've run into one last problem. What's the best way to run an AND query on this model? For instance in the above example what query do I run if I want to find the EntryClass who's name="John" AND age=29?

The only solution that I can come up with is to run a separate query for each subpredicate of the AND clause and then do an intersection of all the result sets. Ideally I would like to avoid the multiple queries if possible, is there a better way to run AND queries on this model that I'm not thinking about?

Thanks,
Jesse
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Why are small message being treated as large messages?
  • Next by Date: NSBezierPath bounds and containsPoint, having troubles.
  • Previous by thread: Re: CoreData modeling a mutable attribute set for an entity
  • Next by thread: Persistent ZeroLink
  • Index(es):
    • Date
    • Thread