Tinderbox Forum

Agents use sets for general notes


(kyle) #1

I have been working with Tinderbox for some time and am now trying to push it further. I am using it to collect an extensive collection including books and items. What I would like to do is aggregate all items and books using agents. For example, if I have an author/creator of a book and physical item one of the attributes is $Name. I have a prototype ($Person) and would like to make this into an agent so all of the books and items would be ‘collected’ within each person.

I have a question and then would like to push this further.

The question is, is it possible to convert a ‘note’ into an agent?

If this is possible and recommended, here is the rub and how I am trying to push this a little but further. Although each $Person has a $Name attribute, it also has an attribute, $AKA, which is a set. I would like each of the $Person notes to ‘collect’ all books/items that have either $Name or any other names (also known as) in the notes for book/item.

I hope this question makes sense. For example, my collection has thousands of books and items in it and the $Name for a given artist might be Ed Mack, Eddie Mack, Edward Mack or E. Mack. I would like to have one single $Person note with $Name = Edward Mack, and the $AKA attribute as aset which includes all of the other names that have been used to label the various items/books in my collection (I want to keep the item/book names consistent with the actual name/spelling on the item/book within their respective notes).

Can anyone let me know if this is 1) possible using agents and 2) worth setting up my Tinderbox document this way.

You in advance for any help on this.


(Mark Anderson) #2

No. But before you do too much more, take a look at the Attribute Browser view was developed to get around having lots and lots of agents. Unless you need a permanent persistent record of every combination of certain attributes, the AB view allows you to say, at it simplest, “show me all books and items grouped by Person”. This avoids you having to build an agent per person.

When you say 'Person', do you mean each note relating to a person? In Tinderbox the -prefix is used:

  • formally in action code the $-prefix indicated as reference to an attribute whose value we are either setting or reading. Thus code $Color="blue" sets attribute ‘Color’ to the value ‘blue’.
  • colloquially in Help and here in the forum to identify we are talking about an attribute of that name. Thus: “I’ve set KAs to show $Name and $Created” is a way of say I have set a note’s key attributes to display the attributes ‘Name’ and ‘Created’.

$Name is the title of a note or agent, i.e. what you name it when you fist add it to the document.

From experience, an approach of just adding more and more things (agents, rules, etc.) constantly searching for things in $Text does not scale well. Eventually all the constant background search using regex queries by made by 100s of notes across the 1000s in the whole document will affect performance.

I think a more effective way to deal with your name issue is to have a $CanonicalName string attribute (you can chose an attribute title you like better), and for each ‘person’ note $CanonicalName to the $Name of that note. So the note on “Edward Mack” would use that value for both $Name and $CanonicalName. Now, when you make a note on, for example, a book you would set the $Author as “Eddie Mack” but $CanonicalName as “Edward Mack”. This then makes it easy to use Attribute Browser to see your notes grouped by $CanonicalName. An edge case to consider is where there are multiple authors.

Without sight of some specimen data, it’s hard to be more specific.