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

Dave Beckett dave.beckett at bristol.ac.uk
Fri Aug 13 14:06:02 BST 2004


(forwarding my reply to list also)

On Fri, 13 Aug 2004 13:29:00 +0200, René Puls <kianga at gmail.com> wrote:

...

> Ah, thanks! It seems to work correctly now.

no problem

> 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?

No, they are identical.  They are just equivalent convienence calls

The second one is broken in the perl binding, I've fixed it.

in Query.pm:
old:
  return &RDF::Redland::CORE::librdf_query_run_as_bindings($self->{QUERY},$model->{MODEL});
new:
  my $results = &RDF::Redland::CORE::librdf_query_execute($self->{QUERY},$model->{MODEL});
  return $results ? RDF::Redland::QueryResults->new($results) : undef;


> > 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. :-)

It was mostly as an aside, in case anyone else was wondering too.

> Anyway, thank you for your help!

Cheers

Dave



More information about the redland-dev mailing list