[Mulgara-general] Substring Function in Sparql?

Stone Xiang stone.xiang at yahoo.com
Mon Aug 24 16:03:45 UTC 2009


That would be great. When will this feature be available?




________________________________
From: Paul Gearon <gearon at ieee.org>
To: Mulgara General <mulgara-general at mulgara.org>
Sent: Friday, August 21, 2009 5:29:39 PM
Subject: Re: [Mulgara-general] Substring Function in Sparql?

On Fri, Aug 21, 2009 at 2:14 PM, Stone Xiang<stone.xiang at yahoo.com> wrote:
> The scenario is a (not so elegant) extension of the Fedora repository, where
> the objects
> in the RELS-EXT datastream are used to store some data values. A more
> appropriate
> example would be:
> SELECT $s from <#ri> {$s <some predicate> $t}
> order by substring($t, 5, 3)
> Here the subject of <some predicate> is the URI of a Fedora item while the
> object stores
> several fields of data and one of them is relevant to sorting (or other
> filtering
> operations).
> Since you already said there is no substring fuctino in Sparql, I think I'll
> find some other
> way around.

Not in standard SPARQL, but I'm sure that some implementation will
have this function available. I've been looking to add extra functions
myself (it's VERY easy). I'd offer to do it here right now, only I
haven't implemented ORDER BY for arbitrary expressions yet. You'd have
to set a variable. So it would probably end up as:

  SELECT $s from <#ri>
  WHERE {$s <some predicate> $t . LET ($ord := fn:substring($t, 5, 3)}
  ORDER BY $ord

Regards,
Paul
_______________________________________________
Mulgara-general mailing list
Mulgara-general at mulgara.org
http://mulgara.org/mailman/listinfo/mulgara-general



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mulgara.org/pipermail/mulgara-general/attachments/20090824/b2ce5df3/attachment.htm>


More information about the Mulgara-general mailing list