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

Can't use times() and all of other math WOQL methods as described in the documentation with error: SERVER ERROR: The query you have sent has no viable mode. Some variables can not be bound under any reordering. #2076

Open
alexander-mart opened this issue Jan 9, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@alexander-mart
Copy link
Contributor

alexander-mart commented Jan 9, 2024

Describe the bug

Doc page:
https://terminusdb.com/docs/maths-based-queries-in-woql/

To Reproduce

  1. Go to documentation page Mathematical Operations in WOQL and copy first example about how to use multiply in WOQL with times() and evaluate() methods

  2. Paste example in WOQL-mode and run:

let v = Vars("result");
evaluate(times(2,3), v.result)

or this (short equivalent):

evaluate(times(2,3), "v:result")

and other math methods:

WOQL.eval(WOQL.plus(2,3)    , "v:result")
WOQL.eval(WOQL.minus(2,3)   , "v:result")
WOQL.eval(WOQL.divide(2,3)  , "v:result")
WOQL.eval(WOQL.div(2,3)     , "v:result")
WOQL.eval(WOQL.exp(2,3)     , "v:result")
WOQL.eval(WOQL.floor(10.123), "v:result")
  1. Receive:
    SERVER ERROR: The query you have sent has no viable mode. Some variables can not be bound under any reordering.

Expected behavior

evaluate(times(2,3), "v:result")

should receive:

[ {"result": {"@type": "xsd:decimal", "@value": 6}} ]

Screenshots

Info (please complete the following information):

  • terminusdb cloud: ?
  • terminusdb self-hosted: v11.1.9

Additional context

@alexander-mart
Copy link
Contributor Author

alexander-mart commented Jan 9, 2024

There is no mention of evaluate here:
https://github.com/terminusdb/terminusdb/blob/main/src/core/query/json_woql.pl

Or there:
https://github.com/search?q=repo%3Aterminusdb%2Fterminusdb%20evaluate&type=code

But this is answer to why is evaluate was not found:
https://github.com/terminusdb/terminusdb-client-js/blob/main/lib/woql.js#L487

because only eval WOQL-method is exist, and evaluate() is only alias to eval()

@alexander-mart
Copy link
Contributor Author

alexander-mart commented Jan 9, 2024

Attempt to call evaluate() in chain-style from limit():

WOQL.limit(100).evaluate(WOQL.times(2,3), "v:result")

Return query-parser error:
SYNTAX ERROR: WOQL.limit(...).evaluate is not a function

But

WOQL.limit(100).eval(WOQL.times(2,3), "v:result")

Return server error:
SERVER ERROR: The query you have sent has no viable mode. Some variables can not be bound under any reordering.

👉 Shold we put it in a separate issue?

@alexander-mart alexander-mart changed the title Can't use times() and other math WOQL methods as described in the documentation with error: SERVER ERROR: The query you have sent has no viable mode. Some variables can not be bound under any reordering. Can't use times() and all of other math WOQL methods as described in the documentation with error: SERVER ERROR: The query you have sent has no viable mode. Some variables can not be bound under any reordering. Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant