Ok, I got it figured out from this page: http://docs.basex.org/wiki/Database_%26_Collection. So, in my return concat, I need to use the "base-uri" of $song to get the actual file path. So, my query will look something like:
for $song in collection("OpenSongSearch")
where $song/song/lyrics[ . contains text "baloche"] or $song/song/title[ . contains text "baloche"] or $song/song/author[ . contains text "baloche"]
order by $song/song/title
return concat(base-uri($song),string('|'), $song/song/title,string('|'),$song/song/author,string('|'),replace(replace($ song/song/lyrics,'\n','^line^'),'[\w+]',''),string(' '))
Yep, that works! Sorry to bug you all with a question that's documented!
Are there other options than base-uri? For instance, base-uri has the file name. Is there a function like that with just the path but not the file name? If not, I can certainly work with base-uri. (I couldn't find any, but thought I'd ask)
Thanks!
Hi David,
Are there other options than base-uri? For instance, base-uri has the file name. Is there a function like that with just the path but not the file name? If not, I can certainly work with base-uri. (I couldn’t find any, but thought I’d ask)
base-uri() and document-uri() will always return the full path. You might want to check out the BaseX specific function db:info(), which gives you general database information, including the original collection path (but this is probably not what you are looking for):
http://docs.basex.org/wiki/Database_Functions#db:info
Christian
Ok, I got it figured out from this page: http://docs.basex.org/wiki/Database_%26_Collection. So, in my return concat, I need to use the “base-uri” of $song to get the actual file path. So, my query will look something like:
for $song in collection("OpenSongSearch")
where $song/song/lyrics[ . contains text "baloche"] or $song/song/title[ . contains text "baloche"] or $song/song/author[ . contains text "baloche"]
order by $song/song/title return concat(base-uri($song),string('|'), $song/song/title,string('|'),$song/song/author,string('|'),replace(replace($song/song/lyrics,'\n','^line^'),'[\w+]',''),string(' '))
Yep, that works! Sorry to bug you all with a question that’s documented!
Thanks!
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
I use the "info db" already to get the number of documents and the root path of the collection is something my calling program already has. So it's really what's in base-uri that interests me. So document-uri is identical to base-uri? Thanks!
-----Original Message----- From: Christian Grün [mailto:christian.gruen@gmail.com] Sent: Thursday, February 03, 2011 12:53 PM To: david@leighweb.com Cc: basex-talk@mailman.uni-konstanz.de Subject: Re: [basex-talk] Including the "doc" information in the RETURN clause
Hi David,
Are there other options than base-uri? For instance, base-uri has the
file
name. Is there a function like that with just the path but not the file name? If not, I can certainly work with base-uri. (I couldnt find any, but thought Id ask)
base-uri() and document-uri() will always return the full path. You might want to check out the BaseX specific function db:info(), which gives you general database information, including the original collection path (but this is probably not what you are looking for):
http://docs.basex.org/wiki/Database_Functions#db:info
Christian
Ok, I got it figured out from this page: http://docs.basex.org/wiki/Database_%26_Collection. So, in my return
concat,
I need to use the base-uri of $song to get the actual file path. So, my query will look something like:
for $song in collection("OpenSongSearch")
where $song/song/lyrics[ . contains text "baloche"] or $song/song/title[
.
contains text "baloche"] or $song/song/author[ . contains text
"baloche"]
order by $song/song/title return concat(base-uri($song),string('|'),
$song/song/title,string('|'),$song/song/author,string('|'),replace(replace($ song/song/lyrics,'\n','^line^'),'[\w+]',''),string(' '))
Yep, that works! Sorry to bug you all with a question thats documented!
Thanks!
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
basex-talk@mailman.uni-konstanz.de