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
Newbie: query and excluding of found notes (Read 7444 times)
Patrick Wendling
Full Member
*
Offline



Posts: 4

Newbie: query and excluding of found notes
Feb 26th, 2009, 4:22am
 
This is probably very simple.
How can I use an agent to search for notes containing f.ex. "theory". Then use an agent to search for notes containing f.ex. "research" but not returning the notes that were found with the first agent. and so on further reducing the pool to be searched?

I tried a search combined with a boolean user attribute f.ex. used=false. But when using an action to set it to true it obviously invalidates the search.

Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Newbie: query and excluding of found notes
Reply #1 - Feb 26th, 2009, 6:03am
 
What is 'f. ex.'? Is it part of the string you're searching for?

My hunch is you're looking for Text containing "research" but not containing "theory". Notice how I turned the order of the arguments around to make things simpler. That gives a query of:

  Text(research)&!Text(theory)

Notice how we use the '!' as a 'NOT' modifier. As it happens, because both the above conditions must be true the query can also be written in reverse order:

  !Text(theory)&Text(research)

Don't worry about white space.  If you find it easy to see the structure by openig out you can use

  Text(research) & !Text(theory)
  (Text(research)) & (!Text(theory))

In the second example the parentheses are just like you'd use in a spreadsheet to indicate the order you want things evaluated - i.e. start with the inner parentheses and work out. Thus, evaluate each Text search and then give only the items found in both the inital sets of results.

To help get you started, the '!' can be used in a few other ways. Use '!=' for 'does not equal'. Also, with Boolean type attributes, rather than say 'MyBoolean = false' or 'MyBoolean != true' you can use !MyBoolean

Back to top
 
 

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



Posts: 4

Re: Newbie: query and excluding of found notes
Reply #2 - Feb 26th, 2009, 8:17am
 
Sorry for the f. ex. It was just to indicate for expample.

I guess the search with the "but not" condition would work. The problem is, the search string will become more and more complicated in time.

Basically I want to leave my master doc. with my exerpts untouched. Collect aliases of notes refering to one subject (which might overlap with another subject) and copy them to a new Doc for manual outlining. Then take those notes found out of the search pool and perform the next search only considering the notes that were not already found. (In order not to copy duplicates to the new doc).  

sample of searches (agents)

1st. search: (theory and design) or (theorie and design)
2nd. search. (theory and practice) or (theorie and praxis)
3rd. search. theory of design or theorie des designs
4th. search: designtheorie
5th. search: research for design
6th search: forschung über design
and so on.

If I understand correctly, the 6th or later searches would be quite complex excluding (&!) everything I found before?
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Newbie: query and excluding of found notes
Reply #3 - Feb 26th, 2009, 9:12am
 
Mark B would have a better idea but in general more searches - and/or wider scope of search - takes more time and at some point excessive demand would exceed resources. however, now you've given more background, there's a better approach.

I'd make a custom Boolean attribute. I'll call it NoteProcessed - call it whatever you like amending the examples below accordingly. Each time we do a query, set the OnAdd to:

  $NoteProcessed = true;

Notice that being a boolean attribute , the value true (or false) is always all-lowercase and not quoted. Thus don't use this:

  $NoteProcessed = "True"; **BAD SYNTAX EXAMPLE FOR BOOLEANS**

OK, why use this attribute.  At stage two, our query would be:

  (!NoteProcessed) & Text(some value)

where 'some' value is the word you want to search for. By placing the 'NoteProcess is false' condition first all other query terms are only run against notes not used as a result of the first search. OnAdd remains the

  $NoteProcessed = true;

As the results of the second search are flagged as used.

If you want you can just run the query without the OnAdd action , then when you've processed all the note and perhaps excluded some false matches/edge cases, then open the agent's Rename dialog and add in the OnAdd action and the value will be set next time the agent updates.
Back to top
 
 

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



Posts: 4

Re: Newbie: query and excluding of found notes
Reply #4 - Feb 26th, 2009, 10:22am
 
I guess I am missing something here.

I created a boolean user attribute called "used". And then a new agent to test it: I put
(!used)&Text(gauss) in the query field
and
$used=true;
in the action field.

Nothing gets returned. but the note gets set to true. So I guess the agent finds the note. sets it to true. realizes it is now true and throws it out.

