You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@marmotta.apache.org by Colin Maudry <co...@maudry.com> on 2014/09/21 14:25:23 UTC

Replacing a graph in command line/batch operation

Hello there,

In the context of the DITA RDF project
<http://purl.org/dita/ditardf-project>, I'm writing a script using
Apache Ant to drive a transformation process from DITA XML to RDF/XML. I
have to use Ant because it's the language used by the DITA Open Toolkit
<http://dita-ot.github.io/>.

Luckily, I found an HTTP Ant task to issue HTTP requests and store the
processing result in a repository.

Unfortunately, both Marmotta documentation and practice seem to tell me
that the methods to replace a graph in the repo are limited, at least
from command line.

Ideally, I would expect to be able to issue such command to replace a
graph in the repo:

curl -X PUT -H "Content-Type: application/rdf+xml; charset=utf-8" -d @file.rdf http://host/marmotta/import/upload

I guess the target URL would be different but you get the idea: instead of using POST and updating the target graph, I use PUT to drop the target graph and create it again with new data.

Unfortunately, this request returns a 405 error (Method Not Allowed):
HTTP/1.1 405 Method Not Allowed
Server: Apache Marmotta/3.2.1 (build 0)
Allow: POST, OPTIONS
Content-Length: 0
Date: Sun, 21 Sep 2014 12:20:58 GMT

Since PUT (and DELETE) are not supported, is there a way to use POST to delete a graph? In any case, I hope the support of PUT and DELETE are on the roadmap :)

I use v3.2.1 on Windows 8.1 64.

Thanks for your answers,
Colin

   

Re: Replacing a graph in command line/batch operation

Posted by Sergio Fernández <wi...@apache.org>.
Hi Colin,

On 21/09/14 14:25, Colin Maudry wrote:
> Unfortunately, both Marmotta documentation and practice seem to tell me
> that the methods to replace a graph in the repo are limited, at least
> from command line.

We have some bash script we internally use for some project. If there 
are users who find it relevant, we can include them int he client library.

> Ideally, I would expect to be able to issue such command to replace a
> graph in the repo:
>
> curl -X PUT -H "Content-Type: application/rdf+xml; charset=utf-8" -d @file.rdf http://host/marmotta/import/upload
>
> I guess the target URL would be different but you get the idea: instead of using POST and updating the target graph, I use PUT to drop the target graph and create it again with new data.
>
> Unfortunately, this request returns a 405 error (Method Not Allowed):

Well, the import web service is just part of the infrastructure that 
support the admin ui. At the webservice tab you can always see some 
documentation, where the /import/upload endpoint allows you to POST raw 
RDF serialized according the sent Content-Type header to the context 
specified by the 'context' query parameter (default if missing).

> Since PUT (and DELETE) are not supported, is there a way to use POST to delete a graph? In any case, I hope the support of PUT and DELETE are on the roadmap :)

In addition to the import infrastructure, Marmotta 3.2.1 also provides 
partial support to the SPARQL 1.1 Graph Store HTTP Protocol 
<http://www.w3.org/TR/sparql11-http-rdf-update/>, where you can do some 
operations directly to the contexts (named graphs) URI. That's will be 
fully supported in 3.3.0 (see MARMOTTA-544 for the details).

Hope that helps.

Cheers,

-- 
Sergio Fernández
Partner Technology Manager
Redlink GmbH
m: +43 660 2747 925
e: sergio.fernandez@redlink.co
w: http://redlink.co