[basex-talk] csv:parse in the age of XQuery 3.1
Dear BaseX developers, I noticed in example 3 under http://docs.basex.org/wiki/CSV_Module#Examples that csv:parse() with option { 'format': 'map' } returns a map of maps, with hardcoded row numbers: map { 1: map { "City": "Newton", "Name": "John" }, 2: map { "City": "Oldtown", "Name": "Jack" } } Using maps, which are unordered, to represent something ordered like rows in a CSV, hardcoded row numbers are necessary for reassembling the map in document order. I assume this was a necessary approach when the module was developed in the map-only world of XQuery 3.0. Now that 3.1 supports arrays, might an array of maps be a closer fit for CSV parsing? array { map { "City": "Newton", "Name": "John" }, map { "City": "Oldtown", "Name": "Jack" } } I'm also curious, do you know of any efforts to create an EXPath spec for CSV? Putting spec and CSV in the same sentence is dangerous, since CSV is a notoriously under-specified format: "The CSV file format is not standardized" (see https://en.wikipedia.org/wiki/Comma-separated_values). But perhaps there is a common enough need for CSV parsing that such a spec would benefit the community? I thought I'd start by asking here, since BaseX's seems to be the most developed (or only?) CSV module in XQuery. Then there's the question of how to approach implementations of such a spec. While XQuery is probably capable of parsing and serializing small enough CSV, CSVs do get large and naive processing with XQuery would tend to run into memory issues (as I found with xqjson). This means implementations would tend to write in a lower-level language. eXist, for example, uses Jackson for fn:parse-json(). I see Jackson has a CSV extension too: https://github.com/FasterXML/jackson-dataformat-csv. Any thoughts on the suitability of XQuery for the task? Joe
Re: [basex-talk] Upgrade from 7.9 to 8.3
Hi Bram, with BaseX 8 we changed the client/server protocol. So you will need do update to a compatible PHP client version. Fortunately, there is a PHP client compatible with BaseX 8 onwards: https://github.com/BaseXdb/basex/tree/master/basex-api/src/main/php Cheers, Dirk On 09/07/2016 10:29 AM, Bram Vanroy wrote: > > Hi everyone > > > > We’re in a bit of a pickle. We upgraded to BaseX 8.3 after some hard > drives failed, but now the PHP Basex client can’t connect to the > server any more. > > > > Here is the general idea: > > > > - basexserver is launched from server A, but the .basex > configuration file it uses is stored on server B. This is the > unchanged file we used in BaseX 7.9; > > - the data that the .basex file refers to is on server C, > this has not changed either since the hard drive crash; > > - the PHP basex client is on server D, this file has not been > changed either. > > > > So I am guessing that either we need to update one of our files, OR > we’d need to re-import our data into the new BaseX server. Do you have > any idea how to handle this? > > > > > > Kind regards > > > > Bram > -- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 91 68 276, Fax: 0049 7531 20 05 22
[basex-talk] Upgrade from 7.9 to 8.3
Hi everyone We're in a bit of a pickle. We upgraded to BaseX 8.3 after some hard drives failed, but now the PHP Basex client can't connect to the server any more. Here is the general idea: - basexserver is launched from server A, but the .basex configuration file it uses is stored on server B. This is the unchanged file we used in BaseX 7.9; - the data that the .basex file refers to is on server C, this has not changed either since the hard drive crash; - the PHP basex client is on server D, this file has not been changed either. So I am guessing that either we need to update one of our files, OR we'd need to re-import our data into the new BaseX server. Do you have any idea how to handle this? Kind regards Bram