[
https://issues.apache.org/jira/browse/DAFFODIL-1741?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Michael Beckerle reassigned DAFFODIL-1741:
------------------------------------------
Assignee: (was: Elizabeth Fahl)
> Performance - validation of Enum and Ranges for simple type unions
> ------------------------------------------------------------------
>
> Key: DAFFODIL-1741
> URL: https://issues.apache.org/jira/browse/DAFFODIL-1741
> Project: Daffodil
> Issue Type: Improvement
> Components: Back End, Middle "End"
> Affects Versions: 2.0.0
> Reporter: Michael Beckerle
> Fix For: deferred
>
>
> DFDL-1634 provides support for simpleType uinons in Daffodil.
> However, a union is still validated (in "limited" validation mode, or when
> dfdl:checkConstraints is called) by sequentially walking through the union
> members one by one.
> When the union consists of enumerations, or ranges, or mixtures of only those
> two, then a faster mechanism is needed.
> E.g., for a union that is just enumerations, the validation should take
> constant time, by using a hash/table lookup.
> For a union of min/max ranges, some sort of decision tree that rapidly
> determines validity is required.
> combinations of these are also possible. A common situation would be for the
> integer 0 to mean "No Statement", 1-25 are valid values that have some
> mathematical meaning, and 26-31 are illegal.
> We want to express this like
> {code}
> <simpleType>
> <union memberTypes="ex:noStatement ex:allowed ex:illegal"/>
> </simpleType>
> <simpleType name="noStatement">
> <restriction base="xs:int">
> <enumeration value="0"/>
> </restriction>
> </simpleType>
> <simpleType name="valid">
> <union memberTypes="ex:car ex:train ex:plane.... ex:bicycle"/
> </simpleType>
> <simpleType name="car"><restriction base="xs:int"><enumeration
> value="1"/></restriction></simpleType>
> <simpleType name="train"><restriction base="xs:int"><enumeration
> value="2"/></restriction></simpleType>
> <simpleType name="plane"><restriction base="xs:int"><enumeration
> value="3"/></restriction></simpleType>
> ... 21 more ...
> <simpleType name="bicycle"><restriction base="xs:int"><enumeration
> value="25"/></restriction></simpleType>
> <simpleType name="illegal">
> <restriction base="xs:int">
> <minInclusive value="26"/>
> <maxInclusive value="31"/>
> </restriction>
> </simpleType>
> {code}
>
> In the above, the union containing the 25 enumeration simple types will be
> iterated with a loop that will go through all 25 possibles one by one. This
> needs to be improved to be a constant time dispatch.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)