Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi
Tinderbox Users >> Agent, Actions, Rules & Automation >> My understanding of inside() is all inside out...
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1459641920

Message started by Pat Maddox on Apr 2nd, 2016, 8:05pm

Title: My understanding of inside() is all inside out...
Post by Pat Maddox on Apr 2nd, 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)

Title: Re: My understanding of inside() is all inside out...
Post by Pat Maddox on 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.

Title: Re: My understanding of inside() is all inside out...
Post by Mark Anderson on 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!


Title: Re: My understanding of inside() is all inside out...
Post by Mark Bernstein on 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.

Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com) » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.