Thank you for your answer! But this solution does not work with one-to-many relationships. When I run the following script: let $i := <root>
<a id = "a1" idref = "b1"> aaa1</a> <a id = "a2" idef = "b1">aaa2</a> <a id = "a3" idef= "b2"> aaa3</a> <a id = "a11" idref = "b2"> aaa11</a> <b id = "b1" idref = "a1 a2">bb1</b> <b id = "b2" idref = "a3 a11">bb2</b> </root> return $i/*[matches(@idref, 'a1')] BaseX produces the result:
<b id="b1" idref="a1 a2">bb1</b> <b id="b2" idref="a3 a11">bb2</b> that is different from: <b id="b1" idref="a1 a2">bb1</b> Besides, my question is about the function idref()? Is it supported? I find some examples here: http://www.xqueryfunctions.com/xq/fn_idref.html I have defined DTD, schema, but the result is the same. BaseX requires the name of the attribute-identifier to contain “id” and the name of the attribute with references to contain ‘idref’. But the function idref() returns result only if the relationship is one-to-one. I would be grateful if you tell me how to apply the function idref() when the relationship is one-to-many. Best regards, Tsvetanka
Hi Tsvetanka,
BaseX produces the result:
<b id="b1" idref="a1 a2">bb1</b> <b id="b2" idref="a3 a11">bb2</b> that is different from: <b id="b1" idref="a1 a2">bb1</b>
The following line of code will give you the expected results (but it may not be efficient enough for large documents):
return $xml/*[tokenize(@idref, '\s') = 'a1']
Besides, my question is about the function idref()? Is it supported?
As BaseX works without schema support, id() and idref() also return results for XML documents that have no schema attached.
BaseX requires the name of the attribute-identifier to contain "id" and the name of the attribute with references to contain 'idref'. But the function idref() returns result only if the relationship is one-to-one.
True. I will have a closer look at this. Let's see what we can do!
Thanks for your observation, Christian
Hi Tsvetanka,
the latest stable snapshot should resolve the idref issues that you encountered [1].
Your feedback is welcome, Christian
[1] http://files.basex.org/releases/latest/
On Mon, Feb 3, 2014 at 8:17 AM, Tsvetanka Georgieva-Trifonova cvetygeorg@yahoo.com wrote:
Thank you for your answer! But this solution does not work with one-to-many relationships. When I run the following script: let $i := <root> <a id = "a1" idref = "b1"> aaa1</a> <a id = "a2" idef = "b1">aaa2</a> <a id = "a3" idef= "b2"> aaa3</a> <a id = "a11" idref = "b2"> aaa11</a> <b id = "b1" idref = "a1 a2">bb1</b> <b id = "b2" idref = "a3 a11">bb2</b>
</root> return $i/*[matches(@idref, 'a1')]
BaseX produces the result:
<b id="b1" idref="a1 a2">bb1</b> <b id="b2" idref="a3 a11">bb2</b> that is different from: <b id="b1" idref="a1 a2">bb1</b>
Besides, my question is about the function idref()? Is it supported? I find some examples here: http://www.xqueryfunctions.com/xq/fn_idref.html I have defined DTD, schema, but the result is the same. BaseX requires the name of the attribute-identifier to contain "id" and the name of the attribute with references to contain 'idref'. But the function idref() returns result only if the relationship is one-to-one. I would be grateful if you tell me how to apply the function idref() when the relationship is one-to-many. Best regards, Tsvetanka
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Hi Christian, Yes, now the function idref() works properly.
Thank you very much! Tsvetanka
On Monday, February 3, 2014 4:10 PM, Christian Grün christian.gruen@gmail.com wrote:
Hi Tsvetanka,
the latest stable snapshot should resolve the idref issues that you encountered [1].
Your feedback is welcome, Christian
[1] http://files.basex.org/releases/latest/
On Mon, Feb 3, 2014 at 8:17 AM, Tsvetanka Georgieva-Trifonova cvetygeorg@yahoo.com wrote:
Thank you for your answer! But this solution does not work with one-to-many relationships. When I run the following script: let $i := <root> <a id = "a1" idref = "b1"> aaa1</a> <a id = "a2" idef = "b1">aaa2</a> <a id = "a3" idef= "b2"> aaa3</a> <a id = "a11" idref = "b2"> aaa11</a> <b id = "b1" idref = "a1 a2">bb1</b> <b id = "b2" idref = "a3 a11">bb2</b>
</root> return $i/*[matches(@idref, 'a1')]
BaseX produces the result:
<b id="b1" idref="a1 a2">bb1</b> <b id="b2" idref="a3 a11">bb2</b> that is different from: <b id="b1" idref="a1 a2">bb1</b>
Besides, my question is about the function idref()? Is it supported? I find some examples here: http://www.xqueryfunctions.com/xq/fn_idref.html I have defined DTD, schema, but the result is the same. BaseX requires the name of the attribute-identifier to contain "id" and the name of the attribute with references to contain 'idref'. But the function idref() returns result only if the relationship is one-to-one. I would be grateful if you tell me how to apply the function idref() when the relationship is one-to-many. Best regards, Tsvetanka
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
basex-talk@mailman.uni-konstanz.de