Composite Tag

In advance I’m sorry for a somewhat lengthy post, but you touch in on multiple subjects which deserves a little explaining and questions you need to answer before moving forward.

First of all I would like to clear out some terms I’m going to use in this post. With type I mean a unique distinguishable characteristic of your characters, where it has to a single value. This could stuff like being either a male or female character, or if you’re into D&D/fantasy either a human or an orc or an elf or a hobbit or … If you’re one of these, you can’t be another.

I’m also going to talk about traits, in the sense that your character might have any number of these characteristics picked from some random (ever expanding?) list of characteristics. A character could be either of shy, beautiful, cure, smart, badass, and so on… And this can be combined in a multitude of ways.

You also need to consider the aspect of whether your characters are only located to any given book, and as such are only described in that particular book, or whether it would make sense to have dedicated notes on the various characters as they reappear in this or that book series or universe. This might affect how you need to describe your characters.

And finally, in this defining section, you’ve described that you need to differentiate between different characters within a given book and you want to do searches only displaying the matches related to that given character. This will also affect how to write the markdown related to describing them.

Using nested tags

I can’t see way to accomplish all of your goals using just nested tags. You could use nested (or composite) tags to describe the type of your characters, but it’ll become very messy when you start describing the different traits of a character. The best way do traits using tags, would be to have dedicated notes for each character, and consider doing something like: #trait/beautiful and #trait/cunning. That is to use multiple tags for each of that characters traits.

In addition if you limit your character description to be in the current note, you’ll have a hard time separating which traits belong to which character, as in the one tag list you can’t connect some of the tags to just one of the characters.

Finally combining each character into one single tag, which although could an option, would make some seriously ugly tags… Like #SomeFemaleName/mc/human/female/shy/beautiful/cunning/capable And I think it would very fast become a nightmare to do searches related to that…

Dedicated notes for each character

If you use dedicated notes for each character, I think it would be one of the easier ways to quickly do searches across the board. I then imagine having properties like the following for each of them, where the note name is the main name of the character, and you could have aliases in the aliases property if need be:

---
type: mc/human/female
traits:
- shy
- beautiful
- cunning 
- capable
books:
- "[[The Woman]]"
---

This would lend itself rather easily to both ordinary searches, and/or dataview queries if you’re into that.

Containing the description within the note

If you insist on keeping the description within each book note, it would have been nice if we could use multi-level properties, as we then could use properties like:

characters:
- name: SomeFemaleName
  type: mc/human/female
  traits:
  - shy
  - beautiful 
  - cunning 
  - capable
- name: SomeDue
  type: mc/human/male
  traits:
  - ugly
  - big
  - strong

The excerpt above is actually legal as property value, but it’ll collapse them into a composed object so it’ll look like:

And it’s kind of a nightmare to update. But it can be used from dataview and some other plugins if I’m not mistaken… Not quite sure how easy it is to do ordinary searches against this structure, though. To some extent you could stuff like section: (ugly male), but it’ll also match on the female part of the other character.

A list in the current note

Another option, which is still keeping the character descriptions within the same note, but allows for different characters to have different description is to use lists (in the example I show to different approaches which both could be used):

- SomeFemaleName #mc/human/female #shy #cunning #capable
- (name:: SomeDude) is a (type:: mc/human/male), known for being (traits:: "ugly", "big", "strong")

Which could render like this:

Now you could do an ordinary search like: line: (ugly male) to find your guy, and this would not include the female. The two variants could easily be queried through dataview, where the female characters focuses on using tags, and the other on using inline fields (with hiding the field name).

Example note with some queries

If you put the the following text in a note, and switch to either live preview (and move outside the queries with the cursor) or reading mode you’ll see how to do some simple queries:

- SomeFemaleName #mc/human/female #shy #cunning #capable
- (name:: SomeDude) is a (type:: mc/human/male), known for being (traits:: "ugly", "big", "strong")
- (name:: SomeOtherDude) is a (type:: mc/human/male), known for being (traits:: "big", "strong")


### Using tags

```dataview
LIST WITHOUT ID character.text
WHERE file = this.file
FLATTEN file.lists as character
WHERE contains(character.tags, "#shy")
```

### Using inline fields

```dataview
TABLE WITHOUT ID
  character.name, character.type, character.traits, typeof(character.traits)
WHERE file = this.file
FLATTEN file.lists as character
WHERE character.name
  AND contains(character.type, "/male")
  AND contains(character.traits, "ugly")
```

In my test vault this displays as:


So, all in all, it’s possible to note stuff related to multiple characters and their type and traits in various ways, and which way is the best one for you depends on your needs and wants. I tend to favor having dedicated notes for each character, as that would easy linking to the same character if/when they reappear in other books.

And at the same time, as long as the multi-level properties are somewhat finicky and don’t look that good, using lists could be an easy way which is also somewhat visually pleasing and easily queryable.

Hope this answers some of your questions related to using composite tag to describe characters from books. :smiley:

1 Like