The above can be modeled as

@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.

--

when small people start casting long shadows, it is time to go to bed

In reply to modeling relationships by punkish

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.