Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LDDTool does not handle "unbounded" maximum cardinality in Choice blocks correctly #180

Closed
jshughes opened this issue May 5, 2020 · 4 comments · Fixed by #181
Closed
Labels
bug Something isn't working

Comments

@jshughes
Copy link
Collaborator

jshughes commented May 5, 2020

LDDTool does not handle "unbounded" maximum cardinality in Choice blocks correctly.
When defining a Choice block in Ingest_LDD, the character "*" is used as a value to represent an unlimited upper bound for cardinality. This value needs to be converted to "unbounded" when writing to an XML SChema file. This error only occurred in the case of the Choice block.

Expected output from the Geometry LDD. See maxOccurs="unbounded" below.

<xs:complexType name="Derived_Geometry">
<xs:annotation>
  <xs:documentation>The Derived_Geometry class is a container for
    surface based observations (lander or rover). It is used to
    provide some geometric quantities relative to a specific
    Reference Coordinate Space. </xs:documentation>
</xs:annotation>
<xs:sequence>
  <xs:choice minOccurs="1" maxOccurs="unbounded">
    <xs:element name="incidence_angle" type="geom:incidence_angle"> </xs:element>
    <xs:element name="emission_angle" type="geom:emission_angle"> </xs:element>
    <xs:element name="phase_angle" type="geom:phase_angle"> </xs:element>
    <xs:element name="instrument_azimuth" type="geom:instrument_azimuth"> </xs:element>
    <xs:element name="instrument_elevation" type="geom:instrument_elevation"> </xs:element>
    <xs:element name="solar_azimuth" type="geom:solar_azimuth"> </xs:element>
    <xs:element name="solar_elevation" type="geom:solar_elevation"> </xs:element>
    <xs:element name="start_azimuth" type="geom:start_azimuth"> </xs:element>
    <xs:element name="stop_azimuth" type="geom:stop_azimuth"> </xs:element>
  </xs:choice>
  <xs:element ref="geom:Coordinate_Space_Reference" minOccurs="0" maxOccurs="1"> </xs:element>
</xs:sequence>

</xs:complexType>

@jshughes jshughes added bug Something isn't working triage-needed labels May 5, 2020
jshughes added a commit that referenced this issue May 5, 2020
…cks correctly.

LDDTool does not handle "unbounded" maximum cardinality in Choice blocks correctly.

When defining a Choice block in Ingest_LDD, the character "*" is used as a value to represent an unlimited upper bound for cardinality. This value needs to be converted to "unbounded" when writing to an XML SChema file. This error only occurred in the case of the Choice block.

Resolves #180
jshughes added a commit that referenced this issue May 5, 2020
…cks correctly. (#181)

LDDTool does not handle "unbounded" maximum cardinality in Choice blocks correctly.

When defining a Choice block in Ingest_LDD, the character "*" is used as a value to represent an unlimited upper bound for cardinality. This value needs to be converted to "unbounded" when writing to an XML SChema file. This error only occurred in the case of the Choice block.

Resolves #180
@rchenatjpl
Copy link

Does anyone have a sample Ingest_LDD (like the one for geom) that creates an ldd with a choice? I don't have one. Thanks

@jshughes
Copy link
Collaborator Author

The Geometry LDD is the LDD where the issue was found and the one I used for testing. I use the posted version. I do not know of another.

@rchenatjpl
Copy link

Thanks, Steve, I don't get it. Can you give me an example of lddtool running into this?

@jshughes
Copy link
Collaborator Author

Here is Ed's message. He used "" to represent "unbounded" as the value of maxOccurs in the Ingest_LDD file. This is correct. However, LDDTool wrote "maxOccurs=""" instead of correctly writing "maxOccurs="unbounded" in the XML Schema file.

Steve,

I am having an issue with updating the geometry dictionary using the version of LDDtool that was built with model 1.13.0.0. The class below has a choice block where the maximum_occurences should be unbounded. Previous versions of lddtool worked with using a '*' in the ingest file.

<DD_Class>
    <name>Derived_Geometry</name>
    <version_id>4.0</version_id>
    <local_identifier>Derived_Geometry</local_identifier>
    <submitter_name>Elizabeth Rye</submitter_name>
    <definition>The Derived_Geometry class is a container for surface based observations 
        (lander or rover). It is used to provide some geometric quantities relative to a 
        specific Reference Coordinate Space.
    </definition>
    <abstract_flag>false</abstract_flag>
    <element_flag>false</element_flag>
    <DD_Association>
        <identifier_reference>XSChoice#</identifier_reference>
        <identifier_reference>incidence_angle</identifier_reference>
        <identifier_reference>emission_angle</identifier_reference>
        <identifier_reference>phase_angle</identifier_reference>
        <identifier_reference>instrument_azimuth</identifier_reference>
        <identifier_reference>instrument_elevation</identifier_reference>
        <identifier_reference>solar_azimuth</identifier_reference>
        <identifier_reference>solar_elevation</identifier_reference>
        <identifier_reference>start_azimuth</identifier_reference>
        <identifier_reference>stop_azimuth</identifier_reference>
        <reference_type>attribute_of</reference_type>
        <minimum_occurrences>1</minimum_occurrences>
        <maximum_occurrences>*</maximum_occurrences>
    </DD_Association>
    <DD_Association>
        <identifier_reference>Coordinate_Space_Reference</identifier_reference>
        <reference_type>component_of</reference_type>
        <minimum_occurrences>0</minimum_occurrences>
        <maximum_occurrences>1</maximum_occurrences>
    </DD_Association>
</DD_Class>

However, this version of lddtool generates the class definition below with a '' for maxOccurs. The '' seems to still work for simple attributes. What should the ingest file look like?

<xs:complexType name="Derived_Geometry">
xs:annotation
xs:documentationThe Derived_Geometry class is a container for
surface based observations (lander or rover). It is used to
provide some geometric quantities relative to a specific
Reference Coordinate Space. </xs:documentation>
</xs:annotation>
xs:sequence
<xs:choice minOccurs="1" maxOccurs="*">
<xs:element name="incidence_angle" type="geom:incidence_angle"> </xs:element>
<xs:element name="emission_angle" type="geom:emission_angle"> </xs:element>
<xs:element name="phase_angle" type="geom:phase_angle"> </xs:element>
<xs:element name="instrument_azimuth" type="geom:instrument_azimuth"> </xs:element>
<xs:element name="instrument_elevation" type="geom:instrument_elevation"> </xs:element>
<xs:element name="solar_azimuth" type="geom:solar_azimuth"> </xs:element>
<xs:element name="solar_elevation" type="geom:solar_elevation"> </xs:element>
<xs:element name="start_azimuth" type="geom:start_azimuth"> </xs:element>
<xs:element name="stop_azimuth" type="geom:stop_azimuth"> </xs:element>
</xs:choice>
<xs:element ref="geom:Coordinate_Space_Reference" minOccurs="0" maxOccurs="1"> </xs:element>
</xs:sequence>
</xs:complexType>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants