[Mulgara-general] empty results from SPARQL queries

Mark Stubbeman MStubbeman at algebraixdata.com
Fri Feb 3 20:11:00 UTC 2012


Got it - here are go.

GET /sparql?query=SELECT%20DISTINCT%20%3Fs%20WHERE%20%7B%20%3Fs%20%3Fp%20%3Fo%20.%20%7D HTTP/1.1
TE: deflate,gzip;q=0.3
Connection: TE, close
Accept: application/sparql-results+json, application/sparql-results+xml;q=0.9, application/rdf+xml, application/x-turtle, text/turtle
Host: goldfish:8080
User-Agent: RDF::Query::Client/0.107 (cpan:TOBYINK) libwww-perl/6.02
Content-Type: application/x-www-form-urlencoded


-----Original Message-----
From: mulgara-general-bounces at mulgara.org [mailto:mulgara-general-bounces at mulgara.org] On Behalf Of Paul Gearon
Sent: Friday, February 03, 2012 1:32 PM
To: Mulgara General
Subject: Re: [Mulgara-general] empty results from SPARQL queries

I was actually referring to the HTTP exchange. (It's reasonably easy.
One way is to run "nc -l 8080" and then point your webURL to
http://localhost:8080/sparql)

I haven't used Perl in a few years, so I don't recall how to get modules from CPAN. When I get the time (I'm at work) I'll get the RDF stuff that you're using and try it myself.

Paul

On Fri, Feb 3, 2012 at 1:04 PM, Mark Stubbeman <MStubbeman at algebraixdata.com> wrote:
> Here's the Dumper() print of the query before I execute it:
>
> $VAR1 = bless( {
>                 'query' => 'SELECT DISTINCT ?s WHERE { ?s ?p ?o . }',
>                 'error' => undef,
>                 'useragent' => undef,
>                 'results' => []
>               }, 'RDF::Query::Client' );
>
> I get the feeling I may be relying upon defaults which work with one DB but not the other.  Since I'm new to this I'm not able to pick it out though.
>
> Thanks,
> Mark
>
> -----Original Message-----
> From: mulgara-general-bounces at mulgara.org 
> [mailto:mulgara-general-bounces at mulgara.org] On Behalf Of Paul Gearon
> Sent: Friday, February 03, 2012 10:11 AM
> To: Mulgara General
> Subject: Re: [Mulgara-general] empty results from SPARQL queries
>
> Mulgara usually works fine with HTTP, so I'm not sure.
>
> Would you be able to get a copy of the HTTP request for this please?
> That may contain a clue.
>
> Thanks in advance.
>
> Paul
>
> On Fri, Feb 3, 2012 at 10:21 AM, Mark Stubbeman <MStubbeman at algebraixdata.com> wrote:
>> 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.
>>
>>
>> _______________________________________________
>> Mulgara-general mailing list
>> Mulgara-general at mulgara.org
>> http://lists.mulgara.org/mailman/listinfo/mulgara-general
>>
> _______________________________________________
> Mulgara-general mailing list
> Mulgara-general at mulgara.org
> http://lists.mulgara.org/mailman/listinfo/mulgara-general
> _______________________________________________
> Mulgara-general mailing list
> Mulgara-general at mulgara.org
> http://lists.mulgara.org/mailman/listinfo/mulgara-general
_______________________________________________
Mulgara-general mailing list
Mulgara-general at mulgara.org
http://lists.mulgara.org/mailman/listinfo/mulgara-general


More information about the Mulgara-general mailing list