sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] branch geoapi-4.0 updated: Provide more details in the documentation about how to upgrade the EPSG geodetic dataset.
Date Wed, 28 Aug 2019 17:37:11 GMT
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


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new bd753fe  Provide more details in the documentation about how to upgrade the EPSG
geodetic dataset.
bd753fe is described below

commit bd753fe9ffea7439c758ab46c7c6cba2da7b5295
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Wed Aug 28 19:36:38 2019 +0200

    Provide more details in the documentation about how to upgrade the EPSG geodetic dataset.
---
 .../referencing/factory/sql/EPSGInstallerTest.java |   8 +-
 .../factory/sql/epsg/DataScriptFormatter.java      |  10 +-
 .../referencing/factory/sql/epsg/DebugTools.sql    |   2 +-
 .../sis/referencing/factory/sql/epsg/package.html  | 113 ++++++++++++---------
 .../report/CoordinateReferenceSystems.java         |   2 +-
 5 files changed, 80 insertions(+), 55 deletions(-)

diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java
b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java
index cdec0ec..c8a5f02 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java
@@ -53,7 +53,13 @@ import static org.junit.Assume.assumeTrue;
 /**
  * Tests {@link EPSGInstaller} indirectly, through {@link EPSGFactory#install(Connection)}.
  * We do not test {@code EPSGInstaller} directly because the EPSG database creation is costly,
- * and we want to use the {@code EPSGFactory} for creating a few CRS for testing purpose.
+ * so we want to opportunistically verify the result immediately after database creation
+ * by using the {@code EPSGFactory} for creating a few CRS.
+ *
+ * <p>This test requires that {@code $SIS_DATA/Databases/ExternalSources} directory
contains
+ * the {@code EPSG_Tables.sql}, {@code EPSG_Data.sql} and {@code EPSG_FKeys.sql} files.
+ * Those files may be copies or symbolic links to the files documented or generated by
+ * {@link org.apache.sis.referencing.factory.sql.epsg.DataScriptFormatter}.</p>
  *
  * <p>Every databases created by this test suite exist only in memory.
  * This class does not write anything to disk (except maybe some temporary files).</p>
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/DataScriptFormatter.java
b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/DataScriptFormatter.java
index dd29517..f3ba867 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/DataScriptFormatter.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/DataScriptFormatter.java
@@ -38,8 +38,6 @@ import org.apache.sis.util.CharSequences;
 import org.apache.sis.internal.metadata.sql.ScriptRunner;
 import org.apache.sis.test.sql.TestDatabase;
 
-import static org.junit.Assert.assertEquals;
-
 
 /**
  * Rewrites the {@code INSERT TO ...} statements in a SQL script in a more compact form.
@@ -61,8 +59,8 @@ public final class DataScriptFormatter extends ScriptRunner {
      * The values of those arguments are typically:
      *
      * <ol>
-     *   <li>{@code PostgreSQL_Table_Script.sql}</li>
-     *   <li>{@code core/sis-referencing/src/main/resources/org/apache/sis/referencing/factory/sql/Data.sql}</li>
+     *   <li>{@code $EPSG_SCRIPTS/PostgreSQL_Table_Script.sql}</li>
+     *   <li>{@code sis-epsg/src/main/resources/org/apache/sis/referencing/factory/sql/epsg/Data.sql}</li>
      * </ol>
      *
      * @param  arguments  the source files and the destination file.
@@ -233,7 +231,9 @@ public final class DataScriptFormatter extends ScriptRunner {
         if (CharSequences.regionMatches(sql, ++lower, oldValue)) {
             final int s = CharSequences.skipLeadingWhitespaces(sql, 0, lower);
             if (CharSequences.regionMatches(sql, s, "INSERT INTO " + table + " VALUES"))
{
-                assertEquals("oldValue.length", oldValue.length(), --upper - lower);
+                if (--upper - lower != oldValue.length()) {
+                    throw new AssertionError("Unexpected length");
+                }
                 if (before != null) {
                     final int i = sql.indexOf(before);
                     if (i < 0 || i >= lower) return;
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/DebugTools.sql
b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/DebugTools.sql
index 89c665f..fa51bec 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/DebugTools.sql
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/DebugTools.sql
@@ -11,7 +11,7 @@
 --
 
 SET client_encoding = 'UTF8';
-SET search_path = epsg;
+SET search_path = 'EPSG';
 
 
 --
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/package.html
b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/package.html
index dd02498..3bbc807 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/package.html
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/package.html
@@ -21,6 +21,7 @@
     <meta charset="UTF-8">
     <style>
       p {text-align: justify;}
+      pre > i {color:red}
     </style>
   </head>
   <body>
@@ -52,6 +53,7 @@
     <h2>How to apply EPSG geodetic dataset updates</h2>
     <p>
       This page explains how to convert the SQL scripts published by EPSG into the more compact
form used by Apache SIS.
+      The compact form is about half the size of the original files. Compaction is achieved
by avoiding redundant statements.
       This conversion applies only to the data types, the integrity constraints and the way
the SQL scripts are written.
       No data value should be altered. Steps to follow:
     </p>
@@ -68,58 +70,75 @@ export EPSG_SCRIPTS=$PWD</pre>
       <li><p>If a copy of the original SQL scripts (as downloaded from EPSG)
for the previous version is still available,
           and if the following commands report no difference, then jump to step 4.</p>
 
-        <pre>diff PostgreSQL_Table_Script.sql &lt;path to previous version&gt;/PostgreSQL_Table_Script.sql
-diff PostgreSQL_FKey_Script.sql  &lt;path to previous version&gt;/PostgreSQL_FKey_Script.sql</pre>
+        <pre>cd <i>&lt;directory containing EPSG scripts of previous version&gt;</i>
+diff PostgreSQL_Table_Script.sql $EPSG_SCRIPTS/PostgreSQL_Table_Script.sql
+diff PostgreSQL_FKey_Script.sql  $EPSG_SCRIPTS/PostgreSQL_FKey_Script.sql</pre>
 
-        <p>Otherwise:</p>
-        <ol>
-          <li><p>Move to the directory which contains the Apache SIS scripts:</p>
-            <pre>cd &lt;SIS_HOME&gt;/non-free/sis-epsg/src/main/resources/org/apache/sis/referencing/factory/sql/epsg/</pre>
-          </li>
+        <details>
+          <summary>Otherwise:</summary>
+          <ol style="list-style-type: lower-roman">
+            <li><p>Move to the directory which contains the Apache SIS scripts:</p>
+              <pre>cd &lt;SIS_HOME&gt;/non-free/sis-epsg/src/main/resources/org/apache/sis/referencing/factory/sql/epsg/</pre>
+            </li>
 
-          <li><p>Overwrite <code>Tables.sql</code> and <code>FKeys.sql</code>
with the new SQL scripts
-              Do not overwrite <code>Data.sql</code> and <code>Indexes.sql</code>:</p>
-            <pre>cp $EPSG_SCRIPTS/PostgreSQL_Table_Script.sql Tables.sql
+            <li><p>Overwrite <code>Tables.sql</code> and <code>FKeys.sql</code>
with the new SQL scripts
+                Do not overwrite <code>Data.sql</code> and <code>Indexes.sql</code>:</p>
+              <pre>cp $EPSG_SCRIPTS/PostgreSQL_Table_Script.sql Tables.sql
 cp $EPSG_SCRIPTS/PostgreSQL_FKey_Script.sql  FKeys.sql</pre>
-          </li>
-
-          <li><p>Open the <code>Tables.sql</code> file for edition:</p>
-            <ul>
-              <li>Keep the header comments that existed in the overwritten file.</li>
-              <li>In the statement creating the <code>coordinateaxis</code>
table,
-                add the <code>NOT NULL</code> constraint to the <code>coord_axis_code</code>
column.</li>
-              <li>In the statement creating the <code>change</code> table,
-                remove the <code>UNIQUE</code> constraint on the <code>change_id</code>
column
-                and add a <code>CONSTRAINT pk_change PRIMARY KEY (change_id)</code>
line instead.</li>
-              <li>In the statement creating the <code>epsg_datum</code>
table,
-                change the type of the <code>realization_epoch</code> column
to <code>DATE</code>.</li>
-              <li>Change the type of <code>ellipsoid_shape</code>, <code>reverse_op</code>,
<code>param_sign_reversal</code>
-                <code>show_crs</code>, <code>show_operation</code>
and all <code>deprecated</code> fields from <code>SMALLINT</code>
-                (or sometime <code>VARCHAR(3)</code>) to <code>BOOLEAN</code>.</li>
-              <li>Change the type of every <code>table_name</code> columns
from <code>VARCHAR(80)</code> to <code>epsg_table_name</code>.</li>
-              <li>Change the type of <code>coord_ref_sys_kind</code> column
from <code>VARCHAR(24)</code> to <code>epsg_crs_kind</code>.</li>
-              <li>Change the type of <code>coord_sys_type</code> column
from <code>VARCHAR(24)</code> to <code>epsg_cs_kind</code>.</li>
-              <li>Change the type of <code>datum_type</code> column from
<code>VARCHAR(24)</code> to <code>epsg_datum_kind</code>.</li>
-              <li>Suppress trailing spaces and save.</li>
-            </ul>
-            <p>Usually this results in no change at all compared to the previous script
(ignoring white spaces),
-              in which case the maintainer can just revert the changes in order to preserve
the formatting.</p>
-          </li>
-
-          <li><p>Open the <code>FKeys.sql</code> file for edition:</p>
-            <ul>
-              <li>At the end of all <code>ALTER TABLE</code> statement,
-                append <code>ON UPDATE RESTRICT ON DELETE RESTRICT</code>.</li>
-              <li>suppress trailing spaces and save.</li>
-            </ul>
-            <p>In most cases this results in unmodified <code>FKeys.sql</code>
file compared to the previous version.</p>
-          </li>
-        </ol>
+            </li>
+
+            <li><p>Open the <code>Tables.sql</code> file for edition:</p>
+              <ul>
+                <li>Keep the header comments that existed in the overwritten file.</li>
+                <li>In the statement creating the <code>coordinateaxis</code>
table,
+                  add the <code>NOT NULL</code> constraint to the <code>coord_axis_code</code>
column.</li>
+                <li>In the statement creating the <code>change</code> table,
+                  remove the <code>UNIQUE</code> constraint on the <code>change_id</code>
column
+                  and add a <code>CONSTRAINT pk_change PRIMARY KEY (change_id)</code>
line instead.</li>
+                <li>In the statement creating the <code>epsg_datum</code>
table,
+                  change the type of the <code>realization_epoch</code> column
to <code>DATE</code>.</li>
+                <li>Change the type of <code>ellipsoid_shape</code>, <code>reverse_op</code>,
<code>param_sign_reversal</code>
+                  <code>show_crs</code>, <code>show_operation</code>
and all <code>deprecated</code> fields from <code>SMALLINT</code>
+                  (or sometime <code>VARCHAR(3)</code>) to <code>BOOLEAN</code>.</li>
+                <li>Change the type of every <code>table_name</code> columns
from <code>VARCHAR(80)</code> to <code>epsg_table_name</code>.</li>
+                <li>Change the type of <code>coord_ref_sys_kind</code>
column from <code>VARCHAR(24)</code> to <code>epsg_crs_kind</code>.</li>
+                <li>Change the type of <code>coord_sys_type</code> column
from <code>VARCHAR(24)</code> to <code>epsg_cs_kind</code>.</li>
+                <li>Change the type of <code>datum_type</code> column from
<code>VARCHAR(24)</code> to <code>epsg_datum_kind</code>.</li>
+                <li>Suppress trailing spaces and save.</li>
+              </ul>
+              <p>Usually this results in no change at all compared to the previous
script (ignoring white spaces),
+                in which case the maintainer can just revert the changes in order to preserve
the formatting.</p>
+            </li>
+
+            <li><p>Open the <code>FKeys.sql</code> file for edition:</p>
+              <ul>
+                <li>At the end of all <code>ALTER TABLE</code> statement,
+                  append <code>ON UPDATE RESTRICT ON DELETE RESTRICT</code>.</li>
+                <li>suppress trailing spaces and save.</li>
+              </ul>
+              <p>In most cases this results in unmodified <code>FKeys.sql</code>
file compared to the previous version.</p>
+            </li>
+          </ol>
+        </details>
       </li>
 
-      <li><p>Open the <code>org.apache.sis.referencing.factory.sql.epsg.DataScriptFormatter</code>
class
-          located in the test directory of the <code>sis-referencing</code> module
-          and run the <code>main</code> method of that class.</p></li>
+      <li><p>Execute the <code>main</code> method of the
+          <code>org.apache.sis.referencing.factory.sql.epsg.DataScriptFormatter</code>
class
+          located in the test directory of <code>sis-referencing</code> module
+          (adjust version numbers as needed; we may provide an easier way after migration
to Jigsaw modules):</p>
+
+        <pre>cd <i>&lt;path to SIS project directory&gt;</i>
+mvn clean install
+export CLASSPATH=~/.m2/repository/org/apache/derby/derby/10.14.2.0/derby-10.14.2.0.jar
+export CLASSPATH=$PWD/core/sis-metadata/target/test-classes:$CLASSPATH
+export CLASSPATH=$PWD/target/binaries/sis-referencing-2.0-SNAPSHOT.jar:$CLASSPATH
+export CLASSPATH=$PWD/core/sis-metadata/target/test-classes:$CLASSPATH
+export CLASSPATH=$PWD/core/sis-referencing/target/test-classes:$CLASSPATH
+cd <i>&lt;path to local copy of <a href="http://svn.apache.org/repos/asf/sis/data/non-free/">http://svn.apache.org/repos/asf/sis/data/non-free/</a>&gt;</i>
+java org.apache.sis.referencing.factory.sql.epsg.DataScriptFormatter $EPSG_SCRIPTS/PostgreSQL_Data_Script.sql
\
+     sis-epsg/src/main/resources/org/apache/sis/referencing/factory/sql/epsg/Data.sql</pre></li>
+
+     <li><p>Run <code>org.apache.sis.referencing.factory.sql.EPSGInstallerTest</code>
tests.</p></li>
 
       <li><p>Upgrade the <code>FACTORY.VERSION</code> value defined
in the
           <code>org.apache.sis.referencing.report.CoordinateReferenceSystems</code>
class.</p></li>
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
b/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
index 32268de..0102f99 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
@@ -480,7 +480,7 @@ public final strictfp class CoordinateReferenceSystems extends AuthorityCodesRep
         properties.setProperty("PRODUCT.URL",     "http://sis.apache.org");
         properties.setProperty("JAVADOC.GEOAPI",  "http://www.geoapi.org/snapshot/javadoc");
         properties.setProperty("FACTORY.NAME",    "EPSG");
-        properties.setProperty("FACTORY.VERSION", "9.6.3");
+        properties.setProperty("FACTORY.VERSION", "9.7");
         properties.setProperty("FACTORY.VERSION.SUFFIX", ", together with other sources");
         properties.setProperty("PRODUCT.VERSION.SUFFIX", " (provided that <a href=\"http://sis.apache.org/epsg.html\">a
connection to an EPSG database exists</a>)");
         properties.setProperty("DESCRIPTION", "<p><b>Notation:</b></p>\n"
+


Mime
View raw message