Case insensitive "order by" clause in tolog?

2 views
Skip to first unread message

F. Andy Seidl

unread,
Nov 30, 2009, 1:37:40 PM11/30/09
to ontopia
Is it possible to perform a case-insensitive sorting by topic name in
a tolog query?

Lars Marius Garshol

unread,
Nov 30, 2009, 1:59:51 PM11/30/09
to ont...@googlegroups.com

* F. Andy Seidl
>
> Is it possible to perform a case-insensitive sorting by topic name in
> a tolog query?

Yes, it is. You need to either store a case-insensitive sort key on the topic, or do the transform as part of the query. The translate predicate in the string module is perfect for this.

Looking at the documentation I see that the documentation for this particular predicate is commented out, with the note "needs more work". :-/

I'll fix that ASAP.

--Lars M.
http://www.garshol.priv.no/tmphoto/
http://www.garshol.priv.no/blog/

F. Andy Seidl

unread,
Nov 30, 2009, 2:39:58 PM11/30/09
to ontopia
Thanks, Lars. A translate predicate was what I had gone looking
for. ;-)

Now that I know it exists, I'll take a shot at figuring it out from
the source code.

On Nov 30, 1:59 pm, Lars Marius Garshol <lar...@garshol.priv.no>
wrote:

F. Andy Seidl

unread,
Nov 30, 2009, 3:14:22 PM11/30/09
to ontopia
Got it:

import "http://psi.ontopia.net/tolog/string/" as str
select $TOPIC, $LCNAME from
instance-of($TOPIC, @T35604),
topic-name($TOPIC, $TNAME),
value($TNAME, $TNAMESTR),
str:translate($LCNAME, $TNAMESTR, "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"abcdefghijklmnopqrstuvwxyz", "")
order by $LCNAME?

Thanks for the pointer.
-- fas

On Nov 30, 2:39 pm, "F. Andy Seidl" <fase...@myst-technology.com>
wrote:
> > --Lars M.http://www.garshol.priv.no/tmphoto/http://www.garshol.priv.no/blog/- Hide quoted text -
>
> - Show quoted text -

Lars Marius Garshol

unread,
Dec 3, 2009, 4:25:52 AM12/3/09
to ont...@googlegroups.com

* F. Andy Seidl
>
> Got it: [...]

That's it, yes. Now finally managed to document the predicate as well:
http://code.google.com/p/ontopia/source/detail?r=705
Reply all
Reply to author
Forward
0 new messages