W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > April to June 2006

Re: Namespace of builtin functions

From: Eric Prud'hommeaux <eric@w3.org>
Date: Fri, 16 Jun 2006 09:11:55 +0200
To: "Seaborne, Andy" <andy.seaborne@hp.com>
Cc: dawg mailing list <public-rdf-dawg@w3.org>
Message-ID: <20060616071155.GA24910@w3.org>

Oops, just found this in my pending mbox:

2006-06-13T14:06:08Z <LeeF> could someone scratch out the current
proposal, please?

AndyS has provided a list of URIs. As a staring point, consider the
following fairly conservative scenario:

  we (continue to) use XPath functions by name and (continue to) not
  say what the behavoir of the fn:matches is when encountered in a
  tripple pattern or a FILTER.

  we provide a namespace sop: and use it in the spec like so:
    Operator  Argument type   Function	      Result type
    BOUND(A)  variable	      sop:isBound(A)  xsd:boolean

  In 11.3 Operator Mapping [MAP], we add
    [[
    The name of each SPARL operator may be concatonated onto the
    namespace <mumble> to provide an identifier for the semantics of
    that operator. The behavoir of such a URI in a triple pattern
      _:a sop:logical-or _:b
    or a FILTER
      FILTER (sop:logical-or(?a, ?b)
    is not defined.*
    ]]
.

* We could probably define the meaning of these URIs in FILTERs
  without much controversy, but we would add various error situations
  regarding the cardinality and argument types that the grammar would
  not be able to detect. I believe this would just make implementation
  and validation more difficult; it would make the language bigger
  without giving any new utility to the user. My weasel wording above
  is intended to be equivilent to what Howard pointed out in F&O:
[[
Functions defined with the op prefix are described here to underpin
the definitions of the operators in [XML Path Language (XPath) 2.0],
[XQuery 1.0: An XML Query Language] and [XSL Transformations (XSLT)
Version 2.0]. These functions are not available directly to users, and
there is no requirement that implementations should actually provide
these functions.
]]

Re: defining URIs for XPath operators, I note that we do not intend
any special semantics for evaluation in the SPARQL context; in fact,
they are called after the transformation from RDF terms into XSD
terms.  That said, I also don't know what we get out of it. With the
above scenario, we aren't defining terms that anyone will every be
able to utter in an interoperable manner. Implementations can just
make up whatever identifiers they want for these operators. Does the
glue code that SteveH and AndyS are writing need to interoperate?


[MAP] http://www.w3.org/2001/sw/DataAccess/rq23/#OperatorMapping


On Fri, Jun 09, 2006 at 02:00:57PM +0100, Seaborne, Andy wrote:
> Attached is a proposal for URIs for functions in SPARQL.
> 
> Also includes is a list of all the op: and fn: operators/functions rq23 
> mentions.  I produced that list of F&O qnames used with:
> 
> while(<>)
> {
>     @a = /((?:op:|fn:)[\w-]+)/g ;
>     next if ( $#a < 0 ) ;
>     print join("\n", @a), "\n" ;
> }
> 
> which I haven't exhaustively checked.
> 
> 	Andy
> 
> Dan Connolly wrote:
> >On Tue, 2006-06-06 at 16:56 +0100, Seaborne, Andy wrote:
> >>Dan Connolly wrote:
> >>>On Tue, 2006-06-06 at 09:54 +0100, Seaborne, Andy wrote:
> >>>[...]
> >>>>so that makes fn:compare:
> >>>>
> >>>>http://www.w3.org/2005/xpath-functionscompare
> >>>>
> >>>>Ugh.
> >>>I don't think so.
> >>>
> >>>I think their rule for making URIs for functions gives:
> >>>  http://www.w3.org/2005/xpath-functions#compare
> >>>
> >>>see http://www.w3.org/Bugs/Public/show_bug.cgi?id=3121 , which
> >>>is a bug reported by me about the namespace document not agreeing
> >>>with the spec, where Norm confirms that
> >>>the full URI for fn:starts-with is
> >>>http://www.w3.org/2005/xpath-functions#starts-with
> >>>
> >>>
> >>Dan,
> >>
> >>Thanks for the correction - it's good to know there is a suitable URI. 
> >>Reading the namespace document
> >
> >The namespace document is acknowledged to be buggy. See above.
> >
> >> in the CR version it is:
> >>
> >>http://www.w3.org/2005/xpath-functions/#name
> >>
> >>for all op: and fn: operations.
> >>
> >>If we follow the same route, we'd get something like:
> >>
> >>http://www.w3.org/2006/sparql-functions/#datatype
> >
> >I advise against that last /
> >
> >>and put a namespace document at http://www.w3.org/2006/sparql-functions
> >>
> >>EricP - can we automatically generate the namespace doc from rq23?
> >>
> >>	Andy
> >>
> >>

> <html>
> 
> <head>
> <title>URIs for SPARQL functions</title>
>  <link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/base.css" />
> 
>   <link rel="stylesheet" type="text/css" href="http://www.w3.org/2001/sw/DataAccess/rq23/local.css" />
> </head>
> 
> <body>
> 
> <h3>Function URIs for SPARQL</h3>
> <h4>URIs for SPARQL functions</h4>
> <table id="table1">
>   <tr>
>     <th class="major">Prefix</th>
>     <th class="major">URI</th>
>   </tr>
>   <tr>
>     <td><code>sparql:</code></td>
>     <td><code>http://www.w3.org/2006/sparql-functions#</code></td>
>   </tr>
>   <tr>
>     <td><code>fn:</code></td>
>     <td><code>http://www.w3.org/2005/xpath-functions/#</code></td>
>   </tr>
>   <tr>
>     <td><code>op:</code></td>
>     <td>no namespace</td>
>   </tr>
>   </table>
> <h4>SPARQL Functions</h4>
> <table>
>   <tr>
>     <th class="major">Function</th>
>     <th class="major">URI</th>
>   </tr>
>   <tr>
>     <td><code>bound</code></td>
>     <td><code>sparql:bound</code></td>
>   </tr>
>   <tr>
>     <td><code>isIRIis</code></td>
>     <td><code>sparql:isIRI</code></td>
>   </tr>
>   <tr>
>     <td><code>isURI</code></td>
>     <td><code>sparqlisURI</code></td>
>   </tr>
>   <tr>
>     <td><code>isBlank</code></td>
>     <td><code>sparql:isBlank</code></td>
>   </tr>
>   <tr>
>     <td><code>isLiteral</code></td>
>     <td><code>sparql:isLiteral</code></td>
>   </tr>
>   <tr>
>     <td><code>str</code></td>
>     <td><code>sparql:str</code></td>
>   </tr>
>   <tr>
>     <td><code>lang</code></td>
>     <td><code>sparql:lang</code></td>
>   </tr>
>   <tr>
>     <td><code>datatype</code></td>
>     <td><code>sparql:datatype</code></td>
>   </tr>
>   <tr>
>     <td><code>langMatches</code></td>
>     <td><code>sparql:langMatches</code></td>
>   </tr>
>   <tr>
>     <td><code>regex </code></td>
>     <td><code>fn:matches</code></td>
>   </tr>
>   <tr>
>     <td><code>logical-or</code></td>
>     <td><code>sparql:logical-or</code></td>
>   </tr>
>   <tr>
>     <td><code>logical-and</code></td>
>     <td><code>sparql:logical-and</code></td>
>   </tr>
> </table>
> <p>Note that <code>sparql:logical-or</code> and <code>sparql_logical-and</code> are special forms and do 
> not evaluate their second arguments if the first is true (for <code>sparql:logical-or</code>) 
> or false (<code>sparql_logical-and</code>) respectively.</p>
> <h4>XQuery 1.0 and XPath 2.0 Functions and Operators</h4>
> <table>
>   <tr>
>     <th class="major">Name</th>
>     <th class="major">URI</th>  </tr>
>   <tr>
>     <td>&nbsp;</td>
>     <td><code>fn:boolean</code></td>
>   </tr>
>   <tr>
>     <td>&nbsp;</td>
>     <td><code>fn:collation</code></td>
>   </tr>
>   <tr>
>     <td>&nbsp;</td>
>     <td><code>fn:compare</code></td>
>   </tr>
>   <tr>
>     <td>&nbsp;</td>
>     <td><code>fn:matches</code></td>
>   </tr>
>   <tr>
>     <td>&nbsp;</td>
>     <td><code>fn:not</code></td>
>   </tr>
>   <tr>
>     <td>&nbsp;</td>
>     <td><code>op:boolean-equal</code></td>
>   </tr>
>   <tr>
>     <td>&nbsp;</td>
>     <td><code>op:boolean-greater-than</code></td>
>   </tr>
>   <tr>
>     <td>&nbsp;</td>
>     <td><code>op:boolean-less-than</code></td>
>   </tr>
>   <tr>
>     <td>&nbsp;</td>
>     <td><code>op:dateTime-equal</code></td>
>   </tr>
>   <tr>
>     <td>&nbsp;</td>
>     <td><code>op:dateTime-greater-than</code></td>
>   </tr>
>   <tr>
>     <td>&nbsp;</td>
>     <td><code>op:dateTime-less-than</code></td>
>   </tr>
>   <tr>
>     <td>&nbsp;</td>
>     <td><code>op:numeric-add</code></td>
>   </tr>
>   <tr>
>     <td>&nbsp;</td>
>     <td><code>op:numeric-divide</code></td>
>   </tr>
>   <tr>
>     <td>&nbsp;</td>
>     <td><code>op:numeric-equal</code></td>
>   </tr>
>   <tr>
>     <td>&nbsp;</td>
>     <td><code>op:numeric-greater-than</code></td>
>   </tr>
>   <tr>
>     <td>&nbsp;</td>
>     <td><code>op:numeric-less-than</code></td>
>   </tr>
>   <tr>
>     <td>&nbsp;</td>
>     <td><code>op:numeric-multiply</code></td>
>   </tr>
>   <tr>
>     <td>&nbsp;</td>
>     <td><code>op:numeric-subtract</code></td>
>   </tr>
>   <tr>
>     <td>&nbsp;</td>
>     <td><code>op:numeric-unary-minus</code></td>
>   </tr>
>   <tr>
>     <td>&nbsp;</td>
>     <td><code>op:numeric-unary-plus</code></td>
>   </tr>
> </table>
> 
> </body>
> 
> </html>


-- 
-eric

home-office: +1.617.395.1213 (usually 900-2300 CET)
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 Friday, 16 June 2006 07:10:36 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:26 GMT