You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Brice Sommacal <br...@gmail.com> on 2018/06/28 10:24:59 UTC

Retrieving SPARQL-results xml using curl

Hello,

I use the last distribution of Fuseki which is initialized with a TDB2
dataset [1].
Working with the user interface, everything os working well. I mean I am
able to retrieve results from a select query and then download it.

Going one step further, I would like to automate dataset update and dataset
queries restitution.
I am able to run SPARQL Update query within culr (using SPARQL INSERT
inside a ttl file).

I am also able to get SPARQL Result JSON objects using commands line like
the following :
curl
http://localhost:3030/Metro/query?query=PREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22[..
.]

However,  if I specify the header to return XML result set, it keeps
outputting the data in a JSON format.

Here is my command : curl
http://localhost:3030/Metro/query?query=PREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22[..
.]   -X POST  -H 'Accept:+application/sparql-results+xml'

I don't know what could be wrong. I am not an expert using curl... But
syntax that I have seen on forums looks like the same...

> Do you have an idea of what I am doing wrong?


Regards,


Brice


[1] there is a huge progress between TDB1 and TDB2 (also fuseki 1 and 2).
Thanks a lot to the community to make it available.

Re: Retrieving SPARQL-results xml using curl

Posted by Brice Sommacal <br...@gmail.com>.
Thank you Martynas for the direct link & Jean-Marc for the wget method.

I was almost there ;-)

I have been using GET earlier on the morning :
curl -H "Accept: application/sparql-results+xml" -X GET http://[..]

But at this time, due to the call from a .bat file (windows), it has not
been successful because a wrong encoding format in the URL.

Problem is solved (until a deployment in a Linux environment ...) :)

Have a good day,


Brice


2018-06-28 13:29 GMT+02:00 Jean-Marc Vanel <je...@gmail.com>:

> Here is a SPARQL query using wget :
>
> wget --method=POST \
>      --body-data="query=SELECT * WHERE {?S ?P ?O} LIMIT 10" \
>      --header='Accept:application/sparql-results+xml' \
>      http://localhost:9000/sparql2
>
> Other useful scripts in
> https://github.com/jmvanel/semantic_forms/tree/master/
> scala/forms_play/dist/scripts
>
>
>
> 2018-06-28 12:24 GMT+02:00 Brice Sommacal <br...@gmail.com>:
>
> > Hello,
> >
> > I use the last distribution of Fuseki which is initialized with a TDB2
> > dataset [1].
> > Working with the user interface, everything os working well. I mean I am
> > able to retrieve results from a select query and then download it.
> >
> > Going one step further, I would like to automate dataset update and
> dataset
> > queries restitution.
> > I am able to run SPARQL Update query within culr (using SPARQL INSERT
> > inside a ttl file).
> >
> > I am also able to get SPARQL Result JSON objects using commands line like
> > the following :
> > curl
> > http://localhost:3030/Metro/query?query=PREFIX+rdf%3A+%
> > 3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22[..
> > .]
> >
> > However,  if I specify the header to return XML result set, it keeps
> > outputting the data in a JSON format.
> >
> > Here is my command : curl
> > http://localhost:3030/Metro/query?query=PREFIX+rdf%3A+%
> > 3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22[..
> > .]   -X POST  -H 'Accept:+application/sparql-results+xml'
> >
> > I don't know what could be wrong. I am not an expert using curl... But
> > syntax that I have seen on forums looks like the same...
> >
> > > Do you have an idea of what I am doing wrong?
> >
> >
> > Regards,
> >
> >
> > Brice
> >
> >
> > [1] there is a huge progress between TDB1 and TDB2 (also fuseki 1 and 2).
> > Thanks a lot to the community to make it available.
> >
>
>
>
> --
> Jean-Marc Vanel
> http://www.semantic-forms.cc:9111/display?displayuri=http:/
> /jmvanel.free.fr/jmv.rdf%23me#subject
> <http://www.semantic-forms.cc:9111/display?displayuri=http:/
> /jmvanel.free.fr/jmv.rdf%23me>
> Rule-based programming, Semantic Web
> +33 (0)6 89 16 29 52
> Twitter: @jmvanel , @jmvanel_fr ; chat: irc://irc.freenode.net#eulergui
>

