- From: Pat Hayes <phayes@ihmc.us>
- Date: Sat, 5 Feb 2005 14:22:12 -0600
- To: Eric Prud'hommeaux <eric@w3.org>
- Cc: jos.deroo@agfa.com, Dan Connolly <connolly@w3.org>, www-archive@w3.org
>I was a good boy and tried out the XSLT approach. Praise and cash
>donations cheerfully accepted.
Sheesh, I'm impressed. By you, that is, not by XSLT. D3 >> B2, I'd say.
More I think about this, more I like the idea of allowing these
thingies, but putting them in a the query in a place where they
really are forced to be on a special stage, as it were. How about
something like an explicit 'filter' construct, so we might have
>SELECT ?annot ?author
> WHERE { (?annot dc:creator ?author)
> (?annot dc:created ?when) }
> FILTER ( isURI(?author) ||
?when < xs:dateTime(20050101T00:00:00Z) )
The point being that 'AND' reads altogether to much like a
conjunction, as though you were just tacking an extra piece on to the
RDF pattern in the WHERE; whereas this lets us have warnings like
"filters cannot be represented in RDF"
Dan & Jos, would this make you any happier?
Pat
>
>On Sat, Feb 05, 2005 at 12:42:59PM -0600, Pat Hayes wrote:
>> >Anyhow, we do many such jobs to prepare and extract triples
>> >from almost everything (even books written in PDF recently)
>> >and also to consume them, to put them in SVG on pocket PC
>> >etc, but for such jobs we simply use XSLT (and of course
>> >Python, Java, ...)
>>
>> Hmm, point taken. Well, then maybe what SPARQL should do is to
>> explicitly allow XSLT constructions as part of query, to describe
>> syntactic filters (? Does that make sense? Im a little out of my
>> depth here.)
>
>It is feasible, but I think the practicalities make an argument for
>keeping the constraint clause in the SPARQL language.
>
>We could get rid of the constraints altogether and people could do the
>same work in XSLT. For instance,
>
> SELECT ?annot ?author
> WHERE { (?annot dc:creator ?author)
> (?annot dc:created ?when) }
> AND ( isURI(?author) ||
> ?when < xs:dateTime(20050101T00:00:00Z) )
>could be
> SELECT ?annot ?author ?when
> WHERE { (?annot dc:creator ?author)
> (?annot dc:created ?when) }
>+
><xsl:stylesheet version = '1.0'
> xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
> xmlns:r="http://www.w3.org/2001/sw/DataAccess/rf1/result">
>
> <xsl:template match="r:sparql">
> <r:sparql>
> <xsl:apply-templates />
> </r:sparql>
> </xsl:template>
>
> <xsl:template match="r:head">
> <xsl:copy-of select='.' />
> </xsl:template>
>
> <xsl:template match="r:results">
> <r:results>
> <xsl:apply-templates />
> </r:results>
> </xsl:template>
>
> <xsl:template match="r:result[r:author/@uri
> or translate(r:when/text(),'TZ:-','')
> < translate('20050101T00:00:00Z','TZ:-','')]">
> <r:result>
> <xsl:apply-templates />
> </r:result>
> </xsl:template>
>
> <xsl:template match="r:annot">
> <xsl:copy-of select='.' />
> </xsl:template>
>
> <xsl:template match="r:author">
> <xsl:copy-of select='.' />
> </xsl:template>
>
> <xsl:template match="*" />
>
></xsl:stylesheet>
>
>The constraint:
> AND ( isURI(?author) ||
> ?when < xs:dateTime(20050101T00:00:00Z) )
>turns into:
> r:result[r:author/@uri
> or translate(r:when/text(),'TZ:-','')
> < translate('20050101T00:00:00Z','TZ:-','')]">
>
>and all the variables in the final projection (annot, author) get
>enumerated. The rest of the template just keeps the result form
>intact.
>
>Benefits:
> B1. re-use tools (XSLT).
> B2. eliminate burden of SPARQL processors to do some fairly non-RDF stuff.
>
>Drawbacks:
> D1. have to serialize as XML (no direct API calls get filtering)
> D2. only works for XML serialization of result sets (doesn't filter
> CONSTRUCT)
> D3. need to learn an extra language (and I find XSLT difficult).
>--
>-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.
>
>Content-Type: application/pgp-signature; name="signature.asc"
>Content-Description: Digital signature
>Content-Disposition: inline
>
>Attachment converted: betelguese2:signature 17.asc ( / ) (00108F90)
--
---------------------------------------------------------------------
IHMC (850)434 8903 or (650)494 3973 home
40 South Alcaniz St. (850)202 4416 office
Pensacola (850)202 4440 fax
FL 32502 (850)291 0667 cell
phayes@ihmc.us http://www.ihmc.us/users/phayes
Received on Saturday, 5 February 2005 20:24:26 UTC