On Tue, 2022-04-19 at 12:42 -0400, Jonathan Robie wrote:
Here's one thing you may be asking - do you want to know how to specify a join for n sources?
I think the question was, what if n is large or dynamic.
But then we fall back to needing a use case because the best strategy depends on circumstance and people.
XQuery and XSLT are much more dynamic language than SQL, in the way they feel. You're not really doing a SQL-style join so much as programming with relationships, which is more like working with an ER diagram i suppose, but at a micro level. Yes, the underlying XQuery engine is doing things like joins and making tuple-streams, and that's pretty fundamental, but it's implicit and pervasive.
let $me := $here/@id return /doc/people/person[@postcode = $id]
might be thought of as doing a join on the id attribute of person elements even though it's not in a FLWOR expression.
So part of moving to XQuery (as with XSLT) is a change in the way we think of data and how we think of processing data. And i think think that's the hardest part for many people. It can start as simply as understanding why "for" in XQuery (and "for-each" in XSLT) isn't a loop. There might be some mileage in a document, "XQuery for SQL programmers" :)
liam