Automatically append attribute values to existing text of notes

Dear @mwra,

Thank you very much for taking the time to write such a thoughtful and exhaustive reply: I found it most inspiring, especially because it seems to refer to the application of an approach similar to one that has been on my mind lately; here it is.

I have been considering using keywords for my notes (added through $Tags). This would allow me to find all the notes labeled with a given keyword and evaluate whether those notes should be linked to one another, either directly or through other notes.

The problem is that I of course don’t know precisely which keywords are or will be relevant for my growing set of notes. For example, I may think that the keyboard “cell polarity” is and will be sufficient, but over time I may need to differentiate between “cell polarity establishment” and “cell polarity maintenance”. In this case, I know I could find all those notes labeled with the keyword “cell polarity”, but once I had identified for which of those notes I would like to replace the keyword “cell polarity” with the keyword “cell polarity establishment”, would I be able to do that replacement automatically in TB, without doing that one note at a time? I am not asking precisely how to do that at this stage, but only whether you thought one could automate that replacement in TB. If that were the case, I would consider it worth it the investment of time required to apply keywords to all the notes I already have and the ones I will create without worrying about finding the “perfect keyword” from the very beginning.

I suspect that should be possible with TB, but sometimes my suspicions are wrong; for example, I thought that simply by adding $Tags as a KA to a Prototype, all the notes that had been created with that Prototype would automatically inherit $Tags as a KA, but that did not seem to be the case…

Thank you for your consideration.

Best regards,
Enrico

  1. Yes, there are several good ways to automate this kind of tag conversion. For example, an agent could find all the notes that have the tag CellPolarity
Query: $Tags.contains("CellPolarity")

and add a new tag

Action: $Tags=$Tags+"CellPolarityEstablishment";

or remove the old tag

Action: $Tags=$Tags-"CellPolarity"; $Tags=$Tags +"CellPolarityEstablishment";
  1. You question about key attributes is quite straightforward. If a note has its own value of an attribute, that value takes precedence over any inherited value. If you think about it, that’s essential: otherwise, notes would inherit all their values, and you couldn’t tell them apart! So, you simple need to remove the value assigned to existing notes; if you do, the inherited values will be used.

I don’t… it’s more like, let’s say you like one note to another. Well that other note is linked to another note, that links to another, that links to another. So you have two separate clusters of notes, but when you link one from one cluster to one from the other, the two clusters become joined to make a bigger cluster / network of notes. Does that make sense?

Thank you very much, @eastgate, not only for the helpful clarification, but for already explaining in detail how I could add or replace keywords (i.e. $Tags): I really appreciate that!

As to:

You question about key attributes is quite straightforward. If a note has its own value of an attribute, that value takes precedence over any inherited value. If you think about it, that’s essential: otherwise, notes would inherit all their values, and you couldn’t tell them apart! So, you simple need to remove the value assigned to existing notes; if you do, the inherited values will be used.

However, that’s not exactly what happens to me; I apologize for the confusion and please let me clarify. When I add $Tags as a KA to a Prototype—for example, to the Prototype Quotes in the screenshot below—even if I do not add any keywords/tags in the $Tags attribute field of the Prototype:

The notes that had been created with the Quotes Prototype before I added the $Tags KA to the Quotes Prototype fail to inherit such KA; for example, the note q20190105163532:

However, notes created after the addition of $Tags as a KA to the Prototype Quotes inherit such KA; for example, the note untitled:

I hope I clarified what I meant and would be grateful for any help/suggestions you may have.

Thank you for your consideration.

Best regards,
Enrico

Thank you very much, @pat, for the helpful clarification: it makes perfect sense, and I now understand exactly what you originally meant!

Best regards,
Enrico

It appears that you added attribute sourceURL to the KA for this note. Therefore the note will not inherit the KA settings from the prototype because that not has local settings for the KeyAttibutes. You can use a Quickstamp to make the note inherit from the prototype instead of using the local settings.

Thank you very much, @PaulWalters, for identifying the problem: if I am not mistaken, that $SourceURL attribute is generated by @pat’s Publish-to-DEVONthink Stamp, which I use to export my notes to DTPO.

Thank you very much also for suggesting a solution: I have never used a Quickstamp, so your suggestion also offers me the opportunity to learn that too!

Best regards,
Enrico

@enricoscarpella I suggest you take a look at my tutorial on inheritance in Tinderbox which is the underlying issue to your problem above.

Thank you very much, @mwra, for the helpful suggestion and for the amazing resource, which I will read with the greatest interest!

Through that page, I was also able to find other very helpful tutorials here; are they public or would I be infringing copyrights by reading them? I know your name is acknowledged at the beginning of that page, but I am not sure if you really posted them or somebody else did without your consent… (I recently discovered a TB-related case of copyright infringement and reported it to Eastgate, so I am circumspect).

Thank you again very much for your continuous support!

Best regards,
Enrico

