Ok, getting a little farther but need some assistance. I'm running this command to set the node case to lower case via the command processor. It's works great in the gui but now I need to adapt it for command line execution.
I tried:
for $i in //* return rename node $i as lower-case(name($i))
and got:
Error: Stopped at line 1, column 14: [XPDY0002] No context item set for 'root()'.
Thinking that, like for my queries, I needed to specify the database, I tried:
for $i in collection("OpenSongSearch") return rename node $i as lower-case(name($i))
and got:
Error: Stopped at line 1, column 84: [XUTY0012] Single element, attribute or pi expected as rename target.
Any clues as to what I'm doing wrong?
Thanks for your help!
David
mailto:david@leighweb.com DavidEmailSig
From: David Leigh [mailto:david@leighweb.com] Sent: Monday, June 18, 2012 07:49 PM To: 'basex-talk@mailman.uni-konstanz.de' Subject: RE: [basex-talk] XML element case sensitivity
Oops.didn't look at it closely enough. Of course it changes all the nodes. It's also fast so it will work perfectly. Thanks!
mailto:david@leighweb.com DavidEmailSig
From: David Leigh [mailto:david@leighweb.com] Sent: Sunday, June 17, 2012 09:28 PM To: 'basex-talk@mailman.uni-konstanz.de' Subject: [basex-talk] XML element case sensitivity
Jens, Could I do this right after database creation and it would actually CHANGE the node names so that my queries could all still references the lower case node names? (that's what it looks like it's doing but I just wanted to confirm it).
I need to do it for 3 node names, can it be done in one "for" loop?
I don't mind taking the hit at database creation time as opposed to query time. Thanks! David
*********************************************************************** Hi David,
for preprocessing you could use something like
for $i in //* return rename node $i as lower-case(name($i))
to rename all nodes to their lower-case equivalent. If you only want to process lyrics-nodes of all variations, insert Dirk's predicate to `//*`.
Sadly the full-text index which offers case insensitivity doesn't include tag names, so you can't use this either.
Kind regards from Lake Constance, Germany, Jens
Hi David,
for $i in //* return rename node $i as lower-case(name($i))
for $i in collection("OpenSongSearch") return rename node $i as lower-case(name($i))
The following query should do what you need (collection() does work here, too):
for $i in db:open("OpenSongSearch")//* return rename node $i as lower-case(name($i)), db:optimize("OpenSongSearch")
The attached optimize call will update your index structures.
Hope this helps, Christian
basex-talk@mailman.uni-konstanz.de