On Thu, May 28, 2009 at 12:58 PM, Matt Trinneer
<[email protected]>wrote:
> Hi all,
> Am wondering if anyone might have a suggestion as to why the following
> query might be failing when run against the SPARQL endpoint, but work when
> executed using SNORQL. After reviewing for a while I am starting to think
> that it is due to the comma (,) in the dbpedia.org resource string.
> Here's why:
>
>
> This works via SNORQL:
>
> SELECT ?abstract WHERE { <http://dbpedia.org/resource/Toronto%2C_Ohio> <
> http://dbpedia.org/property/abstract> ?abstract. FILTER langMatches(
> lang(?abstract), 'en') }
>
>
> However this doesn't (notice I replaced %2C with (,):
>
> SELECT ?abstract WHERE { <http://dbpedia.org/resource/Toronto,_Ohio> <
> http://dbpedia.org/property/abstract> ?abstract. FILTER langMatches(
> lang(?abstract), 'en') }
>
>
> The following query, executed via the SPARQL endpoint returns no results.
> This is the encoded version of either of the above queries:
>
>
> SELECT+%3Fabstract+WHERE+%7B+%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FToronto%2C_Ohio%3E+%3Chttp%3A%2F%2Fdbpedia.org%2Fproperty%2Fabstract%3E+%3Fabstract.+FILTER+langMatches%28+lang%28%3Fabstract%29%2C+%27en%27%29+%7D
>
Alas, this is the encoded version of the /latter/ query only. The two have
different forms, and thus should have different encodings. The encoding of
the first should encode the "%" in the resource URI as "%25", so that your
encoded query is:
SELECT+%3Fabstract+WHERE+%7B+%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FToronto%252C_Ohio%3E+%3Chttp%3A%2F%2Fdbpedia.org%2Fproperty%2Fabstract%3E+%3Fabstract.+FILTER+langMatches%28+lang%28%3Fabstract%29%2C+%27en%27%29+%7D%0D
Note that you can get this from SNORQL directly by grabbing the contents of
the URL after ?query=
Hope that helps :)
Cheers,
Peter
What's I'm guessing is that, the query is being decoded prior to execution.
> This decoding is converting the %2C back to a (,) which is no longer a
> valid dbpedia resource. Can anyone see an error in how I'm going about
> this, or suggest a method of executing this query against the SPARQL
> endpoint?
>
> Thanks,
>
> Matthew
>
>
>
>
>
> Full request / response
>
> POST /sparql HTTP/1.1
> Accept-Encoding: identity
> Host: dbpedia.org
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 223
> Accept: application/rdf+xml
>
>
> query=SELECT+%3Fabstract+WHERE+%7B+%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FToronto%2C_Ohio%3E+%3Chttp%3A%2F%2Fdbpedia.org%2Fproperty%2Fabstract%3E+%3Fabstract.+FILTER+langMatches%28+lang%28%3Fabstract%29%2C+%27en%27%29+%7DHTTP/1.1
> 200 OK
> Server: Virtuoso/05.11.3039 (Solaris) x86_64-sun-solaris2.10-64 VDB
> Connection: Keep-Alive
> Date: Thu, 28 May 2009 11:48:20 GMT
> Accept-Ranges: bytes
> Content-Type: application/rdf+xml; charset=UTF-8
> Content-Length: 314
>
> <rdf:RDF xmlns:res="http://www.w3.org/2005/sparql-results#" xmlns:rdf="
> http://www.w3.org/1999/02/22-rdf-syntax-ns#">
> <rdf:Description rdf:nodeID="rset">
> <rdf:type rdf:resource="http://www.w3.org/2005/sparql-results#ResultSet"
> />
> <res:resultVariable>abstract</res:resultVariable>
> </rdf:Description>
> </rdf:RDF>
>
>
>
>
> ------------------------------------------------------------------------------
> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
> is a gathering of tech-side developers & brand creativity professionals.
> Meet
> the minds behind Google Creative Lab, Visual Complexity, Processing, &
> iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
> Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
> _______________________________________________
> Dbpedia-discussion mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/dbpedia-discussion
>
>
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
_______________________________________________
Dbpedia-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dbpedia-discussion