[redland-dev] Perl Redland::Query returns strange results

René Puls kianga at gmail.com
Fri Aug 13 12:32:49 BST 2004


(Sorry, I sent this reply directly to Dave, but it should have gone to
the list instead...)

On Fri, 13 Aug 2004 10:33:17 +0100, Dave Beckett
<dave.beckett at bristol.ac.uk> wrote:
> On Fri, 13 Aug 2004 05:02:30 +0200, René Puls <kianga at gmail.com> wrote:
>
> ....
>
> >
> > (How can the bindings count be 2 when I have only one variable in the query?)
>
> Mea culpa.
>
> The example code in the documentation for the Query class in perl is
> wrong (it is correct in the QueryResults example).
>
> What I had:
>         for (my $i=0; $i < $results->count(); $i++) {
> correct:
>         for (my $i=0; $i < $results->bindings_count(); $i++) {

Ah, thanks! It seems to work correctly now.

Sometimes I spend hours and hours trying to figure out what is wrong
when a quick look at the right documentation page would be enough. But
I only looked at the Query class, not QueryResults...

By the way, the following seems to work:

$results = $model->query_execute($query);

... but this doesn't work, even though it's in the documentation:

$results = $query->execute($model);

When I do the latter, Perl prints out some scary looking error messages:

Use of inherited AUTOLOAD for non-method
RDF::Redland::CORE::librdf_query_run_as_bindings() is deprecated at
/usr/local/libdata/perl5/site_perl/i386-openbsd/RDF/Redland/Query.pm
line 120.
Can't locate auto/RDF/Redland/CORE/librdf_quer.al in @INC (@INC
contains: /usr/libdata/perl5/i386-openbsd/5.8.2
/usr/local/libdata/perl5/i386-openbsd/5.8.2 /usr/libdata/perl5
/usr/local/libdata/perl5
/usr/local/libdata/perl5/site_perl/i386-openbsd
/usr/libdata/perl5/site_perl/i386-openbsd
/usr/local/libdata/perl5/site_perl /usr/libdata/perl5/site_perl
/usr/local/lib/perl5/site_perl .) at
/usr/local/libdata/perl5/site_perl/i386-openbsd/RDF/Redland/Query.pm
line 120

Ignoring the fact that the second call doesn't currently work, is
there a semantic difference between the two calls?

> If you are a Perl-head, you are probably thinking QueryResults could
> be made into a perl tied array and then all you'd need were
>  while(my $result=$query->execute)
> but there are issues with only allowing forward movment in the array,
> and it should also be used with redland streams and iterators.  I'm
> not currently working on this.

Don't worry, I don't consider myself a Perl-head. I am on "live and
let live" terms with Perl; I use it because it gets the job done, but
I usually prefer languages like Python or Obj-C. :-)

Anyway, thank you for your help!

Kind regards,
René Puls



More information about the redland-dev mailing list