The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Bio::DB::Query::AbstractQuery - Abstract Query class

SYNOPSIS

  # Don\'t use this class directly; use one of the subclasses (eg
  # SqlQuery, BioQuery)

  $q = $queryclass->new;
  $q->datacollections(["table1 t1", "table2 t2"]);
  $q->selectelts(["t1.colA", "t2.colB"]);
  $q->where("or", "colA=x", "colB=y");
  $q->orderelts(["t1.colA", "t2.colB"]);

DESCRIPTION

Core methods for representing some kind of query - eg a query expressed in an human type language, an SQL query, an object oriented query.

Abstracted attribute names have been used; eg a query is assumed to be over some kind of collection of data. the query is performed over a subset of this data, a set of datacollections. These datacollections are equivalent to tables in SQL and object adaptors when forming an OO query.

The where clause / constraints is represented by the QueryConstraint composite object

CONTACT

Chris Mungall, cmungall@fruitfly.org

APPENDIX

The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _

datacollections

  Usage:  $query->datacollections([$t1,$t2]);      # setting
      OR   return $query->datacollections();  # getting

array reference of strings representing datacollections (eg tables, objects)

add_datacollection

  Usage:  $query->add_datacollection($t1, $t2, $t3);

adds datacollections; removes duplicates

where

  Usage:  $query->where("and", "att1 = val1", "att2=val2"); # setting
      OR  $query->where("att1 = val1"); # setting
      OR  $query->where({att1=>$val1, att2=>$val2}); # setting
      OR  $query->where(["OR",
                              ["AND",
                                     "x=1", "y=2", "z like blah*"],
                              ["AND",
                                     "x=5", "y=7", "z like wow*"]]);

      OR   $qc = $query->where();  # getting

 of type Bio::DB::Query::QueryConstraint

this method is liberal in what it accepts.

see the new() method of Bio::DB::Query::QueryConstraint

it will turn hashes into an ANDed query constraint composite, with each component being a name=value pair. it will turn arrays into an ANDed constraint composite, breaking up each element around the = symbol. if the first element of the array is a valid composite operand (e.g. "or") it will combine the array elements using this.

Or you can just feed it a Bio::DB::Query::QueryConstraint object

selectelts

  Usage:  $query->selectelts([$col1,$col2,$col3]);      # setting
      OR  $eltsref = $query->selectelts();  # getting

array reference of string represnting attributes/elements to be selected

orderelts

  Usage:  $query->orderelts(\@elts);      # setting
      OR   return $query->orderelts();  # getting

groupelts

  Usage:  $query->groupelts(\@elts);      # setting
      OR   return $query->groupelts();  # getting

querytype

  Usage:  $query->querytype($val);      # setting
      OR   return $query->querytype();  # getting

one of : select, select distinct, insert, update, delete

ignored for now...