Friday, March 30, 2012

Saving Tags on Uploaded Content

Hi.
I am wondering if somebody could give me some advice on saving
tags (such as "art", "picasso", "guernica", "spain", "spanish civil
war", "cubism", for an uploaded image of picasso's Guernica painting).
How do these terms get saved to the database? Do
they live together as single TEXT (or varchar)? Do they get parsed
before insertion? How do they get searched?
I am guessing that much has been said about this topic so, if
you don't feel like getting into it here (although it would be
appreciated), maybe somebody could suggest a well-known resource/
link?
I have come up with a few links after a google search, most
directly:
http://www.pui.ch/phred/archives/2005/04/tags-database-schemas.html
Thanks.
Peter> I am wondering if somebody could give me some advice on saving
> tags (such as "art", "picasso", "guernica", "spain", "spanish civil
> war", "cubism", for an uploaded image of picasso's Guernica painting).
I would make a Tag table, and a tag_image relations table.
If image 1 is uploaded with 2 tags, then the 2 tags are saved in the tag
table, and the image in the image table - and then two rows are inserted in
the tag_image table - indikating that image 1 is relatet to tag 1 and that
image 1 is related to tag 2.
Of course you should tjeck if the given tag already exists in the tag table,
an then reuse that id instead.
table: image
id,
imagedata
table: tag
id,
tagName
table: tag_image
imageId,
tagId
The above should show the idea.
/Sjang|||On Sep 11, 11:23 pm, "Henrik Davidsen" <n...@.none.dk> wrote:
> > I am wondering if somebody could give me some advice on saving
> > tags (such as "art", "picasso", "guernica", "spain", "spanish civil
> > war", "cubism", for an uploaded image of picasso's Guernica painting).
> I would make a Tag table, and a tag_image relations table.
> If image 1 is uploaded with 2 tags, then the 2 tags are saved in the tag
> table, and the image in the image table - and then two rows are inserted in
> the tag_image table - indikating that image 1 is relatet to tag 1 and that
> image 1 is related to tag 2.
> Of course you should tjeck if the given tag already exists in the tag table,
> an then reuse that id instead.
> table: image
> id,
> imagedata
> table: tag
> id,
> tagName
> table: tag_image
> imageId,
> tagId
> The above should show the idea.
> /Sjang
OK, thanks. I was a bit confused because
I read in places that the tag string should be inserted as a whole
which
seems confusing to me. Your suggestion makes perfect sense.
Thanks.

No comments:

Post a Comment