Liam, I think that answers my question and is what I expected. So basically BaseX and maybe XQuery as a whole does not respect or understand the id/idref concept formally and thus will not automatically join. This isn't a 'problem' so much as an attempt to insure I do not reproduce what already exists. Does this sound correct? For example if I had a node named item with 2 child nodes simply referencing another childitem node by ID but not inline. with item as the context node. If I wrote: childitem I would expect the nodes being referenced not the inline nodes with the references on them. But this is not how it works.. Right? I need to handle the relationship explicitly. - James
> Subject: Re: [basex-talk] Question regarding BaseX support for id and idref > From: [email protected] > To: [email protected] > CC: [email protected] > Date: Mon, 13 May 2013 21:36:34 -0400 > > On Mon, 2013-05-13 at 19:15 -0600, James Wright wrote: > > [...] I know the xml standard defines id and idref however I have not > > been able to find any documentation on these in BaseX or XML in > > general. For example does BaseX handle idiosyncrasies of id and idref > > or must I handle these in my queries? For example: > > let $context := <item id="10"> > > Note that an XML ID must be an identifier, so must start with a name > start character (a letter)... > > > let $context := <item id="10"> > > <child idref="2" /><item><item id="20"> <child idref="2" /> > > <child idref="1" /></item><item id="30" /> > > <child id="1" name="firstChild" /><child id="2" name="secondChild" /> > > for $itemWithFirstChild in $context/item[child/@name = 'firstChild']return > > $itemWithFirstChild/@id > > I think this got garbled somewhere - e.g. there aren't enough end tags. > Make sure you turn off HTML formatting in your email program. > > > I would like this to return "10 20"Now this example uses a dynamic > > context node however in the application these would exist as nodes in > > the database... > > If it does fully support this how do I enable it or get it to work? > > One way to get started with BaseX would be to use the "basexgui" program > in the bin directory to create a database (there's also a command-line > program to do it; I use the Perl and PHP APIs too on > www.fromoldbooks.org). > > People usually do joins by value in XML and XQuery; ID/IDREF only work > with older DTD technology, or with xml:id; I don't know if BaseX has > support for them. But if it does the values must be IDs :) > > So you're on the right lines. > > > Also what about XLink? > > It's not used very much. As a standard it solved the wrong problems, > unfortunately. Easy for me to say in hindsight. > > The XQuery Use Cases on www.w3.org/TR may be helpful; there's also a > chapter on XQuery using BaseX for examples in a book I co-authored last > year, "Beginning XML" 5th edition. > > Liam > > -- > Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ > Pictures from old books: http://fromoldbooks.org/ > Ankh: irc.sorcery.net irc.gnome.org freenode/#xml >
_______________________________________________ BaseX-Talk mailing list [email protected] https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk

