Seems I forgot the ORDER BY in the query I sent earlier. This is the
complete version:
SELECT DISTINCT *
WHERE {
?s a clr:Launch .
BIND (xsd:string(?s) AS ?str)
} ORDER BY afn:substr(?str, fn:string-length(?str)-2, fn:string-
length(?str))
-- Scott
On Jul 1, 12:27 pm, Tim Harsch <[email protected]> wrote:
> I read this:
> sp:arg2 (xsd:integer): the index of the first character (text starts
> with index 0).
>
> but I still thought I might try the negative thing anyway, since it
> was a simple test and I was so hoping to be in luck, and if I squint I
> could interpret what's in parentheses as just a helpful hint. :-)
>
> Should the parameter be xsd:nonNegativeInteger ? I'm wondering if
> that might allow the SPARQL syntax checker to invalidate the query if
> a negative integer is in that parameter.
>
> Thanks a bunch,
> Tim
>
> On Fri, Jul 1, 2011 at 10:14 AM, Scott Henninger
>
> <[email protected]> wrote:
> > Tim; See the description of afn:substr in Help > Reference > Functions
> > Overview. The index starts a 0 and a negative integer would therefore
> > be out-of-bounds. The following would do what you want:
>
> > SELECT DISTINCT *
> > WHERE {
> > ?s a ub:Organization .
> > BIND (xsd:string(?s) AS ?str)
> > } afn:substr(?str, fn:string-length(?str)-2, fn:string-length(?str))
>
> > -- Scott
>
> > On Jul 1, 11:08 am, Tim Harsch <[email protected]> wrote:
> >> Hi,
> >> I tried the following query in TBC. This pattern would produce about 1200
> >> results in my dataset.
>
> >> SELECT DISTINCT *
> >> WHERE {
> >> ?s a ub:Organization
>
> >> } ORDER BY afn:substr(xsd:string(?s), -2)
>
> >> TBC began throwing the same warning (probably about 1200 times)
>
> >> Warning
> >> Fri Jul 01 08:52:42 PDT 2011
> >> WARN [Thread-26] (Log.java:63) - IndexOutOfBounds
>
> >> Presumably the -2 is the issue here, but since the 2nd parameter type of
> >> afn:substr is xsd:integer I would think this would return the last two
> >> characters of the string.
>
> >> Thanks,
> >> Tim
>
> > --
> > You received this message because you are subscribed to the Google
> > Group "TopBraid Suite Users", the topics of which include TopBraid Composer,
> > TopBraid Live, TopBraid Ensemble, SPARQLMotion and SPIN.
> > To post to this group, send email to
> > [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > For more options, visit this group at
> >http://groups.google.com/group/topbraid-users?hl=en
--
You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include TopBraid Composer,
TopBraid Live, TopBraid Ensemble, SPARQLMotion and SPIN.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en