Hello all

We recently committed on the JDK8 branch an API proposal for "attributes
on attributes". This is part of ISO 19109 and there is a real need for
that (example below), but there is a risk of over-engineering. I would
like feedback if anyone wishes to share.

According ISO 19109, an "AttributeType" may contains itself other
AttributeTypes. To compare with the Java language, this is like
annotations on a field. For example consider the following scenario: a
dataset (e.g. a Shapefile) contains measurements (e.g. air
temperatures), and we also want to store the accuracy of those
measurements. Often (but not always) the accuracy is the same for all
measurements of the same kind in the dataset. For example we may have a
database table with a "Air temperature (°C)" column with an accuracy of
±0.1°C applying to that column as a whole. Such accuracy can been seen
as a kind of metadata attached to the "air temperature" attribute.

First, I propose the following "AttributeType.characteristics()" method.
If we were following strictly ISO 19109, the method name would be
"characterizeBy" and the return type would be a collection of
AttributeTypes. I propose a Map instead for making easier to get an
AttributeType for a known name. E.g.
temperature.characteristics().get("accuracy"):

   
https://builds.apache.org/job/sis-dev/javadoc/org/apache/sis/feature/DefaultAttributeType.html#characteristics--

The above method provides the default characteristics for all
measurements of a given type. Next, I propose the following
"Attribute.characteristics()" method for case-by-case characteristics
(e.g. if for some reason, a particular measurement has an accuracy
different than the usual one, for example because of a problem with the
sensor at a particular time):

   
https://builds.apache.org/job/sis-dev/javadoc/org/apache/sis/feature/AbstractAttribute.html#characteristics--

We could possibly simplify the API if we replace the above
Map<String,Attribute> by Map<String,Object> which would contains
directly the characteristic values. However Map<String,Attribute> seems
more consistent with the above-cited AttributeType.characteristics()
method, and may allow users to use characteristics as if they were
ordinary attributes.

Does anyone would like to comment?

    Martin

Reply via email to