Re: casting out-of-range

According to our current definitions [1,2] of the guards and negative guards...

positive guard return "t if and only if s1 is in the value space of DATATYPE and f otherwise."

and analogously:

negative guards return "t if and only if s1 is in the value space of one of the datatypes in DTS but not in the value space of the datatype with shortname DATATYPE, and f otherwise."

so, you will always get either true or false when calling either a negative or positive guard...

however, since the casting functions for values outside the domain are unspecified [3]...

"If the argument value is outside of its domain, the value of the function is left unspecified."
(stems from that we don't have errors in RIF...)

... so, we do not restrict in any way the outcome of the cast, and - correct me if I am wrong - i.e. that could vary implementation dependently... BUT: either ways that means  *one* of the two calls below should return true, IMHO, just you can't be sure which one... other opinions?

HTH,
Axel

On 16 Feb 2010, at 17:09, Sandro Hawke wrote:

> 
> Looking at test cases today we thought about this:
> 
>   External( pred:is-literal-int( External ( xs:int ( "x"^^xs:string ) ) ) )
> 
> and
> 
>   External( pred:is-literal-not-int( External ( xs:int ( "x"^^xs:string ) ) ) )
> 
> Is either of them true? If not, is there any way to handle casting
> deterministically in the face of bad data?
> 


>    -- Sandro
> 


1. http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes
2. http://www.w3.org/TR/rif-dtb/#Negative_Guard_Predicates_for_Datatypes
3. http://www.w3.org/TR/rif-dtb/#Casting_to_XML_Schema_Datatypes

Received on Monday, 22 February 2010 16:19:45 UTC