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 operate on set attribute in export language (Read 17016 times)
Loryn
Full Member
*
Offline



Posts: 97

How to operate on set attribute in export language
Jun 21st, 2008, 10:15am
 
How do I operate on a set attribute using the export language?

If I've done this (cribbed from the User Guide, p259) in a rule:

Code:
MySet=links.inbound..Name 



How do I then include each of the names in this set?

e.g.
^for_all($MySet(this) as Name,^include(Name)^)^
Back to top
 
« Last Edit: Jun 21st, 2008, 10:19am by Loryn »  
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: How to operate on set attribute in export language
Reply #1 - Jun 21st, 2008, 5:57pm
 
You can't ^include a set notes.  Sorry.

But what you can do is create an agent that contains the desired notes -- e.g. "all notes that link to A. B. Clump".  Then, ^include the agent, using a suitable template:

    ^include(/agents/ClumpNotes,ListTemplate)
Back to top
 
 
WWW   IP Logged
Loryn
Full Member
*
Offline



Posts: 97

Re: How to operate on set attribute in export language
Reply #2 - Jun 22nd, 2008, 12:27am
 
Hi Mark

It's good to know what's possible today...

Is there any chance of having a for_all type operator in the export language in a near future release?

I'm wanting to build Theory of Constraint:
- Current Reality Trees
- Strategy and Tactics Maps

The items are related through links, not hierarchical relationships, and any outputs should be able to follow the links.

The type of output I'm looking for should:
- display the target note
- display all the notes linking in to it
- display all the notes it links out to

like this...


        OBJECTIVE


                ^
                 |
                 |

           TARGET


                 ^
                  |
                  |
                  |

 NECESSARY CONDITIONS


clicking on the objective will shift it into TARGET position, etc.

For this, I believe I need some way to arbitrarily access the note-set being linked to, and the note set linking to, an arbitrary note. And I think it is infeasible to create an agent per note to do this! The links operator already captures the analysis. But I have no way to export it!

Real close.

So ... any chance of getting it into Eastgate's plans?
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: How to operate on set attribute in export language
Reply #3 - Jun 22nd, 2008, 5:58am
 
Not necessarily the tools you're after but have you looked at the Roadmap (Cmd+Opt+R) and Browse Links (Cmd+backslash) dialogs?
Back to top
 
 

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



Posts: 97

Re: How to operate on set attribute in export language
Reply #4 - Jun 23rd, 2008, 8:29am
 
Hi Mark

Yes, I've seen these tools. Browse links shows me the links interactively.

Roadmap is close to what I was asking for, except:
1. Using the links operator, I can filter the link type, which I'm unsure you can do with roadmap. (I didn't explicitly say it in the above thread, because that part of the functionality is already built into Tinderbox, and didn't need repeating.)
2. Roadmap doesn't have an export function either, does it?
Back to top
 
 
  IP Logged
Loryn
Full Member
*
Offline



Posts: 97

Re: How to operate on set attribute in export language
Reply #5 - Jun 23rd, 2008, 8:44am
 
Well, after considering this for a while, it seems I'm trying to bend Tinderbox into doing something for which it isn't yet ready. It's designed for hierarchical outline type material, but, surprisingly, given its focus on linking, seems not quite designed to work as well with a Directed-Acyclic Graph structure.

Today I happened to come across (at ATPM/ATPO) a program that is suited natively to working on a DAG: Flying Logic. Moreover, it is specifically designed for Theory of Constraint applications. It has a fully dynamic graph layout mechanism, which is superb for dealing with that type of information.

But it is purely a graphing tool. No agents. No programmable export. It's a tool designed with a limited focus in mind---at which it excels---and beyond which is impossible to traverse. It will be very, very interesting seeing how I divide my tasks between Flying Logic and Tinderbox! (Fortunately, Flying Logic does export OPML, and Tinderbox imports it. So, when I bring my pretty diagrams in Flying Logic to a state when I want to begin executing them, I'll be able to bring it into Tinderbox to take advantage of agents, etc. And have to worry about losing meaning through the export / import process.)


