public static Query createQuery(long seqId) {

    Select select =
        new Select(
            new String[] {
              "*",
              "left/*",
              "left/category/*",
              "right/*",
              "right/category/*",
              "categoryLink/left/*",
              "categoryLink/right/*",
              "categoryLink/left/parent/*",
              "categoryLink/right/parent/*",
              "categoryLink/left/parent/parent/*",
              "categoryLink/right/parent/parent/*",
              "categoryLink/left/parent/parent/parent/*",
              "categoryLink/right/parent/parent/parent/*",
              "categoryLink/left/parent/parent/parent/parent/*",
              "categoryLink/right/parent/parent/parent/parent/*",
              "categoryLink/left/parent/parent/parent/parent/parent/*",
              "categoryLink/right/parent/parent/parent/parent/parent/*",
              "categoryLink/left/parent/parent/parent/parent/parent/parent/*",
              "categoryLink/right/parent/parent/parent/parent/parent/parent/*",
            });
    From from = new From(TaxonomyMap.TYPE_NAME_TAXONOMY_MAP, TaxonomyMap.NAMESPACE_URI);
    Where where = new Where();
    where.addExpression(Property.forName(TaxonomyMap.PROPERTY.seqId.name()).eq(seqId));
    return new Query(select, from, where);
  }
 public List<Variable> getVariables(Where where) {
   final List<Variable> list = new ArrayList<Variable>(1);
   QueryVisitor visitor =
       new DefaultQueryVisitor() {
         public void start(Variable var) {
           list.add(var);
         }
       };
   where.accept(visitor);
   return list;
 }