Hi
I get problems listing some documents
Attached is compressed database.
Test scenario - listing all docs - OK
for $doc in collection() return base-uri($doc)
returns
file:/D:/opt/BaseX/snapshot
file:/D:/opt/BaseX/mydata.xml
file:/D:/opt/BaseX/path/to/data/mydata.xml
file:/D:/opt/BaseX/mydata2.xml
file:/D:/opt/BaseX/path/to/data/mydata2.xml
file:/D:/opt/BaseX/DDRTest/ddr/live/JSDI_NDIC_20100111_00000751.xml
file:/D:/opt/BaseX/DDRTest/ddr/live/JSDI_NDIC_20100111_00000752.xml
This is OK
Test scenario - listing path/to/data documents - OK
for $doc in collection("DDRTest/path") return base-uri($doc)
for $doc in collection("DDRTest/path/to") return base-uri($doc)
for $doc in collection("DDRTest/path/to/data") return base-uri($doc)
in all cases returns
file:/D:/opt/BaseX/path/to/data/mydata.xml
file:/D:/opt/BaseX/path/to/data/mydata2.xml
This is also OK
Test scenario - listing ddr/live docs - ERROR
for $doc in collection("DDRTest/ddr") return base-uri($doc)
for $doc in collection("DDRTest/ddr/live") return base-uri($doc)
does not return anything.
This is bad.
How was the database created
All DDRTest/path/to/data documents were added via command line client.
Note, that those documents are very simple like <root/>
All DDRTest/ddr/live documents were added using Python API
Note, that when adding those documents, XML declaration was present as seen
from my log record
add as JSDI_NDIC_20100111_00000752.xml to DDRTest/ddr/live *<?xml
version="1.0" encoding="utf-8"?>*<DOC version="3.0"
id="14662257-ca70-48a1-b2b8-0c34d6f4cef4" country="CZ"
DataSet="extended"><INF sender="JSDI_NDIC" receiver="TRAFFICINTELLIGENCE"
transmission="HTTP"><DAT><EVTT version="2.01" language="CZ" /><SNET
type="GN" version="8.12" country="CZ" /><UIRADR structure="4.2"
version="593" /></DAT></INF><MJD count="1"><MSG
id="{8ad5a3b7-261d-b1f0-0126-1dd076cd0045}" version="1" type="TI"
planned="false"><MTIME
format="YYYY-MM-DDThh:mm:ssTZD"><TGEN>2010-01-11T15:39:38+01:00</TGEN><TSTA>2010-01-11T15:33:17+01:00</TSTA><TSTO>2010-01-11T16:33:17+01:00</TSTO></MTIME><MTXT
language="CZ">Od 11.1.2010 15:33 do 16:33
v ulici Okružní v obci Klášterec nad Ohří okres Chomutov , délka 176m;
Klášterec nad Ohří, ul. Okružní u č.p. 557, okr. Chomutov
nehoda; OA srazilo chodce, bez zranění</MTXT><MEVT><TMCE urgencyvalue="N"
directionalityvalue="1" timescalevalue="(D)" diversion="false"><EVI
eventcode="201" updateclass="3" quantifier="1" eventorder="1"><TXUCL
language="CZ">Nehody</TXUCL><TXEVC language="CZ">nehoda</TXEVC></EVI><TXTMCE
language="CZ">nehoda </TXTMCE></TMCE></MEVT><MLOC><TXPL>v ulici Okružní v
obci Klášterec nad Ohří okres Chomutov , délka 176m</TXPL><SNTL
coordsystem="S-JTSK" count="4"><COORD x="-825701" y="-996639" /><STEL
el_code="160642" /><STEL el_code="160642" /><STEL el_code="160771" /><STEL
el_code="160951" /></SNTL></MLOC><MDST><DEST CountryName="Česká republika"
RegionCode="60" RegionName="Ústecký" TownShipCode="3503" TownShip="Chomutov"
TownCode="563129" TownName="Klášterec nad Ohří"><STRE StreetCode="147290"
StreetName="Okružní" /></DEST></MDST></MSG></MJD></DOC>
Attached is also log file from BaseX.
Jan
On Tue, Oct 26, 2010 at 1:16 PM, Jan Vlčinský <jan.vlcinsky(a)gmail.com>wrote:
> 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(a)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(a)gmail.com
>
>
--
*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(a)gmail.com