Nevertheless, I reckon a way to export the values of set attributes (and iteratively execute them) would be a perfect complement to the links operator.

It isn't possible to turn note names in a set attribute into ^include()^ calls using macros?
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: How to operate on set attribute in export language
Reply #6 - Jun 23rd, 2008, 9:38am
 
[this was written be fore the last post - for an answer to the trailing question - see the comment below on format()]

I just tested and, no, Roadmap doesn't show the link type and/or allow you to filter by link type. It doesn't have a role in export. You can follow a link within road map by double-clicking a note in the inbound/outbound link lists on the dialog but note that the selection in Map/Outline/etc doesn't follow - it remains on the original link which can be slightly counter-intuitive on first use. In the latter case I'd like the option for Roadmap to shift app focus to the 'current' roadmap item allowing me to traverse links and have major view types shift focus to follow that (though doubtless there are complications arising from that). However, right-clicking on any note in the left/right side lists in Roadmap to allow you to open a new Map/Outline/etc based on the clicked note easily allowing you to see than note in context.

For export, to list all inbound links and of more than one type you need to use both:
^inboundBasicLinks(<ul>,<li>,</li>,</ul>,(agree|disagree|dispute))^
^inboundBTextLinks(<ul>,<li>,</li>,</ul>,(agree|disagree|dispute))^

to do the same for all outbound links you need to cover 3 codes:
^outboundBasicLinks(<ul>,<li>,</li>,</ul>,(agree|disagree|dispute))^
^outboundTextLinks(<ul>,<li>,</li>,</ul>,(agree|disagree|dispute))^
^outboundWebLinks(<ul>,<li>,</li>,</ul>,(agree|disagree|dispute))^


The more generic codes ^inboundLinks()^ and ^outboundLinks()^ don't offer the optional filter for link type(s). The above should allow you to export all links of a given link type. Alternatively, create a Set consisting of the names of appropriately linked noted and use a format() to create a set of code links: format($MyLinksSet,"<ul>","<li>","</li>","</ul>") and pass the result to another user attribute, e.g. MyLinks. Then use ^get(MyLink)^ in your export template to write out the links. Similarly, you could use format($MyLinksSet,",") to generate CSV output.

If you've a TBX with some appropriate data that you could make available to experiment with it might help elucidate what TB can do at present - even if in an unexpected way and what is definitely a new feature request.
Back to top
 
« Last Edit: Jun 24th, 2008, 11:28am 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: How to operate on set attribute in export language
Reply #7 - Jun 24th, 2008, 1:43pm
 
The strikethrough in my last post is because I'm wrong about making a set of exported HTML links using a set. The syntax methods cited indeed do allow creation of HTML lists or delimited list string from set values but there is currently no way (v4.2.4) that I can see to coerce a list of HTML links out of a set using TB codes. By feeding the set to a command line you should be able to achieve this with sed or some such, using a regexp to give backreferences to each set terms that is then enclosed in the appropriate text. However, I believe (I'm not a command line expert) most regexp type tools only support a limited number of such references, usually 9. So a script with a recursive function is probably neded, taking the set arguments up 9 at a time and building a string out of the ongoing results. In case someone wants to try.....

Test Case
Set attribute MySet hold 11 values (note no semi-colon after last term):
Ant;Ape;Bat;Bee;Cat;Cow;Dog;Eel;Elk;Fox;Fly

We need a CL or script that consumes the above string and returns:
<a href="^linkTo("Ant")^">Ant</a>\n
<a href="^linkTo("Ape")^">Ape</a>\n
<a href="^linkTo("Bat")^">Bat</a>\n
<a href="^linkTo("Bee")^">Bee</a>\n
<a href="^linkTo("Cat")^">Cat</a>\n
<a href="^linkTo("Cow")^">Cow</a>\n
<a href="^linkTo("Dog")^">Dog</a>\n
<a href="^linkTo("Eel")^">Eel</a>\n
<a href="^linkTo("Elk")^">Elk</a>\n
<a href="^linkTo("Fox")^">Fox</a>\n
<a href="^linkTo("Fly")^">Fly</a>\n


