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

NAME

Webservice::InterMine::Simple::Query

SYNOPSIS

  my $query = $service->new_query;

  $query->add_view("Organism.shortName", "Organism.taxonId");
  $query->add_constraint({path => "Organism.genus", op => "=", value => "Rattus"});

  @rows = $query2->results_table;
  for my $row (@rows) {
    print "name: $row->[0], id: $row->[1]\n";
  }

DESCRIPTION

This is a basic representation of a query. It can handle straight-forward requests and result sets, but for anything more complicated, we recommend you look as the more fully featured Webservice::InterMine. This is especially true of large data sets, as this implementation has the potential to use lots of memory when receiving and processing results.

METHODS

new - Construct a new query.

Create a new blank query.

new_from_xml - Construct a new query from xml

Read in an existing query from a string or a file.

Parameters:

  • source_file => $file_name

    The name of the file to read in.

  • source_string => $xml

    The xml that represents the query.

add_view($col1, $col2)

Add one or more output columns to the query. These must be fully qualified, legal path-strings. No validation will be performed.

add_constraint([ $href | %parameters])

Add a constraint to the query. The constraint may be represented either as a hash-reference, or as a list of parameters.

  $query->add_constraint(path => "Organism.species", op => "=", value => "melanogaster")

add_join([ $href | %parameters])

Add a join to the query. The join may be represented either as a hash-reference, or as a list of parameters.

  $query->add_join(path => "Gene.proteins", style => "OUTER")

set_logic($logic)

Set the constraint logic of the query. The logic must be represented as a legal logic string. No validation will be done.

set_sort_order(@list_of_elements)

Set the sort order for the query. The sort order should be composed of pairs of paths and directions:

  $query->set_sort_order("Organism.genus asc Organism.species desc");

as_xml - get the XML serialisation of the query

This is either the same value passed in to new_from_xml, or a very naïve XML serialisation. No thorough XML escaping will be performed.

results - get the results for this query as a single string.

Returns the string representation of the query's results.

Parameters:

  • as => $format

    Specifies the result format.

  • size => int

    Specifies the maximum number of rows to return. A query can return up to 10,000,000 rows in a single page.

  • start => int

    Specifies the index of the first result to return.

  • columnheaders => bool

    Whether or not you want the first row to be the names of the output columns.

results_table - get a list of rows (as array-references)

Performs very naïve parsing of returned tabular data and splits rows into array references based using a failure-prone "tab" split.

get_count - get the number of rows the query returns

Returns a number representing the total number of rows in the result set.

SEE ALSO

AUTHOR

Alex Kalderimis <dev@intermine.org>

BUGS

Please report any bugs or feature requests to dev@intermine.org.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Webservice::InterMine

You can also look for information at:

COPYRIGHT AND LICENSE

Copyright 2006 - 2011 FlyMine, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 191:

Non-ASCII character seen before =encoding in 'naïve'. Assuming UTF-8