Hi I am adding new documents to collection and would like to have base-uri without prefix of BaseX startup location
add as 3ndtest to \special\path <root/>
Path '3ndtest' added in 3.88 ms.
xquery for $doc in collection() return base-uri($doc)
file:/D:/opt/BaseX/second.xml file:/D:/opt/BaseX/second.xml file:/D:/opt/BaseX/s econd.xml file:/D:/opt/BaseX/second.xml file:/D:/opt/BaseX/third.xml file:/D:/op t/BaseX/third.xml file:/D:/opt/BaseX/third.xml file:/D:/opt/BaseX/test file:/D:/ opt/BaseX/2ndtest file:/D:/opt/BaseX/path/3ndtest file:/D:/opt/BaseX/special/pat h/3ndtest file:/D:/opt/BaseX/special/path/3ndtest file:/D:/opt/BaseX/special/pat h/3ndtest Query executed in 2.68 ms.
I tried many ways how to specify target - without and with slash and backslash - no change. Is there any way to manage that?
Jan Vlčinský
PS: Be sure this is not a problem if it is not possible. it would be only a bit nicer.
Hi Jan,
I am sorry but at the moment there is - to my knowledge - way of specifying a custom prefix to the base-uri(). You can as well, starting from 6.3, provide a path to documents inside a collection via:
for $doc in collection('test/dir') return base-uri($doc)
Anyway, regarding your issue:
for $doc in collection('test/dir') return replace(base-uri($doc),'file:/path/foo/bar/','')
might do the trick.
Kind regards Michael Am 26.10.2010 um 11:16 schrieb Jan Vlčinský:
I tried many ways how to specify target - without and with slash and backslash - no change. Is there any way to manage that?
Jan Vlčinský
PS: Be sure this is not a problem if it is not possible. it would be only a bit nicer.
Thanks Michael The option to specify path in collection is good one. Just for others to see how it behaves:
I have collection name "Pokus" add as item01.xml to "dir/subdir" <root1/> add as item02.xml to "/dir/subdir" <root2/> creates two documents there (both path versions works the same, with or without slash) base-uri reports names starting "file:/D:/opt/BaseX/dir/subdir" (what might confuse a bit, but not much)
xquery for $doc in collection("Pokus/dir/subdir") return base-uri($doc) selects both items properly (of course showing the 'D:/opt/BaseX/' inside of the base-uri result string).
xquery for $doc in collection("Pokus/") return base-uri($doc) selects all items in the collection, not only from the root
xquery for $doc in collection("") return base-uri($doc) selects all items in the currently open collection, if one used open <collection>, otherwise it complains about no default collection.
I did not find any way how to query relative path in current collection without naming it. No real need for this now.
With best regards
Jan
On Tue, Oct 26, 2010 at 11:37 AM, Michael Seiferle < michael.seiferle@uni-konstanz.de> wrote:
Hi Jan,
I am sorry but at the moment there is - to my knowledge - way of specifying a custom prefix to the base-uri(). You can as well, starting from 6.3, provide a path to documents inside a collection via:
for $doc in collection('test/dir') return base-uri($doc)
Anyway, regarding your issue:
for $doc in collection('test/dir') return replace(base-uri($doc),'file:/path/foo/bar/','')
might do the trick.
Kind regards Michael Am 26.10.2010 um 11:16 schrieb Jan Vlčinský:
I tried many ways how to specify target - without and with slash and backslash - no change. Is there any way to manage that?
Jan Vlčinský
PS: Be sure this is not a problem if it is not possible. it would be only a bit nicer.
basex-talk@mailman.uni-konstanz.de