by kortex · 4y ago · 0 comments
Tags are just dumb strings which label data. They are basically KeyValues, where the value is just always equal to True. We don't think of KVs as hierarchical unless they are explicitly a path string, and in that case, they are forced to be a plain tree with no cycles or diamonds.
Tags are just dumb strings that label data, but tags are also data. If I can't label tag:"red" a tag:"colored" in your system, it's not great. It's not much better if I'm labeling things tag:"colored-red" because if I'm doing that and there's no central validation to add semantics to that relationship, I'm going to end up with tag:"red" things, tag:"colored" things, tag:"colored-red" things, and probably even tag:"color-red" and tag:"red-color" things.
edit: what's so bad about cycles when it comes to a tag being assigned another tag that has been assigned the original tag? It's just a mutual implication. There's nothing wrong to me with adding a single tag and seeing five more added automatically. It means that you're building a knowledge base.
That's precisely the problem. You started with tags and now you are building a knowledge base. You wanted a banana and now you have a gorilla holding a banana and the whole jungle. If you want to build a knowledge base, use links/URIs/ontologies.
You'll find out the moment you add cycles the algorithms get way more intense. And then once you have stronger algos, you want more search power. Next thing you know you are bikeshedding about things like "apple" is both "fruit" and "tech company" so you need tags-of-tags etc. Just build a knowledge base if you need a knowledge base. Otherwise tags are just a way to do faceted search.
They aren't mutually exclusive, either.
OpenTelemetry, for example, has both tags and references.
Many years ago I've developed a proprietary database for a media related product. It was a NoSQL Entity-Attribute-Value database where Attribute was basically a tag. Tags had no hierarchy but query language allowed to specify sequence of attributes like Genre, Artist, Album, Title. When said sequence was not empty the result set would be a tree where each level would correspond to an attribute position as defined in query.
Sometimes you know that users are going to tag `laptop` a bunch and want that to also drag in `personal computer` (but not all `PC`s are `laptop`s) or that `blue dress` is also a `dress` and don't want to hard code special cases.
That said, if you are going to do this, then you must have it controlled by an admin/moderator. Maybe allow for hierarchy request submissions but have it moderated. There is at least one public system where this just works to my knowledge and a bunch of self-hosted ones as well.
That would be a set of values :-)