Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with user-defined predicate in tolog #277

Closed
GoogleCodeExporter opened this issue Mar 16, 2015 · 4 comments
Closed

Problem with user-defined predicate in tolog #277

GoogleCodeExporter opened this issue Mar 16, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?

1. Put the two attached files (tolog-test.ltm and tolog-test.tl) in the 
topicmaps directory of Omnigator.

2. Load the attached topic map (tolog-test.ltm) into Omnigator

3. Go to the Query page in Omnigator and type the following:
import "tolog-test.tl" as tt

tt:bn1($B,$B)?

4. You will (erroneously) get a result set consisting of two rows: one for 
"dog" and one for "tree"
5. Now type in the equivalent expanded form of the query:

tt:bn($B,$I), tt:bn($I,$B)?

6. You will (correctly) get the empty result set.

What is the expected output? What do you see instead?

I expected the first query to have the same results as the second query but it 
didn't.

Please use labels and text to provide additional information.

Original issue reported on code.google.com by dan.sp...@gmail.com on 16 Jul 2010 at 1:16

Attachments:

@GoogleCodeExporter
Copy link
Author

I don't know why the two files I attached above are 0 bytes. I'm attaching new 
versions here.

Original comment by dan.sp...@gmail.com on 17 Jul 2010 at 2:04

Attachments:

@GoogleCodeExporter
Copy link
Author

The problem here is that inside bn1() there is no indication that the user set 
both parameters to the same variable. Therefore bn1() is evaluated as though 
they were distinct, and, emerging on the other side, nothing is done to ensure 
that they are indeed the same.

Ideally, we should bring the implicit $B = $N constraint with us from the 
moment we start evaluating bn1. This could perhaps be done by not running bn1 
as declared, but instead running

  bn($B,$I), bn($I,$N), $B = $N

which the optimizer would automatically turn into

  bn($B,$I), $B = $N, bn($I,$N)

which would again mean that the last bn would run with both columns bound, and 
so the final broader-narrower predicate would filter instead of producing more 
temporary results to be handled later.

Actually doing this in practice seems a bit tricky, though.

A simpler and more straightforward solution would be to fix the code that 
translates the result of bn1 into the variables used in the calling context 
(that is, the top-level query) to take into account the restriction that both 
result rows that map to $B have to agree for a row to be acceptable. This 
should have been there all along, of course.

Original comment by lar...@gmail.com on 19 Jul 2010 at 9:09

  • Changed state: Accepted
  • Added labels: Component-Tolog

@GoogleCodeExporter
Copy link
Author

Fixed by taking the second route in revision 1188. Added your example data and 
query as the test case in the test suite. I hope that is OK.

Original comment by lar...@gmail.com on 19 Jul 2010 at 11:38

  • Changed state: Verified

@GoogleCodeExporter
Copy link
Author

That's great! Thanks.

Original comment by dan.sp...@gmail.com on 19 Jul 2010 at 3:42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant