Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
Create agents from a set (Read 8566 times)
Peter Rich
Full Member
*
Offline



Posts: 49
Provo, Utah
Create agents from a set
Jun 03rd, 2013, 2:51pm
 
I've used a 'set' attribute, $Topic, to code several notes.  Now, I'd like to be able to have an agent that:

    [#]finds all the topics in the set attribute named $Topic
    [#]If an agent for this topic does NOT exist as a child of "/Topics/topic/," create that agent
    [#]set the query of that agent to find all notes with $Prototype ='note' & $Topic.contains(thisTopic)
    [#]create a note whose $Title = thisTopic
    [#]make this note a child of /Topics/Definitions/


I'm just unsure of where to begin, inasmuch as I'm looking to operate on the results of a single attribute instead of notes themselves.
Back to top
 
 

</something witty>
  IP Logged
J Fallows
Full Member
*
Offline



Posts: 418

Re: Create agents from a set
Reply #1 - Jun 3rd, 2013, 3:21pm
 
1) I would like exactly this same agent!

2) I think I can say with confidence that what you (and I) are trying to do cannot be done within TB5.  Wink I generally shun emoticons but am using one here in acknowledgement of many rounds of (friendly) exchanges with Team Eastgate, in which I have wheedled and begged for this kind of feature -- one allowing auto-creation of agents to match "Set" values -- but have become convinced that it cannot currently be done.

3) I think I can say with confidence that Team Eastgate has it on the aspirational list for TB6. Now, for the aspirations/practicality matchup, we will all watch with interest.
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Create agents from a set
Reply #2 - Jun 3rd, 2013, 4:06pm
 
Al the steps are possible except #3, for the simple reason that action code will not create new notes or delete them; this applies to all note forms including agents, adornments, etc.

You could certainly have an agent that checked if any value currently in $Topic did not already have an agent. An agent prototype would be created to configure the rest of the process based on the value of a chosen attribute ($Name or something else). You'd then make a new prototype-based agent for one of the missing $Topic values. Rinse and repeat as long as there are missing values.

Actually, this doesn't scale well. 50 topics, that's 50 agents humming away. TB can do this, but it's not efficient. I don't know what's proposed for v6, but ISTM that what's needed is a new UI view (instead of  slew of agents), that does this filtering for the chosen $Topic value.
Back to top
 
« Last Edit: Jun 3rd, 2013, 4:06pm by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Peter Rich
Full Member
*
Offline



Posts: 49
Provo, Utah
Re: Create agents from a set
Reply #3 - Jun 3rd, 2013, 4:16pm
 
Mark,
   You bring up a good point about the scalability factor.  I understand that it's possible to turn off the $AgentPriority so that the agent doesn't update all the time, which is something I'd be willing to do with these agents.  Basically, I'd say, "ok, now what notes meet this criteria?"  It seems the manual update, though, applies to all agents.  Is there a way to update a single, designated agent, manually?  if so, I could set a query to search for agents with set names that don't current exist as child notes of a specific container, and apply a prototype, as you recommend.  Then, I could manually create agents that appear on the list.   (a bit tedious, but doable).

BTW, I'd be very curious to know more about what you think this UI view would look like and do.  
Back to top
 
 

</something witty>
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Create agents from a set
Reply #4 - Jun 3rd, 2013, 4:47pm
 
I think you might be trying to do what I'd describe as self-referring agents. The technique leverages the 'agent' designator which only works with agents.

The basic concept is you change one attribute in an agent - manually or via code elsewhere - and any/all of the agent's query/action/rule can reflect that change.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Peter Rich
Full Member
*
Offline



Posts: 49
Provo, Utah
Re: Create agents from a set
Reply #5 - Jun 3rd, 2013, 4:53pm
 
Mark,
  This sounds extremely interesting.  Unfortunately, I'm not completely clear on how it works, from reading your documentation on self-referring agents.  Any chance you have a sample file demonstrating this out there somewhere?
Back to top
 
 

</something witty>
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Create agents from a set
Reply #6 - Jun 3rd, 2013, 5:43pm
 
Let's assume you want an agent to search for notes with a particular value in $Topic (assumed to be a multi-value attribute) and add that same value to $Tags in the same note(s). To make the agent flexible, you don't want to hard-code the search value. Instead, we'll use the agent $Name (we could employ a user string attribute but let's keep it simple for now). We'll also move the matched note to 'container B', to make sure we don't keep re-matching it.

Mage an agent - leave the default title of 'agent' for now.  Add the query:

descendedFrom("Container A") & $Topic == $Name(agent)

This matches any note descended from 'Container A' where $Topic includes the discrete value that matches the current $Name of the agent. It works with String types too.

Now the action:

$Tags = $Tags + $Name(agent); $Container(original) = "Container B";

This adds a new value to the listing $Tags in the matched note. The value added is the current name of the agent. The second expression moves the original (of the alias upon which the agent is acting) to the new location. As (I'm assuming) container B is not descended from A then the moved note can no longer match the query making it a one off.

Do try this - it's very simple and will take you less time than it's taken me to type all this. Then modify further as you wish.
Back to top
 
« Last Edit: Jun 3rd, 2013, 5:43pm by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Create agents from a set
Reply #7 - Jun 4th, 2013, 7:30am
 
I've expanded the note on self-referring agents, hopefully to make it a little clearer.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
J Fallows
Full Member
*
Offline



Posts: 418

Re: Create agents from a set
Reply #8 - Jun 4th, 2013, 7:17pm
 
This is very useful and makes the process of creating agents to match the values of a "Set"-type attribute easier. Thank you for clear explanation.
Back to top
 
 
  IP Logged
Peter Rich
Full Member
*
Offline



Posts: 49
Provo, Utah
Re: Create agents from a set
Reply #9 - Jun 6th, 2013, 3:35pm
 
Mark A, though this doesn't necessarily resolve my initial inquiry, I can see how useful this would be.  It's a way of using "this" or "self," as it were, if I understand correctly.
Back to top
 
 

</something witty>
  IP Logged
Peter Rich
Full Member
*
Offline



Posts: 49
Provo, Utah
Re: Create agents from a set
Reply #10 - Jun 6th, 2013, 4:18pm
 
dMark, I spoke too soon.  I had to create agents with the names of each individual set value, but once I did that, I was able to create a query that would find all the notes associated with that value, without having to rewrite the query each time (which means that I was able to set the $AgentQuery to the $Text of a single note for each agent).

Here's the query that I ended up using:
$Prototype='note' & $Tag.contains($Name(agent))

Once again, thank you for your time and attention.  
Back to top
 
 

</something witty>
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Create agents from a set
Reply #11 - Jun 6th, 2013, 5:06pm
 
Yes, Tinderbox does not let actions create, or delete objects (notes, agents, etc.). Thus, of your original workflow, you can:
  • Create a list of keywords - i.e. values for which you need to test. You can additionally filter out those values for which an ant exists.
  • Make a prototype agent.
The manual part is making the agents. Don't overlook an agent or rule to look for Tags that have no agent.

Automating the agent creation is… a feature request.  Smiley
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Peter Rich
Full Member
*
Offline



Posts: 49
Provo, Utah
Re: Create agents from a set
Reply #12 - Jun 6th, 2013, 5:10pm
 
ooh, a feature request?  Coming from you, that's a very positive tidbit.  I look forward to the next major update  Roll Eyes
Back to top
 
 

</something witty>
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Create agents from a set
Reply #13 - Jun 6th, 2013, 5:23pm
 
Ah, what I meant was, anyone who wants this should write in and ask (just posting here isn't a request).

My understanding is implementing this is less the creation part than implementing safeguards against runaway processes. It would otherwise be easy for someone to make a mistake and write code that kept spawning new notes or agents (or delete them). Either way it might be hard for the user to stop the process and unhappiness result. It's building the safeguards against unintended outcomes that become the expensive part of the engineering. IOW, there is unseen complexity for the app's author in adding such a 'simple' feature. Not that I'd not use it if it were there!
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Peter Rich
Full Member
*
Offline



Posts: 49
Provo, Utah
Re: Create agents from a set
Reply #14 - Jun 6th, 2013, 5:30pm
 
Sorry about the misunderstanding.  Funny thing is, I was thinking of how it would be a powerful feature, but one that I'd have to be careful of b/c it might accidentally delete notes, too, so the damage potential (perpetual creation or  accidental deletion) is really high with such a feature.  It would be really nice on a 1-time per use basis, though.
Back to top
 
 

</something witty>
  IP Logged
Pages: 1
Send Topic Print