Hello, I'm writing a replacement for del.icio.us on GAE, and am really
struggling with what the right way to do the User / URL / Tag
relationship:

Here's what I'm referencing for my idea:

http://code.google.com/appengine/articles/modeling.html

My thought is to have three Entity's:

User
URL
Tag

Then use a relationship model for the inter-relationships:

class UserURLTags(db.Model):
   userURLs = db.ReferenceProperty(User,
                                  required=True,
                                  collection_name='urls')
   userTags = db.ReferenceProperty(User,
                                  required=True,
                                  collection_name='tags')
   urlUsers = db.ReferenceProperty(URL,
                                  required=True,
                                  collection_name='users')
   urlTags = db.ReferenceProperty(URL,
                                  required=True,
                                  collection_name='tags')
   tagUsers = db.ReferenceProperty(Tag,
                                  required=True,
                                  collection_name='users')
   tagURLs = db.ReferenceProperty(Tag,
                                  required=True,
                                  collection_name='urls')


The idea behind this is to allow lookups for each of the following:

User's URLs (get all of user xyz's URLs)
User's Tags

URL's Tags (get all of the tags for URL 'abc')
URL's Users

Tag's URLs (get all of the URLs tagged with 'efg')
Tag's Users

Is this just a terrible mis-understanding of the proper way of doing
this association?

Thanks in advance!

-Ben

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to