A famous Portuguese Perl hacker, author of the recent Acme::AsciiArt2HtmlTable module and I have been pondering the best way to classify the shapes in Acme::EyeDrops module to make them more amenable to searching and selecting.

You see, he wants, for example, to select from the many shapes available, only the faces of Perl celebrities.

I'm struggling a bit, not having much experience in this field. My first instinct was to look at the web site of a famous British Perl hacker to learn how to search his magnificent photo collection. acme seems to use some sort of keyword search, but when I typed in "perl celebrity" I was told to "Please come back later" in eight different languages.

My next instinct was to steal an idea I remember from Subversion, that of allowing arbitrary "properties" (key-value pairs), aka metadata, to be associated with a file.

And that is what I plan on implementing. That is, to allow any number of arbitrary properties to be associated with a shape. For example:

merlyn: name=Randal L Schwartz face=1 person=1 perlcelebrity=1 smiley: face=1 buffy: face=1 person=1 kermit: face=1 cartoon=1 camel: animal=1
That way, given a shape property hash reference $p, you can find all faces (even smileys and kermit) by testing each shape for:
while if you only wanted human faces you would use instead:
$p->{face} && $p->{person}
and if you wanted only human Perl celebrity faces you would use instead:
$p->{face} && $p->{person} && $p->{perlcelebrity}

It seems to me the idea of attaching arbitrary properties to a file (shape, photo, whatever) is generally useful but I have little experience in this domain and little clue on how to define what the properties or keywords should be.

My current candidate property list for my shapes is:

name Name of the person in the shape cpanid cpanid of the person in the shape description description of the shape author author of the shape (ascii art) authorcpanid cpan id of the author of the shape source photo that the shape was derived from face is it a face? person is it a person? animal is it an animal? flag is it a flag? map is it a map? hbanner is it a horizontal banner? vbanner is it a vertical banner? object is it an object? (a beer bottle, say) planet is it a planet? underwear is it an item of underwear? cartoon is it a cartoon character? perlcelebrity is it a famous perl hacker?
So, if you have some bright ideas on how to tackle this problem, please let us know.

Replies are listed 'Best First'.
Re: Properties, meta data and Perl celebrities
by dorward (Curate) on Jul 29, 2005 at 16:34 UTC

    You might want to look into RDF for the data format, its already being used to describe photographs in various ways (that article might give you some ideas about what information you want to store too).

Re: Properties, meta data and Perl celebrities
by shenme (Priest) on Jul 29, 2005 at 17:11 UTC
    An off-topic aside:

    The output "Please come back later" in the eight different languages is from the Catalyst framework. This is the default output after an application error when not in debug mode. It follows Merlyn's (?) principle that you should not divulge nasty internals to just anyone.

    Anyway, the full text (so Super-Search can find it) is:

    (en) Please come back later
    (de) Bitte versuchen sie es spaeter nocheinmal
    (nl) Gelieve te komen later terug
    (no) Vennligst prov igjen senere
    (fr) Veuillez revenir plus tard
    (es) Vuelto por favor mas adelante
    (pt) Voltado por favor mais tarde
    (it) Ritornato prego pił successivamente
Re: Properties, metadata and Perl celebrities
by simonm (Vicar) on Jul 29, 2005 at 21:51 UTC
    Consider replacing the boolean fields (face, person, etc.) with a single field of space-spearated keywords.

    This is also easy to search (grep { $_->{keywords} =~ /\bface\b/ } @items) and it avoids having an unpredictable set of top-level properties.