09/02/2005 11:11 AM
post4638
|
Definition of ranges
The RangeValueType is a bit confusing. In my opinion introducing both Upper/LowerBoundedRange and Range elements, which
basically have the same semantics makes it more ambiguous. I understand that they have been defined to enable users to
specify more than one range. However, multiple range elements can be used to express it. A numeric value could match a
RangeValue if and only if at least one of the following conditions is true:
- R contains an Exact, E, with an epsilon attribute e, where E-e ≤ N ≤ E+e.
- R contains a Range with LowerBound, L such that the following condition is true:
- L has a false exclusiveBound attribute and N ≥ L, or L has a true exclusiveBound attribute and N > L.
- R contains a Range with UpperBound, U, such that the following condition is true:
- U has a false exclusiveBound attribute and N ≤ U, or U has a true exclusiveBound attribute and N < U.
- R contains a Range with LowerBound, L, and UpperBound, U, such that both of the following are true:
- L has a false exclusiveBound attribute and N ≥ L, or L has a true exclusiveBound attribute and N > L.
- U has a false exclusiveBound attribute and N ≤ U, or U has a true exclusiveBound attribute and N < U.
Then the pseudo-schema and the example from the specification would look like:
<Exact epsilon="xsd:double"?>
xsd:double
</Exact>*
<Range>
<LowerBound exclusiveBound="xsd:boolean"?>
xsd:double
</LowerBound>
<UpperBound exclusiveBound="xsd:boolean"?>
xsd:double
</UpperBound>
</Range>*
<jsdl:Exact> 5.0 </jsdl:Exact>
<jsdl:Exact epsilon="0.00001"> 6.7777 </jsdl:Exact>
<jsdl:Exact> 7.0 </jsdl:Exact>
<jsdl:Range>
<jsdl:LowerBound> 50.3 </jsdl:LowerBound>
<jsdl:UpperBound exclusiveBound="true"> 99.5 </jsdl:UpperBound>
</jsdl:Range>
<jsdl:Range>
<jsdl:LowerBound> 100.0 </jsdl:LowerBound>
</jsdl:Range>
The only disadvantage of this solution is that user could define a range without neither LowerBound nor UpperBound. On
the other hand this would simply mean that all values match RangeValue. It would be semantically correct since a lack of
lower or upper bound means negative and positive infinity, respectively. Therefore, the range element without bounds
would mean range from negative to positive infinity.
Anyway, everything what is needed can be expressed using the current construct (it's nice that the "epsilon" argument
was also
added) so there is only a question of an elegant shape and ease of use.
|
|
|