Hi Andrea and Jody,

Thanks for the proposals and comments.

Le 23/12/2020 à 09:40, Andrea Aime a écrit :
Agreed with Jody, should be a new set of functions, you can delegate to the old one if needed (but not fully, the Name returned cannot be the same). Should be doable with just a factory and a generic function wrapper instanciated with the target function and the new name to be used... as long as the semantic of the function is the same
(I'd expect it to be, but wouldn't just assume it).

This is my idea also. I will check all the functions to look on the semantic(s) and the algorithm(s).


What is worrying me a bit is, to what point do you want to push this? Having them in CQL is fine. Having a 1-1 translation down in SQL, done in FilterToSQL, the class shared by all databases, is not: some databases would not natively support the functions anyways. Examples are GeoTools own H2 store, Oracle with Locator extension (afaik), GeoPackage. So, the eventual encoding down in SQL should be left to a case by case decision.

At OGC spec level there is a lake of definition about a standardized expression language that permits to query a data-source. CQL implementation in Geotools solved partially this issue. It's quite comfortable and a very good idea to reuse CQL text language to offer a way to query any kind of feature sources. Nevertheless, it can be confusing for a user to have on one side functions whose names are standardized  (and that he can use in a language like SQL)  and on the other side functions that depend on vendor spec or a specific usage.

Let's take the case of the geomlength function in GT that returns the length of a geometry. If I'm not wrong, the compliant name in ISO/TC 211, ISO /IEC JTC 1/SC 32/WG 4 - SQL MM or OGC -SFS is length, prefixed with the ST_ for SQL part. I understand that CQL is based on Filter Encoding Spec so using contains, intersects without st_ are absolutely compliant with the spec.

But because the use of CQL can be extended to any kind of datasources not only set of features from a WFS service, I think it'd be nice to offer a way to use the SFS function names in CQL. The impact will be positive since a user who manipulates the spatial SQL will not be lost in the CQL domain.  Of course it will not have the same possibilities than SQL to write complex expressions (e.g subquery or window expressions), but for basic "SELECT" it will be enough.

This is my idea : add support to SFS names in CQL (filter and expression) without breaking anything in the parser ;-)

I'd like to push CQL in the next feature2D style encoding POC based on SymCore to have this kind of encoding  : https://twitter.com/OrbisGIS/status/1339904475004342274

Cheers and Merry Christmas with your family and friends.

Erwan



Cheers
Andrea

On Wed, Dec 23, 2020 at 3:41 AM Jody Garnett <jody.garn...@gmail.com <mailto:jody.garn...@gmail.com>> wrote:

    Yep, that is just the only reference we have mapping from SFSQL to
    geotools functions right now.

    And yeah, you should be able to extend not geotools function, but
    geotools function factory.

    1. Make a new FunctionFactory listing the SFSQL function names
    2. Make a Function wrapper implementation
    3. Use the wrapper to create any SFSQL function name instance
    requested

    --
    Jody Garnett


    On Tue, 22 Dec 2020 at 08:42, Erwan Bocher
    <erwan.boc...@univ-ubs.fr <mailto:erwan.boc...@univ-ubs.fr>> wrote:

        Jody,

        I know that but I want to use the SFS function names in ECQL.

        If I understand well the way to do that is to extend the
        current geotools function and filter on my side and register
        them ?

        Erwan

        Le 22/12/2020 à 08:47, Jody Garnett a écrit :
        Erwan:

        It depends a bit on each database, you will find that many of
        them implement the SFSQL specification.

        Here is one for PostGIS:
        
https://github.com/geotools/geotools/blob/master/modules/plugin/jdbc/jdbc-postgis/src/main/java/org/geotools/data/postgis/FilterToSqlHelper.java



        --
        Jody Garnett


        On Mon, 7 Dec 2020 at 07:50, Erwan Bocher
        <erwan.boc...@univ-ubs.fr <mailto:erwan.boc...@univ-ubs.fr>>
        wrote:

            Hi,

            I have a first prototype to convert SQL expression to
            Geotools
            Expression available as a draft here
            https://github.com/orbisgis/orbisgis/pull/1404

            Spatial databases use ST_ prefix to define spatial
            function. e.g
            st_area, st_centroid

            Geotools expression and filter function doesn't.

            I added a workaround in the sql to expression parser to
            check when the
            sql expression contains a "st_" function and rename it to
            a geotools
            representation.

            I'd like to known if there is a simple way to aliasing
            filter function
            in geotools and write something like that

            st_area(the_geom) >1000 instead of area(the_geom) >1000

            best regards

            Erwan

-- Ingénieur de Recherche CNRS - HDR,
            Laboratoire Lab-STICC – UMR 6285
            Equipe DECIDE
            Institut Universitaire de Technologie de Vannes
            8, Rue Montaigne - BP 561 56017 Vannes Cedex
            T: +33 2 97 62 64 92
            W: https://cv.archives-ouvertes.fr/erwan-bocher
            W: http://www.labsticc.fr



            _______________________________________________
            GeoTools-GT2-Users mailing list
            GeoTools-GT2-Users@lists.sourceforge.net
            <mailto:GeoTools-GT2-Users@lists.sourceforge.net>
            https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

-- Ingénieur de Recherche CNRS - HDR,
        Laboratoire Lab-STICC – UMR 6285
        Equipe DECIDE
        Institut Universitaire de Technologie de Vannes
        8, Rue Montaigne - BP 561 56017 Vannes Cedex
        T: +33 2 97 62 64 92
        W:https://cv.archives-ouvertes.fr/erwan-bocher
        W:http://www.labsticc.fr

        _______________________________________________
        GeoTools-GT2-Users mailing list
        GeoTools-GT2-Users@lists.sourceforge.net
        <mailto:GeoTools-GT2-Users@lists.sourceforge.net>
        https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

    _______________________________________________
    GeoTools-GT2-Users mailing list
    GeoTools-GT2-Users@lists.sourceforge.net
    <mailto:GeoTools-GT2-Users@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users



--

Regards, Andrea Aime

== GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- /Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail./

--
Ingénieur de Recherche CNRS - HDR,
Laboratoire Lab-STICC – UMR 6285
Equipe DECIDE
Institut Universitaire de Technologie de Vannes
8, Rue Montaigne - BP 561 56017 Vannes Cedex
T: +33 2 97 62 64 92
W: https://cv.archives-ouvertes.fr/erwan-bocher
W: http://www.labsticc.fr

_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to