RDF::Redland::QueryResults(3pm) User Contributed Perl Documentation RDF::Redland::QueryResults(3pm)NAME
RDF::Redland::QueryResults - Redland RDF Syntax Query Results Class
SYNOPSIS
use RDF::Redland;
...
my $query=new RDF::Redland::Query("query string", undef, undef, "sparql");
my $results=$model->query_execute($query);
# or my $results=$query->execute($model);
while(!$results->finished) {
for (my $i=0; $i < $results->bindings_count(); $i++) {
my $name=$results->binding_name($i);
my $value=$results->binding_value($i);
# ... do something with the results
}
$results->next_result;
}
The $results in the example is an object of class RDF::Redland::QueryResults.
DESCRIPTION
This class represents queries of various syntaxes over an RDF::Redland::Model returning a sequence of results that bind variable names to
RDF::Redland::Node values.
CONSTRUCTOR
There are no public constructors.
METHODS
count
Return the number of current results from the query.
finished
Return non-0 if the results have been exhausted.
binding_name INDEX
Get the name of variable binding INDEX in the array of variable names.
binding_names
Get the names all of the variable bindings as an array.
binding_value INDEX
Get the value of the variable binding INDEX in the current query result.
binding_values
Get the values of all of the variable bindings in the current query result.
binding_value_by_name NAME
Get the value of the variable binding NAME in the current query result.
bindings
Get the variable names and values of the current query result as a hash
bindings_count
Return the number of variable bindings.
next_result
Move to the next query result.
as_stream
Return a new RDF::Redland::Stream object representing the query results as an RDF Graph.
to_string [FORMAT-URI [BASE-URI]]
Serialize to a string syntax in format FORMAT-URI using the optional BASE-URI. The default format when none is given is determined by
librdf_query_results_to_string.
is_bindings
Return non-0 if the query results format is variable bindings
is_boolean
Return non-0 if the query results format is a boolean
is_graph
Return non-0 if the query results format is an RDF graph
get_boolean
Get the boolean query result; non-0 is true.
SEE ALSO
RDF::Redland::Query
AUTHOR
Dave Beckett - http://www.dajobe.org/
perl v5.14.2 2011-02-04 RDF::Redland::QueryResults(3pm)
Check Out this Related Man Page
RDF::Redland(3pm) User Contributed Perl Documentation RDF::Redland(3pm)NAME
RDF::Redland - Redland RDF Class
SYNOPSIS
use RDF::Redland;
my $storage=new RDF::Redland::Storage("hashes", "test", "new='yes',hash-type='memory'");
my $model=new RDF::Redland::Model($storage, "");
...
DESCRIPTION
This class initialises the Redland RDF classes.
See the main classes for full detail: RDF::Redland::Node, RDF::Redland::BlankNode, RDF::Redland::URINode, RDF::Redland::LiteralNode,
RDF::Redland::XMLLiteralNode, RDF::Redland::URI, RDF::Redland::Statement, RDF::Redland::Model, RDF::Redland::Storage, RDF::Redland::Parser,
RDF::Redland::Query, RDF::Redland::QueryResults, RDF::Redland::Iterator, RDF::Redland::Stream and RDF::Redland::RSS.
STATIC METHODS
set_log_handler SUB
Set SUB as the subroutine to be called on any Redland error, warning or log message. The subroutine must have the followign signature:
sub handler ($$$$$$$$$) {
my($code, $level, $facility, $message, $line, $column, $byte, $file, $uri)=@_;
# int error code
# int log level
# int facility causing the error (parsing, serializing, ...)
# string error message
# int line number (<0 if not relevant)
# int column number (<0 if not relevant)
# int byte number (<0 if not relevant)
# string file name or undef
# string URI or undef
# ...do something with the information ...
};
RDF::Redland::set_log_handler(&handler);
reset_log_handler
Reset redland to use the default logging handler, typically printing the message to stdout or stderr and exiting on a fatal error.
set_error_handler SUB
The method set_log_handler is much more flexible than this and includes this functionality.
Set SUB as the subroutine to be called on a Redland error with the error message as the single argument. For example:
RDF::Redland::set_error_handler(sub {
my $msg=shift;
# Do something with $msg
});
The default if this is not set, is to run die $msg
set_warning_handler SUB
The method set_log_handler is much more flexible than this and includes this functionality.
Set SUB as the subroutine to be called on a Redland warning with the warning message as the single argument. For example:
RDF::Redland::set_warning_handler(sub {
my $msg=shift;
# Do something with $msg
});
The default if this is not set, is to run warn $msg
SEE ALSO
RDF::Redland::Node, RDF::Redland::BlankNode, RDF::Redland::URINode, RDF::Redland::LiteralNode, RDF::Redland::XMLLiteralNode,
RDF::Redland::URI, RDF::Redland::Statement, RDF::Redland::Model, RDF::Redland::Storage, RDF::Redland::Parser, RDF::Redland::Query,
RDF::Redland::QueryResults, RDF::Redland::Iterator, RDF::Redland::Stream and RDF::Redland::RSS.
AUTHOR
Dave Beckett - http://www.dajobe.org/
perl v5.14.2 2012-03-11 RDF::Redland(3pm)