Re: [Fwd: : http://www.w3.org/2001/sw/DataAcce​ss/issues#useMentionOp]

Some clarifications -- not a DAWG response.

On Thu, Apr 21, 2005 at 04:03:27PM -0500, Dan Connolly wrote:
> typo in the To line...
> 

Content-Description: Forwarded message - : http://www.w3.org/2001/sw/DataAcce​ss/issues#useMentionOp
> Date: Thu, 14 Apr 2005 15:34:16 -0400
> From: Tim Berners-Lee <timbl@w3.org>
> Subject: : http://www.w3.org/2001/sw/DataAcce​ss/issues#useMentionOp
> To: public-dawg-comments@w3.org
> Cc: Dan Connolly <connolly@w3.org>
> 
> In my opinion, it is a serious breach of sanity to coerce the
> URI for something to its value using str().
> All kinds of things can get URIs, and the actual URIs they
> get is in general irrelevant.
> Here is an example case.
> 
> # Data
> @prefix  : <#>.
> :ellen foaf:name  :n.
> :n  =    "Ellen".
> 
> We are working with a processor which knows that  :n and "Ellen"
> are the same, and so concludes
> 
> :ellen foaf:name "Ellen".
> 
> so that is part of the data too.

What is the projection of this into RDF? Is it:?
  <file://localhost/query1/#ellen> foaf:name
    <http://localhost/arbitraryPath#a>, "h_Ellen".
*note, changed Ellen's name to ensure a match and a difficult childhood

> #  Query:
> #  Find people whose names begin with "h"
> 
> SELECT ?x WHERE    ?x  :name  ?n  FILTER  FILTER  regex(str(?n), "^h"}
>
> This works fine and as intended, except in the case when the base URI
> of the document starts with "h", in which case suddenly it will
> produce all the URIs used for names as well as the names themselves.
> Yuk.  Bzzzt.  Not as intended.

tested with <http://dev.w3.org/cvsweb/perl/modules/W3C/Rdf/test/SPARQL-str-alg.sh?rev=HEAD&content-type=text/x-cvsweb-markup>:

PREFIX foaf:       <http://xmlns.com/foaf/0.1/>
SELECT ?x ?n
 WHERE { ?x foaf:name ?n .
         FILTER regex(str(?n), "^h")
       }
==>
+-----------------------+----------------------------------+
|                      x|                                 n|
|-----------------------|----------------------------------|
|<file:///query1/#ellen>|<http://localhost/arbitraryPath#a>|
|<file:///query1/#ellen>|                         "h_Ellen"|
+-----------------------+----------------------------------+

whereas
PREFIX foaf:       <http://xmlns.com/foaf/0.1/>
SELECT ?x ?n
 WHERE { ?x foaf:name ?n .
         FILTER regex(?n, "^h")
       }
==>
+-----------------------+---------+
|                      x|        n|
|-----------------------|---------|
|<file:///query1/#ellen>|"h_Ellen"|
+-----------------------+---------+

success table of functions vs. arguments:

  str uri
regex(?n, ok fail
regex(str(?n), ok ok

> Really, the relation between something and the string used as a
> symbol for it is  a special and weird relationship.
> It is rarely used, as it is a level-breaker, because the URI stringss 
> are
> generally irrelevant to the semantics.

The come up an awful lot in trust issues. For instance, google would
be much less trusted if folks couldn't see the source domain names.
Even when not tied to provenance, they are pretty handy for policy
assertions ala PICS.

>                                        When used,
> it is really important that the programmer and the machine
> are both aware that it is happening. So it must be explicit.
> 
> Please use uri(?n)  to give a symbol by which ?n is known.

The semantics of uri(?n) seem to be that it fails if they object is
not a URI. I think you'll find that failure behaves nicely in SPARQL
(failures cause a solution not match if if the test is negated).

I think the str(?n) (adopted from XQuery) is very useful. What should
it do when it encounters a URI? Should it fail (may be tough to
justify to the XQuery community)? It could behave has it does now, and
we could provide the uri2str operator to complete the options:

  str uri
regex(?n, ok fail
regex(str(?n), ok ok
uri2str(?n) fail ok

> And be aware that using this is hairy  (as something may of course
> by known by many URIs, some of which you find out later).
-- 
-eric

office: +81.466.49.1170 W3C, Keio Research Institute at SFC,
                        Shonan Fujisawa Campus, Keio University,
                        5322 Endo, Fujisawa, Kanagawa 252-8520
                        JAPAN
        +1.617.258.5741 NE43-344, MIT, Cambridge, MA 02144 USA
cell:   +81.90.6533.3882

(eric@w3.org)
Feel free to forward this message to any list for any purpose other than
email address distribution.

Received on Tuesday, 3 May 2005 22:19:22 UTC