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
My understanding of inside() is all inside out... (Read 1040 times)
Pat Maddox
Full Member
*
Offline



Posts: 66

My understanding of inside() is all inside out...
Apr 02nd, 2016, 8:05pm
 
I'm breaking out of this long thread about agents and children to post a simple practical example of how inside() behaves differently than I would expect it to.

Rather than rehash the documentation, here's a snapshot of a Tinderbox document that looks wrong to me:



Here's the code for agent "this should match only second":

Code:
inside('match first and second') & !inside('container for first alias') 



I think it should not match "first" because an alias of "first" is inside the container "container for first alias". But as you can see, it doesn't work that way.

What am I missing?

You can download the Tinderbox file here... (56 kb)
Back to top
 
 
  IP Logged
Pat Maddox
Full Member
*
Offline



Posts: 66

Re: My understanding of inside() is all inside out...
Reply #1 - Apr 2nd, 2016, 8:17pm
 
Very interesting... if I change the query to:

Code:
inside('match first and second') & !descendedFrom('container for first alias')  



then it returns the results I want.

This may have implications for the other thread but I admit I'm too fried at this point.

inside() behaves very oddly in my opinion! I don't understand why inside() and descendedFrom() would behave so differently.
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: My understanding of inside() is all inside out...
Reply #2 - Apr 3rd, 2016, 7:33am
 
If I edit the last agent's query to:

!inside('container for first alias')

you can see why you get the result you do in the original example:



'first' and 'second' are indeed the match. 'not inside' is everything outside that container.

I too expected your outcome, in that I'd expect query term #2 to work only on the result of term #1. Generally I think this is the caase - certainly with attribute values:

!$Color=="red"  
!($Color=="red)


The latter form, with parentheses, is informally advised - or certainly so if the first form doesn't work. I tried parentheses on your test with inside() and it made no difference. I also made a separate test where there were on other agents being inspected, i.e. all inside() tests were on containers. No joy. I also looked at other joins like &= as described here. No joy.

Interestingly I don't find any hard reference for support fot NOT joins for query operators, as opposed to negative attribute value tests.

I'm also less clear after all this on how multiple term queries are tested. I'd always assumed #2 only checked the output of term #1, but maybe this only applies with attribute tests as opposed to (path) queries. By the latter, I mean the hold '#query' type operators pre-v4.6.

If it's any consolation, I'm now as confused as you!

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: My understanding of inside() is all inside out...
Reply #3 - Apr 3rd, 2016, 8:08am
 
I believe that inside(theNote) is true if this note is a child of theNote or of an alias of this note is a child of theNote.

On the other hand, I believe descendedFrom(theNote) is true only of this note is a descendant of theNote.  

I believe this is the explanation for the original perplexity.  The special behavior of inside() makes a number of common agent expressions far easier than they otherwise might be.
Back to top
 
 
WWW   IP Logged
Pages: 1
Send Topic Print