Re: Value testing: implementing str()

Steve Harris wrote:
> It seems logical. I havent implemented it so dont grok the problems yet,
> but I have a few minor concerns:
> 
> On Sun, Feb 20, 2005 at 02:00:03PM +0000, Andy Seaborne wrote:
> 
>>Proposal:
>>
>>1/ str(type literal) return lexical form for the typed literals, without 
>>canonicalization
> 
> 
> Seems reasonable and useful.
> 
> 
>>2/ str(bNode) is an evaluation error
> 
> 
> Is it out of the question to get a string with the same form as a N3 bNode
> back? eg _:a. I'm not sure I'd argue for that, but I think that rejecting
> all solutions which feature str(?x) where ?x binds to a bNode will be
> inconvient and supprising in some cases.

Would the str(bNode) => "" regardless of label be useful?  It avoids
rejecting the solution or requiring a sprinkling of

   isBlank(?x) || str(?x) ...

to change the sense of ?x being a bNode.

Exposing the internal bNode label seems inappropriate (and, as the label has
no meaning except to distinguish bNodes) meaningless.  Otherwise str() and 
isBlank() could be used to find a bNode again :-)

BTW - does it say somewhere that || and && only evaluate the RHS if the LHS
is false/true respectively?

[ Looking in XQuery 1.0 I found:
http://www.w3.org/TR/xquery/#id-logical-expressions

"""
The following expression may return either false or raise a dynamic error:

1 eq 2 and 3 idiv 0 = 1
"""
]

> 
> 
>>3/ str(expression) is legal - change the grammar production
> 
> 
> This seems right, but interacts a bit oddly with 1/ in that str(?x) and
> str(?x + 0) are quite different, even when ?x is bound to an integer:
> 
> 	ex:foo rdf:value "001"^^xsd:Integer .
> 
> 	SELECT ?x WHERE (ex:foo rdf:value ?x) AND str(?x+0) != "999"
> 
> Quite possbily not an issue, but ?x and ?x+0 seem similar to me.

Hadn't thought of that.  It's different again if it were 0.0.  There is a 
distiction between value and lexical comparision.

    str(?x+0) => "001"

then
  	ex:foo rdf:value "001"^^xsd:integer .
  	ex:bar rdf:value "01"^^xsd:integer .

	SELECT ?x ?y
         WHERE (ex:foo rdf:value ?x) (ex:bar rdf:value ?y)
         AND str(?x) ne str(?y)
but
	AND ?x == ?y
also
         AND str(?x+0) eq str(?y+0)

> 
> 
>>The only other choice I see is that str() only apply (syntactically) to a 
>>variable but is we have value-based constraints, this is a rather odd.
> 
> 
> Yes, that seems odd.
> 
> - Steve
> 

	Andy

Received on Sunday, 20 February 2005 19:26:07 UTC