i just got through with the gemstone tutorial (http://seaside.gemstone.com/tutorial.html ).. a really great tutorial on some of the facets of seaside.. one question i do have is: if i have some objects like: artist album fan where an artist has many fans an album belongs to an artist an artist can have many fans a fan can have many artists how do i articulate those relationships? how would i articulate something like.. give me a list of all fans of a specified artist.. give me all albums from this artist.. thanks! ___________ sergio t. ruiz network analyst red red design 419.281.8483 _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Hi Sergio,
just relate the objects in instance variables. In collections when N and one when one :) In a second phase you make convenience methods so they talk each other so they answer what you need. Only if the ammount of data is big then you may need to do something else cheers sebastian > -----Mensaje original----- > De: [hidden email] > [mailto:[hidden email]] En nombre > de sergio_101 > Enviado el: Thursday, May 14, 2009 09:50 > Para: Seaside - general discussion > Asunto: [Seaside] generating relationships > > > i just got through with the gemstone tutorial > (http://seaside.gemstone.com/tutorial.html > ).. a really great tutorial on some of the facets of seaside.. > > one question i do have is: > > if i have some objects like: > > artist > album > fan > > where an artist has many fans > an album belongs to an artist > an artist can have many fans > a fan can have many artists > > how do i articulate those relationships? > > how would i articulate something like.. > > give me a list of all fans of a specified artist.. > give me all albums from this artist.. > > thanks! > > ___________ > sergio t. ruiz > network analyst > red red design > 419.281.8483 > > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
>
> just relate the objects in instance variables. In collections when N > and one > when one :) so, in albums, i would have something like artistID? > > In a second phase you make convenience methods so they talk each > other so they > answer what you need. is there something like the rails 'find' function build in? so i could do something like.. Album.find(albumID).artist thanks! > ___________ sergio t. ruiz network analyst red red design 419.281.8483 _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
2009/5/14 sergio_101 <[hidden email]>:
>> >> just relate the objects in instance variables. In collections when N and >> one >> when one :) > > so, in albums, i would have something like artistID? No, you would have an artist. GemStone is an OODBMS not and RDBMS, you don't fiddle around with ids, you have objects. Cheers Philippe _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
On May 14, 2009, at 10:10 AM, Philippe Marschall wrote: > No, you would have an artist. GemStone is an OODBMS not and RDBMS, you > don't fiddle around with ids, you have objects. i need to mess with gemstone a bit.. i made it up to the under the hood section.. i need to check out the pricing and licensing for gemstone before i start incorporating it into a project.. i have just used the squeak parts of the system.. ___________ sergio t. ruiz network analyst red red design 419.281.8483 _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by sergio_101-2
On 14/05/2009 11:58 PM +10:00, sergio_101 wrote:
>> >> just relate the objects in instance variables. In collections when N >> and one >> when one :) > > so, in albums, i would have something like artistID? More likely you'd have an artist with a collection of albums and a collection of fans. Forget ids in an OODBMS reference the actual object. > > is there something like the rails 'find' function build in? so i could > do something like.. > Album.find(albumID).artist You need to decide what is/are your root object/s. Use global to hold the collection of root objects. You find stuff by doing detect/select etc on that collection. HTH Steve _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by sergio_101-2
>>>>> "sergio" == sergio 101 <[hidden email]> writes:
sergio> i need to check out the pricing and licensing for gemstone before i start sergio> incorporating it into a project.. It's free until you start needing more than a dozen dynamic pages a second (roughly). After that, it's still the best deal in town, since you'll never have to worry about an ORM no matter how big you scale. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[hidden email]> <URL:http://www.stonehenge.com/merlyn/> Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by sergio_101-2
> so, in albums, i would have something like artistID?
> nothing will stop you but is unfriendly given you can make the album to hold the artist object itself. > is there something like the rails 'find' function build in? > so i could > do something like.. > > Album.find(albumID).artist > to a certain point, yes. You have to query the collection, ala smalltalk in this case. For instance: u2Albums := store albums select:[:album| album artist name = 'U2'] I'm asuming that store hols a collection of albums and album holds an artist which answers a name cheers sebastian > thanks! > > > > > > ___________ > sergio t. ruiz > network analyst > red red design > 419.281.8483 > > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by sergio_101-2
On May 14, 2009, at 9:58 AM, sergio_101 wrote: >> >> just relate the objects in instance variables. In collections when >> N and one >> when one :) > > so, in albums, i would have something like artistID? > >> >> In a second phase you make convenience methods so they talk each >> other so they >> answer what you need. > > is there something like the rails 'find' function build in? so i > could do something like.. > > Album.find(albumID).artist > you dont need a find. create your domain objects so that artist is an instance variable of album when you have the album, just send it an artist message or perhaps isBy or whatever artist := album artist or artist := album isBy in your case, you dont ever need an id. you have Artist, Album, Songs if you want to find all albums by an artist, you could either have a persistent collection of artists that you go through, find the artist you are interested in and do something like: albums := artist albums or you could just maintain a persistent collection of albums and go through those, asking each who it was by. the options are pretty wide open, if you are using gemstone and have a ton of data, they provide special methods to make querying faster than iterating over a collection, but in the beginning, iterating over a collection would be your first step. ( iterating is a bad choice of words but you get the idea ). _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by sergio_101-2
On May 14, 2009, at 10:17 AM, sergio_101 wrote: > i need to check out the pricing and licensing for gemstone before i > start incorporating it into a project.. pricing is here: http://seaside.gemstone.com/docs/GLASS-Announcement.htm _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by SeanTAllen
I suspect that as you work on the application you'll run up against issues like Albums that have more than one Artist. You'd probably handle that by naming the instance variable on your Album class as artists rather than artist and have it hold a collection. Many, if not most, albums would just have a single Artist element in that collection but you'd be able to accommodate more when needed.
In fact, you might even want to go down to the Track level before you assign an instance variable to hold the artist(s). The Album, which would no longer have an artist(s) instance variable would have a tracks instance variable to hold all of its Track instances and the Track class would have an artists instance variable to hold the appropriate Artist instance(s) associated to that Track. In that case, one way to get the artists on a particular Album would be to implement a convenience method that iterates over all of it's tracks, collecting each Track's artists into a Set to remove the duplicates (most tracks on a given Album would usually - but not always - have the same artists). As noted by others in this email chain, all of these relationships are controlled by the instance variables without the need to resort to dedicated key fields. On Thu, May 14, 2009 at 4:33 PM, Sean Allen <[hidden email]> wrote:
_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |