Re: [basex-talk] db:open(), xquery:eval(), and path()

2013-11-17 Thread Christian Grün
> Ah, I see. It just felt too PHPish to synthesize the whole query as a > string, therefore I thought I might use xquery:eval() ad libitum in the > middle of a query and that it would operate on the same database as the > static remainder of the query. …completely true. When thinking of our own pr

Re: [basex-talk] db:open(), xquery:eval(), and path()

2013-11-17 Thread Imsieke, Gerrit, le-tex
Ah, I see. It just felt too PHPish to synthesize the whole query as a string, therefore I thought I might use xquery:eval() ad libitum in the middle of a query and that it would operate on the same database as the static remainder of the query. And of course it is harder to debug if the whole

Re: [basex-talk] db:open(), xquery:eval(), and path()

2013-11-17 Thread Christian Grün
> for $doc in db:open('doc', 'doc.xml')/* > let $nodes as element(*)* := xquery:eval("$doc//*", map{"doc":=$doc}) > return > for $node in $nodes > return I tried to rewrite you query into sth. that may be of help for you… for $doc in db:open('doc', 'doc.xml')/* let $query := '$doc//* ! '

Re: [basex-talk] db:open(), xquery:eval(), and path()

2013-11-17 Thread Christian Grün
Hi Gerrit, > db:node-id(xquery:eval("db:open('doc', 'doc.xml')/*")) > => 0 some quick feedback (I'll further look into this): when running xquery:eval, a main-memory copy of the original node is created, which may have another node id than the original node. To get the node id of the original nod

Re: [basex-talk] db:open(), xquery:eval(), and path()

2013-11-16 Thread Imsieke, Gerrit, le-tex
Probably related: db:node-id(xquery:eval("db:open('doc', 'doc.xml')/*")) ⇒ 0 db:node-id(db:open('doc', 'doc.xml')/*) ⇒ 1 On 16.11.2013 23:57, Imsieke, Gerrit, le-tex wrote: I think that under certain conditions, the path() function does not return the proper paths. Here’s an example that wo

[basex-talk] db:open(), xquery:eval(), and path()

2013-11-16 Thread Imsieke, Gerrit, le-tex
I think that under certain conditions, the path() function does not return the proper paths. Here’s an example that works ok: for $doc in let $nodes as element(*)* := xquery:eval("$doc//*", map{"doc":=$doc}) return for $node in $nodes return ⇒ http://www.w3.org/2005/xpath-functions}root(