BaseX 9.4 - XQuery locks - documentation query

Tuesday, 28 July 2020 · 6 messages · last reply 30 Jul 2020
JB
James Ball28 Jul 2020 16:52 #
Hello, I was just looking at the changes to locking for 9.4 and I think the documentation has got ‘garbled’ in an update. https://docs.basex.org/wiki/Transaction_Management#XQuery_Locks <https://docs.basex.org/wiki/Transaction_Management#XQuery_Locks> " The lock may be transformed to a write lock by cominthe operations as Similar to the internal database locks, write locks block all other operations while read locks allow parallel access. “ I think this line should be two bullets but I’m not sure what ‘cominthe operations’ should be? Combining? The lock may be transformed to a write lock by combining operations Similar to the internal database locks, write locks block all other operations while read locks allow parallel access. I’m happy to update the wiki but I wasn't confident enough that I’ve understood the 9.4 change to do it without first checking on the list. Regards, James
CG
Christian Grün28 Jul 2020 17:33 #
Hi James, Thanks for the pointer, and your other edit(s) in our Wiki. I have revised the corresponding section, it now reads as follows: • A lock string may consist of a single key or multiple keys separated with commas. • Internal locks and XQuery locks can co-exist. No conflicts arise, even if a lock string equals the name of a database that is locked by the transaction manager. • The lock is transformed into a write lock by making the corresponding expression updating. Best, Christian
SC
Srikumar Choudhury28 Jul 2020 17:49 #
Hi, <!DOCTYPE some name SYSTEM .. and <?xml version="1.0"?> data loss are happening while importing the xml document using db:replace(...) API.
 <?xml version="1.0"?>
<!DOCTYPE testSuiteConfig SYSTEM "../../../configs/TestConfig_2_1.dtd"> etc. We need help to resolve this issue. we are using Java executeQuery api of XQExpression. class to run "db:replace(...)" query to store document in Basex database, but while retrieving the XML files from basex server we notice data loss. we can loss above data. Please help us, how we can resolve this issue or share some documentation, which can help to resolve this issue. Thanks, Srikumar
Quoted text · BaseX-Talk · 17 lines
From: BaseX-Talk <basex-talk-bounces at mailman.uni-konstanz.de> on behalf of Christian Grün <christian.gruen at gmail.com> Sent: Tuesday, July 28, 2020 9:03 PM To: James Ball <basex-talk at jamesball.co.uk> Cc: BaseX <basex-talk at mailman.uni-konstanz.de> Subject: [EXTERNAL] - Re: [basex-talk] BaseX 9.4 - XQuery locks - documentation query Hi James, Thanks for the pointer, and your other edit(s) in our Wiki. I have revised the corresponding section, it now reads as follows: • A lock string may consist of a single key or multiple keys separated with commas. • Internal locks and XQuery locks can co-exist. No conflicts arise, even if a lock string equals the name of a database that is locked by the transaction manager. • The lock is transformed into a write lock by making the corresponding expression updating. Best, Christian
CG
Christian Grün28 Jul 2020 17:57 #
Hi Srikumar, As document type definitions and XML declarations are not part of the XML information set, they are not stored in the database. However, you can easily recreate them when serializing your documents. See [1] for further information. Hope this helps Christian [1] https://www.w3.org/TR/xml-infoset/ [2] https://docs.basex.org/wiki/Serialization
Quoted text · Srikumar Choudhury · 17 lines
On Tue, Jul 28, 2020 at 5:49 PM Srikumar Choudhury <schoudhu at opentext.com> wrote: > > Hi, > <!DOCTYPE some name SYSTEM .. and <?xml version="1.0"?> data loss are happening while importing the xml document using db:replace(...) API. > > <?xml version="1.0"?> > > <!DOCTYPE testSuiteConfig SYSTEM "../../../configs/TestConfig_2_1.dtd"> > etc. > We need help to resolve this issue. > we are using Java executeQuery api of XQExpression. class to run "db:replace(...)" query to store document in Basex database, but while retrieving the XML files from basex server we notice data loss. we can loss above data. > > Please help us, how we can resolve this issue or share some documentation, which can help to resolve this issue. > > Thanks, > Srikumar
SC
Srikumar Choudhury29 Jul 2020 08:39 #
Hi Christian, Thanks for quick response. will following serializing xquery help to generate the Doctype and xml declaration? Original XML file: =================== <?xml version="1.0"?> <!-- Configuration file for user test suite. --> <!DOCTYPE testSuiteConfig SYSTEM "../../../configs/TestConfig_2_1.dtd">
<testSuiteConfig version="2.1">
    <testSuiteEnv>
        <paths>
            <path type="input" value="../data"/>
        </paths>
.......

<Basex Database Name>/<folder name>/<xml file name>.xml:  XML file in Basex Database:
============================================================================
<!--
Configuration file for user test suite.
 -->
<testSuiteConfig version="2.1">
    <testSuiteEnv>
        <paths>
            <path type="input" value="../data"/>
        </paths>
