>In some case, it's even not possible because the optimizer creates new expressions that have no counterpart in the original XQuery language
Do you mean they invoke internal BaseX functions? Also to help me understand what BaseX optimization involves: If these serializations are post optimization does mean they MAY embody assumptions about the context that are only valid at the moment they were made? Or could one expect to be able to deserialize them later and always get the same answers the original xquery would generate? /Andy On 6 November 2014 16:34, Christian Grün <christian.gr...@gmail.com> wrote: > To complement this: In a straightforward implementation, the following > query… > > declare function local:f() { 123 }; > inspect:serialize(map {}), > inspect:serialize(local:f#0), > inspect:serialize(substring#2), > inspect:serialize(function() {1}) > > …would yield the following result: > > map { } > function() as item()* { local:f() } > function($string_0 as xs:string?, $start_1 as xs:double) as > xs:string { fn:substring($string_0, $start_1) } > function() as xs:integer { 1 } >