Re: URIs in constraints, isBound, casting in eq

Dan Connolly wrote:
> I'm studying...
> 
> "Definition: Constraints
> 
> A constraint is a boolean-valued expression of variables and RDF Terms
> that can be applied to restrict query solutions."
> 
> I think that should be "and RDF Literals", right?
> i.e. 
>  AND dc:title < 5
> is not a constraint in that sense, is it?
> 
> Nor is
>  AND dc:title eq dc:creator
> is it?

Yes - it is.  Maybe it shouldn't be, but the following is possible:

    dc:title =~ /^http:/    # Test whether http URI

so extension functions may take URIs as arguments.

> 
> 
> I *think* a constraint is just a boolean function of a solution,
> right? i.e. the constraint
>  ?X < 5
> is true of the solution { ?X => 4 } and false for { ?X => 6 }.

Yes - that is the intention.

> 
> Looking at it that way gives a definition for
> isBound(expr). Though... isn't isBound always redundant?

Hmm - theer is something odd here.

> Don't all solutions bind all variables?

Optionals cause solutions with unbound variables.

> 
> Also, this scares me:
> 
> "The following operators work in any type, and will cast values to
> appropriate types before testing: eq, ne"
> 
> Design of casting is one of the most time-consuming things a WG
> can do. Please strike that or replace it with a very precise
> pointer into a mature spec (Java or maybe XQuery) that gives
> the casting rules.

Agreed!

The casting should be devolved to F&O mostly.  The exceptions are corner cases 
like passing bNodes or unbound variables to op:numeric-add etc (it's an error).

Specifcally for eq/ne, which are general "are they the same/different" 
operations and are backed by proper operations : example, quoting F&O:

[[
8.2 op:anyURI-equal
op:anyURI-equal($arg1 as xs:anyURI, $arg2 as xs:anyURI) as xs:boolean

Summary: Returns true if $arg1 and $arg2 compare equal on a 
codepoint-by-codepoint basis. Otherwise, returns false. This function backs up 
the "eq" and "ne" operators on anyURI.

For more details on comparing URIs see [Uniform Resource Identifiers (URI): 
Generic Syntax].
]]

Hopefully, they will address the casting issue when that section is properly 
draft.  I will tweak the current text right now.

> 
> 
> ref
> http://www.w3.org/2001/sw/DataAccess/rq23/
> $Revision: 1.137 $ of $Date: 2004/11/19 17:44:46 $

Thank you for noting the version.

 Andy

Received on Monday, 22 November 2004 16:54:22 UTC