it sounds like what you are describing would need 3 additional tables
in addition to the plants table.
plant

characteristic

provides join
needs join

plant has many provides_characteristics and many provides through
provides characteristics
plant has many needs characteristics and many needs through needs
characteristics

then you can start looking at a characteristic and seeing what plants
have and need it relatively easily.  otherwise, you can add a flag on
a single join table that tells whether it's a provides or a needs... I
think the 4 table approach though will be easier to write views and
such for as there is a clear functional division between the provides
and needs relationships, even if the data difference is negligible.

On Jun 1, 2:40 pm, Ronbo <[email protected]> wrote:
> Hello,
>
> I have a beginner's question about modeling. The application I am
> working on is a plant database. One of the critical features is that
> it make it easy to represent symbiotic relationships (like the 3
> sisters in Mexico, squash, beans and corn), and to discover potential
> new relationships.
>
> So I have a plant model with some core characteristics describing a
> species. I would like to be able to assign certain attributes by which
> a plant has relationships with other species, such as:
>
> shade
> fixes_nitrogen
> scaffolding (corn provides a scaffold for beans to climb)
> Micronutrients
> etc.
>
> These would be another table.
> So far, easy.
>
> Plants can have one of two types of relationships with these
> characteristics. Either 'need' or 'provide'. So a plant could provide
> shade and need scaffolding, while another needs shade and provides
> scaffolding...
>
> Question: can this be represented with just two tables, and if so, how
> to go about it, or do I need to duplicate these characteristics in
> 'needs' and 'provides' tables? From the little I know about
> polymorphic associations, this seems different.
>
> Many thanks

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to