opengeospatial / sensorthings

The official web site of the OGC SensorThings API standard specification.
135 stars 29 forks source link

Filter on empty string #133

Open matcho opened 2 years ago

matcho commented 2 years ago

Hello,

Is there a standard way to properly filter on empty (or non-empty) string ?

someproperty eq '' fails with

{
  "code": 400,
  "type": "error",
  "message": "Query is not valid: Encountered \" \"\\'\\'\" \"\\'\\' \"\" at line 1, column 94.\nWas expecting one of:\n    \"(\" ...\n    <LONG> ...\n    <DOUBLE> ...\n    <DATETIMEINTERVAL> ...\n    <DATETIME> ...\n    <DATE> ...\n    <TIME> ...\n    <DURATION> ...\n    \"eq\" ...\n    \"ne\" ...\n    \"gt\" ...\n    \"ge\" ...\n    \"lt\" ...\n    \"le\" ...\n    \"and\" ...\n    \"or\" ...\n    \"add\" ...\n    \"sub\" ...\n    \"mul\" ...\n    \"div\" ...\n    \"mod\" ...\n    \"expand\" ...\n    \"orderby\" ...\n    \"asc\" ...\n    \"desc\" ...\n    \"top\" ...\n    \"count\" ...\n    \"skip\" ...\n    \"select\" ...\n    \"filter\" ...\n    <QF_LENGTH> ...\n    <QF_INDEXOF> ...\n    <QF_SUBSTRING> ...\n    <QF_TOLOWER> ...\n    <QF_TOUPPER> ...\n    <QF_TRIM> ...\n    <QF_CONCAT> ...\n    <QF_YEAR> ...\n    <QF_MONTH> ...\n    <QF_DAY> ...\n    <QF_HOUR> ...\n    <QF_MINUTE> ...\n    <QF_SECOND> ...\n    <QF_FRACTIONALSECONDS> ...\n    <QF_DATE> ...\n    <QF_TIME> ...\n    <QF_TOTALOFFSETMINUTES> ...\n    <QF_NOW> ...\n    <QF_MINDATETIME> ...\n    <QF_MAXDATETIME> ...\n    <QF_ROUND> ...\n    <QF_FLOOR> ...\n    <QF_CEILING> ...\n    <QF_GEO_DISTANCE> ...\n    <QF_GEO_LENGTH> ...\n    \"true\" ...\n    \"false\" ...\n    <CHARSEQ> ...\n    <GEO_STR_LIT> ...\n    <STR_LIT> ...\n    "
}

Likewise, someproperty eq "" fails with

{
  "code": 400,
  "type": "error",
  "message": "Query is not valid: Lexical error at line 1, column 94.  Encountered: \"\\\"\"(34),
  after: \"\""
}

Currently the workarounds I found are:

Thanks for any advice.

Greetings, Mathias