[Mulgara-general] empty results from SPARQL queries

Mark Stubbeman MStubbeman at algebraixdata.com
Fri Feb 3 15:21:01 UTC 2012


I'm new to SPARQL and to triple-store technology in general.  I have a couple of example DBs - Mulgara being one of them - against which I am trying to write some simple Perl code to submit queries and extract responses.  The following works against one of my DB's but not against Mulgara:

sub runQuery
{
  use RDF::Query::Client;

# $webURL scrubbed of actual hostname but otherwise true to my actual code
  my $webURL = "http://$somehostname:8080/sparql";

# an array of lines read from a file containing a SPARQL query
  my @queryIn = @_;
  my $funcQuery = join('', @queryIn);

  print "Query\n-----\n\n$funcQuery\n";
  my $query = RDF::Query::Client->new($funcQuery);
  my $iterator = $query->execute($webURL);
  print "Response\n------\n\n";
  print Dumper($iterator);
  while (my $row = $iterator->next)
  {
    print "$row\n";
  }
}

With $webURL directed at another DB we get the following:

Executing: C:\sandboxes\cdbms\Hawk\Tests\SP2Bench\queries\q1.sparql

Query
-----

SELECT DISTINCT ?s WHERE { ?s ?p ?o . }
Response
------

$VAR1 = bless( {
                 '_peek' => [],
                 '_row' => undef,
                 '_count' => 0,
                 '_type' => 'bindings',
                 '_finished' => 0,
                 '_names' => [],
                 '_args' => {},
                 'sorted_by' => [],
                 '_stream' => sub { "DUMMY" },
                 '_open' => 0
               }, 'RDF::Trine::Iterator::Bindings' );
{ s=<http://localhost/publications/articles/Journal1/1944/Article4> }

(note that the output has been truncated to just one line).  However, with $webURL set to our Mulgara installation the same code generates the following:

Query
-----

SELECT DISTINCT ?s WHERE { ?s ?p ?o . }
Response
------

$VAR1 = bless( {
                 '_peek' => [],
                 '_row' => undef,
                 '_count' => 0,
                 '_type' => 'bindings',
                 '_finished' => 0,
                 '_names' => [
                               's'
                             ],
                 '_args' => {},
                 'sorted_by' => [],
                 '_stream' => sub { "DUMMY" },
                 '_open' => 0
               }, 'RDF::Trine::Iterator::Bindings' );

We get back an iterator (with slightly different properties) but no results.  I know via the Mulgara webui that the data is there.  That's how I load the data.  I'm not sure what to use for Graph URI (several settings seem to work) but for the above exercise I used "<hostname>:8080/sparql" where <hostname> is the same as $somehostname from the sample code.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mulgara.org/pipermail/mulgara-general/attachments/20120203/d45d752e/attachment.html>


More information about the Mulgara-general mailing list