Как открыть базу данных BaseX из контекста в FLOWR для XQuery? - PullRequest
0 голосов
/ 19 октября 2019

Как установить контекст в качестве конкретной базы данных, а затем ссылаться на эту базу данных в FLOWR?

PS C:\Users\thufir\Desktop\basex>
PS C:\Users\thufir\Desktop\basex>
PS C:\Users\thufir\Desktop\basex> basex .\openDB.xq
<book category="web">
  <title lang="en">XQuery Kick Start</title>
  <author>James McGovern</author>
  <author>Per Bothner</author>
  <author>Kurt Cagle</author>
  <author>James Linn</author>
  <author>Vaidyanathan Nagarajan</author>
  <year>2003</year>
  <price>49.99</price>
</book>
PS C:\Users\thufir\Desktop\basex>
PS C:\Users\thufir\Desktop\basex> type .\openDB.xq
let $db := db:open("books")
for $item in $db
return $item/bookstore/book[3]
PS C:\Users\thufir\Desktop\basex>
PS C:\Users\thufir\Desktop\basex> basex db.xq
Stopped at C:/Users/thufir/Desktop/basex/db.xq, 1/21:
[XPST0003] Expecting ':=', found 's'.
PS C:\Users\thufir\Desktop\basex>
PS C:\Users\thufir\Desktop\basex> type .\db.xq
declare context items := db:open("books")

for $ctx in .

return $ctx

PS C:\Users\thufir\Desktop\basex>
PS C:\Users\thufir\Desktop\basex>

см. Также:

как вернуть третью книгу изэтот книжный магазин, использующий FLOWR в XQuery?

Я хотел бы указать базу данных примерно так:

как указать базу данных BaseX из запроса FLOWR xquery?

, но явно в контексте самого XQuery.

...