You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2025/08/10 21:14:18 UTC

(sis) branch geoapi-4.0 updated (7c9b89f905 -> d918d5e6fb)

This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a change to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git


    from 7c9b89f905 `MemoryGridResource.read(…)` should support more than 2 dimensions.
     new c9cf4f9e43 Adjust the check for geoid-based realization method.
     new 073df1665d Use a consistent naming convention for the tables that are new in EPSG 10+.
     new d918d5e6fb Rename the enumeration types in `EPSG_Prepare.sql` to the final names that they will have in the database. The previous version was using temporary names which were changed on-the-fly during the installation. Finer conversion to `VARCHAR` for databases that do not support enumerations.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../referencing/factory/sql/AuthorityCodes.java    |   2 +-
 .../referencing/factory/sql/EPSGCodeFinder.java    |   2 +-
 .../referencing/factory/sql/EPSGDataAccess.java    |  24 ++---
 .../sis/referencing/factory/sql/EPSGInstaller.java |  32 +++---
 .../sis/referencing/factory/sql/EPSG_Prepare.sql   |  29 +++---
 .../sis/referencing/factory/sql/SQLTranslator.java | 111 ++++++++++++---------
 .../sis/referencing/factory/sql/TableInfo.java     |  36 +++----
 .../referencing/internal/VerticalDatumTypes.java   |   2 +-
 .../sis/referencing/factory/sql/epsg/README.md     |  11 +-
 9 files changed, 134 insertions(+), 115 deletions(-)


(sis) 03/03: Rename the enumeration types in `EPSG_Prepare.sql` to the final names that they will have in the database. The previous version was using temporary names which were changed on-the-fly during the installation. Finer conversion to `VARCHAR` for databases that do not support enumerations.

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit d918d5e6fb4f6e8ff23b712056cff8b66fa080f5
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Sun Aug 10 14:18:29 2025 +0200

    Rename the enumeration types in `EPSG_Prepare.sql` to the final names that they will have in the database.
    The previous version was using temporary names which were changed on-the-fly during the installation.
    Finer conversion to `VARCHAR` for databases that do not support enumerations.
---
 .../referencing/factory/sql/AuthorityCodes.java    |  2 +-
 .../referencing/factory/sql/EPSGCodeFinder.java    |  2 +-
 .../referencing/factory/sql/EPSGDataAccess.java    |  6 ++--
 .../sis/referencing/factory/sql/EPSGInstaller.java | 22 +++++++------
 .../sis/referencing/factory/sql/EPSG_Prepare.sql   | 20 ++++++------
 .../sis/referencing/factory/sql/SQLTranslator.java | 11 +++++++
 .../sis/referencing/factory/sql/TableInfo.java     | 36 ++++++++++------------
 .../sis/referencing/factory/sql/epsg/README.md     | 11 ++++---
 8 files changed, 60 insertions(+), 50 deletions(-)

diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/AuthorityCodes.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/AuthorityCodes.java
index 5a7eac4e08..27b01d3b7d 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/AuthorityCodes.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/AuthorityCodes.java
@@ -134,7 +134,7 @@ final class AuthorityCodes extends AbstractMap<String,String> implements Seriali
         final int columnNameStart = buffer.append("SELECT ").length();
         final int columnNameEnd = buffer.append(table.codeColumn).length();
         buffer.append(" FROM ").append(table.table);
