Hi Adam, This may sound stupid, but: have you considered that (and would it be relevant to you that) the second expression may raise errors that the first one wouldn't have raised, rather than returning a subset?
Consider the case where b has a numeric type, and the attribute a cannot be cast to double? Kind regards, Ghislain On Thu, Jan 28, 2016 at 2:17 PM, Pavel Velikhov <[email protected]> wrote: > No, the first line in the base case should also return false, sorry > > > > > > > So suppose you have 2 path expressions, p1 and p2, and you allow only /x > or //x as path steps > > and each path step can have a predicate: > > > > p1 = axis_1 pred_1, …, axis_n pred_n > > p2 = axis_1 pred_1, … , axis_m pred_m > > > > subsumes(p1, p2): > > /* recursion base case */ > > if p1 is empty: return true > > if p2 is empty: return false > > > > a_1 = first axis of p1 > > a_2 = first axis of p2 > > > > if a_1 is a child axis ‘/‘ label l : > > if a_2 is a child axis ‘/' with the same label l, and the predicates > are equivalent: > > return subsumes(p1 - a_1, p2 - a_2) > > else: > > return false > > > > if a_1 is a descendants axis ‘//‘ with label l: > > if p2 contains an axis with label l: > > p2’ = remove all axes of p2 from the head, until you find an axis > with label l > > p2’ = remove the axis with label l from p2' > > return subsumes( p_1 - a_1, p2’ ) > > > > return false > > > _______________________________________________ > [email protected] > http://x-query.com/mailman/listinfo/talk
_______________________________________________ [email protected] http://x-query.com/mailman/listinfo/talk
