<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Thanks Alex.  My problem here is that 1) I’m not sure what makes for an appropriate Graph URI and 2) I’m not sure how to encode that in the request.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">As for the graph URI, the data uploads and queries successfully from the webui if I use something like “goldfish:8080/sparql” (where goldfish is the hostname
 of the server on which Mulgara is running).  So going with that, if I modify the request as follows:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">SELECT DISTINCT ?s FROM <goldfish:8080/sparql> WHERE { ?s ?p ?o . }<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">then the line of Perl
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">my $iterator = $query->execute($webURL);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">returns the an iterator which dumps as follows:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">$VAR1 = bless( {<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">                 '_peek' => [],<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">                 '_row' => undef,<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">                 '_count' => 0,<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">                 '_type' => 'bindings',<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">                 '_finished' => 0,<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">                 '_names' => [<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">                               's'<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">                             ],<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">                 '_args' => {},<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">                 'sorted_by' => [],<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">                 '_stream' => sub { "DUMMY" },<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">                 '_open' => 0<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">               }, 'RDF::Trine::Iterator::Bindings' );<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">(still no rows of data however) and with Mulgara down and nc running I get:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">GET /sparql?query=SELECT%20DISTINCT%20%3Fs%20FROM%20%3Chttp%3A%2F%2Fgoldfish%3A8080%2Fsparql%3E%20WHERE%20%7B%20%3Fs%20%3Fp%20%3Fo%20.%20%7D
 HTTP/1.1<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">TE: deflate,gzip;q=0.3<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">Connection: TE, close<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">Accept: application/sparql-results+json, application/sparql-results+xml;q=0.9, application/rdf+xml, application/x-turtle, text/turtle<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">Host: goldfish:8080<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">User-Agent: RDF::Query::Client/0.107 (cpan:TOBYINK) libwww-perl/6.02<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">Content-Type: application/x-www-form-urlencoded</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">FWIW I think you have me on the right path however.  I *<b>know</b>* I’m just guessing at what an appropriate Graph URI would be and how to specify it in the
 perl script request.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">-Mark<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> mulgara-general-bounces@mulgara.org [mailto:mulgara-general-bounces@mulgara.org]
<b>On Behalf Of </b>Alex Hall<br>
<b>Sent:</b> Friday, February 03, 2012 2:24 PM<br>
<b>To:</b> Mulgara General<br>
<b>Subject:</b> Re: [Mulgara-general] empty results from SPARQL queries<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I think the problem is you haven't specified a default graph for the query. The default graph is where Mulgara looks to actually match the triple patterns in the WHERE clause. So you need to give Mulgara the URI of the graph where you loaded
 your data, either as part of the query string using a FROM clause...<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">SELECT DISTINCT ?s FROM <my_graph_uri> WHERE { ?s ?p ?o . }<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">or using the default-graph-uri parameter of the SPARQL HTTP request:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">GET /sparql?query=SELECT...&default-graph-uri=my_graph_uri<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Having no experience with the RDF module for Perl, so I don't know how you would set that request parameter.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">If you don't specify a default graph URI in either the query string or request parameter, Mulgara uses the built-in graph URI sys:null which is always empty.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">-Alex<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Fri, Feb 3, 2012 at 3:11 PM, Mark Stubbeman <<a href="mailto:MStubbeman@algebraixdata.com">MStubbeman@algebraixdata.com</a>> wrote:<o:p></o:p></p>
