Query corrupts my database

Thursday, 20 January 2011 · 8 messages · last reply 21 Jan 2011
CG
Christian Grünin reply to Mark Boon, 20 Jan 2011, 23:0620 Jan 2011 22:09 #
Mark, thanks for your mails. Just a short one.. Does the same error occur with the latest version of BaseX (6.5)? Christian
Quoted text · Mark Boon · 80 lines
On Thu, Jan 20, 2011 at 10:06 PM, Mark Boon <mboon at blueplanetsoftware.com> wrote: > I've been trying to keep an OWL ontology in the BaseX database. It's a > little contrived but I thought it should work. But whenever I insert the > ontology it corrupts my entire collection. > I have a single Ontology node, that initially is just an empty element. Then > I perform the following query: > replace node collection('bm_test_iam')/BOT-L/Ontology with <Ontology > xmlns="http://www.w3.org/2002/07/owl#" > xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" > xmlns:xsd="http://www.w3.org/2001/XMLSchema#" > xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" > xml:base="http://www.w3.org/2002/07/owl#"> > <Prefix name="rdf" IRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/> > <Prefix name="rdfs" IRI="http://www.w3.org/2000/01/rdf-schema#"/> > <Prefix name="xsd" IRI="http://www.w3.org/2001/XMLSchema#"/> > <Prefix name="owl" IRI="http://www.w3.org/2002/07/owl#"/> > <SubClassOf> > <Class IRI="http://ar#boat"/> > <Class IRI="http://ar#vehicle"/> > </SubClassOf> > </Ontology> > I get an error. Same thing when I run this query from the BasX UI. This is > what I see in the "Query Info" panel: > Query: replace node collection('bm_test_iam')/BOT-L/Ontology with <Ontology > xmlns="http://www.w3.org/2002/07/owl#" > xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" > xmlns:xsd="http://www.w3.org/2001/XMLSchema#" > xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" > xml:base="http://www.w3.org/2002/07/owl#"> > <Prefix name="rdf" IRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/> > <Prefix name="rdfs" IRI="http://www.w3.org/2000/01/rdf-schema#"/> > <Prefix name="xsd" IRI="http://www.w3.org/2001/XMLSchema#"/> > <Prefix name="owl" IRI="http://www.w3.org/2002/07/owl#"/> > <SubClassOf> > <Class IRI="http://ar#boat"/> > <Class IRI="http://ar#vehicle"/> > </SubClassOf> > </Ontology> > Error: Possible bug? Feedback is welcome: basex-talk at mailman.uni-konstanz.de > BaseX 6.3.2: > java.lang.RuntimeException: Possible bug? Feedback is welcome: > basex-talk at mailman.uni-konstanz.de > BaseX 6.3.2: > Data Access out of bounds [pre:699, indexSize:5, access:5 > 4] > org.basex.util.Util.notexpected(Util.java:46) > org.basex.io.TableDiskAccess.cursor(TableDiskAccess.java:323) > org.basex.io.TableDiskAccess.read1(TableDiskAccess.java:92) > org.basex.data.Data.kind(Data.java:324) > org.basex.query.item.DBNode$4.next(DBNode.java:272) > org.basex.query.path.IterStep$1.next(IterStep.java:45) > org.basex.query.iter.NodeIter.next(NodeIter.java:1) > org.basex.query.path.IterPath$1.next(IterPath.java:66) > org.basex.query.path.IterPath$1.next(IterPath.java:1) > org.basex.query.up.Replace.item(Replace.java:59) > org.basex.query.expr.ParseExpr.iter(ParseExpr.java:47) > org.basex.query.QueryContext.iter(QueryContext.java:360) > org.basex.query.QueryContext.iter(QueryContext.java:324) > org.basex.query.QueryContext.eval(QueryContext.java:282) > org.basex.query.QueryProcessor.execute(QueryProcessor.java:104) > org.basex.core.cmd.AQuery.query(AQuery.java:83) > org.basex.core.cmd.XQuery.run(XQuery.java:22) > org.basex.core.Command.run(Command.java:245) > org.basex.core.Command.exec(Command.java:227) > org.basex.core.Command.execute(Command.java:66) > org.basex.gui.GUI.exec(GUI.java:383) > org.basex.gui.GUI$5.run(GUI.java:346) > Note: the XML I try to insert is created by Pellet, so I have little control > over it. > Not only does the query fail, but any subsequent query on the same > collection now gives me a "Possible Bug?" message. Any ideas would be > greatly appreciated. > Mark Boon > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >
CG
Christian Grünin reply to Mark Boon, 20 Jan 2011, 23:2720 Jan 2011 22:39 #
Hi Mark, I'm sorry, but I think I need some more information to find a helpful answer. Do you have a little example (sscce) that allows us to reproduce the issue? Christian
Quoted text · Mark Boon · 137 lines
On Thu, Jan 20, 2011 at 10:27 PM, Mark Boon <mboon at blueplanetsoftware.com> wrote: > OK, I tried with BaseX 6.5. Now I don't get an error, but now my Ontology > element remains empty. > This is the output of the query: > Query: replace node collection('bm_test_iam')/BOT-L/Ontology with <Ontology > xmlns="http://www.w3.org/2002/07/owl#" > xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" > xmlns:xsd="http://www.w3.org/2001/XMLSchema#" > xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" > xml:base="http://www.w3.org/2002/07/owl#"> > Compiling: > - pre-evaluating collection("bm_test_iam") > Result: replace node document-node { "bm_test_iam" }/*:BOT-L/*:Ontology with > element { "Ontology" } { attribute { "xml:base" } { > "http://www.w3.org/2002/07/owl#" }, element { "Prefix" } { attribute { > "name" } { "rdf" }, attribute { "IRI" } { > "http://www.w3.org/1999/02/22-rdf-syntax-ns#" } }, element { "Prefix" } { > attribute { "name" } { "rdfs" }, attribute { "IRI" } { > "http://www.w3.org/2000/01/rdf-schema#" } }, element { "Prefix" } { > attribute { "name" } { "xsd" }, attribute { "IRI" } { > "http://www.w3.org/2001/XMLSchema#" } }, element { "Prefix" } { attribute { > "name" } { "owl" }, attribute { "IRI" } { "http://www.w3.org/2002/07/owl#" } > }, element { "SubClassOf" } { element { "Class" } { attribute { "IRI" } { > "http://ar#boat" } }, element { "Class" } { attribute { "IRI" } { > "http://ar#vehicle" } } } } > Query plan: > <Replace> > <IterPath> > <document-node() name="bm_test_iam"/> > <IterStep axis="child" test="*:BOT-L"/> > <IterStep axis="child" test="*:Ontology"/> > </IterPath> > <CElem> > <Item value="Ontology" type="xs:QName"/> > <CAttr> > <Item value="xml:base" type="xs:QName"/> > <Item value="http://www.w3.org/2002/07/owl#" type="xs:string"/> > </CAttr> > <CElem> > <Item value="Prefix" type="xs:QName"/> > <CAttr> > <Item value="name" type="xs:QName"/> > <Item value="rdf" type="xs:string"/> > </CAttr> > <CAttr> > <Item value="IRI" type="xs:QName"/> > <Item value="http://www.w3.org/1999/02/22-rdf-syntax-ns#" > type="xs:string"/> > </CAttr> > </CElem> > <CElem> > <Item value="Prefix" type="xs:QName"/> > <CAttr> > <Item value="name" type="xs:QName"/> > <Item value="rdfs" type="xs:string"/> > </CAttr> > <CAttr> > <Item value="IRI" type="xs:QName"/> > <Item value="http://www.w3.org/2000/01/rdf-schema#" > type="xs:string"/> > </CAttr> > </CElem> > <CElem> > <Item value="Prefix" type="xs:QName"/> > <CAttr> > <Item value="name" type="xs:QName"/> > <Item value="xsd" type="xs:string"/> > </CAttr> > <CAttr> > <Item value="IRI" type="xs:QName"/> > <Item value="http://www.w3.org/2001/XMLSchema#" type="xs:string"/> > </CAttr> > </CElem> > <CElem> > <Item value="Prefix" type="xs:QName"/> > <CAttr> > <Item value="name" type="xs:QName"/> > <Item value="owl" type="xs:string"/> > </CAttr> > <CAttr> > <Item value="IRI" type="xs:QName"/> > <Item value="http://www.w3.org/2002/07/owl#" type="xs:string"/> > </CAttr> > </CElem> > <CElem> > <Item value="SubClassOf" type="xs:QName"/> > <CElem> > <Item value="Class" type="xs:QName"/> > <CAttr> > <Item value="IRI" type="xs:QName"/> > <Item value="http://ar#boat" type="xs:string"/> > </CAttr> > </CElem> > <CElem> > <Item value="Class" type="xs:QName"/> > <CAttr> > <Item value="IRI" type="xs:QName"/> > <Item value="http://ar#vehicle" type="xs:string"/> > </CAttr> > </CElem> > </CElem> > </CElem> > </Replace> > Timing: > - Parsing: 0.87 ms > - Compiling: 1.21 ms > - Evaluating: 2.33 ms > - Printing: 0.14 ms > - Total Time: 4.55 ms > When I now do collection('bm_test_iam')/BOT-L/Ontology the "Text" panel just > contains: > <Ontology/> > where I expected it to contain the XML I just inserted. > Mark Boon > > > On Jan 20, 2011, at 11:13 AM, Mark Boon wrote: > > On Jan 20, 2011, at 11:09 AM, Christian Grün wrote: > > Mark, > thanks for your mails. Just a short one.. Does the same error occur > with the latest version of BaseX (6.5)? > Christian > > Actually, I just picked up this work where I left it a few weeks ago. Some > reorganization at work made me change e-mail so I hadn't followed this list > either. So I missed that a new version came out. I'll try it immediately. > I'll get back with the result. > Mark > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >
MB
Mark Boon20 Jan 2011 23:06 #
I've been trying to keep an OWL ontology in the BaseX database. It's a little contrived but I thought it should work. But whenever I insert the ontology it corrupts my entire collection. I have a single Ontology node, that initially is just an empty element. Then I perform the following query:
replace node collection('bm_test_iam')/BOT-L/Ontology with <Ontology xmlns="http://www.w3.org/2002/07/owl#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xml:base="http://www.w3.org/2002/07/owl#">
    <Prefix name="rdf" IRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
    <Prefix name="rdfs" IRI="http://www.w3.org/2000/01/rdf-schema#"/>
    <Prefix name="xsd" IRI="http://www.w3.org/2001/XMLSchema#"/>
    <Prefix name="owl" IRI="http://www.w3.org/2002/07/owl#"/>
    <SubClassOf>
        <Class IRI="http://ar#boat"/>
        <Class IRI="http://ar#vehicle"/>
    </SubClassOf>
