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 2022/11/10 19:30:36 UTC

[sis] branch geoapi-4.0 updated (d79ae0a663 -> 5967341a84)

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 d79ae0a663 Update the `RenameOnImport.lst` file for importing data in old schema.
     new 41e6a8261c Use adapters for deciding whether to marshall an element (depending on metadata standard).
     new 5967341a84 Update for a change in GeoAPI: - New method: `ParameterDescriptor.getValueType()`.

The 2 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:
 .../main/java/org/apache/sis/feature/Features.java |  6 ++--
 .../apache/sis/internal/jaxb/gco/GO_DateTime.java  | 26 ++++++++++++--
 .../apache/sis/internal/jaxb/gco/package-info.java |  2 +-
 .../jaxb/metadata/DQ_EvaluationMethod.java         |  8 +++--
 .../jaxb/metadata/DQ_MeasureReference.java         |  8 +++--
 .../DQ_StandaloneQualityReportInformation.java     |  8 +++--
 .../jaxb/metadata/replace/ServiceParameter.java    |  3 +-
 .../sis/metadata/iso/quality/AbstractElement.java  | 42 ++++++++++++++++------
 .../sis/metadata/iso/quality/AbstractResult.java   |  7 +++-
 .../metadata/iso/quality/DefaultDataQuality.java   |  2 +-
 .../apache/sis/util/iso/DefaultNameFactory.java    |  1 +
 .../org/apache/sis/util/iso/DefaultTypeName.java   | 37 +++++++++----------
 .../main/java/org/apache/sis/util/iso/Names.java   | 22 ++++++++++--
 .../sis/parameter/DefaultParameterDescriptor.java  | 18 ++++++++--
 .../org/apache/sis/parameter/ParametersTest.java   |  4 ++-
 15 files changed, 144 insertions(+), 50 deletions(-)


[sis] 02/02: Update for a change in GeoAPI: - New method: `ParameterDescriptor.getValueType()`.

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 5967341a84747e75423892fe746fb6399e54ac58
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Thu Nov 10 20:21:27 2022 +0100

    Update for a change in GeoAPI:
    - New method: `ParameterDescriptor.getValueType()`.
    
    https://github.com/opengeospatial/geoapi/issues/76
---
 .../main/java/org/apache/sis/feature/Features.java |  6 ++--
 .../jaxb/metadata/replace/ServiceParameter.java    |  3 +-
 .../apache/sis/util/iso/DefaultNameFactory.java    |  1 +
 .../org/apache/sis/util/iso/DefaultTypeName.java   | 37 +++++++++++-----------
 .../main/java/org/apache/sis/util/iso/Names.java   | 22 +++++++++++--
 .../sis/parameter/DefaultParameterDescriptor.java  | 18 +++++++++--
 .../org/apache/sis/parameter/ParametersTest.java   |  4 ++-
 7 files changed, 63 insertions(+), 28 deletions(-)

diff --git a/core/sis-feature/src/main/java/org/apache/sis/feature/Features.java b/core/sis-feature/src/main/java/org/apache/sis/feature/Features.java
index 0ecfd7ccff..86e00cb23d 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/feature/Features.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/feature/Features.java
@@ -20,7 +20,6 @@ import java.util.Map;
 import java.util.Optional;
 import java.util.IdentityHashMap;
 import org.opengis.util.GenericName;
-import org.opengis.util.NameFactory;
 import org.opengis.util.InternationalString;
 import org.opengis.metadata.maintenance.ScopeCode;
 import org.opengis.metadata.quality.ConformanceResult;
@@ -28,8 +27,8 @@ import org.opengis.metadata.quality.DataQuality;
 import org.opengis.metadata.quality.Element;
 import org.opengis.metadata.quality.Result;
 import org.apache.sis.util.Static;
+import org.apache.sis.util.iso.Names;
 import org.apache.sis.util.iso.DefaultNameFactory;
-import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.internal.feature.Resources;
 
 // Branch-dependent imports
