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