.......
Can I run following xquery to get original XML file. XQUERY:
========
declare namespace output = 'http://www.w3.org/2010/xslt-xquery-serialization';
declare option output:method 'xml';
serialize(<Basex Database Name>/<folder name>/<xml file name>.xml ,
map {
    'method' : 'xml'
     'xml' : map { 'doctype-system' : '<!DOCTYPE testSuiteConfig SYSTEM "../../../configs/TestConfig_2_1.dtd">',  'omit-xml-declaration' : 'no' }
    }
)
Above serializing xquery will help to generate the Doctype and xml declaration. Thanks, Srikumar
Quoted text · Christian Grün · 31 lines
From: Christian Grün <christian.gruen at gmail.com> Sent: Tuesday, July 28, 2020 9:27 PM To: Srikumar Choudhury <schoudhu at opentext.com> Cc: James Ball <basex-talk at jamesball.co.uk>; BaseX <basex-talk at mailman.uni-konstanz.de> Subject: Re: [EXTERNAL] - Re: [basex-talk] BaseX 9.4 - XQuery locks - documentation query Hi Srikumar, As document type definitions and XML declarations are not part of the XML information set, they are not stored in the database. However, you can easily recreate them when serializing your documents. See [1] for further information. Hope this helps Christian [1] https://urldefense.com/v3/__https://www.w3.org/TR/xml-infoset/__;!!Obbck6kTJA!OZeMfuu_v5bg2MlWBgvOV5Cz4kfvZzejlmLdia84fV9ScLMuUO5R91AP4AVy7d0PwQ$ [2] https://urldefense.com/v3/__https://docs.basex.org/wiki/Serialization__;!!Obbck6kTJA!OZeMfuu_v5bg2MlWBgvOV5Cz4kfvZzejlmLdia84fV9ScLMuUO5R91AP4AWXSI7EQA$ On Tue, Jul 28, 2020 at 5:49 PM Srikumar Choudhury <schoudhu at opentext.com> wrote: > > Hi, > <!DOCTYPE some name SYSTEM .. and <?xml version="1.0"?> data loss are happening while importing the xml document using db:replace(...) API. > > <?xml version="1.0"?> > > <!DOCTYPE testSuiteConfig SYSTEM "../../../configs/TestConfig_2_1.dtd"> > etc. > We need help to resolve this issue. > we are using Java executeQuery api of XQExpression. class to run "db:replace(...)" query to store document in Basex database, but while retrieving the XML files from basex server we notice data loss. we can loss above data. > > Please help us, how we can resolve this issue or share some documentation, which can help to resolve this issue. > > Thanks, > Srikumar
CG
Christian Grün30 Jul 2020 09:50 #
Quoted text · Srikumar Choudhury · 6 lines
> serialize(<Basex Database Name>/<folder name>/<xml file name>.xml , > map { > 'method' : 'xml' > 'xml' : map { 'doctype-system' : '<!DOCTYPE testSuiteConfig SYSTEM "../../../configs/TestConfig_2_1.dtd">', 'omit-xml-declaration' : 'no' } > } > )
There are various ways to specify the serialization parameters. If you assign options in the query prolog, there is no need to call serialize:
declare namespace output = 'http://www.w3.org/2010/xslt-xquery-serialization';
declare option output:omit-xml-declaration 'no';
declare option output:doctype-system '../../../configs/TestConfig_2_1.dtd';
db:open('db', 'path/to/file.xml')
If you invoke serialize, a valid item must be supplied as first argument for serialize. This can e.g look as follows:
  serialize(db:open('db', 'path/to/file.xml'), map { ... })
Quoted text · Srikumar Choudhury · 38 lines
> From: Christian Grün <christian.gruen at gmail.com> > Sent: Tuesday, July 28, 2020 9:27 PM > To: Srikumar Choudhury <schoudhu at opentext.com> > Cc: James Ball <basex-talk at jamesball.co.uk>; BaseX <basex-talk at mailman.uni-konstanz.de> > Subject: Re: [EXTERNAL] - Re: [basex-talk] BaseX 9.4 - XQuery locks - documentation query > > Hi Srikumar, > > As document type definitions and XML declarations are not part of the > XML information set, they are not stored in the database. However, you > can easily recreate them when serializing your documents. See [1] for > further information. > > Hope this helps > Christian > > [1] https://urldefense.com/v3/__https://www.w3.org/TR/xml-infoset/__;!!Obbck6kTJA!OZeMfuu_v5bg2MlWBgvOV5Cz4kfvZzejlmLdia84fV9ScLMuUO5R91AP4AVy7d0PwQ$ > [2] https://urldefense.com/v3/__https://docs.basex.org/wiki/Serialization__;!!Obbck6kTJA!OZeMfuu_v5bg2MlWBgvOV5Cz4kfvZzejlmLdia84fV9ScLMuUO5R91AP4AWXSI7EQA$ > > > > On Tue, Jul 28, 2020 at 5:49 PM Srikumar Choudhury > <schoudhu at opentext.com> wrote: > > > > Hi, > > <!DOCTYPE some name SYSTEM .. and <?xml version="1.0"?> data loss are happening while importing the xml document using db:replace(...) API. > > > > <?xml version="1.0"?> > > > > <!DOCTYPE testSuiteConfig SYSTEM "../../../configs/TestConfig_2_1.dtd"> > > etc. > > We need help to resolve this issue. > > we are using Java executeQuery api of XQExpression. class to run "db:replace(...)" query to store document in Basex database, but while retrieving the XML files from basex server we notice data loss. we can loss above data. > > > > Please help us, how we can resolve this issue or share some documentation, which can help to resolve this issue. > > > > Thanks, > > Srikumar

⚡Generated with XQuery