Hi Bang,

If you export a database its contents will be written to the folder given as an 
argument to the EXPORT command:

EXPORT [path]
> Exports all documents in the database to the specified file path


The `basex.*`-files you are seeing in your data folder are database files.
This is what exporting a database might look like: 
https://asciinema.org/a/QzLcXX93nJIUaOAcjfp94rOOQ 
<https://asciinema.org/a/QzLcXX93nJIUaOAcjfp94rOOQ>

Step 1: put your database in the `data/${database-name}` folder 
Step 2: OPEN ${database-name}
Step 3: EXPORT ${path}
Step 4: find your (XML)-files in ${path}

(Replace ${foo} with the actual names).

Apart from that http://docs.basex.org/wiki/Databases 
<http://docs.basex.org/wiki/Databases> might be a good read =) 

Best
Michael




> Am 02.02.2018 um 14:03 schrieb Bang Pham Huu <b.pham...@jacobs-university.de>:
> 
> Yes, I opened the document
> (http://files.basex.org/releases/7.3/BaseX73.pdf) and it said "EXPORT
> writes all resources to the specified target directory • GUI: Go to
> Database → Export, choose the target directory and press OK".
> 
> But as the BaseX GUI tool cannot open .basex file as database (that is
> why I asked you by listing all the files I have) so the export button in
> drop down database menu is disable.
> 
> Thanks,
> 
> 
> On 02/02/2018 01:56 PM, Christian Grün wrote:
>> Have you found and opened the documentation PDF for BaseX 7.3? Looking
>> for the term "export" should give you some hints.
>> 
>> Best,
>> Christian
>> 
>> 
>> 
>> On Fri, Feb 2, 2018 at 1:36 PM, Bang Pham Huu
>> <b.pham...@jacobs-university.de> wrote:
>>> Hi Christian,
>>> 
>>> I'd do as your suggestion, but I'm stuck with how to export old database
>>> to XML file. I only have these files (no XML):
>>> 
>>> atv.basex   atvr.basex  tbl.basex   txt.basex   txtr.basex
>>> atvl.basex  inf.basex   tbli.basex  txtl.basex
>>> 
>>> and from your link, I tried to download BaseX GUI application
>>> http://files.basex.org/releases/7.3/BaseX73.jar. But this tool seems can
>>> open from XML file only. How can I open these .basex file and convert
>>> to  a XML file?
>>> 
>>> Thanks,
>>> 
>>> 
>>> On 02/02/2018 12:55 PM, Christian Grün wrote:
>>>> Hi Bang,
>>>> 
>>>> The general answer on your initial question: BaseX is
>>>> backward-compatible. Older databases can be opened and queried with
>>>> newer versions of BaseX.
>>>> 
>>>> This seems to conflict with the experiences you made. But I agree with
>>>> Dirk: It’s difficult to understand what is going wrong in your testing
>>>> environment. It’s not possible to tell why a query should yield
>>>> results that is not contained in the data you provide.
>>>> 
>>>> Maybe you could try to proceed step by step and give feedback:
>>>> 
>>>> 1. Export the database with BaseX 7.3.1. Note that you cannot use all
>>>> the BaseX 8.x syntax with older versions of the software. Please check
>>>> out our documentation history to learn how to proceed [1].
>>>> 2. Export the same database with BaseX 8.x.
>>>> 3. Compare the resulting output.
>>>> 
>>>> If the output of BaseX 7 and 8 differs, then:
>>>> 
>>>> 4. Ensure that your database directories are really identical.
>>>> 5. Report back to us which output you believe is correct: If the
>>>> output of BaseX 7.x is wrong, it may even be due to a bug in the old
>>>> version, or due to some corrupt data that can successfully restored by
>>>> BaseX 8. If the output of BaseX 8.x is wrong, tell us what is missing.
>>>> 
>>>> If the output is identical, then:
>>>> 
>>>> 4. Create a new database from this data with BaseX 8.x.
>>>> 5. Run your query and compare the results.
>>>> 
>>>> Best,
>>>> Christian
>>>> 
>>>> [1] http://docs.basex.org/wiki/Documentation
>>>> 
>>>> 
>>>> 
>>>> 
>>>> On Fri, Feb 2, 2018 at 11:48 AM, Bang Pham Huu
>>>> <b.pham...@jacobs-university.de> wrote:
>>>>> What I tried to say is: I'm using input (old database) which has lot of
>>>>> modifications since version 7.3.1 and I could use this database for both
>>>>> applications (BaseX 8.6.7 and BaseX 7.3.1 on different systems). But
>>>>> application in 8.6.7 can export database (with some missing data),
>>>>> application in 7.3.1 cannot export database (error).
>>>>> 
>>>>> If it is hard to understand, sorry about it. I shouldn't have asked this
>>>>> question if one database is queried with same queries on both version 
>>>>> BaseX
>>>>> 8.6.7 and BaseX 7.3.1 could return different results.
>>>>> 
>>>>> So, now, actually I couldn't provide you a valid test input ("Your input 
>>>>> XML
>>>>> (using BaseX 8.6.7)") because as you saw that in exported db from an
>>>>> application using BaseX 8.6.7 on this olddatabase, the data is missing and
>>>>> you questioned about it.
>>>>> 
>>>>> "The expected result and how it differs from what you expect", I'd say it
>>>>> should be the same from application using BaseX version 7.3.1 as my first
>>>>> email (it can be replaced from "\n" to " ", it is ok).
>>>>> 
>>>>> I asked because I just want to confirm there was no big change from
>>>>> application using BaseX version 7.3.1 to application using BaseX version
>>>>> 8.6.7 on old database. But the outputs are different that got me confused.
>>>>> 
>>>>> Thanks,
>>>>> 
>>>>> 
>>>>> On 02/02/2018 11:35 AM, Kirsten, Dirk wrote:
>>>>> 
>>>>> Now I am very confused: What does “BaseX database version 7.3.1 (old
>>>>> database) via Java application with BaseX version 8.6.7.” even mean? How 
>>>>> can
>>>>> you access a newer BaseX version with some older BaseX version? Sorry, but
>>>>> this doesn’t make any sense to me.
>>>>> 
>>>>> Could you please simple open the BaseX GUI and open your database and run
>>>>> the XQuery?
>>>>> 
>>>>> 
>>>>> 
>>>>> Also, as I said I think it doesn’t make any sense to focus on this old
>>>>> database version anymore. Keep in mind that BaseX 7.3 is (I had to look 
>>>>> this
>>>>> up…) from June 2012 and hasn’t been supported for years.
>>>>> 
>>>>> 
>>>>> 
>>>>> So, to move on from this, you need to provide the following (in general) 
>>>>> for
>>>>> people to be able to help you:
>>>>> 
>>>>> 
>>>>> 
>>>>> -      Your input XML (using BaseX 8.6.7)
>>>>> 
>>>>> -      You query (you already showed this, so not needed anymore)
>>>>> 
>>>>> -      The actual result (you already showed this, so nothing to do)
>>>>> 
>>>>> -      The expected result and how it differs from what you expect
>>>>> 
>>>>> 
>>>>> 
>>>>> Cheers
>>>>> 
>>>>> Dirk
>>>>> 
>>>>> 
>>>>> 
>>>>> Von: Bang Pham Huu [mailto:b.pham...@jacobs-university.de]
>>>>> Gesendet: Freitag, 2. Februar 2018 11:19
>>>>> An: Kirsten, Dirk <dirk.kirs...@senacor.com>;
>>>>> basex-talk@mailman.uni-konstanz.de
>>>>> Betreff: Re: AW: AW: [basex-talk] Big Surprise from outputs in version 
>>>>> 7.3.1
>>>>> and 8.6.7 ?
>>>>> 
>>>>> 
>>>>> 
>>>>> Thanks for your detail answer.
>>>>> 
>>>>> What I gave to you is an exported output of BaseX database version 7.3.1
>>>>> (old database) via Java application with BaseX version 8.6.7. I tried to
>>>>> export with BaseX version 7.3.1 with same db:export() XQuery, but it 
>>>>> returns
>>>>> error
>>>>> 
>>>>> db:export("userdb", "/home/mascalan/", map { 'method': 'xml' })
>>>>> Error when querying BaseX database 'Failed at querying the database, 
>>>>> detail:
>>>>> Stopped at line 1, column 45: [XPST0003] Invalid key, simple expression
>>>>> expected. Check collection name and version are valid first.'.
>>>>> 
>>>>> I think if I could export to you the XML of old database by BaseX version
>>>>> 7.3.1, you could see the
>>>>> http://localhost:8080/def/crs/OGC/0/_Temporal_template in the XML file 
>>>>> which
>>>>> BaseX version 8.6.7 couldn't find to export (?)
>>>>> 
>>>>> 
>>>>> 
>>>>> On 02/02/2018 11:02 AM, Kirsten, Dirk wrote:
>>>>> 
>>>>> Hi,
>>>>> 
>>>>> 
>>>>> 
>>>>> well, the XQuery might be the same, but because you certainly use 
>>>>> different
>>>>> BaseX instances they might use different properties (i.e. point to a
>>>>> different BaseX storage). At least for the examples you provide here it
>>>>> simply doesn’t add up. To make it clear: You say the result on the right 
>>>>> is
>>>>> with the old BaseX version. One of the results is the string
>>>>> http://localhost:8080/def/crs/OGC/0/_Temporal_template. However, the 
>>>>> string
>>>>> does simply not appear in your input XML. So, where does the difference 
>>>>> come
>>>>> from?
>>>>> 
>>>>> 
>>>>> 
>>>>> Maybe it would be easier to simply forget about the old version and 
>>>>> instead
>>>>> you could describe what results you are missing from the 8.6.7 vcersion?
>>>>> (you said data is missing)? I can hardly imagine that something is really
>>>>> missing in this case.
>>>>> 
>>>>> 
>>>>> 
>>>>> However, what certainly has improved (and thus: changed) with BaseX 8 (I
>>>>> think) is the serialization. It uses the adaptive serialization by 
>>>>> default,
>>>>> which uses newlines as separators when serialiazing. However, you can 
>>>>> switch
>>>>> to any other serialization method quite easily and use the old default xml
>>>>> by issueing “declare option output:method “xml”; in the query prolog.
>>>>> 
>>>>> 
>>>>> 
>>>>> Cheers
>>>>> 
>>>>> Dirk
>>>>> 
>>>>> 
>>>>> 
>>>>> Von: Bang Pham Huu [mailto:b.pham...@jacobs-university.de]
>>>>> Gesendet: Freitag, 2. Februar 2018 10:08
>>>>> An: Kirsten, Dirk <dirk.kirs...@senacor.com>;
>>>>> basex-talk@mailman.uni-konstanz.de
>>>>> Betreff: Re: AW: [basex-talk] Big Surprise from outputs in version 7.3.1 
>>>>> and
>>>>> 8.6.7 ?
>>>>> 
>>>>> 
>>>>> 
>>>>> Yes, I'm sure I tested with old database from version 7.3.1 for both
>>>>> versions (7.3.1 and 8.6.7). Please see the exported XML from this database
>>>>> here: https://pastebin.com/ZjkFrE7B
>>>>> 
>>>>> with this XQuery: db:export("userdb", "./userdb", map { 'method': 'xml' })
>>>>> 
>>>>> At least I can see that query in version 7.3.1 doesn't return "new line
>>>>> character \n" as in 8.6.7 but an empty space " ".
>>>>> 
>>>>> Thanks,
>>>>> 
>>>>> 
>>>>> 
>>>>> On 02/02/2018 09:46 AM, Kirsten, Dirk wrote:
>>>>> 
>>>>> Hallo,
>>>>> 
>>>>> are you sure you are querying the same collection? I am quite confused by
>>>>> your different outputs, because they seem to have not much in common (the
>>>>> results on the left almost exclusively return URIs pointing to opengis.net
>>>>> and the one on the right to localhost:8080?
>>>>> 
>>>>> If you are sure it would most certainly be helpful if you provide the 
>>>>> input
>>>>> XML.
>>>>> 
>>>>> Also, looking at your query I don't really get why you write it that way,
>>>>> e.g. "for $i in $x return $i" is identical as simply "$x"...
>>>>> 
>>>>> Cheers
>>>>> Dirk
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> Senacor Technologies Aktiengesellschaft - Sitz: Eschborn - Amtsgericht
>>>>> Frankfurt am Main - Reg.-Nr.: HRB 105546
>>>>> Vorstand: Matthias Tomann, Marcus Purzer - Aufsichtsratsvorsitzender: 
>>>>> Daniel
>>>>> Grözinger
>>>>> 
>>>>> -----Ursprüngliche Nachricht-----
>>>>> Von: basex-talk-boun...@mailman.uni-konstanz.de
>>>>> [mailto:basex-talk-boun...@mailman.uni-konstanz.de] Im Auftrag von Bang 
>>>>> Pham
>>>>> Huu
>>>>> Gesendet: Freitag, 2. Februar 2018 08:45
>>>>> An: basex-talk@mailman.uni-konstanz.de
>>>>> Betreff: [basex-talk] Big Surprise from outputs in version 7.3.1 and 
>>>>> 8.6.7 ?
>>>>> 
>>>>> Hello,
>>>>> 
>>>>> I've been using BaseX to query an XML file in version 7.3.1 and it worked
>>>>> well. However, because of this problem
>>>>> https://www.mail-archive.com/basex-talk@mailman.uni-konstanz.de/msg10241.html
>>>>> and I was suggested to use version 8.6.7 then I changed to use this 
>>>>> version
>>>>> in a Java Web application which queries the old BaseX files from version
>>>>> 7.3.1.
>>>>> 
>>>>> However, I didn't know that this version changes created a very surprise
>>>>> result between version 7.3.1 and 8.6.7 (i.e: data is missing in version
>>>>> 8.6.7 from output result !!!).
>>>>> 
>>>>> Could someone tell me why it happens and how to use BaseX version 8.6.7 on
>>>>> BaseX database from version 7.3.1.
>>>>> 
>>>>> Here is the difference between 2 outputs on same old BaseX database 
>>>>> version
>>>>> 7.3.1 (left: 8.6.7, right: 7.3.1) with same XQuery:
>>>>> https://www.diffchecker.com/iCgLhRUx
>>>>> 
>>>>> The XQuery is:
>>>>> 
>>>>> declare namespace gml = "http://www.opengis.net/gml/3.2";;
>>>>> declare function local:get-children() {
>>>>> let $x := collection('userdb')//gml:identifier/text()
>>>>> return
>>>>>      if (exists($x)) then
>>>>>           for $i in $x
>>>>>                return $i
>>>>>      else <empty/>
>>>>> };
>>>>> 
>>>>>  let $x := distinct-values(local:get-children())
>>>>>  for $i in $x return $i
>>>>> 
>>>>> Thanks,
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>> 
> 

Reply via email to