@@ -244,8 +243,7 @@ public final class Features extends Static {
             // Tested first because this is the main interest for this method.
             return DefaultAssociationRole.getValueTypeName((FeatureAssociationRole) property);
         } else if (property instanceof AttributeType<?>) {
-            final DefaultNameFactory factory = DefaultFactories.forBuildin(NameFactory.class, DefaultNameFactory.class);
-            return factory.toTypeName(((AttributeType<?>) property).getValueClass());
+            return Names.createTypeName(((AttributeType<?>) property).getValueClass());
         } else if (property instanceof Operation) {
             final IdentifiedType result = ((Operation) property).getResult();
             if (result != null) {
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameter.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameter.java
index f3187366cc..7613231284 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameter.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameter.java
@@ -293,9 +293,10 @@ public final class ServiceParameter extends SimpleIdentifiedObject implements Pa
      * Note that there is not setter method, since we expect the same information
      * to be provided in the {@link #name} attribute type.
      */
+    @Override
     @XmlElement(name = "valueType", namespace = LegacyNamespaces.SRV)
     @XmlJavaTypeAdapter(GO_GenericName.class)    // Not in package-info because shall not be applied to getLegacyName().
-    final TypeName getValueType() {
+    public final TypeName getValueType() {
         if (memberName != null && FilterByVersion.LEGACY_METADATA.accept()) {
             return memberName.getAttributeType();
         }
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java b/core/sis-metadata/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java
index 92fcc67b5d..a7557d787a 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java
@@ -419,6 +419,7 @@ public class DefaultNameFactory extends AbstractFactory implements NameFactory {
      *
      * @see DefaultTypeName#toClass()
      * @see Names#toClass(TypeName)
+     * @see Names#createTypeName(Class)
      *
      * @since 0.5
      */
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java b/core/sis-metadata/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java
index c065bd66b3..deaca620e4 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java
@@ -34,10 +34,11 @@ import org.apache.sis.util.UnknownNameException;
  *
  * <h2>Mapping Java classes to type names</h2>
  * It is sometime useful to establish a mapping between {@link Class} and {@code TypeName}.
- * When an UML identifier from an OGC standard exists for a given {@code Class}, Apache SIS
- * uses that identifier prefixed by the {@code "OGC"} namespace.
+ * When an UML identifier from an OGC standard exists for a given {@code Class},
+ * Apache SIS uses that identifier prefixed by the {@code "OGC"} namespace.
  * Note that this is <strong>not</strong> a standard practice.
- * A more standard practice would be to use the <cite>definition identifiers in OGC namespace</cite>
+ * A more standard practice would be to use the
+ * <a href="https://schemas.opengis.net/definitions/1.1.0/dataType.xml">data type URN standard values</a>
  * (third column in the table below), but the set of data type identifiers defined by OGC is currently
  * small and is sometime not an exact match.
  *
@@ -45,68 +46,68 @@ import org.apache.sis.util.UnknownNameException;
  *   <caption>Mapping from Java classes to type names (non-exhaustive list)</caption>
  *   <tr>
  *     <th>Java class</th>
- *     <th>Type name (unofficial)</th>
- *     <th>Definition identifier in OGC namespace</th>
- *     <th>Recommended URL in Web Processing Services</th>
+ *     <th>Scoped type name</th>
+ *     <th class="sep">Data type URN standard values</th>
+ *     <th>URL in Web Services</th>
  *   </tr><tr>
  *     <td>{@link org.opengis.util.InternationalString}</td>
  *     <td>{@code OGC:FreeText}</td>
- *     <td></td>
+ *     <td class="sep"></td>
  *     <td></td>
  *   </tr><tr>
  *     <td>{@link java.lang.String}</td>
  *     <td>{@code OGC:CharacterString}</td>
- *     <td>{@code urn:ogc:def:dataType:OGC::string}</td>
+ *     <td class="sep">{@code urn:ogc:def:dataType:OGC::string}</td>
  *     <td>{@code http://www.w3.org/2001/XMLSchema#string}</td>
  *   </tr><tr>
  *     <td>{@link java.net.URI}</td>
  *     <td>{@code OGC:URI}</td>
- *     <td>{@code urn:ogc:def:dataType:OGC::anyURI}</td>
+ *     <td class="sep">{@code urn:ogc:def:dataType:OGC::anyURI}</td>
  *     <td></td>
  *   </tr><tr>
  *     <td>{@link java.lang.Boolean}</td>
  *     <td>{@code OGC:Boolean}</td>
- *     <td>{@code urn:ogc:def:dataType:OGC::boolean}</td>
+ *     <td class="sep">{@code urn:ogc:def:dataType:OGC::boolean}</td>
  *     <td>{@code http://www.w3.org/2001/XMLSchema#boolean}</td>
  *   </tr><tr>
  *     <td>{@link java.lang.Integer}</td>
  *     <td>{@code OGC:Integer}</td>
- *     <td>{@code urn:ogc:def:dataType:OGC::nonNegativeInteger}</td>
+ *     <td class="sep">{@code urn:ogc:def:dataType:OGC::nonNegativeInteger}</td>
  *     <td>{@code http://www.w3.org/2001/XMLSchema#integer}</td>
  *   </tr><tr>
  *     <td>{@link java.math.BigDecimal}</td>
  *     <td>{@code OGC:Decimal}</td>
- *     <td></td>
+ *     <td class="sep"></td>
  *     <td>{@code http://www.w3.org/2001/XMLSchema#decimal}</td>
  *   </tr><tr>
  *     <td>{@link java.lang.Double}</td>
  *     <td>{@code OGC:Real}</td>
- *     <td></td>
+ *     <td class="sep"></td>
  *     <td>{@code http://www.w3.org/2001/XMLSchema#double}</td>
  *   </tr><tr>
  *     <td>{@link java.lang.Float}</td>
  *     <td>{@code OGC:Real}</td>
- *     <td></td>
+ *     <td class="sep"></td>
  *     <td>{@code http://www.w3.org/2001/XMLSchema#float}</td>
  *   </tr><tr>
  *     <td>{@link java.util.Date}</td>
  *     <td>{@code OGC:DateTime}</td>
- *     <td></td>
+ *     <td class="sep"></td>
  *     <td></td>
  *   </tr><tr>
  *     <td>{@link java.util.Locale}</td>
  *     <td>{@code OGC:PT_Locale}</td>
- *     <td></td>
+ *     <td class="sep"></td>
  *     <td></td>
  *   </tr><tr>
  *     <td>{@link org.opengis.metadata.Metadata}</td>
  *     <td>{@code OGC:MD_Metadata}</td>
- *     <td></td>
+ *     <td class="sep"></td>
  *     <td></td>
  *   </tr><tr>
  *     <td>Unknown Java class</td>
  *     <td>{@code class:}&lt;the class name&gt;</td>
- *     <td></td>
+ *     <td class="sep"></td>
  *     <td></td>
  *   </tr>
  * </table>
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/util/iso/Names.java b/core/sis-metadata/src/main/java/org/apache/sis/util/iso/Names.java
index 8fc8d6b6bc..cdce2bb011 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/util/iso/Names.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/util/iso/Names.java
@@ -72,7 +72,7 @@ import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
  * </table></blockquote>
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.0
+ * @version 1.3
  *
  * @see DefaultNameFactory
  * @see DefaultNameSpace
@@ -250,6 +250,24 @@ public final class Names extends Static {
         return factory.createTypeName(createNameSpace(factory, namespace, separator), localPart);
     }
 
+    /**
+     * Suggests a type name for the given class. Apache SIS provides a mapping between {@code Class}
+     * and {@code TypeName} objects as documented in the {@link DefaultTypeName} javadoc.
+     * This is the converse of {@link #toClass(TypeName)} method.
+     *
+     * @param  valueClass the type of values, used for inferring a {@link TypeName} instance.
+     * @return a type name for values of the given type.
+     *
+     * @see DefaultNameFactory#toTypeName(Class)
+     *
+     * @since 1.3
+     */
+    public static TypeName createTypeName(final Class<?> valueClass) {
+        ensureNonNull("valueClass", valueClass);
+        final DefaultNameFactory factory = DefaultFactories.forBuildin(NameFactory.class, DefaultNameFactory.class);
+        return factory.toTypeName(valueClass);    // SIS-specific method.
+    }
+
     /**
      * Creates a member name for values of the given class. A {@link TypeName} will be inferred
      * from the given {@code valueClass} as documented in the {@link DefaultTypeName} javadoc.
@@ -353,8 +371,8 @@ public final class Names extends Static {
      * @throws UnknownNameException if a mapping from the given name to a Java class was expected to exist
      *         (typically because of the {@linkplain DefaultTypeName#scope() scope}) but the operation failed.
      *
+     * @see #createTypeName(Class)
      * @see DefaultTypeName#toClass()
-     * @see DefaultNameFactory#toTypeName(Class)
      *
      * @since 0.5
      */
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java b/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java
index da4b0e09fa..e73d118369 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java
@@ -24,6 +24,7 @@ import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.measure.Unit;
 import org.opengis.util.CodeList;
+import org.opengis.util.TypeName;
 import org.opengis.parameter.ParameterValue;
 import org.opengis.parameter.ParameterDescriptor;
 import org.apache.sis.util.Classes;
@@ -31,6 +32,7 @@ import org.apache.sis.util.Numbers;
 import org.apache.sis.util.Utilities;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.iso.Names;
 import org.apache.sis.measure.Range;
 import org.apache.sis.measure.MeasurementRange;
 import org.apache.sis.internal.util.Numerics;
@@ -65,7 +67,7 @@ import static org.apache.sis.util.ArgumentChecks.ensureCanCast;
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Johann Sorel (Geomatys)
- * @version 0.8
+ * @version 1.3
  *
  * @param <T>  the type of elements to be returned by {@link DefaultParameterValue#getValue()}.
  *
@@ -313,7 +315,19 @@ public class DefaultParameterDescriptor<T> extends AbstractParameterDescriptor i
     }
 
     /**
-     * Returns the class that describe the type of the parameter.
+     * Returns the name that describes the type of parameter values.
+     *
+     * @return value type of the parameter.
+     *
+     * @since 1.3
+     */
+    @Override
+    public final TypeName getValueType() {
+        return Names.createTypeName(valueClass);
+    }
+
+    /**
+     * Returns the class that describes the type of parameter values.
      *
      * @return the parameter value class.
      */
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java b/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java
index ed1c8e9a49..fdb16740a8 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java
@@ -25,6 +25,7 @@ import org.opengis.parameter.ParameterDirection;
 import org.opengis.parameter.ParameterValue;
 import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.metadata.Identifier;
+import org.opengis.util.TypeName;
 import org.opengis.util.GenericName;
 import org.opengis.util.InternationalString;
 import org.apache.sis.measure.Range;
@@ -43,7 +44,7 @@ import static org.junit.Assert.*;
  * Tests the static methods in the {@link Parameters} class.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.3
  * @since   0.4
  * @module
  */
@@ -123,6 +124,7 @@ public final strictfp class ParametersTest extends TestCase {
             @Override public ParameterDirection       getDirection()     {return descriptor.getDirection();}
             @Override public int                      getMinimumOccurs() {return descriptor.getMinimumOccurs();}
             @Override public int                      getMaximumOccurs() {return descriptor.getMaximumOccurs();}
+            @Override public TypeName                 getValueType()     {return descriptor.getValueType();}
             @Override public Class<T>                 getValueClass()    {return descriptor.getValueClass();}
             @Override public Set<T>                   getValidValues()   {return descriptor.getValidValues();}
             @Override public Comparable<T>            getMinimumValue()  {return descriptor.getMinimumValue();}


[sis] 01/02: Use adapters for deciding whether to marshall an element (depending on metadata standard).

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 41e6a8261c505155364bc8c57bcfe7994c42d369
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Wed Nov 9 11:14:41 2022 +0100

    Use adapters for deciding whether to marshall an element (depending on metadata standard).
---
 .../apache/sis/internal/jaxb/gco/GO_DateTime.java  | 26 ++++++++++++--
 .../apache/sis/internal/jaxb/gco/package-info.java |  2 +-
 .../jaxb/metadata/DQ_EvaluationMethod.java         |  8 +++--
 .../jaxb/metadata/DQ_MeasureReference.java         |  8 +++--
 .../DQ_StandaloneQualityReportInformation.java     |  8 +++--
 .../sis/metadata/iso/quality/AbstractElement.java  | 42 ++++++++++++++++------
 .../sis/metadata/iso/quality/AbstractResult.java   |  7 +++-
 .../metadata/iso/quality/DefaultDataQuality.java   |  2 +-
 8 files changed, 81 insertions(+), 22 deletions(-)

diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gco/GO_DateTime.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gco/GO_DateTime.java
index e39d0a435e..0e7b9e1dc1 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gco/GO_DateTime.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gco/GO_DateTime.java
@@ -25,6 +25,7 @@ import javax.xml.datatype.DatatypeConfigurationException;
 import javax.xml.datatype.XMLGregorianCalendar;
 import javax.xml.datatype.DatatypeConstants;
 import org.apache.sis.internal.jaxb.Context;
+import org.apache.sis.internal.jaxb.FilterByVersion;
 import org.apache.sis.internal.xml.XmlUtilities;
 
 
@@ -48,7 +49,7 @@ import org.apache.sis.internal.xml.XmlUtilities;
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.0
+ * @version 1.3
  *
  * @see org.apache.sis.internal.jaxb.gml.DateAdapter
  * @see org.apache.sis.internal.jaxb.gml.UniversalTimeAdapter
@@ -57,7 +58,7 @@ import org.apache.sis.internal.xml.XmlUtilities;
  * @module
  */
 @XmlType(name = "Date_PropertyType")
-public final class GO_DateTime extends XmlAdapter<GO_DateTime, Date> {
+public class GO_DateTime extends XmlAdapter<GO_DateTime, Date> {
     /**
      * The date and time value using the {@code code "DateTime"} name.
      * Only one of {@code date} and {@link #dateTime} shall be non-null.
@@ -122,7 +123,7 @@ public final class GO_DateTime extends XmlAdapter<GO_DateTime, Date> {
      * @return a {@linkplain Date date} which represents the metadata value.
      */
     @Override
-    public Date unmarshal(final GO_DateTime value) {
+    public final Date unmarshal(final GO_DateTime value) {
         return (value != null) ? value.getDate() : null;
     }
 
@@ -138,4 +139,23 @@ public final class GO_DateTime extends XmlAdapter<GO_DateTime, Date> {
     public GO_DateTime marshal(final Date value) {
         return (value != null) ? new GO_DateTime(value) : null;
     }
+
+    /**
+     * Wraps the value only if marshalling ISO 19115-3 element.
+     * Otherwise (i.e. if marshalling a legacy ISO 19139:2007 document), omit the element.
+     */
+    public static final class Since2014 extends GO_DateTime {
+        /** Empty constructor used only by JAXB. */
+        public Since2014() {
+        }
+
+        /**
+         * Wraps the given value in an ISO 19115-3 element, unless we are marshalling an older document.
+         *
+         * @return a non-null value only if marshalling ISO 19115-3 or newer.
+         */
+        @Override public GO_DateTime marshal(final Date value) {
+            return FilterByVersion.CURRENT_METADATA.accept() ? super.marshal(value) : null;
+        }
+    }
 }
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gco/package-info.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gco/package-info.java
index b9f2fea697..dcb5e4f479 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gco/package-info.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gco/package-info.java
@@ -78,7 +78,7 @@
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Cullen Rombach (Image Matters)
- * @version 1.0
+ * @version 1.3
  *
  * @see javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter
  *
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQ_EvaluationMethod.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQ_EvaluationMethod.java
index 245c4ce976..60426907b1 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQ_EvaluationMethod.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQ_EvaluationMethod.java
@@ -26,6 +26,9 @@ import org.apache.sis.internal.jaxb.gco.PropertyType;
  * JAXB adapter mapping implementing class to the GeoAPI interface. See
  * package documentation for more information about JAXB and interface.
  *
+ * <p>This adapter excludes the value when marshalling the older version of ISO 19115 standard.
+ * That exclusion is systematic because the type did not existed in the old standard version.</p>
+ *
  * @author  Alexis Gaillard (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @version 1.3
@@ -63,11 +66,12 @@ public final class DQ_EvaluationMethod extends PropertyType<DQ_EvaluationMethod,
      * in a {@code <mdq:DQ_EvaluationMethod>} XML element.
      *
      * @param  metadata  the metadata element to marshal.
-     * @return a {@code PropertyType} wrapping the given the metadata element.
+     * @return a {@code PropertyType} wrapping the given the metadata element,
+     *         or {@code null} if marshalling a too old version of the standard.
      */
     @Override
     protected DQ_EvaluationMethod wrap(final EvaluationMethod metadata) {
-        return new DQ_EvaluationMethod(metadata);
+        return accept2014() ? new DQ_EvaluationMethod(metadata) : null;
     }
 
     /**
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQ_MeasureReference.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQ_MeasureReference.java
index 14d60127dc..f79e9f4fee 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQ_MeasureReference.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQ_MeasureReference.java
@@ -26,6 +26,9 @@ import org.apache.sis.internal.jaxb.gco.PropertyType;
  * JAXB adapter mapping implementing class to the GeoAPI interface. See
  * package documentation for more information about JAXB and interface.
  *
+ * <p>This adapter excludes the value when marshalling the older version of ISO 19115 standard.
+ * That exclusion is systematic because the type did not existed in the old standard version.</p>
+ *
  * @author  Alexis Gaillard (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @version 1.3
@@ -63,11 +66,12 @@ public final class DQ_MeasureReference extends PropertyType<DQ_MeasureReference,
      * in a {@code <mdq:DQ_MeasureReference>} XML element.
      *
      * @param  metadata  the metadata element to marshal.
-     * @return a {@code PropertyType} wrapping the given the metadata element.
+     * @return a {@code PropertyType} wrapping the given the metadata element,
+     *         or {@code null} if marshalling a too old version of the standard.
      */
     @Override
     protected DQ_MeasureReference wrap(final MeasureReference metadata) {
-        return new DQ_MeasureReference(metadata);
+        return accept2014() ? new DQ_MeasureReference(metadata) : null;
     }
 
     /**
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQ_StandaloneQualityReportInformation.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQ_StandaloneQualityReportInformation.java
index 181195e264..a4449f863e 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQ_StandaloneQualityReportInformation.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQ_StandaloneQualityReportInformation.java
@@ -26,6 +26,9 @@ import org.apache.sis.internal.jaxb.gco.PropertyType;
  * JAXB adapter mapping implementing class to the GeoAPI interface. See
  * package documentation for more information about JAXB and interface.
  *
+ * <p>This adapter excludes the value when marshalling the older version of ISO 19115 standard.
+ * That exclusion is systematic because the type did not existed in the old standard version.</p>
+ *
  * @author  Alexis Gaillard (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @version 1.3
@@ -65,11 +68,12 @@ public final class DQ_StandaloneQualityReportInformation extends
      * in a {@code <mdq:DQ_StandaloneQualityReportInformation>} XML element.
      *
      * @param  metadata  the metadata element to marshal.
-     * @return a {@code PropertyType} wrapping the given the metadata element.
+     * @return a {@code PropertyType} wrapping the given the metadata element,
+     *         or {@code null} if marshalling a too old version of the standard.
      */
     @Override
     protected DQ_StandaloneQualityReportInformation wrap(final StandaloneQualityReportInformation metadata) {
-        return new DQ_StandaloneQualityReportInformation(metadata);
+        return accept2014() ? new DQ_StandaloneQualityReportInformation(metadata) : null;
     }
 
     /**
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractElement.java b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractElement.java
index 1a426d8151..b4b639256b 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractElement.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractElement.java
@@ -25,6 +25,7 @@ import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 import org.opengis.metadata.Identifier;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.metadata.quality.Result;
@@ -41,6 +42,7 @@ import org.opengis.metadata.quality.MeasureReference;
 import org.opengis.metadata.quality.Metaquality;
 import org.opengis.util.InternationalString;
 import org.apache.sis.internal.jaxb.FilterByVersion;
+import org.apache.sis.internal.jaxb.gco.InternationalStringAdapter;
 import org.apache.sis.internal.metadata.Dependencies;
 import org.apache.sis.internal.xml.LegacyNamespaces;
 
@@ -84,7 +86,7 @@ import static org.apache.sis.util.collection.Containers.isNullOrEmpty;
     "evaluationProcedure",
     "dates",
     "results",
-    "derivedElements"
+    "derivedElement"
 })
 @XmlRootElement(name = "AbstractDQ_Element")
 @XmlSeeAlso({
@@ -235,8 +237,9 @@ public class AbstractElement extends ISOMetadata implements Element {
      */
     @Override
     @XmlElement(name = "standaloneQualityReportDetails")
+    @XmlJavaTypeAdapter(InternationalStringAdapter.Since2014.class)
     public InternationalString getStandaloneQualityReportDetails() {
-        return FilterByVersion.CURRENT_METADATA.accept() ? standaloneQualityReportDetails : null;
+        return standaloneQualityReportDetails;
     }
 
     /**
@@ -261,11 +264,7 @@ public class AbstractElement extends ISOMetadata implements Element {
     @Override
     @XmlElement(name = "measure", required = false)
     public MeasureReference getMeasureReference() {
-        if (FilterByVersion.CURRENT_METADATA.accept()) {
-            return (measureReference != null) ? measureReference : Element.super.getMeasureReference();
-        } else {
-            return null;
-        }
+        return (measureReference != null) ? measureReference : Element.super.getMeasureReference();
     }
 
     /**
@@ -405,7 +404,7 @@ public class AbstractElement extends ISOMetadata implements Element {
     @Override
     @XmlElement(name = "evaluationMethod", required = false)
     public EvaluationMethod getEvaluationMethod() {
-        return FilterByVersion.CURRENT_METADATA.accept() ? evaluationMethod : null;
+        return evaluationMethod;
     }
 
     /**
@@ -595,9 +594,8 @@ public class AbstractElement extends ISOMetadata implements Element {
      * @since 1.3
      */
     @Override
-    @XmlElement(name = "derivedElement")
+    // @XmlElement at the end of this class.
     public Collection<Element> getDerivedElements() {
-        if (!FilterByVersion.CURRENT_METADATA.accept()) return null;
         return derivedElements = nonNullCollection(derivedElements, Element.class);
     }
 
@@ -611,4 +609,28 @@ public class AbstractElement extends ISOMetadata implements Element {
     public void setDerivedElements(final Collection<? extends Element> newValues) {
         derivedElements = writeCollection(newValues, derivedElements, Element.class);
     }
+
+
+
+
+    //////////////////////////////////////////////////////////////////////////////////////////////////
+    ////////                                                                                  ////////
+    ////////                               XML support with JAXB                              ////////
+    ////////                                                                                  ////////
+    ////////        The following methods are invoked by JAXB using reflection (even if       ////////
+    ////////        they are private) or are helpers for other methods invoked by JAXB.       ////////
+    ////////        Those methods can be safely removed if Geographic Markup Language         ////////
+    ////////        (GML) support is not needed.                                              ////////
+    ////////                                                                                  ////////
+    //////////////////////////////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Invoked by JAXB at both marshalling and unmarshalling time.
+     * This attribute has been added by ISO 19157:2013 standard.
+     * If (and only if) marshalling an older standard version, we omit this attribute.
+     */
+    @XmlElement(name = "derivedElement")
+    private Collection<Element> getDerivedElement() {
+        return FilterByVersion.CURRENT_METADATA.accept() ? getDerivedElements() : null;
+    }
 }
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractResult.java b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractResult.java
index f1ca9dcf32..2813fc5e2b 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractResult.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractResult.java
@@ -21,13 +21,16 @@ import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlSeeAlso;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.apache.sis.internal.metadata.ImplementationHelper;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 import org.opengis.metadata.quality.Result;
 import org.opengis.metadata.quality.CoverageResult;
 import org.opengis.metadata.quality.ConformanceResult;
 import org.opengis.metadata.quality.QuantitativeResult;
 import org.opengis.metadata.quality.DescriptiveResult;
 import org.opengis.metadata.maintenance.Scope;
+import org.apache.sis.internal.jaxb.metadata.MD_Scope;
+import org.apache.sis.internal.jaxb.gco.GO_DateTime;
+import org.apache.sis.internal.metadata.ImplementationHelper;
 
 
 /**
@@ -155,6 +158,7 @@ public class AbstractResult extends ISOMetadata implements Result {
      */
     @Override
     @XmlElement(name = "resultScope")
+    @XmlJavaTypeAdapter(MD_Scope.Since2014.class)
     public Scope getResultScope() {
         return resultScope;
     }
@@ -179,6 +183,7 @@ public class AbstractResult extends ISOMetadata implements Result {
      */
     @Override
     @XmlElement(name = "dateTime")
+    @XmlJavaTypeAdapter(GO_DateTime.Since2014.class)
     public Date getDateTime() {
         return ImplementationHelper.toDate(dateTime);
     }
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultDataQuality.java b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultDataQuality.java
index 6389f6eb7a..b60c360ec5 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultDataQuality.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultDataQuality.java
@@ -222,7 +222,7 @@ public class DefaultDataQuality extends ISOMetadata implements DataQuality {
     @Override
     @XmlElement(name = "standaloneQualityReport")
     public StandaloneQualityReportInformation getStandaloneQualityReport() {
-        return FilterByVersion.CURRENT_METADATA.accept() ? standaloneQualityReport : null;
+        return standaloneQualityReport;
     }
 
     /**