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
How to create link from one note to another (Read 3925 times)
rtalexander
Full Member
*
Offline



Posts: 37

How to create link from one note to another
Jan 27th, 2013, 12:33am
 
Hi,

I've searched through the various forums and cannot locate an answer to the following question, so apologies if I've missed it. Anyway, I'm using an agent to collect notes that have some specific property, and what I want to do is to create a link between each note that the agent collects to a note other than the agent itself.  For example, suppose I have the following note hierarchies:

 Cousins
   D

 Ancester
   A
   B


and an agent that collects the children of Ancestor:

 Query: inside(Ancestor)

What I want to do is have the agent create links from A -> D and B -> D.

I have tried the following action code:

  linkTo(D)

but that only creates a temporary link from the agent to D, not from the aliases collected by the agent. Is this possible??

Thanks,

Roger Alexander.
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: How to create link from one note to another
Reply #1 - Jan 27th, 2013, 6:24am
 
Did you see this? I'd try the method suggested in the last paragraph.
Back to top
 
 

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



Posts: 37

Re: How to create link from one note to another
Reply #2 - Jan 27th, 2013, 5:38pm
 
Mark, thanks for the response. I've taken a look at what you suggested, but I can't seem to put it together. I think I need to present my problem in more detail  than I did. In the problem I'm working on, I have a collection of tasks, each having entry and exit criteria. The children of entry criteria are the artifacts that must be available before the corresponding task can start. In a similar fashion, the exit criteria are the artifacts that the corresponding task must produce. Hopefully the following illustrates this.

Task 1 does not require any artifact to start (its entry criteria is empty), but it does produce two artifacts, Artifact A and Artifact B.

   Task 1
       Entry Criteria

       Exit Criteria
           Artifact A
           Artifact B


Before Task 2 can start, Artifact A must be available to satisfy the single entry criterion. When Task 2 has finished, it will have produced Artifact Z.

   Task 2
       Entry Criteria
           Artifact A
       Exit Criteria
           Artifact Z


Task 3 requires the availability of both Artifact B and artifact Z before it can start. Upon completion, Task 3 will have produced Artifact C.

   Task 3
       Entry Criteria
           Artifact B
           Artifact Z
       Exit Criteria
           Artifact C  
     

In terms of dependencies, Task 3 is dependent on Task 2 for Artifact Z and on Task 1 for Artifact B. Similarly, Task 2 is dependent on Task 1 for Artifact A.

So, what I want to do write one or more agents that will create TB links to represent those dependencies. The end result would be the following:

    Task 1 --produces-> Artifact A
   Task 1 --produces-> Artifact B

   Task 2 --requires-> Artifact A
   Task 2 --produces-> Artifact Z

   Task 3 --requires-> Artifact B
   Task 3 --requires-> Artifact Z
   Task 3 --produces-> Artifact C


Next I want write on or more agents that will use these dependencies to create links that represent ordering between the tasks. For the above example, this would be:

    Task 1 --precedes-> Task 2
   Task 1 --precedes-> Task 3
   Task 2 --precedes-> Task 3


In terms of agent queries, what I need to do is collect those artifacts that are children of the Entry Criteria container that is a child of a particular task. And for each such artifact, create a requires link from the corresponding task to that artifact. I also need to do something similar for the artifacts that are inside the task's Exit Criteria child, this time creating produces links.

In pseudo code, this is something like:

   for each task T inside AgentThatCollectsTasks:
       for each artifact R inside 'T/Entry Criteria':
           create requires link from T to R


So, is it possible to do this in TB??

Thanks,

Roger.
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: How to create link from one note to another
Reply #3 - Jan 27th, 2013, 5:52pm
 
A quick thought (it's late here - code not tested). Agent "AgentThatCollectsTasks" duly makes an alias to each appropriate task. The agent's Rule:

$TaskList = collect("children",$Path(original))

In "EntryCriteria" the $Rule:

$ArtifactList = collect_if("children", $Prototype==Task, $Path)
$TaskList("AgentThatCollectsTasks").each(X){
  $AtricleList.each(Y) {
     ...do link creation stuff using the paths in Y and Y
  }
}


It's worth, by way of expression, noting that TB's action code isn't a full programming environment - mainly because (IMO) it was never intended as such. However, with care you mimic most 'missing' structures.
Back to top
 
« Last Edit: Jan 27th, 2013, 5:55pm by Mark Anderson »  

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



Posts: 37

Re: How to create link from one note to another
Reply #4 - Jan 27th, 2013, 6:29pm
 
Thanks for the (always) quick reply! I'll give what you suggest a try.

Quote:
It's worth, by way of expression, noting that TB's action code isn't a full programming environment - mainly because (IMO) it was never intended as such.


Yeah, I see that, and the path that TB has taken over the years makes sense. I am hopeful that some day TB will adopt a scripting language such as Python or Ruby. They are obviously much richer languages TB's action code and have the advantage of large user bases. Plus it would get Eastgate out of the language business, and allow the reclaimed effort to be put to other and more beneficial uses within TB. The language itself is incidental (as observed in its evolution over the years), but it is the Agent engine that is essential to TB.

Quote:
However, with care you mimic most 'missing' structures.


Yes, you're absolutely right. Of course, this always holds true when working with any programming language, be it TB Action code, Python, Scala, Java, Lisp, and so on (I too am a software developer by profession).

Btw, thanks for your service over the years to the TB community. It really has added to the success of the product. This also applies to Mark Bernstein as  well.

Roger.
Back to top
 
 
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: How to create link from one note to another
Reply #5 - Jan 27th, 2013, 10:30pm
 
Remember that runCommand gives you really excellent access to ruby or python or (I think) node.js -- really to whatever language you prefer.  Meanwhile, the built-in language is easy for small tasks, which are inevitably common, and will be familiar to most people who already know a C- or perl-style language.
Back to top
 
 
WWW   IP Logged
Pages: 1
Send Topic Print