@enricoscarpella, they’re all free and unencumbered for re-use. Inevitably a few features may change - e.g. descriptions of each Inspector feature - and I don’t necessarily have time to update these a quickly as aTbRef. Stuff with graphics always takes a bit longer (normally because you need to ‘make’ the right picture to record. Indeed, aTbRef8 is pretty much done, bar the graphics.

Sadly, the Clarify app has been withdrawn and remains a 32-bit app (so not supported on macOS 10.5) as the makers have concentrated on a $$$ enterprise version of the app. I’m not aware of an app that does annotated screenshot based tutorials with as much ease/speed.

Thank you very much fo the clarification, @mwra.

I don’t necessarily have time to update these a quickly as aTbRef.

Frankly, I don’t even know where you find the time to work on your PhD thesis: it seems that we users in this forum are the main obstacle between you and your degree… I cannot speak for anyone else — even though I am quite certain the sentiment is widespread — but your generosity with your time speaks volumes about you, so thank you very very much!

Best regards,
Enrico

1 Like

Dear @PaulWalters,

I found the clearest explanation of what I needed to do in this posting of yours. I hope you don’t mind if I link it here: I thought it could be helpful to other users too. Thank you again for pointing me in the right direction.

Best regards,
Enrico

1 Like

This is possible, if you specify a section within the Text where you would like the attribute values to go. I agree with @mwra’s general assessment about the best way to accomplish what you’re aiming for. But independently of that, this is a useful trick for generating reports in a note’s text.

The attached document contains a prototype with the following Edict:

$InboundLinks=links.inbound..$Name;
$OutboundLinks=links.outbound..$Name;

if ($Text.contains("(.*BEGIN_LINK_REPORT\n).*(\nEND_LINK_REPORT.*)")) {
$Text=$1 + 
      "InboundLinks: " + $InboundLinks +
      "\nOutboundLinks: " + $OutboundLinks + 
      $2;
}

When the edict is run, it updates InboundLinks and OutboundLinks. It then checks to see if the note’s text contains a section that looks like this:

BEGIN_LINK_REPORT
...
[any text can go here]
...
END_LINK_REPORT

If it does, it inserts a report of the incoming and outgoing links between BEGIN_LINK_REPORT and END_LINK_REPORT. The other text in the note is unaffected.

Changes to the links are automatically propagated into the text of the note.

Here’s what it looks like in action:

link-report.tbx (94.2 KB)

That’s fantastic, @galen! Thank you very much for generously taking the time to help me out describing in such detail what the Edict does and for attaching the sample .tbx file (already downloaded!).

I am always pleasantly surprised by how powerful TB is: it seems it can always do what I need, even though I often don’t know how. And that’s where the second pleasant surprise comes in: how selfless the users in this forum are. So thank you very much again!

Best regards,
Enrico

1 Like

I use Tinderbox and TheBrain, and they meet very different requirements because they are designed to solve different problems. The main difference for me is that TheBrain is designed to scale up to hundreds of thousands or millions of notes while remaining responsive, and Tinderbox is designed to give rich, varied, and customizable visual presentations of your data (as well as helping to automatically categorize and/or generate data).

Tinderbox can’t scale up to a large graph like TheBrain does (again, by “large” I mean > 10^5 here). For example, in hyperbolic view, Tinderbox displays all nodes that are reachable from the note in focus. This means in a graph of only a few hundred notes, the hyperbolic view in Tinderbox slows to a crawl. TheBrain only shows notes that are at most two jumps away from the note in focus. This keeps the document responsive, but at the cost of only ever being able to see a restricted subgraph.

TheBrain also doesn’t support fine scrolling adjustments of the graph view like Tinderbox does. With TheBrain, the focus note sits in the middle of the screen, period. If you want to look at a different part of the graph, you have to move the focus to another note. This means that exploring the graph in TheBrain necessarily means you lose some coherence of the view, because the nodes are constantly being rearranged on the screen as you change focus to explore the graph.

I use TheBrain as a long-term reference store. I have one brain database, and anything that catches my interest goes in there. TheBrain’s design (including its restricted view of the graph, oddly enough) allows you to keep adding stuff to it without slowing down performance and without it feeling like the database is becoming a huge unmanageable hairball. But it does this by heavily restricting the presentation of the data to a few (quite well designed) views. TheBrain also offers minimal automation to reclassify notes etc., so to my mind it’s best suited for long-term data store that doesn’t change all that much (aside from new manually created links). I see people trying to use TheBrain as a daily planner/GTD system and I am totally baffled.

I use Tinderbox as a dynamic planning, thinking, and drafting tool. Tinderbox is like a toolbox for creating a little specialized app that’s perfectly suited to the task at hand. It’s far more flexible and powerful than TheBrain, but at the cost of scalability and responsiveness. In practice I use TBX as a document drafting tool and as a mini database tool for jobs that are too complex for a spreadsheet. I use a bullet journal for planning these days, but in my view Tinderbox is the best digital GTD tool there is (if you are willing and able to pay the opportunity cost of learning to use it well).