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

Paul Gearon gearon at ieee.org
Fri Jan 23 20:19:20 UTC 2009


On Fri, Jan 23, 2009 at 1:12 PM, Agustina Martinez <amgcia at gmail.com> wrote:
> Hi all!
>
> Don't worry Paul. For sure you have a huge list of things to do, so it's
> undestandable those sort of things :).
> I am interested in using this endpoint too and if you could write via email
> the syntax and possible return formats to query the HTTP endpoint would be
> really appreciated.

OK, a quick rundown...

The SPARQL endpoint is implemented as a servlet, served at /sparql on
the host (being a servlet, it should be easy to add it to the WAR file
for Tomcat, but that hasn't been done yet).

For 2.0.7, the following methods are supported:

GET
parameter: query
  A SPARQL query
parameter: out
  Optional. Either json or xml. Defaults to xml
parameter: default-graph-uri
  The default graph to use in the query.
parameter: named-graph-uri
  Ignored in 2.0.7
parameter: graph
  an alias for default-graph-uri
Result:
  The answer to the query, either as an XML response, or JSON,
depending on the "out" parameter.
Example:
  http://localhost:8080/sparql?query=SELECT+%3Fs+%24p+%24o+FROM+%3Csparql%3Adata%3E+WHERE+%7B+%24s+%24p+%24o+.+%7D&out=json

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.


2.0.8 will have a few differences. For instance, the "out" parameter
is changing to "format". The format can also be specified in the
"Accept" header instead of as a parameter. I am also looking at
various URLs and methods to make it more REST-like. (For instance, so
you can PUT and DELETE individual statements).

There is also a TQL servlet which is similar, and may be used for
updates (since TQL is an update language, while SPARQL is not):

GET
parameter: query
  A TQL query. This MUST be a SELECT query.
parameter: out
  Optional. Either json or xml. Defaults to xml
Result:
  The answer to the query, either as an XML response, or JSON,
depending on the "out" parameter.

POST
If the data type is multipart/form-data then identical to file uploads
on /sparql. For all other data types:
parameter: query
  A TQL query.
parameter: out
  Optional. Either json or xml. Defaults to xml
Result:
  The answer to the query, either as an XML response, or JSON,
depending on the "out" parameter. For SELECT queries an Answer is
returned in the requested format. For all other commands, the string
status of the result is returned.
Example:
    http://localhost:8080/tql?query=insert+select+%3Fs+%24p+%24o+from+%3Cdata%3Aold%3E+where+%24s+%24p+%24o+into+%3Cdata%3Anew%3E&out=xml


Regards,
Paul



More information about the Mulgara-dev mailing list