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

Using standard form for numeric literals throws an error when parsed #288

Open
james-whiteside opened this issue Jun 6, 2023 · 5 comments

Comments

@james-whiteside
Copy link

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 ';'
@shaad00
Copy link

shaad00 commented Jun 6, 2023

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.

@james-whiteside
Copy link
Author

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.

@shaad00
Copy link

shaad00 commented Jun 6, 2023

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

@shaad00
Copy link

shaad00 commented Jun 6, 2023

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.

@flyingsilverfin
Copy link
Member

@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

@james-whiteside james-whiteside changed the title Numbers in standard form are not valid syntax Using standard form for numeric literals throws an error when parsed Jun 9, 2023
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

3 participants