typhon-project / typhonql

Typhon Query Language
Eclipse Public License 2.0
4 stars 1 forks source link

[BUG] Select query with #polygon parameter does not parse #113

Closed platux closed 3 years ago

platux commented 3 years ago

Describe the bug

When executing this QL query via the HTTP API

{ "query": "from EXTENT e select e where e.bounding_box in #polygon((130.7955 -19.742, 130.7955 1.9883, 165.2834 1.9883, 165.2834 -19.742, 130.7955 -19.742))" }

we gen an error related to the query parsing what is the correct syntax for the spatial select using a polygon item?

Query

{
"query": "from EXTENT e select e where e.bounding_box in #polygon((130.7955 -19.742, 130.7955 1.9883, 165.2834 1.9883, 165.2834 -19.742, 130.7955 -19.742))"
}

Model

entity EXTENT {
    bounding_box: polygon
    time_period_id: string[100]
    time_period_type: string[100]
    ex_begin: datetime
    ex_end: datetime
    inspire -> INSPIRE[1]
}

Expected behavior

list of results

REST API

the following is returned: {"timestamp":"2021-01-08T19:32:04.644+0000","status":500,"error":"Internal Server Error","message":"500 Server Error","path":"/api/query"}

log of the typhonQL server

19:18:18.932 [qtp402405659-13] ERROR engineering.swat.typhonql.server.QLRestServer - Failed to handle response org.rascalmpl.interpreter.control_exceptions.Throw: |lib://typhonql/src/lang/typhonql/RunUsingCompiler.rsc|:249,69: "Error parsing:\nfrom EXTENT e select e where e.bounding_box in #polygon(130.7955 -19.742, 130.7955 1.9883, 165.2834 1.9883, 165.2834 -19.742, 130.7955 -19.742)\nposition: \<1,56> -- \<1,57>" at org.rascalmpl.interpreter.control_exceptions.ControlException.reallyFillInStackTrace(ControlException.java:42) ~[rascal-0.18.2.jar:?]

if removing one set of brakets"(" ")", the error is in the "#" character. if removing the "#" character, the error is in the first coma in the points

130.7955 -19.742, <-----

tvdstorm commented 3 years ago

Should be fixed in b8be9762