Bio::DB::Query::QueryConstraint - a constraint on a variable value in a query
# create a constraint that says "species not like drosophila*" my $qc = Bio::DB::Query::QueryConstraint->new(-name=>"species", -op=>"like", -value=>"drosophila*", -neg=>1); # alternate way of writing same thing my $qc = Bio::DB::Query::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::Query::QueryConstraint->new( [ "or", "species=7227", "species=7228", "species=7229" ] ); # composite queries can also be built this way: my $qc = Bio::DB::Query::QueryConstraint->new(-op=>"or", value=>[$subqc1, $subqc2, $subqc3]); $qc->is_composite(1); # we can have nested constraints like this: my $qc = Bio::DB::Query::QueryConstraint->new( [ "or", [ "and", "species=Human", "keywords=foo*" ], [ "and", "species=Drosophila virilis", "keywords=bar*" ] ] );
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.
Chris Mungall, cmungall@fruitfly.org
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
Usage: $qc->name($val); # setting OR return $qc->name(); # getting
the name of the variable being constrained
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
Usage: $qc->operand($val); # setting OR return $qc->operand(); # getting
defaults to "="
Usage: $qc->neg($val); # setting OR return $qc->neg(); # getting
boolean
set if the constraint is to be negated
Usage: $qc->is_composite($val); # setting OR return $qc->is_composite(); # getting Returns: boolean
et if the constraint is a composite constraint (in this case the sub constraints go in $qc->values)
To install Bio::BioEntry, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bio::BioEntry
CPAN shell
perl -MCPAN -e shell install Bio::BioEntry
For more information on module installation, please visit the detailed CPAN module installation guide.