Thanks Tones!

Looks like I may have been overthinking this – just :filter, working 
backwards from the match found and seeing when you hit the current tiddler, 
is sufficient:

\define xcor-sort() [backlinks[]tag[Use]] 
:filter[links[]field:title<currentTiddler>] +[count[]]
\define xcor-count() [<crossRef>backlinks[]tag[Use]] 
:filter[links[]field:title<currentTiddler>] +[count[]]

...

<$list 
filter="[all[current]backlinks[]tag[Use]links[]!tag[Use]!field:title<currentTiddler>sort[]!sortsub<xcor-sort>]"
 
variable="crossRef">
  <$set name=numPaths filter=<<xcor-count>>>
<li><$link to=<<crossRef>>/> (<$text text=<<numPaths>>/> occurrence(s))</li>
  </$set>
</$list>

(A different subfilter is needed for the sort than to populate the count 
variable in 5.2.3 since the tiddler being processed by a subfilter can't be 
retrieved through a variable. This could probably be tweaked in prerelease 
so you only need one subfilter.)
On Sunday, August 8, 2021 at 12:45:51 AM UTC-5 TW Tones wrote:

> Soren
>
> Without working through this requirement of yours, I suspect some of the 
> code patterns in my recent reply to another thread 
> <https://groups.google.com/g/tiddlywiki/c/ahbcnXqVgl8/m/eYbVchcRBAAJ>could 
> help you.
>
>    1. Your could make a list of all tiddler links (as a variable) without 
>    removing duplicates, then listing a given tiddler you could count how many 
>    mentions it has.
>    2. With the prerelease Sort Filter Run Prefix 
>    <https://tiddlywiki.com/prerelease/#Sort%20Filter%20Run%20Prefix> should 
>    allow you to sortby the count of mentions as per the filter in 1.
>
> Regards
> Tones
>
>
> On Sunday, 8 August 2021 at 12:12:51 UTC+10 Soren Bjornstad wrote:
>
>> I have a wiki where I want to cross-correlate *concepts *across *uses *of 
>> these concepts. (A concept, in this example, can be defined as any tiddler 
>> *not* tagged Use, while a use is obviously any tiddler tagged Use.) By 
>> "cross-correlate", I mean that given the current tiddler is a concept 
>> tiddler, find all the other concept tiddlers that are used on any use 
>> tiddler that links to the current tiddler (that is, they are often used 
>> together).
>>
>> I can do this with the following filter:
>>
>> [all[current]backlinks[]tag[Use]links[]!tag[Use]]
>>
>> However, I would now like to retrieve (and sort by) the number of 
>> discrete link paths by which you can reach each concept (i.e., the number 
>> of times the current tiddler and this other concept are used together on a 
>> use tiddler). So if 5 use tiddlers which link to the current tiddler also 
>> link to a particular other concept tiddler, the number 5 should be 
>> accessible in a variable when $list'ing through that concept tiddler, to be 
>> used in sortsub[] or the like and the template displaying each match.
>>
>> I haven't been able to think of any way to do this – I tried using the = 
>> filter prefix, but this evidently does not work when you're not adding the 
>> results *to* anything (and probably tag[] and links[] already 
>> deduplicate before they start).
>>
>> Since I'm sure what I want is absolutely clear as mud at this point, 
>> here's a diagram of a toy example, with arrows representing links and the 
>> green numbers showing how many “matches” there would be for my search 
>> criteria:
>>
>> [image: ksnip_20210807-210609.png]
>>
>> As always, thanks for any suggestions!
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/3d62062d-7fb7-4706-9491-5121b7d4fcd2n%40googlegroups.com.

Reply via email to