@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.
In reply to modeling relationships by punkish
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |