punkish has asked for the wisdom of the Perl Monks concerning the following question:
@arr = ( {person => 'PersonA', place => 'PlaceA',} {person => 'PersonB', place => 'PlaceB',} );
which can be stored in
CREATE TABLE tbl ( person, org )
Moving on, PersonC works for PersonA. Yes, I could simply do a push @arr, {person => 'PersonC', place => 'PlaceA'}, but I really want to do
@arr = ( { person => 'PersonA', place => 'PlaceA', has_assistant => 'PersonC', } { person => 'PersonB', place => 'PlaceB', has_assistant => 'PersonC', } { person => 'PersonC', place => 'PlaceA', works_for => 'PersonA', } );
or, I can de-sparse it (but, do I have to?) as
@arr = ( { person => 'PersonA', place => 'PlaceA', works_for => '', has_assistant => 'PersonC', } { person => 'PersonB', place => 'PlaceB', works_for => '', has_assistant => 'PersonC', } { person => 'PersonC', place => 'PlaceA', works_for => 'PersonA', has_assistant => '', } );
which can be stored in
CREATE TABLE tbl ( person, org, works_for, has_assistant )
The complexity is likely to grow. We might want a 'works_with' relationship (sibling rather than sub-ordinate). There might be other predicates we might want to include later.
Ok, what are the better ways to model something like this? Linked lists? How? This screams of linked lists (implemented in hashes, no?), or RDF Triples. And, I want to store this nonsense, and I want to extract it from the store and display it as a network digraph, probably through Java, or better yet, via Processing http://www.processing.org in Java, or even Flash. Since there are several attributes about each node, a standard rdbms (SQLite for prototyping, then PostGres for production) would be the preferred store, unless there is a better format. All ideas welcome as this is still in the design phase.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: modeling relationships
by fmerges (Chaplain) on Feb 07, 2007 at 15:39 UTC | |
|
Re: modeling relationships
by fenLisesi (Priest) on Feb 07, 2007 at 15:50 UTC | |
|
Re: modeling relationships
by klekker (Pilgrim) on Feb 07, 2007 at 16:05 UTC | |
|
Re: modeling relationships
by talexb (Chancellor) on Feb 07, 2007 at 18:18 UTC | |
by punkish (Priest) on Feb 07, 2007 at 20:39 UTC | |
|
Re: modeling relationships
by b10m (Vicar) on Feb 07, 2007 at 16:21 UTC | |
by punkish (Priest) on Feb 07, 2007 at 16:28 UTC | |
|
Re: modeling relationships
by NetWallah (Canon) on Feb 07, 2007 at 18:13 UTC | |
|
Re: modeling relationships
by dragonchild (Archbishop) on Feb 09, 2007 at 01:40 UTC | |
|
Re: modeling relationships
by planetscape (Chancellor) on Feb 09, 2007 at 03:24 UTC | |
|
Re: modeling relationships
by pajout (Curate) on Feb 08, 2007 at 11:14 UTC |