[Mulgara-general] Queries on WebUI Vs. SPARQL Endpoint

Paul Gearon gearon at ieee.org
Wed Jul 22 17:35:25 UTC 2009


I notice that Alex has responded to this question, but I'll refer to
the original email directly...

On Wed, Jul 22, 2009 at 12:25 AM, Sands Fish<sands at mit.edu> wrote:
> Experimenting with queries in the webui, I have tried to port
> successful/result-bearing ones over to the SPARQL endpoint.
> Unfortunately, they don't seem to port, unless I'm missing something.

They should port, since both sections of code use the same parser, but
let's see....

> I
> have yet to get a result-set out of the endpoint.  Here's the query I'm
> hitting the webui with:
>   select ?s ?o from <rmi://dhcp-18-111-23-130.dyn.mit.edu/server1#> where
> {?s <http://xmlns.com/foaf/0.1/Name> ?o .}

I would be surprised to see you get anything at all from this query,
since you are asking for a foaf:Name from the system graph (which
really shouldn't contain any information like that). Do you have
anything set in the "Graph" field when you run this query? If so, then
it will override the "from" part of the query.

> Simple enough.  Now, encoded for the endpoint, I hit:
>   http://localhost:8080/mulgara/sparql/?query=select%20%3Fs%20%3Fo%20from%20%3Crmi%3A%2F%2Fdhcp-18-111-23-130.dyn.mit.edu%2Fserver1%23%3E%20where%20%7B%3Fs%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2FName%3E%20%3Fo%20.%7D
> All I get is:
> <?xml version="1.0"?>
> <sparql xmlns="http://www.w3.org/2005/sparql-results#">
>   <head>
>     <variable name="s"/>
>     <variable name="o"/>
>   </head>
>   <results>
>   </results>
> </sparql>

This is the result I expected.

> Am I missing something glaring?  I tried with/without the trailing slash,
> using the default-graph-uri parameter and including it directly in
> the query.

Including it directly in the query? You mean like the "from" clause
you have above?

If you want the "default" graph, then use a graph URI of sys:default.
So that would mean you could either use the following URI:
http://localhost:8080/mulgara/sparql/?query=select%20%3Fs%20%3Fo%20where%20%7B%3Fs%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2FName%3E%20%3Fo%20.%7D

Or you could refer to it explicitly:
http://localhost:8080/mulgara/sparql/?query=select%20%3Fs%20%3Fo%20from%20%3Csys%3Adefault%3E%20where%20%7B%3Fs%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2FName%3E%20%3Fo%20.%7D
or:
http://localhost:8080/mulgara/sparql/?default-graph-uri=sys%3Adefault&query=select%20%3Fs%20%3Fo%20where%20%7B%3Fs%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2FName%3E%20%3Fo%20.%7D

Incidentally, spaces are usually in parameters as the + character,
though I'm pretty sure that %20 works as well. So the first form of
that URI would become:
http://localhost:8080/mulgara/sparql/?query=select+%3Fs+%3Fo+where+%7B%3Fs+%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2FName%3E+%3Fo+.%7D


> Nothing seems to yield the results I get in the webui.

Well, it really depends on which graph you're querying. I'm not saying
that nothing is wrong, but at face value it looks like you are telling
the WebUI to query one graph, and asking the endpoint to look at
another.

> Incidentally, the &format switch doesn't seem to have any effect at all.  I
> have to be missing something here.

As Alex mentioned, there was a problem when asking for JSON on
anything that wasn't a CONSTRUCT query, but that's been fixed now. Is
this what you're seeing, or are you getting another problem.

BTW, this parameter was added for convenience with browsers. If
possible, you should be using content negotiation.

Regards,
Paul



More information about the Mulgara-general mailing list