[Mulgara-dev] Mulgara 2.0.7 - support for sparql?

Agustina Martinez amgcia at gmail.com
Tue Feb 10 09:19:33 UTC 2009


Lots of thanks Paul!!! The real thing is that I was pretending to pass the
data directly from the results obtained from the REST call to Fedora API-A
to obtain directly the RDF, but I didn't know how to, thats why I thought on
copying the response to a file and after that call the service using POST
request. But it really less efficient I think. Maybe your Calais trick can
apply to the rdf obtained as a string from the Fedora GET methods :-).

Many thanks again!!!
Agustina

2009/2/9 Paul Gearon <gearon at ieee.org>

> On Mon, Feb 9, 2009 at 11:12 AM, Agustina Martinez <amgcia at gmail.com>
> wrote:
> > Hi again Paul,
> >
> > I am back! :)
> >
> > I am trying to upload using an Apache HttpClient API via POST method some
> > RDF files to Mulgara.
>
> OK, I'll include some basic code with this post.
>
> > You posted me a brief description of the parameters of the POST request:
> >
> > "POST
> > expected encoding: multipart/form-data
> > parameter: default-graph-uri
> >  Name of a graph. If this graph does not exist it will be created.
> > parameter: (any name except default-graph-uri, named-graph-uri or graph)
> >  An RDF file to be uploaded. The data type is specified by the
> > filename extension (.rdf, .n3, .nt). Multiple files can be loaded in a
> > single request.
> > Result:
> >  An HTTP response. For each loaded file, there will be a header of
> > "Statements-Loaded" with the number of triples loaded. Multiple
> > headers will appear if multiple files were loaded. For each file that
> > could not be loaded, the header "Cannot-Load" will appear, set to the
> > filename of the data that could not be loaded."
> >
> > So my doubts are the following: what's the url of the service? Because if
> > for example I use "http://localhost/sparql/" I obtain the error: HTTP
> ERROR:
> > 400 Command must be supplied.
>
> The server listens to 8080 by default, meaning a URL of
> http://localhost:8080/sparql/, but yes, that is otherwise correct. If
> you start Mulgara with a different config file, or just "-p 80" then
> the above URL will work.
>
> > And how to specify more than one file in the request?
>
> I've had a strange issue with including the graph name as an encoded
> parameter when loading multiple files (strange in that it returns the
> name of a class instead of the graph name, and it always works
> perfectly when it runs in the debugger). So I recommend using a URL
> parameter when uploading. eg. If you graph URI is "data:test" then the
> URL for the upload would be:
>  http://localhost:8080/sparql/?default-graph-uri=data%3Atest
>
> A couple of points to note in the example code:
>
> - You needn't set the content-type of the data, as this is ignored.
> The internal interfaces that consider this are hidden from the HTTP
> code. I'll have to fix it, but for the moment, it will guess the mime
> type based on the filename extension.
>
> - The names on the parameters are ignored, except for "graph",
> "default-graph-uri", and "named-graph-uri". Uploaded files can have
> any name, so I've just used their filename.
>
> - The files are being read and uploaded with FileBody objects. If the
> data is to come from a string (e.g. you're getting the RDF file from
> Calais), then there's a simple trick to set it up. Ask me. :-)
>
> Paul
>
> _______________________________________________
> Mulgara-dev mailing list
> Mulgara-dev at mulgara.org
> http://mulgara.org/mailman/listinfo/mulgara-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mulgara.org/pipermail/mulgara-dev/attachments/20090210/39680fdb/attachment.htm>


More information about the Mulgara-dev mailing list