</Ontology>
I get an error. Same thing when I run this query from the BasX UI. This is what I see in the "Query Info" panel:
Query: replace node collection('bm_test_iam')/BOT-L/Ontology with <Ontology xmlns="http://www.w3.org/2002/07/owl#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xml:base="http://www.w3.org/2002/07/owl#">
    <Prefix name="rdf" IRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
    <Prefix name="rdfs" IRI="http://www.w3.org/2000/01/rdf-schema#"/>
    <Prefix name="xsd" IRI="http://www.w3.org/2001/XMLSchema#"/>
    <Prefix name="owl" IRI="http://www.w3.org/2002/07/owl#"/>
    <SubClassOf>
        <Class IRI="http://ar#boat"/>
        <Class IRI="http://ar#vehicle"/>
    </SubClassOf>
</Ontology>
Error: Possible bug? Feedback is welcome: basex-talk at mailman.uni-konstanz.de
BaseX 6.3.2:
java.lang.RuntimeException: Possible bug? Feedback is welcome: basex-talk at mailman.uni-konstanz.de
BaseX 6.3.2:
Data Access out of bounds [pre:699, indexSize:5, access:5 > 4]
org.basex.util.Util.notexpected(Util.java:46) org.basex.io.TableDiskAccess.cursor(TableDiskAccess.java:323) org.basex.io.TableDiskAccess.read1(TableDiskAccess.java:92) org.basex.data.Data.kind(Data.java:324) org.basex.query.item.DBNode$4.next(DBNode.java:272) org.basex.query.path.IterStep$1.next(IterStep.java:45) org.basex.query.iter.NodeIter.next(NodeIter.java:1) org.basex.query.path.IterPath$1.next(IterPath.java:66) org.basex.query.path.IterPath$1.next(IterPath.java:1) org.basex.query.up.Replace.item(Replace.java:59) org.basex.query.expr.ParseExpr.iter(ParseExpr.java:47) org.basex.query.QueryContext.iter(QueryContext.java:360) org.basex.query.QueryContext.iter(QueryContext.java:324) org.basex.query.QueryContext.eval(QueryContext.java:282) org.basex.query.QueryProcessor.execute(QueryProcessor.java:104) org.basex.core.cmd.AQuery.query(AQuery.java:83) org.basex.core.cmd.XQuery.run(XQuery.java:22) org.basex.core.Command.run(Command.java:245) org.basex.core.Command.exec(Command.java:227) org.basex.core.Command.execute(Command.java:66) org.basex.gui.GUI.exec(GUI.java:383) org.basex.gui.GUI$5.run(GUI.java:346) Note: the XML I try to insert is created by Pellet, so I have little control over it. Not only does the query fail, but any subsequent query on the same collection now gives me a "Possible Bug?" message. Any ideas would be greatly appreciated. Mark Boon
MB
Mark Boonin reply to Christian Grün, 20 Jan 2011, 22:0920 Jan 2011 23:13 #
Quoted text · Christian Grün · 5 lines
On Jan 20, 2011, at 11:09 AM, Christian Grün wrote: > Mark, > thanks for your mails. Just a short one.. Does the same error occur > with the latest version of BaseX (6.5)? > Christian
Actually, I just picked up this work where I left it a few weeks ago. Some reorganization at work made me change e-mail so I hadn't followed this list either. So I missed that a new version came out. I'll try it immediately. I'll get back with the result. Mark
CG
Christian Grün20 Jan 2011 23:21 #
Hi Mark, this is due to a missing namespace declaration. You can either explicitly specify your namespace...
  declare default element namespace "http://www.w3.org/2002/07/owl#";
  doc('test')/Ontology
