Hello BaseX-Talk,

I am new to the boards and BaseX in general. I have been looking for a open source NoSQL database with expressive query abilities and I think BaseX fits the bill. Its been an exciting journey as I am new to the whole X platform aside from the angle brackets... As I think many are.

I am currently exploring the capabilities of RestXQ and the xml stack.  I especially like its potential coupled with knockout.js, and a truly flexible RESTful metadata/hypermedia driven api. I have implemented an api of this nature in .Net however the metadata and querying capabilities are hindered and unnecessarily complex where I feel xml and XQuery make this dynamic orchestration quite gracefully. 

Unfortunately I am stuck now that I am exploring referential relationships and xml. I am trying to understand the support BaseX and XML in general has for referential nodes especially when dealing with queries. For example 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">
      <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 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?  Also what about XLink?

Any help would be greatly appreciated. 
Thanks again for your time.
- James