I don't have the energy to contemplate the subtleties of XPath semantics on a Saturday afternoon. But I can say that this is not a profiling artifact, since I wrote the MarkLogic profiler.
The code snippets you see in the profiler output are derived from the expression tree produced by the XQuery parser. The profiler doesn't modify that tree in any way, it's just hooked into the run-time evaluation of it. The "code" for each expression in the profiling report is a serialization of a node in the tree, not the original source text. Any rewriting or optimization done during static analysis (when the expression tree is built) will be reflected in the profiler report. So, either the XQuery parser/optimizer is choosing a simpler representation which it believes to be equivalent, or there may be a subtle bug in it. If you can produce a test case that shows different results for the compact vs verbose XPaths, I'm sure MarkLogic would love to see it. I'm going back to my weekend now. On Jan 7, 2012, at 1:19 PM, Geert Josten wrote: > Hi all, > > I was using the Query console to profile a simple piece of abbreviated > xpath, and my eye was caught by the way it was expanded in the profile > details. I ran this expression: > > //nr/text() > > (wrapped in a distinct-values actually, but that shouldn't really matter) > The profile stats however are talking about: > > collection()/descendant::nr/text() > > Anyone who followed the blog articles from Evan > (http://developer.marklogic.com/blog/xpath-punctuation-part-5 in > particular), should know it really stands for: > > collection()/descendant-or-self::node()/child::nr/text() > > That can be of significant difference when predicates are in play (applied > to nr). Is MarkLogic really interpreting //nr as /descendant::nr, or is > that just a glitch in the profiler output? I haven't taken time to come up > with some test case to check myself, yet.. > > Anyone care to comment? > > Kind regards, > Geert > > drs. G.P.H. (Geert) Josten > Senior Developer > > > > Dayon B.V. > Delftechpark 37b > 2628 XJ Delft > > T +31 (0)88 26 82 570 > > [email protected] > www.dayon.nl > > De informatie - verzonden in of met dit e-mailbericht - is afkomstig van > Dayon BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit > bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan > dit bericht kunnen geen rechten worden ontleend. > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general --- Ron Hitchens {mailto:[email protected]} Ronsoft Technologies +44 7879 358 212 (voice) http://www.ronsoft.com +1 707 924 3878 (fax) Bit Twiddling At Its Finest "No amount of belief establishes any fact." -Unknown _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
