frostyfan109 / tranql

A Translator Query Language
https://researchsoftwareinstitute.github.io/data-translator/apps/tranql
MIT License
0 stars 1 forks source link

Handle Floating Point Numbers #94

Closed stevencox closed 5 years ago

stevencox commented 5 years ago

We don't handle floating point numbers correctly in query where clauses.

Currently, max_p_value can be set to 1 and works.

0.5 is turned into a string and ICEES rejects this.

This may be caused by the lexical analyzer in main.py recognizing floating point numbers as strings but integers as numbers.

See this issue

frostyfan109 commented 5 years ago

This seems to be the offending code (in util.py's Context class):

def resolve_arg(self, val):
        if isinstance(val, int):
            return val
        return self.mem.get (val[1:], None) if val.startswith ("$") else val

I'm guessing I can just change this to isinstance(val,str) and place the int part into an else block. Hopefully it doesn't cause any problems.

frostyfan109 commented 5 years ago

The query ran successfully for me and returned fewer nodes and links than the same query when maximum_p_value was 1, so it seems to be working now.