Re: Retrieving SPARQL-results xml using curl

Posted by Jean-Marc Vanel <je...@gmail.com>.
Here is a SPARQL query using wget :

wget --method=POST \
     --body-data="query=SELECT * WHERE {?S ?P ?O} LIMIT 10" \
     --header='Accept:application/sparql-results+xml' \
     http://localhost:9000/sparql2

Other useful scripts in
https://github.com/jmvanel/semantic_forms/tree/master/scala/forms_play/dist/scripts



2018-06-28 12:24 GMT+02:00 Brice Sommacal <br...@gmail.com>:

> Hello,
>
> I use the last distribution of Fuseki which is initialized with a TDB2
> dataset [1].
> Working with the user interface, everything os working well. I mean I am
> able to retrieve results from a select query and then download it.
>
> Going one step further, I would like to automate dataset update and dataset
> queries restitution.
> I am able to run SPARQL Update query within culr (using SPARQL INSERT
> inside a ttl file).
>
> I am also able to get SPARQL Result JSON objects using commands line like
> the following :
> curl
> http://localhost:3030/Metro/query?query=PREFIX+rdf%3A+%
> 3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22[..
> .]
>
> However,  if I specify the header to return XML result set, it keeps
> outputting the data in a JSON format.
>
> Here is my command : curl
> http://localhost:3030/Metro/query?query=PREFIX+rdf%3A+%
> 3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22[..
> .]   -X POST  -H 'Accept:+application/sparql-results+xml'
>
> I don't know what could be wrong. I am not an expert using curl... But
> syntax that I have seen on forums looks like the same...
>
> > Do you have an idea of what I am doing wrong?
>
>
> Regards,
>
>
> Brice
>
>
> [1] there is a huge progress between TDB1 and TDB2 (also fuseki 1 and 2).
> Thanks a lot to the community to make it available.
>



-- 
Jean-Marc Vanel
http://www.semantic-forms.cc:9111/display?displayuri=http://jmvanel.free.fr/jmv.rdf%23me#subject
<http://www.semantic-forms.cc:9111/display?displayuri=http://jmvanel.free.fr/jmv.rdf%23me>
Rule-based programming, Semantic Web
+33 (0)6 89 16 29 52
Twitter: @jmvanel , @jmvanel_fr ; chat: irc://irc.freenode.net#eulergui

Re: Retrieving SPARQL-results xml using curl

Posted by Martynas Jusevičius <ma...@atomgraph.com>.
You're doing a POST request but supplying a URL query as if it was GET?

https://www.w3.org/TR/sparql11-protocol/#query-operation

On Thu, Jun 28, 2018 at 12:24 PM, Brice Sommacal <br...@gmail.com>
wrote:

> Hello,
>
> I use the last distribution of Fuseki which is initialized with a TDB2
> dataset [1].
> Working with the user interface, everything os working well. I mean I am
> able to retrieve results from a select query and then download it.
>
> Going one step further, I would like to automate dataset update and dataset
> queries restitution.
> I am able to run SPARQL Update query within culr (using SPARQL INSERT
> inside a ttl file).
>
> I am also able to get SPARQL Result JSON objects using commands line like
> the following :
> curl
> http://localhost:3030/Metro/query?query=PREFIX+rdf%3A+%
> 3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22[..
> .]
>
> However,  if I specify the header to return XML result set, it keeps
> outputting the data in a JSON format.
>
> Here is my command : curl
> http://localhost:3030/Metro/query?query=PREFIX+rdf%3A+%
> 3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22[..
> .]   -X POST  -H 'Accept:+application/sparql-results+xml'
>
> I don't know what could be wrong. I am not an expert using curl... But
> syntax that I have seen on forums looks like the same...
>
> > Do you have an idea of what I am doing wrong?
>
>
> Regards,
>
>
> Brice
>
>
> [1] there is a huge progress between TDB1 and TDB2 (also fuseki 1 and 2).
> Thanks a lot to the community to make it available.
>