Assumption: set values are note Names and names are unique across the TBX.

There could be more HTML - <p> or <li> etc but I don't think that really affects the regexp part of things massively.
Back to top
 
« Last Edit: Jun 25th, 2008, 6:51pm 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: How to operate on set attribute in export language
Reply #8 - Jun 26th, 2008, 9:56am
 
Here's more of the jigsaw. The command line:

$ echo '<ul><li><a href=\"^linkTo("'`echo "ant;bee;cow" | sed 's/\([^;]*\)/\1#\1/g' | sed 's/#/")^">/g' | sed 's/;/<\/a><\/li><li><a href="^linkTo("/g'`"</a></li></ul>"

...gives back:

<ul><li><a href=\"^linkTo("ant")^">ant</a></li><li><a href="^linkTo("bee")^">bee</a></li><li><a href="^linkTo("cow")^">cow</a></li></ul>

Sadly I can't get that to run as a command in TB using my set data in place of the test string. Progress of sorts...

Back to top
 
 

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

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: How to operate on set attribute in export language
Reply #9 - Jun 27th, 2008, 5:25am
 
Working from a café in Porto so I can't hack, but....

... Remember that the command line shell parses many characters, including backslash, quotes, etc.

It's often easier to write a short script file that holds the arguments, so Tinderbox can call

      prepareForExport

which contains the command, such as

    sed /...pattern/with \"special\'" characters.../ exported stuff /


Back to top
 
 
WWW   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: How to operate on set attribute in export language
Reply #10 - Jun 27th, 2008, 9:08am
 
I realised the issue was quoting/special characters - it's my lack of CL smarts and not limits in Tinderbox! I just posted where I'd got to as it may be a while before I can get back to the topic.

As regards (external shell) scripts, I was trying deliberately to avoid that as it makes everything less share-able and more prone to breakage. Still, it did occur to me that I could use a note's text as the script and perhaps call that....and that's worked!  

I'll post a proof-of-concept TBX soon.
Back to top
 
 

--
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: How to operate on set attribute in export language
Reply #11 - Jun 27th, 2008, 10:20am
 
Back to top
 
 

--
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: How to operate on set attribute in export language
Reply #12 - Jun 28th, 2008, 6:15am
 
The above test file has been updated. I'd incorrectly attributed a stray line return to Tinderbox - mea culpa, it was the sed output. That's now fixed.

The file now uses a live set created via a links() action and creates a link list, in an unordered list based on that data.  

The only thing I've not fixed/solved are:
- I've not tested with very long set values and/or accented characters (at some point a set data string or the CL output based on them may overflow an internal text buffer. not sure.
- I can't pretty up the output as I'd like putting line returns after <ul>, </li> and </ul> codes. It seems I can insert the codes but they're getting coerced back to string litterals. See MyStringB or note 'Test' in the demo to see the problem. It's more likely my lack of shell skills rather than a fault of TB.

I've a sense that it might be neat if in time Tinderbox adopted this process as an export code - i.e. the code would include a links() call and the result would be returned as the corrrect HTML export code.  One sophistication this might offer is something I'm not sure my method allows and that is to have something other than the (target) note's Name attribute** as the link anchor

** To explain, the links()-action-derived set attribute in the demo gathers the target note(s) Name values as without that the ^linkTo^ code won't work on export.

I hope this helps those looking to be able to take their rich Map visual links and reflect that as links in HTML text-based export.
Back to top
 
« Last Edit: Sep 26th, 2008, 7:49am by Mark Anderson »  

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



Posts: 97

Re: How to operate on set attribute in export language
Reply #13 - Jul 2nd, 2008, 6:47am
 
Wow.
Back to top
 
 
  IP Logged
Pages: 1
Send Topic Print