NAME

RDF::Sesame::TableResult - Results from a select query

DESCRIPTION

The RDF::Sesame::Repository::select method returns a TableResult object after completing a successful query. This object is a subclass of Data::Table so many table manipulation methods are available. Additional methods specific to RDF::Sesame::TableResult are documented below.

The values returned by a query are represented in N-Triples syntax. NULL values are represented with undef.

METHODS

has_rows( )

Returns a true value if the table result has any rows, otherwise it returns a false value. This method is a small wrapper around Data::Table::nofRow to provide some syntactic sugar.

sort( )

This method overrides the method provided by Data::Table. The method performs the same, but it allows for more pleasing parameter values. For $type, one may pass the strings 'numeric' and 'non-numeric' instead of 0 and 1 respectively. For $order, one may pass 'asc' and 'desc' instead of 0 and 1 respectively. The name parameters are case sensitive.

For further documentation, see Data::Table.

each( )

A method for iterating through the result rows, similar in spirit to Perl's built-in each() function for hashes. Returns a list consisting of the values for the next row. When all rows have been read, an empty list is returned. The next call to each() after that will start iterating again.

If you want to restart the iteration before reaching the end, see reset() which is documented below. Here is an example:

my $r = $repo->select($serql);
while( my @row = $r->each ) {
   print join("\t", @row), "\n";
}

reset( )

Reset the counter used by each() for iterating through the results. Following a call to reset() the next call to each() will return the values from the first row of results.

AUTHOR

Michael Hendricks <michael@palmcluster.org>