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

Converting WOQL-JS to WOQL-JSON to WOQL-JS did not work: SYNTAX ERROR: WOQL.decimal is not a function #305

Open
alexander-mart opened this issue Nov 29, 2023 · 3 comments

Comments

@alexander-mart
Copy link
Contributor

alexander-mart commented Nov 29, 2023

After toogle mode to JSON and back to WOQL and again to JSON (two times) with example query from docs i receive error: WOQL.decimal is not a function

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

How to reproduce:

  1. Paste example in WOQL-mode and run:
    SERVER ERROR: Not well formed WOQL JSON-LD
let v = Vars("result");
evaluate(times(2,3), v.result)
  1. Convert to JSON:
{
  "@type": "Eval",
  "expression": {
    "@type": "Times",
    "left": {
      "@type": "ArithmeticValue",
      "data": {
        "@type": "xsd:decimal",
        "@value": 2
      }
    },
    "right": {
      "@type": "ArithmeticValue",
      "data": {
        "@type": "xsd:decimal",
        "@value": 3
      }
    }
  },
  "result": {
    "@type": "ArithmeticValue",
    "variable": "result"
  }
}
  1. Convert to WOQL:
WOQL.eval(WOQL.times({"@type":"xsd:decimal","@value":2}, {"@type":"xsd:decimal","@value":3}), "v:result")
  1. Convert to JSON:
{
  "@type": "Eval",
  "expression": {
    "@type": "Times",
    "left": {
      "@type": "xsd:decimal",
      "@value": 2
    },
    "right": {
      "@type": "xsd:decimal",
      "@value": 3
    }
  },
  "result": {
    "@type": "ArithmeticValue",
    "variable": "result"
  }
}
  1. Convert to WOQL:
WOQL.eval(WOQL.times(WOQL.decimal(2), WOQL.decimal(3)), "v:result")
  1. Convert to JSON:
    SYNTAX ERROR: WOQL.decimal is not a function
@alexander-mart
Copy link
Contributor Author

From Discord:

LaurentS:
We tried replacing xsd:decimal with its equivalent (according to the docs) xsd:double but it didn't help.

@alexander-mart
Copy link
Contributor Author

@GavinMendelGleason Give me a hint where to look at the code that is responsible for this? I'll try to find a bug or missing method

@alexander-mart
Copy link
Contributor Author

Related issue about unable to using math methods: terminusdb/terminusdb#2076

@alexander-mart alexander-mart changed the title SYNTAX ERROR: WOQL.decimal is not a function Converting WOQL-JS to WOQL-JSON to WOQL-JS did not work: SYNTAX ERROR: WOQL.decimal is not a function Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant