W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2004

Re: TypeInfo#isDerivedFrom

From: Curt Arnold <carnold@houston.rr.com>
Date: Mon, 9 Aug 2004 15:55:08 -0500
Message-Id: <66251555-EA46-11D8-96D1-000393B97126@houston.rr.com>
To: www-dom@w3.org

On Aug 9, 2004, at 4:02 AM, Michael Kay wrote:

> If type A is derived indirectly from type B by a sequence of steps that
> includes both restriction and extension, what result should
> A.isDerivedFrom(B, x) return where:
> (a) x is 0
> The answer to (a) seems to be clearly documented as TRUE. I can't find  
> an
> explanation of what the other three cases should return.
> Obviously the result of (b) and (c) should be the same, and the spec  
> does
> say that the result of (d) should be the result of b OR c, so it boils  
> down
> to the question, what does (b) return?

a = true, b = true, c = false, d = true

Test cases testinfoisderivedfrom32, 33 and 34 test that type of  
scenario.  Test 32 is equivalent to scenarios a and d, 33 == scenario b  
and 34 == scenario c.

core.html#TypeInfo-DERIVATION_RESTRICTION) ends with the phrase: "and  
all the derivation methods involved are  restriction."  In this  
scenario, one of the derivation methods is not restriction, so that  
condition is not satisfied and c is false.

The definition of DERIVATION_EXTENSION  
core.html#TypeInfo-DERIVATION_EXTENSION) ends with the phrase: "at  
least one  of the derivation methods involved is an  extension".  In  
this scenario, at least one step is an extension, so the condition is  
satisfied and b is true.

In the description of Definition Groups DerivationMethods:  "When   
using the isDerivedFrom method, combining all of  them in the  
derivationMethod parameter is  equivalent to invoking the method for  
each of them separately  and combining the results with the OR boolean  
function."  So

     A.isDerivedFrom(B, METHOD_RESTRICTION) || A.isDerivedFrom(B,  
     false || true == true

The definition of METHOD_RESTRICTION was designed so that if  
A.isDerivedFrom(B, METHOD_RESTRICTION) were true then it would follow  
that all legal values for type A were also legal values for type B.   
This would allow you to, for example, ask if a type was derived by  
restriction from xsd:double.  If it returned true, you could check  
proposed values to see if they were of type double and if not, you  
could safely reject it as not being a legal value for the type.
Received on Monday, 9 August 2004 20:55:16 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:12 UTC