How to get base-uri under my control

Tuesday, 26 October 2010 · 3 messages
JV
Jan Vlčinský26 Oct 2010 11:16 #
Hi I am adding new documents to collection and would like to have base-uri without prefix of BaseX startup location
Quoted text · 1 line
> add as 3ndtest to \special\path <root/>
Path '3ndtest' added in 3.88 ms.
Quoted text · 1 line
> 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.
Quoted text · 1 line
>
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.
MS
Michael Seiferle26 Oct 2010 11:37 #
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:
Quoted text · Jan Vlčinský · 2 lines
> for $doc in collection('test/dir') > return base-uri($doc)
Anyway, regarding your issue:
Quoted text · Jan Vlčinský · 2 lines
> for $doc in collection('test/dir') > return replace(base-uri($doc),'file:/path/foo/bar/','')
might do the trick. Kind regards Michael
Quoted text · Jan Vlčinský · 8 lines
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. >
JV
Jan Vlčinský26 Oct 2010 13:16 #
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
Quoted text · Michael Seiferle · 34 lines
On Tue, Oct 26, 2010 at 11:37 AM, Michael Seiferle < michael.seiferle at 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. > > >
-- *Jan Vlčinský* Slunečnicová 338/3, 734 01 Karviná Ráj, Czech Republic tel: +420-597 602 024; mob: +420-608 979 040 skype: janvlcinsky; GoogleTalk: jan.vlcinsky at gmail.com

⚡Generated with XQuery