retrieving the name of the archive?

Monday, 18 September 2017 · 4 messages
GS
Graydon Saunders18 Sep 2017 16:55 #
Hello -- BaseX will happily consume zip archives; this is just splendid for loading up a bunch of docx files. Now I find myself wanting the name of the docx file -- the original name of the archive -- and I don't know how to retrieve that. (or if it can be!) But I think it must be there somewhere because db:path repeats the standard OOXML file paths: [Content_Types].xml word/document.xml word/footnotes.xml word/footer1.xml word/endnotes.xml word/theme/theme1.xml word/settings.xml docProps/custom.xml customXml/itemProps2.xml docProps/app.xml customXml/item2.xml customXml/itemProps1.xml word/fontTable.xml customXml/item1.xml customXml/item3.xml customXml/itemProps3.xml customXml/item4.xml customXml/itemProps4.xml word/numbering.xml word/styles.xml word/webSettings.xml docProps/core.xml word/people.xml over and over; if they were all going to exactly that there'd be one copy, and all several hundred docx files are there by content. (db:list-details tells me about > 4000 individual xml files.) If I can get the name of the original archive, how do I do that? Thanks! Graydon
CG
Christian Grünin reply to Graydon Saunders, 18 Sep 2017, 18:5218 Sep 2017 17:00 #
Hi Graydon,
Quoted text · Graydon Saunders · 1 line
> the config switch is "ARCHIVENAME = true"
Exactly, that’s the option you’ll need to enable to get the archive names included in your database paths. It can also be passed on to XQuery functions (db:create, db:add, etc.).
Quoted text · Graydon Saunders · 4 lines
> This gets me the behaviour I was expecting would happen, but I'm still > curious if there's a way to get the archive name back in the default case, > because it does look like BaseX is in no way confused about which of those > identically named files belong together.
By default, the archive name will be ignored. In BaseX, it’s possible to have several documents with the same name (this provides better performance if document paths are irrelevant), and db:list-details simply returns all document names in the order in which the documents were added. Hope this helps, Christian
GS
Graydon Saundersin reply to Graydon Saunders, 18 Sep 2017, 16:5518 Sep 2017 18:52 #
Ok, so it looks like: 1. find where BaseX is really getting its config files ($HOME in my case); http://docs.basex.org/wiki/Configuration#Configuration_Files says "Q{org.basex.util.Prop}USERHOME()" which is exceedingly helpful! 2. add, to .basex (NOT .basexgui) AFTER # Local Options the necessary config switch 3. the config switch is "ARCHIVENAME = true" 4. restart BaseX and go to recreate the DB and you'll see a ticky-box option for "add the archive name to the path" This gets me the behaviour I was expecting would happen, but I'm still curious if there's a way to get the archive name back in the default case, because it does look like BaseX is in no way confused about which of those identically named files belong together. Thanks! Graydon
Quoted text · Graydon Saunders · 45 lines
On Mon, Sep 18, 2017 at 8:55 AM, Graydon Saunders <graydonish at gmail.com> wrote: > Hello -- > > BaseX will happily consume zip archives; this is just splendid for loading > up a bunch of docx files. > > Now I find myself wanting the name of the docx file -- the original name > of the archive -- and I don't know how to retrieve that. (or if it can > be!) But I think it must be there somewhere because db:path repeats the > standard OOXML file paths: > > [Content_Types].xml > word/document.xml > word/footnotes.xml > word/footer1.xml > word/endnotes.xml > word/theme/theme1.xml > word/settings.xml > docProps/custom.xml > customXml/itemProps2.xml > docProps/app.xml > customXml/item2.xml > customXml/itemProps1.xml > word/fontTable.xml > customXml/item1.xml > customXml/item3.xml > customXml/itemProps3.xml > customXml/item4.xml > customXml/itemProps4.xml > word/numbering.xml > word/styles.xml > word/webSettings.xml > docProps/core.xml > word/people.xml > > over and over; if they were all going to exactly that there'd be one copy, > and all several hundred docx files are there by content. (db:list-details > tells me about > 4000 individual xml files.) > > If I can get the name of the original archive, how do I do that? > > Thanks! > Graydon >
GS
Graydon Saundersin reply to Christian Grün, 18 Sep 2017, 17:0018 Sep 2017 19:09 #
Thank you! Someday I will get it through my head that it's not really a file system down there. :)
Quoted text · Christian Grün · 26 lines
On Mon, Sep 18, 2017 at 11:00 AM, Christian Grün <christian.gruen at gmail.com> wrote: > Hi Graydon, > > > the config switch is "ARCHIVENAME = true" > > Exactly, that’s the option you’ll need to enable to get the archive > names included in your database paths. It can also be passed on to > XQuery functions (db:create, db:add, etc.). > > > This gets me the behaviour I was expecting would happen, but I'm still > > curious if there's a way to get the archive name back in the default > case, > > because it does look like BaseX is in no way confused about which of > those > > identically named files belong together. > > By default, the archive name will be ignored. In BaseX, it’s possible > to have several documents with the same name (this provides better > performance if document paths are irrelevant), and db:list-details > simply returns all document names in the order in which the documents > were added. > > Hope this helps, > Christian >

⚡Generated with XQuery