Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

Bio::DB::SQL::QueryConstraint
a constraint on a variable value in a query

Bio::DB::SQL::QueryConstraint - a constraint on a variable value in a query


NAME

Bio::DB::SQL::QueryConstraint - a constraint on a variable value in a query


SYNOPSIS


  # create a constraint that says "species not like drosophila*"

  my $qc = 

    Bio::DB::SQL::QueryConstraint->new(-name=>"species",

                                       -op=>"like",

                                       -value=>"drosophila*",

                                       -neg=>1);

  # alternate way of writing same thing

  my $qc = 

    Bio::DB::SQL::QueryConstraint->new("species like drosophila*");

  $qc->neg(1);

  # use lisp-style operand-first way of specifying composites

  # species taxa id is 7227 or 7228

  my $qc = 

    Bio::DB::SQL::QueryConstraint->new("or", 

                                       "species=7227", 

                                       "species=7228",

                                       "species=7229");

  # composite queries can also be built this way:

  my $qc = 

    Bio::DB::SQL::QueryConstraint->new(-op=>"or", 

                                       value=>[$subqc1, $subqc2, $subqc3]);

  $qc->is_composite(1);

  # we can have nested constraints like this:

  my $qc = 

    Bio::DB::SQL::QueryConstraint->new("or", 

                                       ["and", 

                                              "species=Human", 

                                              "keywords=foo*"

                                       ],

                                       ["and", 

                                              "species=Drosophila virilis", 

                                              "keywords=bar*"

                                        ]);


DESCRIPTION

represents the constraints in a query; either the whole constraints or a part of; see the composite design patern.

the qc is a leaf node (eg Col=Val) or a composite node (eg (AND cons1, cons2, cons3, ....)

composite nodes have name=composite

should we split this into two classes ala composite design pattern? cramming both into one works for now.


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 _

name


  Usage:  $qc->name($val);      # setting

      OR   return $qc->name();  # getting

the name of the variable being constrained

value


  Usage:  $qc->value($val);      # setting

      OR   return $qc->value();  # getting

the value of the variable is allowed to take mediated by the operand

this is an arrayref of sub-constraints if this a composite

operand


  Usage:  $qc->operand($val);      # setting

      OR   return $qc->operand();  # getting

defaults to ``=''

neg


  Usage:  $qc->neg($val);      # setting

       OR   return $qc->neg();  # getting

boolean

set if the constraint is to be negated

is_composite


  Usage:  $qc->is_composite($val);       # setting

       OR   return $qc->is_composite();  # getting

boolean

set if the constraint is a composite constraint

(in this case the sub constraints go in $qc->values)

Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy