Need a listing of "same" tags

If I have tags:

TagA, TagB, TagC, TagD

and tiddlers Tiddler1 with tags TagA, TagB and TagD
Tiddler2 with tags TagA and TagC
Tiddler3 with tags TagC and TagD

I would like to see a list of all tiddlers in my wiki that have two or more same tags.

In the above example I want to see a listing that says Tiddler1 and Tiddler 2 have TagA in common, Tiddler2 and Tiddler3 have TagC in common and Tiddler1 and Tiddler3 have TagD in common.

Could a solution, if it exists, apply if there are more tags involved? Say, if three or more tags are common to a group of tiddlers?

I’m confused, because the example doesn’t seem to meet the description.

Which I took to mean tiddler that share at least two tags. But in every case in your example, the pairs of tiddlers you show only have one tag in common.

So, if instead you mean you want to find the tags that appear in at least two tiddlers, then you can use a filter like this:

[tags[]!is[system]] :filter[all[tiddlers]tag<currentTiddler>count[]compare:number:gteq[2]]

You can skip the !is[system] if you want to include system tags ($:/...)

If you want to display all such tags and the tiddlers that have each tag, you can use something like this:

<$list filter="
  [tags[]!is[system]] 
  :filter[all[tiddlers]tag<currentTiddler>count[]compare:number:gteq[2]] 
  +[sortan[]]
">

!! <$link/>
<<list-links [tag<currentTiddler>] >>
</$list>

And of course, you could change that 2 to 3, or 50 or whatever.

If this is not what you want, and my first reading was correct, could you give an updated example?

Are you looking for something like a “tag intersections” function?

Here’s a place where I’ve set up such an automated overview: Google fonts — for TiddlyWiki

1 Like

You are quite right. My example is badly worded. What I mean is that if I have four specific tags I would like to know which tiddlers have any two or more of those tags. Get a listing of tiddler titles and the tags concerned.

I found this solution. It’s related to my Dashboards in my wiki hence the use of the word “dashboardTags” below.

<$let dashboardTags="TagA TagB TagC TagD TagE TagF TagH TagI">

<!-- Loop over ALL tiddlers -->
<$list filter="[all[tiddlers]!is[system]] +[sort[title]]" variable="t">

  <!-- Count how many Dashboard tags this tiddler has -->
  <$set name="catCount" filter="
      [<t>tags[]] 
      :intersection[enlist<dashboardTags>] 
      +[count[]]
  ">

    <!-- Show only if count > 1 -->
    <$list filter="[<catCount>compare:number:gt[1]]">

      <p>
        <b><$link to=<<t>>/></b>
        <span class="tc-muted">(<<catCount>> categories)</span> —

        <!-- List which Dashboard tags apply -->
        <$list filter="[<t>tags[]] :intersection[enlist<dashboardTags>]" variable="tag">
          <span class="tc-tag-label"><$link to=<<tag>>/></span>
        </$list>
      </p>

    </$list>

  </$set>

</$list>

</$let>

And don’t forget @vilc’s wonderful idea!

1 Like

Ah, I had forgotten, even though I joined into that discussion!

1 Like

Funny, because it was you’re using “tag intersections” that reminded me of it.

1 Like

I was just thinking if the idea is to discover tag groups, tidders that share two or more tags, that exist out there you could select a range of tiddlers such as has two or more tags, sort the tags, then search for all tiddlers with the same tags field (sorted). ie the exact same compound of tags.

  • of course you could exclude or only include a subset of tags and construct a variable, a sort of synthetic tags field.

This would give you a list of all common sets of tags as they exist. You can list all such sets and count and list all tiddlers in each set. perhaps decide if such sets include tiddlers with only one tag.

  • we could then build a compound title for each found set.

Now given the sets of tags you found, you can find all tags that are part of one or more of these sets. We could call this the superset.

We could then go on to analyse this superset for the combinations that exist, or don’t exist in the wiki. the new let multiple variables in 5.4.0 may make this even easier.

  • the combinations and possible number of sets could quickly multiply
  • we could create compound titles for each possible set perhaps keeping them as missing tiddlers.
  • it would be quite nerdy but could prove quite interesting :thinking:

It would be great to be able to visualise tag intersections too - which is basically just venn diagrams. Could one of the graphing solutions be bent to that purpose here?

Being a venn diagram fan, I couldn’t resist. No fancy diagram tool needed — just svg

Proof-of-concept is developed on the prerelease, using the new MVV capacity to do things like dynamically scale down the font size as the length of the list grows.

3 Likes

Not exactly what you asked for, but perhaps TiddlyTools/Search/Tags could be useful. It shows a set of checkboxes to select from all existing tags (with an option to include shadow tags). It then shows you two lists:

  • “AND” = tiddlers that have ALL the selected tags
  • “OR” = tiddlers that have at least ONE of the selected tags

-e

that’s neat, though I was assuming a graphing tool since I was thinking about handling a scalable number of categories, and the diagram being able to be visually adjusted after it’s initial automatic creation

eg, tagging the artists in my music collection with

  • rock
  • musical
  • comedy
  • experimental
  • NSFW
  • Australian

You can see it could already become quite complex, and would only get more so when I later realised I wanted a “seen them live” tag too!

TW5-Graph lets the layouts of graphs be easily changed visually, and the same sort of ease for a complex venn diagram is my imagining (since I doubt no amount of clever algorithm could get a complex multi-tag venn with hundreds of overlapping items into an aesthetically workable result every time)

As @Springer has done, I used an LLM to generate various SVG images within which to include content.

Apart from the limitations of the LLM I also quickly discovered that on a 2 D sheet or screen, more than say three or five regions overlapping each other, and accounting for every combination, it quickly fails as a method.

What the answer is I am not sure but its not a venn diagram.

I used an afternoon to explore more advanced uses of Venn diagrams, and realised they only have a limited application. Now the creativity starts.

Technically, from a logical point of view, there’s no 2D model that suffices for even 4 categories. Venn diagrams [edit: as circles] fail (that is, they fail to have one continuous region for each logical intersection location) beyond 3 circles. [EDIT: As @Scott_Sauyet notes, elliptical models can work for a few categories beyond three!]

Of course, a reasonable 2D mapping [of indefinitely many categories if — as with real-life categories, many intersections are empty] may happen to work fine if you’re willing to shrink back to Euler logic to deal with some areas of your map (say, if all X are Y then you can draw the X circle inside the Y circle). But that’s not Venn anymore.

1 Like

I have good memories of a solution called x-list for cross list, it created a table of intersections which would be ideal for more complex list combinations.

That’s true of circles. But you can do four or five sets with ellipses:

I believe there is a six-triangle complete construct as well. I don’t know if there are solutions for larger numbers with convex shapes.

Venn himself showed a construction that allowed an arbitrary number of sets, with increasingly complex spiral-ish sets atop the standard three-circle version.

Of these, though, I think only four is reasonable for actual usage. The others are just curiosities.

2 Likes

yeah, I must admit I wasn’t thinking the strict definition of Venn diagrams, but the more popculture/casual usage of “overlapping shapes”, which may not even fit any of these definitions. eg, this 80s movies diagram (from reddit) - and the more I think of it, the more suitable to my background project this type of mess might be, and the likely impossibility it’ll be automatable in any simple way

2 Likes

Damn, I’ve seen at least 50 of these movies. (Can you guess when I graduated high school? :slight_smile: ) And I love that my favorite one is sitting in a category all by itself. ROUS: The Princess Bride.

Where is the :eating-my-hat: emoji?
:laughing: