implemented QueryObj to Tree