Looking for such patterns might come under the heading of data mining. Why am I not surprised that CPAN has a module in this area? Data::Mining::AssociationRules (no idea on quality I'm afraid). It might pay to look at this module and if it suits your needs, store your data in whatever format it wants natively.

By the way, having xxx1, xxx2 in code or data structures is often a warning sign that you might want to consider some kind of container or list structure. Also, it as useful to put effort into good naming in data models as it is for variables. If something is the answer to a question then it might be better named answer (apologies if I've misunderstood your data structure).

In your XML (and I agree with others that XML is primarily a data transfer language rather than a data storage/querying lanugage) it might be better to have:

<responses> <response id="1"> <answer question="1">I like cheese</answer> <answer question="2">Halloween is scary</answer> ... </response> ... </responses>
Depending on anonymity, you might add other attributes to identify a particular <response>, such as name, date etc.

If you're writing code (or XPATH queries) to examine your original data structure, you'll end up duplicating things to look for all the different tag types.

I bring this up, because most of the same issues apply to data modelling in SQL as well, so its worth thinking about at this stage.


In reply to Re: Research App Optimization by jbert
in thread Research App Optimization by sskohli

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.