I am working on a node based web management system where each node is comprised entirely of meta data (no set parameters are required per node. I have two tables, one to hold each nodes (id) to link meta data to it, and for inheritance reasons. Then I have the meta data table which holds (nodeid, meta data name, meta data). So for each node there are several nodes in the meta data table containing the name of the data "color" and the data itself. So the table might be something like

Nodes
id
1
2
3

Meta Data
NodeID   Name    Value
1        color   red
1        name    george
2        color   green
2        size    5
3        name    fred
3        title   test

Now my problem/question is how to query this data for mutiple meta attributes. Like how to find all nodes who's 'color' attribute = 'green'. Obviously standard queries wont work because the data is spread threwout multiple records.

I have only realy come up with one option, Loading the nodes data into a hash and then looping threw the hash finding all nodes that match the criteria...This is kind of a bad solution if you have very many nodes at all.

So i am hoping that somewhere here might have a brilliant idea about how to query the data, or even some way maybe using temperary tables.

Any and all help/thoughts/opinions are welcome.

___________
Eric Hodges

In reply to Querying Meta Data by eric256

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.