Quaestor has two interfaces, this RESTful HTTP one, which is the main one, and a separate XML-RPC interface (still rather preliminary).
In the documentation below, hostport refers to the
machine and port number hosting the Quaestor service, such as
localhost:8080.
You interact with Quaestor by creating a knowledgebase with a
PUT command, then PUTting ontologies into
the knowledgebase, then POSTing SPARQL queries. The front page points to a demo/walkthrough.
GET http://hostport/quaestor/kbGET http://hostport/quaestor/kb/kb-name[/sm-name]Retrieve either the complete kb-name model, or
the named sm-name submodel. The format of the response
is controlled by the Accept header, which if present must
contain one of the following MIME types (see note):
text/turtle :
Turtletext/rdf+n3 : Notation3 (like Turtle, but less standardised)application/rdf+xml : RDF/XML serialisation (default)text/plain : N-triples formattext/csv : comma-separated valuestext/tab-separated-values*/* to accept any format (the default is RDF/XML)You can add an optional query ?model or
?metadata to retrieve the appropriate thing; the default
is to retrieve the model.
This method returns status 200 (OK) on success, or a 4xx code on error.
GET http://hostport/quaestor/kb/kb-name?query=queryaccept headers as the POST method below.PUT http://hostport/quaestor/kb/kb-nameCreate a new knowledgebase named `kb-name'. The
request content contains the metadata for the knowledgebase. This can
be expressed as RDF (with MIME types text/rdf+n3 or
application/rdf+xml). For example the body might be:
@prefix dc: <http://purl.org/dc/elements/1.1/>.
<> dc:description "My knowledgebase";
dc:creator "Norman".
Alternatively, the content can have a text/plain MIME
type, which in this context means that the knowledgebase will be given
a dc:description whose subject is the given text. For
fuller details see below.
It is an error if the knowledgebase already exists. Returns status 204 (No Content) on success, and a 4xx error message if the knowledgebase already exists or if there is some other error.
PUT http://hostport/quaestor/kb/kb-name/sm-nameUpload the request body as the content of the submodel named
sm-name, replacing any pre-existing content. The
request may have a Content-Type header indicating the
format of the body, which, if it is present, must be one of
the following MIME types (see note):
text/rdf+n3 or text/turtle : Notation3 or Turtle.application/rdf+xml : RDF/XMLtext/plain : N-TriplesIf there is no Content-Type header present, the
content is parsed as application/rdf+xml.
The request may have a query appended, which may be
?abox, ?instances (which is equivalent to
?abox) or ?tbox. This indicates the type of
the corresponding model. The default, if no such query is given, is
tbox (I'm not sure how legit this use of query is -- this
might change).
Notation3 may also be uploaded using the deprecated MIME type
application/n3.
PUT http://hostport/quaestor/kb/kb-name/sm-name?metadataPOST http://hostport/quaestor/kb/kb-nameTakes a SPARQL query as the request body, which should be
posted with the Content-Type set to
application/sparql-query. The request may be
accompanied by an Accept header to control the format of
the returned data; the MIME types recognised are the same as for the
GET request above.
Returns status 200 (OK) on success, and 4xx otherwise.
POST http://hostport/quaestor/kb/kb-name/sm-namePOST http://hostport/quaestor/codeDELETE http://hostport/quaestor/kb/kb-nameDELETE http://hostport/quaestor/kb/kb-name/submodelQuaestor supports a simple form of query delegation. A knowledgebase can be configured, using the metadata below, to forward queries to another SPARQL endpoint.
The delegation is rather simple-minded. If the metadata of a
knowledgebase A includes a triple of the form <A>
quaestor:delegatesTo <B>, then when a query is made
against knowledgebase A, the same query is made
against B (and against any other objects of the same property
relation) and the results of the queries against A and
B are concatenated. This works adequately if the
knowledgebases have similar and independent information, but it fails
to answer queries where the relevant triples are in the union of the
knowledgebases A and B, but not in either
knowledgebase separately.
The object of the quaestor:delegatesTo property may be
the URL of another knowledgebase in the same Quaestor instance, or it
may be a separate SPARQL endpoint. In the latter case, Quaestor
presumes that for a SPARQL endpoint URL http://foo, the query
can be made with a GET on the URL
http://foo?query=<query>, where
<query> is the URL-encoded version of the original
SPARQL query. This interface is not standardised, but it appears to
be rather common, and is the same as Quaestor's GET-query interface.
When you create a knowledgebase with a PUT
http://hostport/quaestor/kb/kb-name, as shown above,
you can include metadata to describe and configure it. The resources
are resolved using the knowledgebase's own URI as the base-URI.
You can add any metadata you like, but some properties are treated
specially. The following classes and properties are in the namespace
http://ns.eurovotech.org/quaestor# (at present, this might
change).
quaestor:Knowledgebasequaestor:ReasonerSpecificationquaestor:requiredReasonerquaestor:ReasonerSpecification as its range.quaestor:levelquaestor:ReasonerSpecification which
indicates the functionality required of the reasoner for this
knowledgebase. The property may have the values indicated below.quaestor:delegatesToThe available reasoners are as follows:
rdfs:subClassOf is transitive).For fuller details of these reasoners, see the Jena inference documentation.
The formal declaration of these properties is below.
@prefix : <http://ns.eurovotech.org/quaestor#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
:Knowledgebase a rdfs:Class;
rdfs:comment "A Quaestor knowledgebase".
:ReasonerSpecification a rdfs:Class;
rdfs:comment """Specification of the reasoner required to handle
a knowledgebase""".
:requiredReasoner a rdf:Property;
rdfs:domain :Knowledgebase;
rdfs:range :ReasonerSpecification;
rdfs:comment "The reasoner required to process a specific knowledgebase".
:level a rdf:Property;
rdfs:domain :ReasonerSpecification;
rdfs:range xsd:string;
rdfs:comment """A string indicating reasoning capability. It may
be one of the strings:
none (do not use a reasoner),
simpleRDFS, defaultRDFS, fullRDFS (three Jena reasoners),
defaultOWL (the default Jena OWL reasoner),
miniOWL, microOWL (the two alternative Jena OWL reasoners)""" .
:delegatesTo a rdf:Property;
rdfs:domain :Knowledgebase;
rdfs:comment """A SPARQL endpoint to which this knowledgebase should
delegate queries""" .
If no level property is available, the default
reasoner is (currently) none.
For example a configuration file such as the following, sent as the
payload of the PUT which creates the knowledgebase, would set up
the knowledgebase with a reasoner that could process a useful subset
of RDFS.
@prefix dc: <http://purl.org/dc/elements/1.1/>.
@prefix quaestor: <http://ns.eurovotech.org/quaestor#>.
<> dc:description "UCD knowledgebase";
dc:creator "Norman";
quaestor:requiredReasoner [
quaestor:level "simpleRDFS"
].