...or use a namespace wildcard to match the root element: doc('test')/*:Ontology Hope this helps, Christian
Quoted text · Mark Boon · 321 lines
On Thu, Jan 20, 2011 at 11:16 PM, Mark Boon <mboon at blueplanetsoftware.com> wrote: > OK, I enter the following commands in the BaseX UI. > create database test > insert node <Ontology/> into doc('test') > replace node collection('test')/Ontology with <Ontology > xmlns="http://www.w3.org/2002/07/owl#" > xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" > xmlns:xsd="http://www.w3.org/2001/XMLSchema#" > xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" > xml:base="http://www.w3.org/2002/07/owl#"> > <Prefix name="rdf" IRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/> > <Prefix name="rdfs" IRI="http://www.w3.org/2000/01/rdf-schema#"/> > <Prefix name="xsd" IRI="http://www.w3.org/2001/XMLSchema#"/> > <Prefix name="owl" IRI="http://www.w3.org/2002/07/owl#"/> > <SubClassOf> > <Class IRI="http://ar#boat"/> > <Class IRI="http://ar#vehicle"/> > </SubClassOf> > </Ontology> > Now, if I do > collection('test') > it shows me that the element was in fact inserted as it prints: > <Ontology xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" > xmlns:xsd="http://www.w3.org/2001/XMLSchema#" > xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" > xmlns="http://www.w3.org/2002/07/owl#" > xml:base="http://www.w3.org/2002/07/owl#"> > <Prefix name="rdf" IRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/> > <Prefix name="rdfs" IRI="http://www.w3.org/2000/01/rdf-schema#"/> > <Prefix name="xsd" IRI="http://www.w3.org/2001/XMLSchema#"/> > <Prefix name="owl" IRI="http://www.w3.org/2002/07/owl#"/> > <SubClassOf> > <Class IRI="http://ar#boat"/> > <Class IRI="http://ar#vehicle"/> > </SubClassOf> > </Ontology> > However, if I enter: > collection('test')/Ontology > it's empty. Isn't that unusual? I do note that in the "Query Info" panel it > prints: > - removing unknown tag/attribute "Ontology" > although it doesn't do so in my larger example. > When I try to execute the same 'replace...' command again, it tells me: > Error: [XUDY0027] Replace target must not be empty. > Mark Boon > > On Jan 20, 2011, at 11:39 AM, Christian Grün wrote: > > Hi Mark, > > I'm sorry, but I think I need some more information to find a helpful > answer. Do you have a little example (sscce) that allows us to > reproduce the issue? > > Christian > ___________________________ > > On Thu, Jan 20, 2011 at 10:27 PM, Mark Boon > <mboon at blueplanetsoftware.com> wrote: > > OK, I tried with BaseX 6.5. Now I don't get an error, but now my Ontology > > element remains empty. > > This is the output of the query: > > Query: replace node collection('bm_test_iam')/BOT-L/Ontology with <Ontology > > xmlns="http://www.w3.org/2002/07/owl#" > > xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" > > xmlns:xsd="http://www.w3.org/2001/XMLSchema#" > > xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" > > xml:base="http://www.w3.org/2002/07/owl#"> > > Compiling: > > - pre-evaluating collection("bm_test_iam") > > Result: replace node document-node { "bm_test_iam" }/*:BOT-L/*:Ontology with > > element { "Ontology" } { attribute { "xml:base" } { > > "http://www.w3.org/2002/07/owl#" }, element { "Prefix" } { attribute { > > "name" } { "rdf" }, attribute { "IRI" } { > > "http://www.w3.org/1999/02/22-rdf-syntax-ns#" } }, element { "Prefix" } { > > attribute { "name" } { "rdfs" }, attribute { "IRI" } { > > "http://www.w3.org/2000/01/rdf-schema#" } }, element { "Prefix" } { > > attribute { "name" } { "xsd" }, attribute { "IRI" } { > > "http://www.w3.org/2001/XMLSchema#" } }, element { "Prefix" } { attribute { > > "name" } { "owl" }, attribute { "IRI" } { "http://www.w3.org/2002/07/owl#" } > > }, element { "SubClassOf" } { element { "Class" } { attribute { "IRI" } { > > "http://ar#boat" } }, element { "Class" } { attribute { "IRI" } { > > "http://ar#vehicle" } } } } > > Query plan: > > <Replace> > > <IterPath> > > <document-node() name="bm_test_iam"/> > > <IterStep axis="child" test="*:BOT-L"/> > > <IterStep axis="child" test="*:Ontology"/> > > </IterPath> > > <CElem> > > <Item value="Ontology" type="xs:QName"/> > > <CAttr> > > <Item value="xml:base" type="xs:QName"/> > > <Item value="http://www.w3.org/2002/07/owl#" type="xs:string"/> > > </CAttr> > > <CElem> > > <Item value="Prefix" type="xs:QName"/> > > <CAttr> > > <Item value="name" type="xs:QName"/> > > <Item value="rdf" type="xs:string"/> > > </CAttr> > > <CAttr> > > <Item value="IRI" type="xs:QName"/> > > <Item value="http://www.w3.org/1999/02/22-rdf-syntax-ns#" > > type="xs:string"/> > > </CAttr> > > </CElem> > > <CElem> > > <Item value="Prefix" type="xs:QName"/> > > <CAttr> > > <Item value="name" type="xs:QName"/> > > <Item value="rdfs" type="xs:string"/> > > </CAttr> > > <CAttr> > > <Item value="IRI" type="xs:QName"/> > > <Item value="http://www.w3.org/2000/01/rdf-schema#" > > type="xs:string"/> > > </CAttr> > > </CElem> > > <CElem> > > <Item value="Prefix" type="xs:QName"/> > > <CAttr> > > <Item value="name" type="xs:QName"/> > > <Item value="xsd" type="xs:string"/> > > </CAttr> > > <CAttr> > > <Item value="IRI" type="xs:QName"/> > > <Item value="http://www.w3.org/2001/XMLSchema#" type="xs:string"/> > > </CAttr> > > </CElem> > > <CElem> > > <Item value="Prefix" type="xs:QName"/> > > <CAttr> > > <Item value="name" type="xs:QName"/> > > <Item value="owl" type="xs:string"/> > > </CAttr> > > <CAttr> > > <Item value="IRI" type="xs:QName"/> > > <Item value="http://www.w3.org/2002/07/owl#" type="xs:string"/> > > </CAttr> > > </CElem> > > <CElem> > > <Item value="SubClassOf" type="xs:QName"/> > > <CElem> > > <Item value="Class" type="xs:QName"/> > > <CAttr> > > <Item value="IRI" type="xs:QName"/> > > <Item value="http://ar#boat" type="xs:string"/> > > </CAttr> > > </CElem> > > <CElem> > > <Item value="Class" type="xs:QName"/> > > <CAttr> > > <Item value="IRI" type="xs:QName"/> > > <Item value="http://ar#vehicle" type="xs:string"/> > > </CAttr> > > </CElem> > > </CElem> > > </CElem> > > </Replace> > > Timing: > > - Parsing: 0.87 ms > > - Compiling: 1.21 ms > > - Evaluating: 2.33 ms > > - Printing: 0.14 ms > > - Total Time: 4.55 ms > > When I now do collection('bm_test_iam')/BOT-L/Ontology the "Text" panel just > > contains: > > <Ontology/> > > where I expected it to contain the XML I just inserted. > > Mark Boon > > > On Jan 20, 2011, at 11:13 AM, Mark Boon wrote: > > On Jan 20, 2011, at 11:09 AM, Christian Grün wrote: > > Mark, > > thanks for your mails. Just a short one.. Does the same error occur > > with the latest version of BaseX (6.5)? > > Christian > > Actually, I just picked up this work where I left it a few weeks ago. Some > > reorganization at work made me change e-mail so I hadn't followed this list > > either. So I missed that a new version came out. I'll try it immediately. > > I'll get back with the result. > > Mark > > _______________________________________________ > > BaseX-Talk mailing list > > BaseX-Talk at mailman.uni-konstanz.de > > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > > > >
MB
Mark Boonin reply to Mark Boon, 20 Jan 2011, 23:1320 Jan 2011 23:27 #
OK, I tried with BaseX 6.5. Now I don't get an error, but now my Ontology element remains empty. This is the output of the query:
Query: replace node collection('bm_test_iam')/BOT-L/Ontology with <Ontology xmlns="http://www.w3.org/2002/07/owl#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xml:base="http://www.w3.org/2002/07/owl#">
Compiling:
- pre-evaluating collection("bm_test_iam")
Result: replace node document-node { "bm_test_iam" }/*:BOT-L/*:Ontology with element { "Ontology" } { attribute { "xml:base" } { "http://www.w3.org/2002/07/owl#" }, element { "Prefix" } { attribute { "name" } { "rdf" }, attribute { "IRI" } { "http://www.w3.org/1999/02/22-rdf-syntax-ns#" } }, element { "Prefix" } { attribute { "name" } { "rdfs" }, attribute { "IRI" } { "http://www.w3.org/2000/01/rdf-schema#" } }, element { "Prefix" } { attribute { "name" } { "xsd" }, attribute { "IRI" } { "http://www.w3.org/2001/XMLSchema#" } }, element { "Prefix" } { attribute { "name" } { "owl" }, attribute { "IRI" } { "http://www.w3.org/2002/07/owl#" } }, element { "SubClassOf" } { element { "Class" } { attribute { "IRI" } { "http://ar#boat" } }, element { "Class" } { attribute { "IRI" } { "http://ar#vehicle" } } } }
Query plan:
<Replace>
  <IterPath>
    <document-node() name="bm_test_iam"/>
    <IterStep axis="child" test="*:BOT-L"/>
    <IterStep axis="child" test="*:Ontology"/>
  </IterPath>
  <CElem>
    <Item value="Ontology" type="xs:QName"/>
    <CAttr>
      <Item value="xml:base" type="xs:QName"/>
      <Item value="http://www.w3.org/2002/07/owl#" type="xs:string"/>
    </CAttr>
    <CElem>
      <Item value="Prefix" type="xs:QName"/>
      <CAttr>
        <Item value="name" type="xs:QName"/>
        <Item value="rdf" type="xs:string"/>
      </CAttr>
      <CAttr>
        <Item value="IRI" type="xs:QName"/>
        <Item value="http://www.w3.org/1999/02/22-rdf-syntax-ns#" type="xs:string"/>
      </CAttr>
    </CElem>
    <CElem>
      <Item value="Prefix" type="xs:QName"/>
      <CAttr>
        <Item value="name" type="xs:QName"/>
        <Item value="rdfs" type="xs:string"/>
      </CAttr>
      <CAttr>
        <Item value="IRI" type="xs:QName"/>
        <Item value="http://www.w3.org/2000/01/rdf-schema#" type="xs:string"/>
      </CAttr>
    </CElem>
    <CElem>
      <Item value="Prefix" type="xs:QName"/>
      <CAttr>
        <Item value="name" type="xs:QName"/>
        <Item value="xsd" type="xs:string"/>
      </CAttr>
      <CAttr>
        <Item value="IRI" type="xs:QName"/>
        <Item value="http://www.w3.org/2001/XMLSchema#" type="xs:string"/>
      </CAttr>
    </CElem>
    <CElem>
      <Item value="Prefix" type="xs:QName"/>
      <CAttr>
        <Item value="name" type="xs:QName"/>
        <Item value="owl" type="xs:string"/>
      </CAttr>
      <CAttr>
        <Item value="IRI" type="xs:QName"/>
        <Item value="http://www.w3.org/2002/07/owl#" type="xs:string"/>
      </CAttr>
    </CElem>
    <CElem>
      <Item value="SubClassOf" type="xs:QName"/>
      <CElem>
        <Item value="Class" type="xs:QName"/>
        <CAttr>
          <Item value="IRI" type="xs:QName"/>
          <Item value="http://ar#boat" type="xs:string"/>
        </CAttr>
      </CElem>
      <CElem>
        <Item value="Class" type="xs:QName"/>
        <CAttr>
          <Item value="IRI" type="xs:QName"/>
          <Item value="http://ar#vehicle" type="xs:string"/>
        </CAttr>
      </CElem>
    </CElem>
  </CElem>
</Replace>
Timing:
 - Parsing:  0.87 ms
 - Compiling:  1.21 ms
 - Evaluating:  2.33 ms
 - Printing:  0.14 ms
 - Total Time:  4.55 ms
When I now do collection('bm_test_iam')/BOT-L/Ontology the "Text" panel just contains:
<Ontology/>
where I expected it to contain the XML I just inserted. Mark Boon
Quoted text · Mark Boon · 17 lines
On Jan 20, 2011, at 11:13 AM, Mark Boon wrote: > > On Jan 20, 2011, at 11:09 AM, Christian Grün wrote: > >> Mark, >> thanks for your mails. Just a short one.. Does the same error occur >> with the latest version of BaseX (6.5)? >> Christian > > Actually, I just picked up this work where I left it a few weeks ago. Some reorganization at work made me change e-mail so I hadn't followed this list either. So I missed that a new version came out. I'll try it immediately. I'll get back with the result. > > Mark > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
MB
Mark Boonin reply to Christian Grün, 20 Jan 2011, 23:2121 Jan 2011 03:01 #
Thank you Christian, for all the prompt replies. It looks like I got it working using *:Ontology. I must say I never understood why namespaces must make things so complicated and counterintuitive. Another thing that has put me on the wrong track a couple of times is when I want to check with the BaseX UI tool some results that my program inserts into the database, only to get completely different results than I'd expect. It's as if there's interference between my running program and the BaseX UI tool. For example, if I replace a node using my program and next try to replace the node through the BaseX UI the result is unpredictable. Sometimes it does what I expect, sometimes it gives the old node that was put in by my program and sometimes something I did ten minutes before. There's probably some explainable system to it, but I haven't figured it out yet. Mark
Quoted text · Christian Grün · 339 lines
On Jan 20, 2011, at 12:21 PM, Christian Grün wrote: > Hi Mark, > > this is due to a missing namespace declaration. You can either > explicitly specify your namespace... > > declare default element namespace "http://www.w3.org/2002/07/owl#"; > doc('test')/Ontology > > ...or use a namespace wildcard to match the root element: > > doc('test')/*:Ontology > > Hope this helps, > Christian > > > > On Thu, Jan 20, 2011 at 11:16 PM, Mark Boon > <mboon at blueplanetsoftware.com> wrote: >> OK, I enter the following commands in the BaseX UI. >> create database test >> insert node <Ontology/> into doc('test') >> replace node collection('test')/Ontology with <Ontology >> xmlns="http://www.w3.org/2002/07/owl#" >> xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" >> xmlns:xsd="http://www.w3.org/2001/XMLSchema#" >> xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" >> xml:base="http://www.w3.org/2002/07/owl#"> >> <Prefix name="rdf" IRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/> >> <Prefix name="rdfs" IRI="http://www.w3.org/2000/01/rdf-schema#"/> >> <Prefix name="xsd" IRI="http://www.w3.org/2001/XMLSchema#"/> >> <Prefix name="owl" IRI="http://www.w3.org/2002/07/owl#"/> >> <SubClassOf> >> <Class IRI="http://ar#boat"/> >> <Class IRI="http://ar#vehicle"/> >> </SubClassOf> >> </Ontology> >> Now, if I do >> collection('test') >> it shows me that the element was in fact inserted as it prints: >> <Ontology xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" >> xmlns:xsd="http://www.w3.org/2001/XMLSchema#" >> xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" >> xmlns="http://www.w3.org/2002/07/owl#" >> xml:base="http://www.w3.org/2002/07/owl#"> >> <Prefix name="rdf" IRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/> >> <Prefix name="rdfs" IRI="http://www.w3.org/2000/01/rdf-schema#"/> >> <Prefix name="xsd" IRI="http://www.w3.org/2001/XMLSchema#"/> >> <Prefix name="owl" IRI="http://www.w3.org/2002/07/owl#"/> >> <SubClassOf> >> <Class IRI="http://ar#boat"/> >> <Class IRI="http://ar#vehicle"/> >> </SubClassOf> >> </Ontology> >> However, if I enter: >> collection('test')/Ontology >> it's empty. Isn't that unusual? I do note that in the "Query Info" panel it >> prints: >> - removing unknown tag/attribute "Ontology" >> although it doesn't do so in my larger example. >> When I try to execute the same 'replace...' command again, it tells me: >> Error: [XUDY0027] Replace target must not be empty. >> Mark Boon >> >> On Jan 20, 2011, at 11:39 AM, Christian Grün wrote: >> >> Hi Mark, >> >> I'm sorry, but I think I need some more information to find a helpful >> answer. Do you have a little example (sscce) that allows us to >> reproduce the issue? >> >> Christian >> ___________________________ >> >> On Thu, Jan 20, 2011 at 10:27 PM, Mark Boon >> <mboon at blueplanetsoftware.com> wrote: >> >> OK, I tried with BaseX 6.5. Now I don't get an error, but now my Ontology >> >> element remains empty. >> >> This is the output of the query: >> >> Query: replace node collection('bm_test_iam')/BOT-L/Ontology with <Ontology >> >> xmlns="http://www.w3.org/2002/07/owl#" >> >> xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" >> >> xmlns:xsd="http://www.w3.org/2001/XMLSchema#" >> >> xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" >> >> xml:base="http://www.w3.org/2002/07/owl#"> >> >> Compiling: >> >> - pre-evaluating collection("bm_test_iam") >> >> Result: replace node document-node { "bm_test_iam" }/*:BOT-L/*:Ontology with >> >> element { "Ontology" } { attribute { "xml:base" } { >> >> "http://www.w3.org/2002/07/owl#" }, element { "Prefix" } { attribute { >> >> "name" } { "rdf" }, attribute { "IRI" } { >> >> "http://www.w3.org/1999/02/22-rdf-syntax-ns#" } }, element { "Prefix" } { >> >> attribute { "name" } { "rdfs" }, attribute { "IRI" } { >> >> "http://www.w3.org/2000/01/rdf-schema#" } }, element { "Prefix" } { >> >> attribute { "name" } { "xsd" }, attribute { "IRI" } { >> >> "http://www.w3.org/2001/XMLSchema#" } }, element { "Prefix" } { attribute { >> >> "name" } { "owl" }, attribute { "IRI" } { "http://www.w3.org/2002/07/owl#" } >> >> }, element { "SubClassOf" } { element { "Class" } { attribute { "IRI" } { >> >> "http://ar#boat" } }, element { "Class" } { attribute { "IRI" } { >> >> "http://ar#vehicle" } } } } >> >> Query plan: >> >> <Replace> >> >> <IterPath> >> >> <document-node() name="bm_test_iam"/> >> >> <IterStep axis="child" test="*:BOT-L"/> >> >> <IterStep axis="child" test="*:Ontology"/> >> >> </IterPath> >> >> <CElem> >> >> <Item value="Ontology" type="xs:QName"/> >> >> <CAttr> >> >> <Item value="xml:base" type="xs:QName"/> >> >> <Item value="http://www.w3.org/2002/07/owl#" type="xs:string"/> >> >> </CAttr> >> >> <CElem> >> >> <Item value="Prefix" type="xs:QName"/> >> >> <CAttr> >> >> <Item value="name" type="xs:QName"/> >> >> <Item value="rdf" type="xs:string"/> >> >> </CAttr> >> >> <CAttr> >> >> <Item value="IRI" type="xs:QName"/> >> >> <Item value="http://www.w3.org/1999/02/22-rdf-syntax-ns#" >> >> type="xs:string"/> >> >> </CAttr> >> >> </CElem> >> >> <CElem> >> >> <Item value="Prefix" type="xs:QName"/> >> >> <CAttr> >> >> <Item value="name" type="xs:QName"/> >> >> <Item value="rdfs" type="xs:string"/> >> >> </CAttr> >> >> <CAttr> >> >> <Item value="IRI" type="xs:QName"/> >> >> <Item value="http://www.w3.org/2000/01/rdf-schema#" >> >> type="xs:string"/> >> >> </CAttr> >> >> </CElem> >> >> <CElem> >> >> <Item value="Prefix" type="xs:QName"/> >> >> <CAttr> >> >> <Item value="name" type="xs:QName"/> >> >> <Item value="xsd" type="xs:string"/> >> >> </CAttr> >> >> <CAttr> >> >> <Item value="IRI" type="xs:QName"/> >> >> <Item value="http://www.w3.org/2001/XMLSchema#" type="xs:string"/> >> >> </CAttr> >> >> </CElem> >> >> <CElem> >> >> <Item value="Prefix" type="xs:QName"/> >> >> <CAttr> >> >> <Item value="name" type="xs:QName"/> >> >> <Item value="owl" type="xs:string"/> >> >> </CAttr> >> >> <CAttr> >> >> <Item value="IRI" type="xs:QName"/> >> >> <Item value="http://www.w3.org/2002/07/owl#" type="xs:string"/> >> >> </CAttr> >> >> </CElem> >> >> <CElem> >> >> <Item value="SubClassOf" type="xs:QName"/> >> >> <CElem> >> >> <Item value="Class" type="xs:QName"/> >> >> <CAttr> >> >> <Item value="IRI" type="xs:QName"/> >> >> <Item value="http://ar#boat" type="xs:string"/> >> >> </CAttr> >> >> </CElem> >> >> <CElem> >> >> <Item value="Class" type="xs:QName"/> >> >> <CAttr> >> >> <Item value="IRI" type="xs:QName"/> >> >> <Item value="http://ar#vehicle" type="xs:string"/> >> >> </CAttr> >> >> </CElem> >> >> </CElem> >> >> </CElem> >> >> </Replace> >> >> Timing: >> >> - Parsing: 0.87 ms >> >> - Compiling: 1.21 ms >> >> - Evaluating: 2.33 ms >> >> - Printing: 0.14 ms >> >> - Total Time: 4.55 ms >> >> When I now do collection('bm_test_iam')/BOT-L/Ontology the "Text" panel just >> >> contains: >> >> <Ontology/> >> >> where I expected it to contain the XML I just inserted. >> >> Mark Boon >> >> >> On Jan 20, 2011, at 11:13 AM, Mark Boon wrote: >> >> On Jan 20, 2011, at 11:09 AM, Christian Grün wrote: >> >> Mark, >> >> thanks for your mails. Just a short one.. Does the same error occur >> >> with the latest version of BaseX (6.5)? >> >> Christian >> >> Actually, I just picked up this work where I left it a few weeks ago. Some >> >> reorganization at work made me change e-mail so I hadn't followed this list >> >> either. So I missed that a new version came out. I'll try it immediately. >> >> I'll get back with the result. >> >> Mark >> >> _______________________________________________ >> >> BaseX-Talk mailing list >> >> BaseX-Talk at mailman.uni-konstanz.de >> >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> >> >> >>
CG
Christian Grün21 Jan 2011 16:18 #
Hi Mark,
Quoted text · Mark Boon · 1 line
> Thank you Christian, for all the prompt replies. It looks like I got it working using *:Ontology. I must say I never understood why namespaces must make things so complicated and counterintuitive.
True; this issue is frequently discussed in the W3C, and I guess that most users would have been glad if an easier approach had been taken to tackle namespaces.
Quoted text · Mark Boon · 1 line
> Another thing that has put me on the wrong track a couple of times is when I want to check with the BaseX UI tool some results that my program inserts into the database, only to get completely different results than I'd expect. It's as if there's interference between my running program and the BaseX UI tool.
It's important to know – and critical if you use BaseX in a productive environment – that the GUI and the BaseX standalone client are not notified if another BaseX instance modifies an opened database. Christian

⚡Generated with XQuery