-        final Class<?> tableType = table.where(type, buffer);
+        final Class<?> tableType = table.where(factory, type, buffer);
         final int conditionStart = buffer.length();
         if (table.showColumn != null) {
             buffer.append(table.showColumn).append("<>0 AND ");
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGCodeFinder.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGCodeFinder.java
index 47975c6b37..cab3292126 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGCodeFinder.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGCodeFinder.java
@@ -418,7 +418,7 @@ crs:    if (isInstance(CoordinateReferenceSystem.class, object)) {
          * It may be absent (typically, only datums or reference frames have that condition).
          */
         buffer.append("SELECT ").append(table.codeColumn).append(" FROM ").append(table.table);
-        table.where(object, buffer);                // Unconditionally append a "WHERE" clause.
+        table.where(dao, object, buffer);           // Unconditionally append a "WHERE" clause.
         boolean isNext = false;
         for (final Condition filter : filters) {
             isNext |= filter.appendToWhere(buffer, isNext);
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
index 88c53ef737..49eca3b051 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
@@ -1596,7 +1596,7 @@ search: try (ResultSet result = executeMetadataQuery("Deprecation",
                  */
                 final FactoryCall<CRSFactory, CoordinateReferenceSystem> constructor;
                 /*
-                 * The following switch statement should have a case for all "epsg_crs_kind" values enumerated
+                 * The following switch statement should have a case for all "CRS Kind" values enumerated
                  * in the "EPSG_Prepare.sql" file, except that the values in this Java code are in lower cases.
                  */
                 switch (type.toLowerCase(Locale.US)) {
@@ -1918,7 +1918,7 @@ search: try (ResultSet result = executeMetadataQuery("Deprecation",
                  */
                 final FactoryCall<DatumFactory, ? extends Datum> constructor;
                 /*
-                 * The following switch statement should have a case for all "epsg_datum_kind" values enumerated
+                 * The following switch statement should have a case for all "Datum Kind" values enumerated
                  * in the "EPSG_Prepare.sql" file, except that the values in this Java code are in lower cases.
                  */
                 switch (type.toLowerCase(Locale.US)) {
@@ -2506,7 +2506,7 @@ search: try (ResultSet result = executeMetadataQuery("Deprecation",
                 final Map<String,Object> properties = createProperties(
                         "Coordinate System", epsg, name, null, null, null, remarks, deprecated);
                 /*
-                 * The following switch statement should have a case for all "epsg_cs_kind" values enumerated
+                 * The following switch statement should have a case for all "CS Kind" values enumerated
                  * in the "EPSG_Prepare.sql" file, except that the values in this Java code are in lower cases.
                  */
                 final CSFactory csFactory = owner.csFactory;
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGInstaller.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGInstaller.java
index 637aba0ca8..95615cb8dc 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGInstaller.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGInstaller.java
@@ -150,22 +150,24 @@ final class EPSGInstaller extends ScriptRunner {
             addReplacement(SQLTranslator.TABLE_PREFIX + "unitofmeasure",              "Unit of Measure");
             addReplacement(SQLTranslator.TABLE_PREFIX + "usage",                      "Usage");
             addReplacement(SQLTranslator.TABLE_PREFIX + "versionhistory",             "Version History");
-            if (isEnumTypeSupported) {
-                addReplacement(SQLTranslator.TABLE_PREFIX + "datum_kind",             "Datum Kind");
-                addReplacement(SQLTranslator.TABLE_PREFIX + "crs_kind",               "CRS Kind");
-                addReplacement(SQLTranslator.TABLE_PREFIX + "cs_kind",                "CS Kind");
-                addReplacement(SQLTranslator.TABLE_PREFIX + "table_name",             "Table Name");
-            }
             prependNamespace(schema);
         }
         if (!isEnumTypeSupported) {
-            addReplacement(SQLTranslator.TABLE_PREFIX + "datum_kind", TableInfo.ENUM_REPLACEMENT);
-            addReplacement(SQLTranslator.TABLE_PREFIX + "crs_kind",   TableInfo.ENUM_REPLACEMENT);
-            addReplacement(SQLTranslator.TABLE_PREFIX + "cs_kind",    TableInfo.ENUM_REPLACEMENT);
-            addReplacement(SQLTranslator.TABLE_PREFIX + "table_name", TableInfo.ENUM_REPLACEMENT);
+            addReplacement("Datum Kind",        "VARCHAR(16)");    // Original: VARCHAR(24) for column "datum_type".
+            addReplacement("CRS Kind",          "VARCHAR(13)");    // Original: VARCHAR(24) for column "coord_ref_sys_kind".
+            addReplacement("CS Kind",           "VARCHAR(15)");    // Original: VARCHAR(24) for column "coord_sys_type".
+            addReplacement("Supersession Type", "VARCHAR(12)");    // Original: VARCHAR(50) for column "supersession_type".
+            addReplacement("Table Name",     ENUM_REPLACEMENT);    // Original: VARCHAR(80) for columns "object_table_name".
         }
     }
 
+    /**
+     * The <abbr>SQL</abbr> type to use as a replacement for enumerated values in databases that do not
+     * support enumerations. The maximal length declared in this constant should be the greatest length
+     * declared in {@code VARCHAR(…)} substitutions done when {@link #isEnumTypeSupported} is false.
+     */
+    static final String ENUM_REPLACEMENT = "VARCHAR(36)";
+
     /**
      * Prepends the given schema or catalog to all table names.
      */
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSG_Prepare.sql b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSG_Prepare.sql
index 7e0bdb267b..8afc412d0f 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSG_Prepare.sql
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSG_Prepare.sql
@@ -10,11 +10,11 @@
 -- If enumerated values are not supported by the database, Apache SIS will automatically replace their usage
 -- by the VARCHAR type.
 --
-CREATE TYPE epsg_datum_kind        AS ENUM ('geodetic', 'vertical', 'temporal', 'engineering', 'dynamic geodetic', 'ensemble');
-CREATE TYPE epsg_crs_kind          AS ENUM ('geocentric', 'geographic 2D', 'geographic 3D', 'projected', 'vertical', 'temporal', 'compound', 'engineering', 'derived');
-CREATE TYPE epsg_cs_kind           AS ENUM ('ellipsoidal', 'spherical', 'Cartesian', 'vertical', 'gravity-related', 'time', 'linear', 'polar', 'cylindrical', 'affine', 'ordinal');
-CREATE TYPE epsg_supersession_type AS ENUM ('Supersession');
-CREATE TYPE epsg_table_name        AS ENUM
+CREATE TYPE "Datum Kind"        AS ENUM ('geodetic', 'vertical', 'temporal', 'engineering', 'dynamic geodetic', 'ensemble');
+CREATE TYPE "CRS Kind"          AS ENUM ('geocentric', 'geographic 2D', 'geographic 3D', 'projected', 'vertical', 'temporal', 'compound', 'engineering', 'derived');
+CREATE TYPE "CS Kind"           AS ENUM ('ellipsoidal', 'spherical', 'Cartesian', 'vertical', 'gravity-related', 'time', 'linear', 'polar', 'cylindrical', 'affine', 'ordinal');
+CREATE TYPE "Supersession Type" AS ENUM ('Supersession');
+CREATE TYPE "Table Name"        AS ENUM
    ('Alias',
     'Area',         -- Deprecated (removed in EPSG 10).
     'Change',
@@ -48,8 +48,8 @@ CREATE TYPE epsg_table_name        AS ENUM
 --
 -- Those casts allow to use enumerated values as if they were VARCHAR elements.
 --
-CREATE CAST (VARCHAR AS epsg_datum_kind)        WITH INOUT AS ASSIGNMENT;
-CREATE CAST (VARCHAR AS epsg_crs_kind)          WITH INOUT AS ASSIGNMENT;
-CREATE CAST (VARCHAR AS epsg_cs_kind)           WITH INOUT AS ASSIGNMENT;
-CREATE CAST (VARCHAR AS epsg_supersession_type) WITH INOUT AS ASSIGNMENT;
-CREATE CAST (VARCHAR AS epsg_table_name)        WITH INOUT AS ASSIGNMENT;
+CREATE CAST (VARCHAR AS "Datum Kind")        WITH INOUT AS ASSIGNMENT;
+CREATE CAST (VARCHAR AS "CRS Kind")          WITH INOUT AS ASSIGNMENT;
+CREATE CAST (VARCHAR AS "CS Kind")           WITH INOUT AS ASSIGNMENT;
+CREATE CAST (VARCHAR AS "Supersession Type") WITH INOUT AS ASSIGNMENT;
+CREATE CAST (VARCHAR AS "Table Name")        WITH INOUT AS ASSIGNMENT;
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/SQLTranslator.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/SQLTranslator.java
index 95327f20ac..d84b6f3d96 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/SQLTranslator.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/SQLTranslator.java
@@ -230,6 +230,8 @@ public class SQLTranslator implements UnaryOperator<String> {
      * Non-null if the {@value #ENUMERATION_COLUMN} column in {@code "Alias"} table uses enumeration instead
      * than character varying. In such case, this field contains the enumeration type. If {@code null}, then
      * then column type is {@code VARCHAR} and the cast can be omitted.
+     *
+     * @see #useEnumerations()
      */
     private String tableNameEnum;
 
@@ -570,6 +572,15 @@ check:  for (;;) {
         return useBoolean;
     }
 
+    /**
+     * Returns {@code true} if the database uses enumeration values where applicable.
+     * This method use the {@value #ENUMERATION_COLUMN} column as a sentinel value for
+     * detecting whether enumerations are used for the whole <abbr>EPSG</abbr> database.
+     */
+    final boolean useEnumerations() {
+        return tableNameEnum != null;
+    }
+
     /**
      * Converts a mixed-case table name to the convention used in the database.
      * The names of the tables for the two conventions are listed in a table in the Javadoc of this class.
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/TableInfo.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/TableInfo.java
index b2afeba4e5..55c0a8653b 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/TableInfo.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/TableInfo.java
@@ -69,8 +69,8 @@ final class TableInfo {
      * <h4>Ambiguity</h4>
      * As of ISO 19111:2019, we have no standard way to identify the geocentric case from a {@link Class} argument
      * because the standard does not provide the {@code GeocentricCRS} interface. This implementation fallbacks on
-     * the SIS-specific geocentric CRS class, with a {@link #where(IdentifiedObject, StringBuilder)} method which
-     * will substitute implementation-neutral objects by the Apache SIS class.
+     * the SIS-specific geocentric CRS class, with a {@link #where(EPSGDataAccess, IdentifiedObject, StringBuilder)}
+     * method which will substitute implementation-neutral objects by the Apache SIS class.
      */
     static final TableInfo[] EPSG = {
         CRS = new TableInfo(CoordinateReferenceSystem.class,
@@ -187,17 +187,10 @@ final class TableInfo {
     final String nameColumn;
 
     /**
-     * Column type for the type (usually with the {@code "_TYPE"} suffix), or {@code null}.
-     * {@link EPSGDataAccess} and {@link AuthorityCodes} assume that values in this column
-     * are not longer than the maximal length specified in {@value #ENUM_REPLACEMENT}.
+     * Column name for the type (usually with the {@code "_TYPE"} suffix), or {@code null}.
      */
     private final String typeColumn;
 
-    /**
-     * The SQL type to use as a replacement for enumerated values on databases that do not support enumerations.
-     */
-    static final String ENUM_REPLACEMENT = "VARCHAR(80)";
-
     /**
      * Sub-interfaces of {@link #type} to handle, or {@code null} if none.
      */
@@ -257,7 +250,7 @@ final class TableInfo {
 
     /**
      * Returns the class of objects created from the given table. The given table name should be one of
-     * the values enumerated in the {@code epsg_table_name} types of the {@code EPSG_Prepare.sql} file.
+     * the values enumerated in the {@code "Table Name"} types of the {@code EPSG_Prepare.sql} file.
      * The name may be prefixed by {@code "epsg_"} and may contain abbreviations of the full name.
      * For example, {@code "epsg_coordoperation"} is considered as a match for {@code "Coordinate_Operation"}.
      *
@@ -280,13 +273,14 @@ final class TableInfo {
 
     /**
      * Appends a {@code WHERE} clause together with a condition for searching the specified object.
-     * This method delegates to {@link #where(Class, StringBuilder)} with the type of the given object,
-     * except that some object properties may be inspected for resolving ambiguities.
+     * This method delegates to {@link #where(EPSGDataAccess, Class, StringBuilder)} with the type
+     * of the given object, except that some object properties may be inspected for resolving ambiguities.
      *
-     * @param  object  the object to search in the database.
-     * @param  buffer  where to append the {@code WHERE} clause.
+     * @param  factory  the factory which is writing a <abbr>SQL</abbr> statement.
+     * @param  object   the object to search in the database.
+     * @param  buffer   where to append the {@code WHERE} clause.
      */
-    final void where(final IdentifiedObject object, final StringBuilder buffer) {
+    final void where(final EPSGDataAccess factory, final IdentifiedObject object, final StringBuilder buffer) {
         Class<?> userType = object.getClass();
         if (object instanceof GeodeticCRS) {
             final CoordinateSystem cs = ((GeodeticCRS) object).getCoordinateSystem();
@@ -296,7 +290,7 @@ final class TableInfo {
                 userType = DefaultGeocentricCRS.class;
             }
         }
-        where(userType, buffer);
+        where(factory, userType, buffer);
     }
 
     /**
@@ -310,18 +304,20 @@ final class TableInfo {
      *
      * The caller shall add at least one condition after this method call.
      *
+     * @param  factory   the factory which is writing a <abbr>SQL</abbr> statement.
      * @param  userType  the type specified by the user.
      * @param  buffer    where to append the {@code WHERE} clause.
      * @return the subtype, or {@link #type} if no subtype was found.
      */
-    final Class<?> where(final Class<?> userType, final StringBuilder buffer) {
+    final Class<?> where(final EPSGDataAccess factory, final Class<?> userType, final StringBuilder buffer) {
         buffer.append(" WHERE ");
         if (typeColumn != null) {
             for (int i=0; i<subTypes.length; i++) {
                 final Class<?> candidate = subTypes[i];
                 if (candidate.isAssignableFrom(userType)) {
-                    if (ENUM_REPLACEMENT != null) {
-                        buffer.append("CAST(").append(typeColumn).append(" AS ").append(ENUM_REPLACEMENT).append(')');
+                    if (factory.translator.useEnumerations()) {
+                        buffer.append("CAST(").append(typeColumn).append(" AS ")
+                                .append(EPSGInstaller.ENUM_REPLACEMENT).append(')');
                     } else {
                         buffer.append(typeColumn);
                     }
diff --git a/optional/src/org.apache.sis.referencing.epsg/test/org/apache/sis/referencing/factory/sql/epsg/README.md b/optional/src/org.apache.sis.referencing.epsg/test/org/apache/sis/referencing/factory/sql/epsg/README.md
index 905941e658..5a5b1998d4 100644
--- a/optional/src/org.apache.sis.referencing.epsg/test/org/apache/sis/referencing/factory/sql/epsg/README.md
+++ b/optional/src/org.apache.sis.referencing.epsg/test/org/apache/sis/referencing/factory/sql/epsg/README.md
@@ -72,11 +72,12 @@ Open the `Tables.sql` file for edition:
 * Change all `FLOAT` types to `DOUBLE PRECISION` because Apache SIS reads all numbers as `double` type.
   This change avoids spurious digits in the conversions from `float` to `double`.
 * Change the type of `epsg_usage` column from `SERIAL` to `INTEGER NOT NULL`.
-* Change the type of every `table_name` columns from `VARCHAR(80)` to `epsg_table_name`.
-* Change the type of `coord_ref_sys_kind` column from `VARCHAR(24)` to `epsg_crs_kind`.
-* Change the type of `coord_sys_type` column from `VARCHAR(24)` to `epsg_cs_kind`.
-* Change the type of `datum_type` column from `VARCHAR(24)` to `epsg_datum_kind`.
-* Change the type of `supersession_type` column from `VARCHAR(50)` to `epsg_supersession_type`.
+* Change the type of every `table_name` columns from `VARCHAR(80)` to `"Table Name"`.
+* Change the type of `coord_ref_sys_kind` column from `VARCHAR(24)` to `"CRS Kind"`.
+* Change the type of `coord_sys_type` column from `VARCHAR(24)` to `"CS Kind"`.
+* Change the type of `datum_type` column from `VARCHAR(24)` to `"Datum Kind"`.
+* Change the type of `supersession_type` column from `VARCHAR(50)` to `"Supersession Type"`.
+* If new enumeration values are added, check the maximal lengths of `VARCHAR` replacements in `EPSGInstaller`.
 * Suppress trailing spaces and save.
 
 Then open the `FKeys.sql` file for edition:


(sis) 02/03: Use a consistent naming convention for the tables that are new in EPSG 10+.

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit 073df1665d295b2315bc8fe7e5d60924cbc6a908
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Sun Aug 10 13:43:00 2025 +0200

    Use a consistent naming convention for the tables that are new in EPSG 10+.
---
 .../referencing/factory/sql/EPSGDataAccess.java    |  18 ++--
 .../sis/referencing/factory/sql/EPSGInstaller.java |  10 +--
 .../sis/referencing/factory/sql/EPSG_Prepare.sql   |   9 +-
 .../sis/referencing/factory/sql/SQLTranslator.java | 100 +++++++++++----------
 4 files changed, 73 insertions(+), 64 deletions(-)

diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
index 59997d0496..88c53ef737 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
@@ -2009,9 +2009,9 @@ search: try (ResultSet result = executeMetadataQuery("Deprecation",
     {
         double max = Double.NaN;
         try (ResultSet result = executeQueryForCodes(
-                "DatumEnsemble",
+                "Datum Ensemble",
                 "SELECT ENSEMBLE_ACCURACY"
-                        + " FROM \"DatumEnsemble\""
+                        + " FROM \"Datum Ensemble\""
                         + " WHERE DATUM_ENSEMBLE_CODE = ?", code))
         {
             // Should have exactly one value. The loop is a paranoiac safety.
@@ -2025,9 +2025,9 @@ search: try (ResultSet result = executeMetadataQuery("Deprecation",
         final var accuracy = PositionalAccuracyConstant.ensemble(max);
         final List<Datum> members = createComponents(
                 GeodeticAuthorityFactory::createDatum,
-                "DatumEnsembleMember",
+                "Datum Ensemble Member",
                 "SELECT DATUM_CODE"
-                        + " FROM \"DatumEnsembleMember\""
+                        + " FROM \"Datum Ensemble Member\""
                         + " WHERE DATUM_ENSEMBLE_CODE = ?"
                         + " ORDER BY DATUM_SEQUENCE", code);
         return (factory, metadata) -> DefaultDatumEnsemble.castOrCopy(factory.createDatumEnsemble(metadata, members, accuracy));
@@ -2104,12 +2104,12 @@ search: try (ResultSet result = executeMetadataQuery("Deprecation",
         var returnValue = (IdentifiedObject) localCache.get(cacheKey);
         if (returnValue == null) {
             try (ResultSet result = executeQueryForCodes(
-                    "ConventionalRS",
+                    "Conventional RS",
                     "SELECT"+ /* column 1 */ " CONVENTIONAL_RS_CODE,"
                             + /* column 2 */ " CONVENTIONAL_RS_NAME,"
                             + /* column 3 */ " REMARKS,"
                             + /* column 4 */ " DEPRECATED"
-                            + " FROM \"ConventionalRS\""
+                            + " FROM \"Conventional RS\""
                             + " WHERE CONVENTIONAL_RS_CODE = ?", code))
             {
                 while (result.next()) {
@@ -2123,7 +2123,7 @@ search: try (ResultSet result = executeMetadataQuery("Deprecation",
                      */
                     @SuppressWarnings("LocalVariableHidesMemberVariable")
                     final Map<String,Object> properties = createProperties(
-                            "ConventionalRS", epsg, name, null, null, null, remarks, deprecated);
+                            "Conventional RS", epsg, name, null, null, null, remarks, deprecated);
                     returnValue = ensureSingleton(new AbstractIdentifiedObject(properties), returnValue, code);
                     if (result.isClosed()) break;   // See createProperties(…) for explanation.
                 }
@@ -2723,9 +2723,9 @@ search: try (ResultSet result = executeMetadataQuery("Deprecation",
         var returnValue = (RealizationMethod) localCache.get(cacheKey);
         if (returnValue == null && code != null) {
             try (ResultSet result = executeQueryForCodes(
-                    "DatumRealizationMethod",
+                    "Datum Realization Method",
                     "SELECT REALIZATION_METHOD_NAME"
-                            + " FROM \"DatumRealizationMethod\""
+                            + " FROM \"Datum Realization Method\""
                             + " WHERE REALIZATION_METHOD_CODE = ?", code))
             {
                 while (result.next()) {
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGInstaller.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGInstaller.java
index 124eb96682..637aba0ca8 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGInstaller.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGInstaller.java
@@ -124,7 +124,7 @@ final class EPSGInstaller extends ScriptRunner {
             addReplacement(SQLTranslator.TABLE_PREFIX + "alias",                      "Alias");
             addReplacement(SQLTranslator.TABLE_PREFIX + "area",                       "Area");      // Deprecated (removed in EPSG 10)
             addReplacement(SQLTranslator.TABLE_PREFIX + "change",                     "Change");
-            addReplacement(SQLTranslator.TABLE_PREFIX + "conventionalrs",             "ConventionalRS");
+            addReplacement(SQLTranslator.TABLE_PREFIX + "conventionalrs",             "Conventional RS");
             addReplacement(SQLTranslator.TABLE_PREFIX + "coordinateaxis",             "Coordinate Axis");
             addReplacement(SQLTranslator.TABLE_PREFIX + "coordinateaxisname",         "Coordinate Axis Name");
             addReplacement(SQLTranslator.TABLE_PREFIX + "coordoperation",             "Coordinate_Operation");
@@ -136,10 +136,10 @@ final class EPSGInstaller extends ScriptRunner {
             addReplacement(SQLTranslator.TABLE_PREFIX + "coordinatereferencesystem",  "Coordinate Reference System");
             addReplacement(SQLTranslator.TABLE_PREFIX + "coordinatesystem",           "Coordinate System");
             addReplacement(SQLTranslator.TABLE_PREFIX + "datum",                      "Datum");
-            addReplacement(SQLTranslator.TABLE_PREFIX + "datumensemble",              "DatumEnsemble");
-            addReplacement(SQLTranslator.TABLE_PREFIX + "datumensemblemember",        "DatumEnsembleMember");
-            addReplacement(SQLTranslator.TABLE_PREFIX + "datumrealizationmethod",     "DatumRealizationMethod");
-            addReplacement(SQLTranslator.TABLE_PREFIX + "definingoperation",          "DefiningOperation");
+            addReplacement(SQLTranslator.TABLE_PREFIX + "datumensemble",              "Datum Ensemble");
+            addReplacement(SQLTranslator.TABLE_PREFIX + "datumensemblemember",        "Datum Ensemble Member");
+            addReplacement(SQLTranslator.TABLE_PREFIX + "datumrealizationmethod",     "Datum Realization Method");
+            addReplacement(SQLTranslator.TABLE_PREFIX + "definingoperation",          "Defining Operation");
             addReplacement(SQLTranslator.TABLE_PREFIX + "deprecation",                "Deprecation");
             addReplacement(SQLTranslator.TABLE_PREFIX + "ellipsoid",                  "Ellipsoid");
             addReplacement(SQLTranslator.TABLE_PREFIX + "extent",                     "Extent");
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSG_Prepare.sql b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSG_Prepare.sql
index b84c8ad6d4..7e0bdb267b 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSG_Prepare.sql
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSG_Prepare.sql
@@ -17,7 +17,6 @@ CREATE TYPE epsg_supersession_type AS ENUM ('Supersession');
 CREATE TYPE epsg_table_name        AS ENUM
    ('Alias',
     'Area',         -- Deprecated (removed in EPSG 10).
-    'AxisName',     -- Deprecated (removed in EPSG 10).
     'Change',
     'ConventionalRS',
     'Coordinate Axis',
@@ -31,10 +30,10 @@ CREATE TYPE epsg_table_name        AS ENUM
     'Coordinate Reference System',
     'Coordinate System',
     'Datum',
-    'DatumEnsemble',
-    'DatumEnsembleMember',
-    'DatumRealizationMethod',
-    'DefiningOperation',
+    'Datum Ensemble',
+    'Datum Ensemble Member',
+    'Datum Realization Method',
+    'Defining Operation',
     'Deprecation',
     'Ellipsoid',
     'Extent',
diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/SQLTranslator.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/SQLTranslator.java
index ca2979436d..95327f20ac 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/SQLTranslator.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/SQLTranslator.java
@@ -55,58 +55,68 @@ import org.apache.sis.referencing.internal.Resources;
  *   <li>{@code SELECT * FROM epsg_CoordinateReferenceSystem} (same as above with {@code "epsg_"} prefix added)</li>
  * </ul>
  *
- * Above possibilities differ in the letter cases, spaces and {@code "epsg_"} prefix (non-exhaustive).
- * Those differences exist between the <abbr>EPSG</abbr> databases distributed in MS-Access format or
- * as <abbr>SQL</abbr> scripts. More differences may exist for handling the differences between version
- * 9 and 10 of the <abbr>EPSG</abbr> database schema.
+ * Some differences are the lower or camel case, the spaces between words and the {@code "epsg_"} prefix.
+ * Those differences exist because the <abbr>EPSG</abbr> database is distributed in two family of formats:
+ * as an MS-Access file and as <abbr>SQL</abbr> scripts, and those two families use different table names.
+ * In addition to format-dependent differences, there is also changes in the database schema between some
+ * versions of the <abbr>EPSG</abbr> dataset.
  *
- * <p>Apache <abbr>SIS</abbr> generally uses the naming convention found in the MS-Access database,
- * because it provides more readable <abbr>SQL</abbr> statements. <abbr>SIS</abbr> also assumes an
- * <abbr>EPSG</abbr> database schema version 10 or latter. If {@link EPSGFactory} is connected to
- * a database which uses a different table naming convention, or to <abbr>EPSG</abbr> version 9,
- * then this {@code SQLTranslator} class will translate the <abbr>SQL</abbr> statements on-the-fly.
- * The following table gives the mapping between the two naming conventions:</p>
+ * <h2>Table naming convention</h2>
+ * For readability reasons,
+ * Apache <abbr>SIS</abbr> generally uses the naming convention found in the MS-Access database,
+ * except for the cases shown in the "Name in Apache <abbr>SIS</abbr>" column of the table below.
+ * The <abbr>SQL</abbr> statements given to the {@link #apply(String)} method use the latter.
+ * The following table gives the mapping between the naming conventions:
  *
  * <table class="sis">
- *   <caption>Table and column names</caption>
- *   <tr><th>Element</th>       <th>Name in MS-Access database</th>                    <th>Name in <abbr>SQL</abbr> scripts</th></tr>
- *   <tr><td>Table</td>         <td>{@code Alias}</td>                                 <td>{@code epsg_alias}</td></tr>
- *   <tr><td>Legacy table</td>  <td>{@code Area}</td>                                  <td>{@code epsg_area}</td></tr>
- *   <tr><td>Table</td>         <td>{@code Change}</td>                                <td>{@code epsg_change}</td></tr>
- *   <tr><td>Table</td>         <td>{@code ConventionalRS}</td>                        <td>{@code epsg_conventionalrs}</td></tr>
- *   <tr><td>Table</td>         <td>{@code Coordinate Axis}</td>                       <td>{@code epsg_coordinateaxis}</td></tr>
- *   <tr><td>Table</td>         <td>{@code Coordinate Axis Name}</td>                  <td>{@code epsg_coordinateaxisname}</td></tr>
- *   <tr><td>Table</td>         <td>{@code Coordinate_Operation}</td>                  <td>{@code epsg_coordoperation}</td></tr>
- *   <tr><td>Table</td>         <td>{@code Coordinate_Operation Method}</td>           <td>{@code epsg_coordoperationmethod}</td></tr>
- *   <tr><td>Table</td>         <td>{@code Coordinate_Operation Parameter}</td>        <td>{@code epsg_coordoperationparam}</td></tr>
- *   <tr><td>Table</td>         <td>{@code Coordinate_Operation Parameter Usage}</td>  <td>{@code epsg_coordoperationparamusage}</td></tr>
- *   <tr><td>Table</td>         <td>{@code Coordinate_Operation Parameter Value}</td>  <td>{@code epsg_coordoperationparamvalue}</td></tr>
- *   <tr><td>Table</td>         <td>{@code Coordinate_Operation Path}</td>             <td>{@code epsg_coordoperationpath}</td></tr>
- *   <tr><td>Table</td>         <td>{@code Coordinate Reference System}</td>           <td>{@code epsg_coordinatereferencesystem}</td></tr>
- *   <tr><td>Table</td>         <td>{@code Coordinate System}</td>                     <td>{@code epsg_coordinatesystem}</td></tr>
- *   <tr><td>Table</td>         <td>{@code Datum}</td>                                 <td>{@code epsg_datum}</td></tr>
- *   <tr><td>Table</td>         <td>{@code DatumEnsemble}</td>                         <td>{@code epsg_datumensemble}</td></tr>
- *   <tr><td>Table</td>         <td>{@code DatumEnsembleMember}</td>                   <td>{@code epsg_datumensemblemember}</td></tr>
- *   <tr><td>Table</td>         <td>{@code DatumRealizationMethod}</td>                <td>{@code epsg_datumrealizationmethod}</td></tr>
- *   <tr><td>Table</td>         <td>{@code DefiningOperation}</td>                     <td>{@code epsg_definingoperation}</td></tr>
- *   <tr><td>Table</td>         <td>{@code Deprecation}</td>                           <td>{@code epsg_deprecation}</td></tr>
- *   <tr><td>Table</td>         <td>{@code Ellipsoid}</td>                             <td>{@code epsg_ellipsoid}</td></tr>
- *   <tr><td>Table</td>         <td>{@code Extent}</td>                                <td>{@code epsg_extent}</td></tr>
- *   <tr><td>Table</td>         <td>{@code Naming System}</td>                         <td>{@code epsg_namingsystem}</td></tr>
- *   <tr><td>Table</td>         <td>{@code Prime Meridian}</td>                        <td>{@code epsg_primemeridian}</td></tr>
- *   <tr><td>Table</td>         <td>{@code Scope}</td>                                 <td>{@code epsg_scope}</td></tr>
- *   <tr><td>Table</td>         <td>{@code Supersession}</td>                          <td>{@code epsg_supersession}</td></tr>
- *   <tr><td>Table</td>         <td>{@code Unit of Measure}</td>                       <td>{@code epsg_unitofmeasure}</td></tr>
- *   <tr><td>Table</td>         <td>{@code Version History}</td>                       <td>{@code epsg_versionhistory}</td></tr>
- *   <tr><td>Table</td>         <td>{@code Usage}</td>                                 <td>{@code epsg_usage}</td></tr>
- *   <tr><td>Column</td>        <td>{@code ORDER}</td>                                 <td>{@code coord_axis_order}</td></tr>
+ *   <caption>Mapping of table names</caption>
+ *   <tr><th>Name in <abbr>SQL</abbr> scripts</th>      <th>Name in MS-Access database</th>                  <th>Name in Apache <abbr>SIS</abbr></th></tr>
+ *   <tr><td>{@code epsg_alias}</td>                    <td>{@code Alias}</td>                               <td>″</td></tr>
+ *   <tr><td>{@code epsg_area}</td>                     <td>{@code Area}</td>                                <td>″</td></tr>
+ *   <tr><td>{@code epsg_change}</td>                   <td>{@code Change}</td>                              <td>″</td></tr>
+ *   <tr><td>{@code epsg_conventionalrs}</td>           <td>{@code ConventionalRS}</td>                      <td>{@code Conventional RS}</td></tr>
+ *   <tr><td>{@code epsg_coordinateaxis}</td>           <td>{@code Coordinate Axis}</td>                     <td>″</td></tr>
+ *   <tr><td>{@code epsg_coordinateaxisname}</td>       <td>{@code Coordinate Axis Name}</td>                <td>″</td></tr>
+ *   <tr><td>{@code epsg_coordoperation}</td>           <td>{@code Coordinate_Operation}</td>                <td>″</td></tr>
+ *   <tr><td>{@code epsg_coordoperationmethod}</td>     <td>{@code Coordinate_Operation Method}</td>         <td>″</td></tr>
+ *   <tr><td>{@code epsg_coordoperationparam}</td>      <td>{@code Coordinate_Operation Parameter}</td>      <td>″</td></tr>
+ *   <tr><td>{@code epsg_coordoperationparamusage}</td> <td>{@code Coordinate_Operation Parameter Usage}</td><td>″</td></tr>
+ *   <tr><td>{@code epsg_coordoperationparamvalue}</td> <td>{@code Coordinate_Operation Parameter Value}</td><td>″</td></tr>
+ *   <tr><td>{@code epsg_coordoperationpath}</td>       <td>{@code Coordinate_Operation Path}</td>           <td>″</td></tr>
+ *   <tr><td>{@code epsg_coordinatereferencesystem}</td><td>{@code Coordinate Reference System}</td>         <td>″</td></tr>
+ *   <tr><td>{@code epsg_coordinatesystem}</td>         <td>{@code Coordinate System}</td>                   <td>″</td></tr>
+ *   <tr><td>{@code epsg_datum}</td>                    <td>{@code Datum}</td>                               <td>″</td></tr>
+ *   <tr><td>{@code epsg_datumensemble}</td>            <td>{@code DatumEnsemble}</td>                       <td>{@code Datum Ensemble}</td></tr>
+ *   <tr><td>{@code epsg_datumensemblemember}</td>      <td>{@code DatumEnsembleMember}</td>                 <td>{@code Datum Ensemble Member}</td></tr>
+ *   <tr><td>{@code epsg_datumrealizationmethod}</td>   <td>{@code DatumRealizationMethod}</td>              <td>{@code Datum Realization Method}</td></tr>
+ *   <tr><td>{@code epsg_definingoperation}</td>        <td>{@code DefiningOperation}</td>                   <td>{@code Defining Operation}</td></tr>
+ *   <tr><td>{@code epsg_deprecation}</td>              <td>{@code Deprecation}</td>                         <td>″</td></tr>
+ *   <tr><td>{@code epsg_ellipsoid}</td>                <td>{@code Ellipsoid}</td>                           <td>″</td></tr>
+ *   <tr><td>{@code epsg_extent}</td>                   <td>{@code Extent}</td>                              <td>″</td></tr>
+ *   <tr><td>{@code epsg_namingsystem}</td>             <td>{@code Naming System}</td>                       <td>″</td></tr>
+ *   <tr><td>{@code epsg_primemeridian}</td>            <td>{@code Prime Meridian}</td>                      <td>″</td></tr>
+ *   <tr><td>{@code epsg_scope}</td>                    <td>{@code Scope}</td>                               <td>″</td></tr>
+ *   <tr><td>{@code epsg_supersession}</td>             <td>{@code Supersession}</td>                        <td>″</td></tr>
+ *   <tr><td>{@code epsg_unitofmeasure}</td>            <td>{@code Unit of Measure}</td>                     <td>″</td></tr>
+ *   <tr><td>{@code epsg_versionhistory}</td>           <td>{@code Version History}</td>                     <td>″</td></tr>
+ *   <tr><td>{@code epsg_usage}</td>                    <td>{@code Usage}</td>                               <td>″</td></tr>
  * </table>
  *
- * Apache <abbr>SIS</abbr> automatically detects which convention is used, regardless the database engine.
+ * Columns have the same name in all formats, with only one exception:
+ * for avoiding confusion with the <abbr>SQL</abbr> keyword of the same name,
+ * the {@code ORDER} column in MS-Access has been renamed {@code coord_axis_order} in <abbr>SQL</abbr> scripts.
+ * Apache <abbr>SIS</abbr> uses the latter.
+ *
+ * <p>Apache <abbr>SIS</abbr> automatically detects which name convention is used, regardless the database engine.
  * For example, it is legal to use the mixed-case variant in a PostgreSQL database
  * even if <abbr>EPSG</abbr> distributes the PostgreSQL scripts in lower-case.
  * The {@code "epsg_"} prefix is redundant with database schema and can be omitted.
- * {@code SQLTranslator} automatically detects which database schema contains the <abbr>EPSG</abbr> tables.
+ * {@code SQLTranslator} automatically detects which database schema contains the <abbr>EPSG</abbr> tables.</p>
+ *
+ * <h2>Versions of <abbr>EPSG</abbr> schema</h2>
+ * Apache <abbr>SIS</abbr> assumes an <abbr>EPSG</abbr> database schema version 10 or latter.
+ * If {@link EPSGFactory} is connected to the <abbr>EPSG</abbr> version 9 database,
+ * then this {@code SQLTranslator} class will modify the <abbr>SQL</abbr> statements on-the-fly.
  *
  * <h2>Thread safety</h2>
  * All {@code SQLTranslator} instances given to the {@link EPSGFactory} constructor
@@ -232,7 +242,7 @@ public class SQLTranslator implements UnaryOperator<String> {
     private boolean useBoolean;
 
     /**
-     * Whether the sentinel table "Coordinate_Operation" or a variant has been found.
+     * Whether the sentinel table {@code "Coordinate_Operation"} or a variant has been found.
      * If {@code false}, then {@link EPSGInstaller} needs to be run.
      * Note that the {@linkplain #schema} may be {@code null}.
      *


(sis) 01/03: Adjust the check for geoid-based realization method.

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit c9cf4f9e43fb0e851fa8667a65d88b04014a72b7
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Sat Aug 9 14:48:03 2025 +0200

    Adjust the check for geoid-based realization method.
---
 .../main/org/apache/sis/referencing/internal/VerticalDatumTypes.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/VerticalDatumTypes.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/VerticalDatumTypes.java
index ecea0315c6..6f7c9b7c7b 100644
--- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/VerticalDatumTypes.java
+++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/VerticalDatumTypes.java
@@ -272,7 +272,7 @@ public final class VerticalDatumTypes {
             if (CharSequences.equalsFiltered("Mean Sea Level", name, Characters.Filter.LETTERS_AND_DIGITS, true)) {
                 return RealizationMethod.TIDAL;
             }
-            if (name.contains("geoid")) {
+            if (name.regionMatches(true, 0, "geoid", 0, 5)) {
                 return RealizationMethod.GEOID;
             }
         }