[redland] Re: Perl method Stream->end is corrupt

Dave Beckett dave.beckett at bristol.ac.uk
Tue Dec 19 14:39:57 GMT 2000


>>>smeinert at uos.de said:
> It returns a defined, but empty Stream and $stream->end crashes.
> 
> An Example:
> 
> $stream=$self->{graph}->{model}->find_statements($arc->{statement});
>   while (!$stream->end) {
>     	$next=$stream->next;
>   }
> 
> if there is no matching statement $stream is defined, but $stream->end
> crashes.
> Stefan

Stefan, I tried to create a test that would demonstrate it - included
below - but it works fine for me.  Can you please try this and tell
me if it corresponds to your problem or if it crashes for you.  If it
does crash, it must be something I fixed post 0.9.6

Run it in the perl directory of the redland installation with:

   perl -Iblib/arch -Iblib/lib script.pl

Dave

----------------------------------------------------------------------
#!/usr/bin/perl -w

use RDF;

# Create the model storage object
my $storage = RDF::Storage->new(
        "hashes",                               # storage factory name
        "test",                                 # my storage name
        "hash-type='memory'",                   # options string
);

# Create the model
my $model = RDF::Model->new($storage, undef);

# Create a statement
my $statement = RDF::Statement->new_from_nodes(RDF::Node->new_from_uri_string("http://subject-site.com/"), 
                                               RDF::Node->new_from_uri_string("http://predicate.com/"),
                                               RDF::Node->new_from_literal("object string",undef,0,0));

# Add this statement to our model
$model->add_statement($statement);

# Statement is zapped when put into model
$statement=undef;


# Create a new statement to query with (that will fail)
$statement=RDF::Statement->new_from_nodes(RDF::Node->new_from_uri_string("http://does-not-exist.com/"),
					  undef, undef);

my $stream=$model->find_statements($statement);
my $count=0;
while (!$stream->end) {
  my $next=$stream->next;
  $count++;

}
warn "Statements matched: $count\n";








More information about the redland-dev mailing list