I tried again this time using
onAdd($used=true);

The note got found, but the value of used remains false.

Also could you please explain what the "$" (indicates Attribute?)  "!" (is not? why not !=?) ";" do?
Back to top
 
 
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Newbie: query and excluding of found notes
Reply #5 - Feb 26th, 2009, 11:20am
 
Backing up a bit, whenever I find myself with complicated queries in a bunch of agents, I find it's often useful to make agents that do part of the work. For example, if I have an agent

    Query: Text(theory)|Text(theorie)

other agents can simply say

    Query: #inside(TheoryAgent)

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

User - not staff!

Posts: 5689
Southsea, UK
Re: Newbie: query and excluding of found notes
Reply #6 - Feb 26th, 2009, 11:21am
 
Your guess re the agent is correct, it's updating one of it's own search criteria causing the target notes to not meet the criteria next agent cycle.  Use my alternate suggest in my last post. Don't add the OnAdd action to the agent until you've worken on the current round of searched for items. In other words, at the end of phase 2, add the OnAdd action and let it update the notes.  You can then turn off or delete the agent and create the one for phase 3.  Same here, don't add the OnAdd action yuntil your're ready for phase 4.  Repeat as required.

Quote:
Also could you please explain what the "$" (indicates Attribute?)

Yes, and it's in the manual. In the past putting a $ in front of attribute names (in actions and rules) has optional. It's about to become the rule, so I'm trying to use the new rules to ensure people start adopting the right syntax going forward. I'd also recommend following the best practice suggestion of naming Attributes so they use starting and word join capitals, e.g. Single of MultiWord names. Thus I'd recommend 'User' not 'user' and also note that the two are treated as different atributes.  Using the capitals convention isn't mandatory but it helps if you work in a way TB thinks - i.e. if you force it to guess it's less likely to mistake your attribute for a text string. Of course the $ prefix help TB know what is a attribute reference too.

Quote:
"!" (is not? why not !=?) ";" do?

I don't understand what you're asking. Best to re-read my earlier posts that explaining use of '!'. If that doesn't make sense I'd suggest not trying to figure it out but just treat the usage as a syntax rule to follow - sometimes not understanding makes things easier. Less to worry about - just follow the rule.

I'll make the usual suggestion that if you've got a workflow you're trying to figure, making available a specimen TBX - however broken in workflow terms - but with your structure, data, prototypes in place, the easier it is to help. As an example, notice  See how your first question in the thread, asked out of context of your project, led us to a wrong choice of otherwise correct answer?
Back to top
 
 

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



Posts: 4

Re: Newbie: query and excluding of found notes
Reply #7 - Feb 26th, 2009, 12:17pm
 
Ok. Thanks for all your help. I was somehow fixed on the idea of having the agent reduce my pool of notes.
However what I need is just this: I do my querry. Copy the found notes to a container. Set found notes to true. Delete agent. Next query.

I cant quite follow Mark's comment yet. I assume it is a query within a query that would be named "TheoryAgent"?
   Query: Text(theory)|Text(theorie)
other agents can simply say
   Query: #inside(TheoryAgent)

How would I make a TBX file available?
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Newbie: query and excluding of found notes
Reply #8 - Feb 26th, 2009, 1:04pm
 
Quote:
Copy the found notes to a container.

Copy or move?  It makes a difference. If you're moving the notes then you want your next agent to search using a query starting:

  !#inside(X)&Text....

where 'X' is the name of the container holding the 'used' note you moved as a result of the last query.

I cant quite follow Mark's comment yet. I assume it is a query within a query that would be named "TheoryAgent"?
To which comment do you refer. I'm a bit lost as well. You can make one agent look inside another.  Lets assume you've Agent1 and Agent2. You can make Agent2 look inside Agent1 by starting Agent2's query with "#inside(Agent1)" and then adding on your other query terms, e.g. #inside(Agent1)&Text(theorie).

Quote:
How would I make a TBX file available

you can't upload files tot the forum but you can put them on your own web space or in a FTP location. If you have neither, I guess you could email me (assuming it's not to big for email) - my email's accessed from the button below this post. If you think the file may get garbled in transit there's no harm in zipping it.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Pages: 1
Send Topic Print