$Onadd link to container + inherit all meta-data (esp. tags)

Thanks again for these great answers (this probably the most helpful forum I ever participated in)! I think I have to do a bit more explaining…

Background: For a book project I’m working with many different kinds of sources (scientific publications, laws, interviews, newspaper articles etc in English and Chinese). In the past I’ve been using tags and filename-based metadata to find common themes (based on/inspired by Grounded Theory). I applied tags to both, the original reference (eg an article) and the small, paragraph-based text files mentioned above. At a later stage, when doing analysis on a specific topic, I usually searched for specific combinations of tags (or tags and other metadata). In a way, this is also what I intend to do here. Actually, I expect to mostly work with the Attribute Browser once the initial analysis (=assigning tags and metadata to the exploded notes/smaller text files) is done.

Idea: So this is how I thought to do it: 1. Import of the reference from Devonthink (Prototype “reference”); 2. Import of all small comment files into this reference, which then inherit certain key attributes and are linked to the reference. 3. Rearrange notes with similar natured content next to each other and create a “tag” note (see the example below, the tag here is “modernization”). 4. The code I’m looking for should add the tag modernization to the five blue notes (“notes on notes”). 5. The parent container (“reference”) of all these notes should then collect all the tags it contains (such as “modernization”, “land grab” etc, see also second example). I think this will provide me several avenues to find what I’m looking for once all references have been added (via Attribute Browser, Map View, Roadmap etc). 1 to 3 are solved, I’m struggling with 4 and 5.

Issues: Regrettably, $MySet=links(find($Prototype==“tag”)).outbound…$Tags; $Tags=$MySet; does not seem to work either. It only returns the tags of the parent note (in this case “test”) but not “modernization”, which is what I was looking for:

Thanks also for the advice regarding the difference between rule and edict - in my pervious project I had several thousand notes and I expect this one to be even more complex. Once I have the correct query I’ll turn this into an edict (I would like to avoid a Stamp as I would have to invoke this manually, am I correct?).