On 06/09/16 00:51, Jason Koh wrote:
Hi there,
I am Jason Koh, a PhD student at UCSD studying semantic web.
I am trying to use Jena+Fuseki as it supports REST API directly, but I
cannot find API documents for it. I was trying to do reverse-engineering,
but it is too much. *Is there any REST API document of Fuseki?*
See the SPARQL protocol specification and SPARQL Graph Store Protocol.
Links at the top of:
http://jena.apache.org/documentation/fuseki2/
Specific problem I currently face is following (in Python)
1) Working: requests.post('http://localhost:3030/myproject?query=SELECT
?anything WHERE{?anything ?aa ?bb} LIMIT 10')
2) Not working: requests.post('http://localhost:3030/myproject?query=
'prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?anything
WHERE{?anything rdf:type ?bb} LIMIT 10'')
This is not a SPARQL problem.
The URL has a # in it - that's the start of a URL fragment and it is not
part of the URL sent over HTTP.
The request will end like:
"...?query=prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns"
(space are illegal as well, as are < and > and ?,& have a different
specific meaning)
You need to encode the query string to include in HTTP.
See the library your using for how to do this or better use a specific
RDF/SPARQL library.
For example for Python: rdflib
http://rdflib3.readthedocs.io/en/latest/intro_to_sparql.html
This returns code 404,
It returns 400 "Bad request", not 404 "Not Found"
Andy
and the server says:
[2016-09-04 14:42:17] Fuseki INFO [12] 400 Parse error:
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns
Encountered " "<" "< "" at line 1, column 13.
Was expecting:
<IRIref> ...
(5 ms)
I cannot help myself to debug this as I put one < for prefix which seems to
be standard in SPARQL.
*Does any of you know how to fix this problem?* (Still I would be very
happy to have an API doc.)
Thanks for all the open sources and supports. It really helps me.
With regards,
Jason Koh
cseweb.ucsd.edu/~jbkoh