Operator mapping for value comparisons(xs:anyURI in particular)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Operator mapping for value comparisons(xs:anyURI in particular)

frans.englich (Bugzilla)

Hello,

I don't think this expression should compile:

xs:anyURI("example.org/") lt xs:anyURI("example.org/")

Because:

1. There's no 'lt' operator defined for xs:anyURI in B.2 Operator Mapping; and
2. The way operands are handled for value comparisons(3.5.1 Value
Comparisons), does not allow xs:anyURI to be promoted to xs:string, which I
think is what happening in Saxon's case.

All these should fail, by the same principle:

xs:anyURI("example.org/") lt xs:anyURI("example.org/")
xs:anyURI("example.org/") le xs:anyURI("example.org/")
xs:anyURI("example.org/") gt xs:anyURI("example.org/")
xs:anyURI("example.org/") ge xs:anyURI("example.org/")

Considering that there's sparse on type promotions for value comparisons,
these should also fail:

xs:string("example.org/") eq xs:anyURI("example.org/") (: xs:string cannot be
promoted to xs:anyURI :)
xdt:untypedAtomic("example.org/") eq xs:anyURI("example.org/") (: the
untypedAtomic gets promoted to xs:string but that doesn't help :)

This one should succeed(and it also does):

xdt:untypedAtomic("example.org/") eq xs:string("example.org/")

Right? (Running 8.5)


Cheers,

                Frans


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Operator mapping for value comparisons(xs:anyURI in particular)

Michael Kay
Ouch.

I' confident it was the intention of the working group that value
comparisons between anyURI and string should work, for example this is
necessary to retain backwards compatibility for the expression

<xsl:if test="namespace-uri() = 'http://thing/'">

(if URI-to-string promotion doesn't work for value comparisons, then it
doesn't work for general comparisons either).

But I agree, if you follow the spec closely, there's nothing that causes
type promotion to kick in here.

I think it's a bug in the spec. Can you raise it, or shall I?

Michael Kay
http://www.saxonica.com/
 

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of
> Frans Englich
> Sent: 30 September 2005 17:40
> To: [hidden email]
> Subject: [saxon] Operator mapping for value
> comparisons(xs:anyURI in particular)
>
>
> Hello,
>
> I don't think this expression should compile:
>
> xs:anyURI("example.org/") lt xs:anyURI("example.org/")
>
> Because:
>
> 1. There's no 'lt' operator defined for xs:anyURI in B.2
> Operator Mapping; and
> 2. The way operands are handled for value comparisons(3.5.1 Value
> Comparisons), does not allow xs:anyURI to be promoted to
> xs:string, which I
> think is what happening in Saxon's case.
>
> All these should fail, by the same principle:
>
> xs:anyURI("example.org/") lt xs:anyURI("example.org/")
> xs:anyURI("example.org/") le xs:anyURI("example.org/")
> xs:anyURI("example.org/") gt xs:anyURI("example.org/")
> xs:anyURI("example.org/") ge xs:anyURI("example.org/")
>
> Considering that there's sparse on type promotions for value
> comparisons,
> these should also fail:
>
> xs:string("example.org/") eq xs:anyURI("example.org/") (:
> xs:string cannot be
> promoted to xs:anyURI :)
> xdt:untypedAtomic("example.org/") eq xs:anyURI("example.org/") (: the
> untypedAtomic gets promoted to xs:string but that doesn't help :)
>
> This one should succeed(and it also does):
>
> xdt:untypedAtomic("example.org/") eq xs:string("example.org/")
>
> Right? (Running 8.5)
>
>
> Cheers,
>
> Frans
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads,
> discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> saxon-help mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help
>




-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Operator mapping for value comparisons(xs:anyURI in particular)

frans.englich (Bugzilla)
On Friday 30 September 2005 17:00, Michael Kay wrote:

> Ouch.
>
> I' confident it was the intention of the working group that value
> comparisons between anyURI and string should work, for example this is
> necessary to retain backwards compatibility for the expression
>
> <xsl:if test="namespace-uri() = 'http://thing/'">
>
> (if URI-to-string promotion doesn't work for value comparisons, then it
> doesn't work for general comparisons either).
>
> But I agree, if you follow the spec closely, there's nothing that causes
> type promotion to kick in here.
>
> I think it's a bug in the spec.

Hah. While falling a sleep, my mail bothered me because the implications of it
were so large, and that it also contradicted what I actually thought should
be the behavior(what Saxon currently do). But it's quite a serious bug
though, since a promotion rule for the value comp needs to be added(or
somthing like that), assuming there now actually is a bug(say, it's covered
somewhere else).

> Can you raise it, or shall I?

I can, will do today.


Cheers,

                Frans

> Michael Kay
> http://www.saxonica.com/
>
> > -----Original Message-----
> > From: [hidden email]
> > [mailto:[hidden email]] On Behalf Of
> > Frans Englich
> > Sent: 30 September 2005 17:40
> > To: [hidden email]
> > Subject: [saxon] Operator mapping for value
> > comparisons(xs:anyURI in particular)
> >
> >
> > Hello,
> >
> > I don't think this expression should compile:
> >
> > xs:anyURI("example.org/") lt xs:anyURI("example.org/")
> >
> > Because:
> >
> > 1. There's no 'lt' operator defined for xs:anyURI in B.2
> > Operator Mapping; and
> > 2. The way operands are handled for value comparisons(3.5.1 Value
> > Comparisons), does not allow xs:anyURI to be promoted to
> > xs:string, which I
> > think is what happening in Saxon's case.
> >
> > All these should fail, by the same principle:
> >
> > xs:anyURI("example.org/") lt xs:anyURI("example.org/")
> > xs:anyURI("example.org/") le xs:anyURI("example.org/")
> > xs:anyURI("example.org/") gt xs:anyURI("example.org/")
> > xs:anyURI("example.org/") ge xs:anyURI("example.org/")
> >
> > Considering that there's sparse on type promotions for value
> > comparisons,
> > these should also fail:
> >
> > xs:string("example.org/") eq xs:anyURI("example.org/") (:
> > xs:string cannot be
> > promoted to xs:anyURI :)
> > xdt:untypedAtomic("example.org/") eq xs:anyURI("example.org/") (: the
> > untypedAtomic gets promoted to xs:string but that doesn't help :)
> >
> > This one should succeed(and it also does):
> >
> > xdt:untypedAtomic("example.org/") eq xs:string("example.org/")
> >
> > Right? (Running 8.5)
> >
> >
> > Cheers,
> >
> > Frans
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by:
> > Power Architecture Resource Center: Free content, downloads,
> > discussions,
> > and more. http://solutions.newsforge.com/ibmarch.tmpl
> > _______________________________________________
> > saxon-help mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/saxon-help
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads, discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> saxon-help mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help
Loading...