<p class="MsoNormal">Got it - here are go.<br>
<br>
GET /sparql?query=SELECT%20DISTINCT%20%3Fs%20WHERE%20%7B%20%3Fs%20%3Fp%20%3Fo%20.%20%7D HTTP/1.1<br>
TE: deflate,gzip;q=0.3<br>
Connection: TE, close<br>
Accept: application/sparql-results+json, application/sparql-results+xml;q=0.9, application/rdf+xml, application/x-turtle, text/turtle<br>
Host: goldfish:8080<br>
User-Agent: RDF::Query::Client/0.107 (cpan:TOBYINK) libwww-perl/6.02<br>
Content-Type: application/x-www-form-urlencoded<o:p></o:p></p>
<div>
<p class="MsoNormal"><br>
<br>
-----Original Message-----<br>
From: <a href="mailto:mulgara-general-bounces@mulgara.org">mulgara-general-bounces@mulgara.org</a> [mailto:<a href="mailto:mulgara-general-bounces@mulgara.org">mulgara-general-bounces@mulgara.org</a>] On Behalf Of Paul Gearon<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">Sent: Friday, February 03, 2012 1:32 PM<br>
To: Mulgara General<br>
Subject: Re: [Mulgara-general] empty results from SPARQL queries<br>
<br>
I was actually referring to the HTTP exchange. (It's reasonably easy.<br>
One way is to run "nc -l 8080" and then point your webURL to<br>
<a href="http://localhost:8080/sparql" target="_blank">http://localhost:8080/sparql</a>)<br>
<br>
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.<br>
<br>
Paul<br>
<br>
On Fri, Feb 3, 2012 at 1:04 PM, Mark Stubbeman <<a href="mailto:MStubbeman@algebraixdata.com">MStubbeman@algebraixdata.com</a>> wrote:<br>
> Here's the Dumper() print of the query before I execute it:<br>
><br>
> $VAR1 = bless( {<br>
>                 'query' => 'SELECT DISTINCT ?s WHERE { ?s ?p ?o . }',<br>
>                 'error' => undef,<br>
>                 'useragent' => undef,<br>
>                 'results' => []<br>
>               }, 'RDF::Query::Client' );<br>
><br>
> 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.<br>
><br>
> Thanks,<br>
> Mark<br>
><br>
> -----Original Message-----<br>
> From: <a href="mailto:mulgara-general-bounces@mulgara.org">mulgara-general-bounces@mulgara.org</a><br>
> [mailto:<a href="mailto:mulgara-general-bounces@mulgara.org">mulgara-general-bounces@mulgara.org</a>] On Behalf Of Paul Gearon<br>
> Sent: Friday, February 03, 2012 10:11 AM<br>
> To: Mulgara General<br>
> Subject: Re: [Mulgara-general] empty results from SPARQL queries<br>
><br>
> Mulgara usually works fine with HTTP, so I'm not sure.<br>
><br>
> Would you be able to get a copy of the HTTP request for this please?<br>
> That may contain a clue.<br>
><br>
> Thanks in advance.<br>
><br>
> Paul<br>
><br>
> On Fri, Feb 3, 2012 at 10:21 AM, Mark Stubbeman <<a href="mailto:MStubbeman@algebraixdata.com">MStubbeman@algebraixdata.com</a>> wrote:<br>
>> I'm new to SPARQL and to triple-store technology in general.  I have<br>
>> a couple of example DBs - Mulgara being one of them - against which I<br>
>> am trying to write some simple Perl code to submit queries and<br>
>> extract responses.  The following works against one of my DB's but<br>
>> not against<br>
>> Mulgara:<br>
>><br>
>><br>
>><br>
>> sub runQuery<br>
>><br>
>> {<br>
>><br>
>>   use RDF::Query::Client;<br>
>><br>
>><br>
>><br>
>> # $webURL scrubbed of actual hostname but otherwise true to my actual<br>
>> code<br>
>><br>
>>   my $webURL = "<a href="http://$somehostname:8080/sparql">http://$somehostname:8080/sparql</a>";<br>
>><br>
>><br>
>><br>
>> # an array of lines read from a file containing a SPARQL query<br>
>><br>
>>   my @queryIn = @_;<br>
>><br>
>>   my $funcQuery = join('', @queryIn);<br>
>><br>
>><br>
>><br>
>>   print "Query\n-----\n\n$funcQuery\n";<br>
>><br>
>>   my $query = RDF::Query::Client->new($funcQuery);<br>
>><br>
>>   my $iterator = $query->execute($webURL);<br>
>><br>
>>   print "Response\n------\n\n";<br>
>><br>
>>   print Dumper($iterator);<br>
>><br>
>>   while (my $row = $iterator->next)<br>
>><br>
>>   {<br>
>><br>
>>     print "$row\n";<br>
>><br>
>>   }<br>
>><br>
>> }<br>
>><br>
>><br>
>><br>
>> With $webURL directed at another DB we get the following:<br>
>><br>
>><br>
>><br>
>> Executing: C:\sandboxes\cdbms\Hawk\Tests\SP2Bench\queries\q1.sparql<br>
>><br>
>><br>
>><br>
>> Query<br>
>><br>
>> -----<br>
>><br>
>><br>
>><br>
>> SELECT DISTINCT ?s WHERE { ?s ?p ?o . }<br>
>><br>
>> Response<br>
>><br>
>> ------<br>
>><br>
>><br>
>><br>
>> $VAR1 = bless( {<br>
>><br>
>>                  '_peek' => [],<br>
>><br>
>>                  '_row' => undef,<br>
>><br>
>>                  '_count' => 0,<br>
>><br>
>>                  '_type' => 'bindings',<br>
>><br>
>>                  '_finished' => 0,<br>
>><br>
>>                  '_names' => [],<br>
>><br>
>>                  '_args' => {},<br>
>><br>
>>                  'sorted_by' => [],<br>
>><br>
>>                  '_stream' => sub { "DUMMY" },<br>
>><br>
>>                  '_open' => 0<br>
>><br>
>>                }, 'RDF::Trine::Iterator::Bindings' );<br>
>><br>
>> { s=<<a href="http://localhost/publications/articles/Journal1/1944/Article4" target="_blank">http://localhost/publications/articles/Journal1/1944/Article4</a>> }<br>
>><br>
>><br>
>><br>
>> (note that the output has been truncated to just one line).  However,<br>
>> with $webURL set to our Mulgara installation the same code generates<br>
>> the<br>
>> following:<br>
>><br>
>><br>
>><br>
>> Query<br>
>><br>
>> -----<br>
>><br>
>><br>
>><br>
>> SELECT DISTINCT ?s WHERE { ?s ?p ?o . }<br>
>><br>
>> Response<br>
>><br>
>> ------<br>
>><br>
>><br>
>><br>
>> $VAR1 = bless( {<br>
>><br>
>>                  '_peek' => [],<br>
>><br>
>>                  '_row' => undef,<br>
>><br>
>>                  '_count' => 0,<br>
>><br>
>>                  '_type' => 'bindings',<br>
>><br>
>>                  '_finished' => 0,<br>
>><br>
>>                  '_names' => [<br>
>><br>
>>                                's'<br>
>><br>
>>                              ],<br>
>><br>
>>                  '_args' => {},<br>
>><br>
>>                  'sorted_by' => [],<br>
>><br>
>>                  '_stream' => sub { "DUMMY" },<br>
>><br>
>>                  '_open' => 0<br>
>><br>
>>                }, 'RDF::Trine::Iterator::Bindings' );<br>
>><br>
>><br>
>><br>
>> We get back an iterator (with slightly different properties) but no<br>
>> results.  I know via the Mulgara webui that the data is there. <br>
>> That's how I load the data.  I'm not sure what to use for Graph URI<br>
>> (several settings seem to work) but for the above exercise I used "<hostname>:8080/sparql"<br>
>> where <hostname> is the same as $somehostname from the sample code.<br>
>><br>
>><br>
>> _______________________________________________<br>
>> Mulgara-general mailing list<br>
>> <a href="mailto:Mulgara-general@mulgara.org">Mulgara-general@mulgara.org</a><br>
>> <a href="http://lists.mulgara.org/mailman/listinfo/mulgara-general" target="_blank">
http://lists.mulgara.org/mailman/listinfo/mulgara-general</a><br>
>><br>
> _______________________________________________<br>
> Mulgara-general mailing list<br>
> <a href="mailto:Mulgara-general@mulgara.org">Mulgara-general@mulgara.org</a><br>
> <a href="http://lists.mulgara.org/mailman/listinfo/mulgara-general" target="_blank">
http://lists.mulgara.org/mailman/listinfo/mulgara-general</a><br>
> _______________________________________________<br>
> Mulgara-general mailing list<br>
> <a href="mailto:Mulgara-general@mulgara.org">Mulgara-general@mulgara.org</a><br>
> <a href="http://lists.mulgara.org/mailman/listinfo/mulgara-general" target="_blank">
http://lists.mulgara.org/mailman/listinfo/mulgara-general</a><br>
_______________________________________________<br>
Mulgara-general mailing list<br>
<a href="mailto:Mulgara-general@mulgara.org">Mulgara-general@mulgara.org</a><br>
<a href="http://lists.mulgara.org/mailman/listinfo/mulgara-general" target="_blank">http://lists.mulgara.org/mailman/listinfo/mulgara-general</a><br>
_______________________________________________<br>
Mulgara-general mailing list<br>
<a href="mailto:Mulgara-general@mulgara.org">Mulgara-general@mulgara.org</a><br>
<a href="http://lists.mulgara.org/mailman/listinfo/mulgara-general" target="_blank">http://lists.mulgara.org/mailman/listinfo/mulgara-general</a><o:p></o:p></p>
</div>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>