[mapserver-dev] MapServer Expressions and Bracketing

Seth G sethg at geographika.co.uk
Mon Oct 14 03:25:50 PDT 2019


Hi Steve, Daniel,

Thanks for the clarifications. It makes sense to follow SQL as closesly as possible. 
I've made a minor modification to the docs at https://github.com/mapserver/docs/pull/288 to make this clearer. 
I've also added some new msautotests with multipart expressions with and without brackets at https://github.com/mapserver/mapserver/pull/5897 - there were no non-bracketed expressions previously as my mappyfile parser was able to parse all Mapfiles without any issues. 

Seth

--
web:http://geographika.co.uk
twitter: @geographika

On Wed, Oct 9, 2019, at 10:12 PM, Daniel Morissette wrote:
> What Steve wrote was also my understanding, so I'd vote for updating the 
> docs to match the current behavior (and avoid breaking existing maps).
> 
> Daniel
> 
> On 2019-10-09 16:11, Lime, Steve D (MNIT) wrote:
> > The docs are wrong or at least confusing IMHO. The only requirement is that the entire logical expression has a whole needs to be encased in a ()'s so the parser can find it. Sub-expressions do not have to be encased in brackets unless it is needed to establish precedence in terms of how the expression is evaluated. MapServer more closely matches SQL and I wouldn't want to limit that. I do think ()'s can help with readability but they aren't required save the outer ()'s. --Steve
> > 
> > -----Original Message-----
> > From: mapserver-dev [mailto:mapserver-dev-bounces at lists.osgeo.org] On Behalf Of Seth G
> > Sent: Wednesday, October 09, 2019 1:41 PM
> > To: mapserver-dev at lists.osgeo.org
> > Subject: [mapserver-dev] MapServer Expressions and Bracketing
> > 
> > Hi all,
> > 
> > Not sure if this is more of a dev or user question. The docs for logical expressions state each expression should be encapsulated in round brackets e.g. ( ( Expression1 ) AND ( Expression2 ) ). This is how mappyfile expects them (see issue at [1]), however it seems MapServer is more flexible and allows expressions such as:
> > 
> > EXPRESSION ("[TIME]" eq 'NOW' AND NOT "[TYPE]" ~ "(something|completely|different)")
> > 
> > This should really be:
> > 
> > EXPRESSION (("[TIME]" eq 'NOW') AND NOT ("[TYPE]" ~ "(something|completely|different)"))
> > 
> > So should MapServer 8 become stricter and fail these errors and stick to a tighter spec, or should the docs be updated to reflect the reality of the parsing?
> > 
> > Seth
> > 
> > [1] https://github.com/geographika/mappyfile/issues/85
> > 
> > 
> > --
> > web:http://geographika.co.uk
> > twitter: @geographika
> > _______________________________________________
> > mapserver-dev mailing list
> > mapserver-dev at lists.osgeo.org
> > https://lists.osgeo.org/mailman/listinfo/mapserver-dev
> > _______________________________________________
> > mapserver-dev mailing list
> > mapserver-dev at lists.osgeo.org
> > https://lists.osgeo.org/mailman/listinfo/mapserver-dev
> > 
> 
> 
> -- 
> Daniel Morissette
> Mapgears Inc
> T: +1 418-696-5056 #201
> _______________________________________________
> mapserver-dev mailing list
> mapserver-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-dev


More information about the mapserver-dev mailing list