We consider the polynomial time learnability of finite unions of ordered tree patterns with internal structured variables, in the query learning model of Angluin (1988). An ordered tree pattern with internal structured variables, called a term tree, is a rooted tree pattern which consists of tree structures with ordered children and internal structured variables. A term tree is suited for representing structural features in semistructured or tree structured data such as HTML/XML files. The language L(t) of a term tree t is the set of all trees which are obtained from t by substituting arbitrary trees for all variables in t. Moreover, for a finite set H of term trees, L(H) = tH L(t). Let H, which is a target of learning, be a finite set of term trees. An oracle for restricted subset queries answers "yes" for an input set H if L(H) L(H), and answers "no", otherwise. An oracle for equivalence queries returns "yes" for an input set H if L(H) = L(H), and retur...