NIEM / NIEM-Releases

Repository for releases of the National Information Exchange Model
https://niem.github.io/niem-releases/
88 stars 23 forks source link

Review measure-related components #143

Closed cdmgtri closed 4 years ago

cdmgtri commented 4 years ago

nc:MeasureType

nc:AngleMeasureType

nc:AngularRateMeasureType

nc:LengthMeasureType

nc:SpeedMeasureType

nc:SubstanceMeasureType

nc:TemperatureMeasureType

nc:TimeMeasureType

nc:VelocityMeasureType (extends nc:SpeedMeasureType)

nc:VolumeMeasureType

nc:WeightMeasureType

DonClysdale commented 4 years ago

At ESDC we added an AreaMeasureType and related units etc (attached). Area.txt This would be useful to incorporate into NIEM Core.

There needs to be some work done on the unit types - probably creating different types for ISQ Units (https://en.wikipedia.org/wiki/ISO_80000-1), Imperial Units, US units etc. Wikipedia lists 87 units for area (not all in common use) at https://en.wikipedia.org/wiki/Category:Units_of_area

.

cdmgtri commented 4 years ago

Here are the UN/CEFACT area codes I found in the latest draft:

area-codes

https://www.unece.org/cefact/codesfortrade/codes_index.html

DonClysdale commented 4 years ago

There are many examples of "Unit" and/or "Value" elements being added to MeasureTypes based nc:MeasureType or using nc:Measure (nc:MeasureType). Many times the difference is that units are embedded in the name or definition of the Value element.

I am proposing that niem-core.xsd be modified to have nc:MeasureType follow the representation pattern and create a nc:MeasureRepresentation abstract type. This type would be connected to the current nc:MeasureUnitAbstract and nc:MeasureValueAbstract by creating a nc:MeasureValueType that includes nc: nc:MeasureUnitAbstract and nc:MeasureValueAbstract and have nc:MeasureValue (nc:MeasureValueType) defined as belonging to substitutionGroup nc:MeasureRepresentation. All elements for Unit would belong to substitutionGroup nc:MeasureUnitAbstract and all elements for Value would belong to substitutionGroup nc:MeasureValueAbstract.

The elements of Measure types with multiple values, e.g. nc:AngularMeasure (nc:AngularMeasureType) would belong to substitutionGroup nc:MeasureRepresentation.

All the changes are limited to the niem-core.xsd and mo.xsd schema.

Attached are a draft implementation based on the NIEM 5.0-alpha1 tagged versions. niem-core.txt mo.txt

DonClysdale commented 4 years ago

If the above nc:MeasureRepresentation approach is adopted, then the biom:Measure elements and types could be refactored to use nc:MeasureType as base.

cdmgtri commented 4 years ago

Example XSD snippets from proposal above

<xs:complexType name="MeasureType">
  <xs:annotation>
    <xs:documentation>A data type for a measurement.</xs:documentation>
  </xs:annotation>
  <xs:complexContent>
    <xs:extension base="structures:ObjectType">
      <xs:sequence>
        <xs:element ref="nc:MeasureRepresentation"/>
        <xs:element ref="nc:MeasureCommentText"/>
        <xs:element ref="nc:MeasureDate"/>
        <xs:element ref="nc:MeasureErrorAbstract"/>
        <xs:element ref="nc:Measurer"/>
        <xs:element ref="nc:MeasureMethodText"/>
        <xs:element ref="nc:MeasureEstimatedIndicator"/>
        <xs:element ref="nc:MeasureAugmentationPoint"/>
      </xs:sequence>
      <xs:attribute ref="nc:sigmaErrorValue" use="optional"/>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

<xs:complexType name="MeasureValueType">
  <xs:annotation>
    <xs:documentation>A data type for a measurement value and unit.</xs:documentation>
  </xs:annotation>
  <xs:complexContent>
    <xs:extension base="structures:ObjectType">
      <xs:sequence>
        <xs:element ref="nc:MeasureValueAbstract"/>
        <xs:element ref="nc:MeasureUnitAbstract"/>
        <xs:element ref="nc:MeasureValueAugmentationPoint"/>
      </xs:sequence>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

<xs:element name="MeasureValue" type="nc:MeasureValueType" substitutionGroup="nc:MeasureRepresentation"/>

<xs:element name="MeasureRepresentation" abstract="true"/>
DonClysdale commented 4 years ago

Current nc:AngleMeasure (nc:AngleMeasureType) nc:AngleMeasureType extends nc:MeasureType definition "A data type for a measure of an angular value."

nc:AngularMeasureType extends structures:ObjectType definition "A data type for the measurement of an angle."

hs:MedicationDoseMeasure (nc:MeasureType)

j:MeasureUnitCodeSimpleType j:MeasureUnitCodeType extends j:MeasureUnitCodeSimpleType (not used)

mo:AngularMeasureAugmentationType extends structures:AugmentationType

mo:AngleDegreesMeasure (nc:AngularMeasureType) mo:CourseAngleDegreesMeasureType extends structures:ObjectType

mo:AngularMeasureCompassCode (nc:DirectionCodeType) substitution for mo:HorizontalAngularMeasureAbstract

mo:FrequencyMeasureType extends nc:MeasureType

mo:FrequencyUnitTemporalCodeSimpleType mo:FrequencyUnitTemporalCodeType extends mo:FrequencyUnitTemporalCodeSimpleType

mo:CourseAngleMeasure (nc:AngularMeasureType)

mo:CourseCode (nc:DirectionCodeType) mo:CourseValue (nc:Degree360Type) mo:SlopeValue (nc:Degree90PlusMinusType)

mo:SpeedMeasureAugmentationType extends structures:AugmentationType

mo:HorizontalAngularMeasure (mo:HorizontalAngularMeasureType) mo:HorizontalAngularMeasureAbstract mo:HorizontalAngularMeasureAugmentationPoint mo:HorizontalAngularMeasureType extends nc:AngularMeasureType

mo:SectorMaximumAzimuthMeasure (mo:HorizontalAngularMeasureType) mo: SectorMinimumAzimuthMeasure (mo:HorizontalAngularMeasureType)

mo:VerticalAngularMeasure (mo:VerticalAngularMeasureType) mo:VerticalAngularMeasureAugmentationPoint mo:VerticalAngularMeasureType (nc:AngularMeasureType)

mo:EllipseMajorAxisAzimuthMeasure (mo:HorizontalAngularMeasureType) mo:SectorMaximumAzimuthMeasure (mo:HorizontalAngularMeasureType) mo:SectorMinimumAzimuthMeasure (mo:HorizontalAngularMeasureType)

m:PositionCourseMeasure (nc:AngleMeasureType) m:PositionHeadingMeasure (nc:AngleMeasureType)

Proposal nc:AngleMeasure (nc:AngleMeasureType) substitutes for nc:HorizontalAngularMeasureAbstract nc:DirectionCode (nc:DirectionCodeType) substitutes for nc:HorizontalAngularMeasureAbstract nc:DirectionDatumAbstract nc:DirectionDatumCode (nga:DirectionDatumCodeType) substitutes for nc:DirectionDatumAbstract nc:AngularMeasure (nc:AngularMeasureType) substitutes for nc:HorizontalAngularMeasureAbstract nc:MeasureType

hs:MedicationDoseMeasure (nc:SubstanceMeasureType) - like nc:DrugMeasure

j:MeasureUnitCodeSimpleType (remove) j:MeasureUnitCodeType extends j:MeasureUnitCodeSimpleType (remove) use more specific unit code types

nc:FrequencyMeasureType extends nc:MeasureType

nc:FrequencyUnitTemporalCodeSimpleType nc:FrequencyUnitTemporalCodeType extends nc:FrequencyUnitTemporalCodeSimpleType

mo:CourseAngleDesgreesMeasureType (remove same elements as nc:HorizontalAngularMeasureType) mo:CourseAngleDesgreesMeasureAugmentationPoint (remove)

mo:AngularMeasureCompassCode (remove - replaced by nc:DirectionCode)

mo:AngularMeasureDecimalValue (remove same as MeasureDecimalValue used on nc:MeasurePointAbstract) mo:CourseAngularMeasure (nc:HorizontalAngularMeasureType) substitution mo:CourseAbstract mo:CourseDirectionCode (nc:DirectionCodeType) substitution mo:CourseAbstract mo:CourseDegreeValue (nc:Degree360Type) substitution mo:CourseAbstract mo:SlopeDegreeValue (nc:Degree90PlusMinusType) mo:SpeedMeasureAugmentationType (remove)

nc:HorizontalAngularMeasure (nc:HorizontalAngularMeasureType) nc:HorizontalAngularMeasureAbstract nc:HorizontalAngularMeasureAugmentationPoint nc:HorizontalAngularMeasureType extends structures:ObjectType

nc:VerticalDatumAbstract (replaces or similar to nc:LocationHeightVerticalDatumAbstract?) nc:VerticalDataCode (nga:VerticalDatumCode) substitutes for nc:VerticalDatumAbstract nc:VerticalAngularMeasure (nc:VerticalAngularMeasureType) nc:VerticalAngularMeasureAugmentationPoint nc:VerticalAngularMeasureType (nc:AngularMeasureType)

mo:EllipseMajorAxisAzimuthMeasure (nc:HorizontalAngularMeasureType) mo:SectorMaximumAzimuthMeasure (nc:HorizontalAngularMeasureType) mo:SectorMinimumAzimuthMeasure (nc:HorizontalAngularMeasureType)

m:PositionCourseMeasure (nc:HorizontalAngularMeasureType) m:PositionHeadingMeasure (nc:HorizontalAngularMeasureType)

Probably more....

cdmgtri commented 4 years ago

Flatten measure substitutions?

Current substitution group in nc:MeasureType

Flattened

cdmgtri commented 4 years ago

Info about United States customary units: https://en.wikipedia.org/wiki/United_States_customary_units

cdmgtri commented 4 years ago

The Harmonization work group recommends creating a new nc:AreaMeasureType. Most US customary units seem to already be represented in the current unit code sets we have. Other proposal may be reviewed again at a later date, but are not being recommend for NIEM 5.0.