Skip to content

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

Closed
@alexander-mart

Description

@alexander-mart

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions