+let table_query_tree = Hashtbl.create 97
+
+
+let rec compare_query_tree q1 q2 =
+ q1.id==q2.id|| match q1.desc,q2.desc with
+ | Binop(op1,qt1,qt2),Binop(op2,qt3,qt4)->op1==op2&& ((compare_query_tree qt1 qt3 && compare_query_tree qt2 qt4)
+ || (compare_query_tree qt1 qt4 && compare_query_tree qt2 qt3))
+ | Axis(a1,qt1),Axis(a2,qt2) -> compare_axis a1 a2 && compare_query_tree qt1 qt2
+ | Tag(t1,k1),Tag(t2,k2) ->t1==t2&& k1==k2
+ | Dom,Dom | Start,Start ->true
+ | _,_ ->false
+
+and compare_axis a1 a2 =
+ match a1,a2 with
+ Self ,Self | Attribute, Attribute | Child , Child | Parent , Parent
+ | FollowingSibling , FollowingSibling
+ | PrecedingSibling , PrecedingSibling
+ | Preceding , Preceding | Following , Following -> true
+ | Descendant b1, Descendant b2 -> b1==b2
+ | Ancestor b1, Ancestor b2 -> b1==b2
+ | _,_ -> false
+