typeql icon indicating copy to clipboard operation
typeql copied to clipboard

Using standard form for numeric literals throws an error when parsed

Open james-whiteside opened this issue 2 years ago • 5 comments

Description

Numbers expressed in standard form (exponent notation) are not currently accepted as valid syntax.

Environment

  1. OS: MacOS 12.6.1
  2. TypeDB version: TypeDB 2.17.0
  3. TypeDB client: Studio 6d1b4f730df08d1d96bff66a7f48f974f9088f58

Reproducible Steps

Run a query involving a number in standard form, for example:

match
$g isa geo-entity, has alpha-three-code "AFW";
$i isa indicator-entity, has series-code "IT.NET.USER.ZS";
$y isa year; $y = 1994;
insert
(subject: $g, indicator: $i, year: $y) isa indicator-data, has value 4.37347303003985e-06;

Expected Output

Query is accepted.

Actual Output

## Error> [TQL03] TypeQL Error: There is a syntax error at line 1:
match $g isa geo-entity, has alpha-three-code "AFW"; $i isa indicator-entity, has series-code "IT.NET.USER.ZS"; $y isa year; $y = 1994; insert (subject: $g, indicator: $i, year: $y) isa indicator-data, has value 4.37347303003985e-06;
                                                                                                                                                                                                                                    ^
extraneous input 'e-06' expecting ';'

james-whiteside avatar Jun 06 '23 10:06 james-whiteside

match $g isa geo-entity, has alpha-three-code "AFW"; $i isa indicator-entity, has series-code "IT.NET.USER.ZS"; $y isa year; $y = 1994; insert (subject: $g, indicator: $i, year: $y) isa indicator-data, has value 4.37347303003985e-06;

Try this , this will help you . You are getting an error just because of the indentation error. You need to gave some space after match and then write your query , in the same way write insert just below the match and after that rest of your query.

shaad00 avatar Jun 06 '23 11:06 shaad00

Try this , this will help you . You are getting an error just because of the indentation error. You need to gave some space after match and then write your query , in the same way write insert just below the match and after that rest of your query.

I'm not sure that's correct. TypeQL doesn't take into account indentation of queries when parsed. I've tested the same query but with numbers changed from standard form to place-value form and it's running fine.

james-whiteside avatar Jun 06 '23 11:06 james-whiteside

ohhh , that's cool if it's working fine with another value . I will try to find it out .

shaad00 avatar Jun 06 '23 11:06 shaad00

you can check the data type of the 'value' attribute and ensure that it matches the data type of the value you're trying to insert. If you're still having trouble, please let me know and I'll do my best to assist you further.

shaad00 avatar Jun 06 '23 11:06 shaad00

@james-whiteside the title "Numbers in standard form are not valid syntax" is a pretty unclear description of what you're actually outlining? Please refine

flyingsilverfin avatar Jun 09 '23 09:06 flyingsilverfin