Class SparqlQueryApiExecutor
- java.lang.Object
-
- edu.cornell.mannlib.vitro.webapp.controller.api.sparqlquery.SparqlQueryApiExecutor
-
- Direct Known Subclasses:
SparqlQueryApiAskExecutor,SparqlQueryApiConstructExecutor,SparqlQueryApiDescribeExecutor,SparqlQueryApiSelectExecutor
public abstract class SparqlQueryApiExecutor extends Object
The base class for the SPARQL query API.
-
-
Field Summary
Fields Modifier and Type Field Description protected StringqueryStringprotected RDFServicerdfService
-
Constructor Summary
Constructors Modifier Constructor Description protectedSparqlQueryApiExecutor(RDFService rdfService, String queryString)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidexecuteAndFormat(OutputStream out)Execute the query and write it to the output stream, in the selected format.abstract StringgetMediaType()What media type was selected, based on the Accept header?static SparqlQueryApiExecutorinstance(RDFService rdfService, String queryString, String acceptHeader)Get an instance that is appropriate to the query and the acceptable types.
-
-
-
Field Detail
-
rdfService
protected final RDFService rdfService
-
queryString
protected final String queryString
-
-
Constructor Detail
-
SparqlQueryApiExecutor
protected SparqlQueryApiExecutor(RDFService rdfService, String queryString)
-
-
Method Detail
-
instance
public static SparqlQueryApiExecutor instance(RDFService rdfService, String queryString, String acceptHeader) throws NotAcceptableException, org.apache.jena.query.QueryParseException, InvalidQueryTypeException, AcceptHeaderParsingException
Get an instance that is appropriate to the query and the acceptable types.- Throws:
AcceptHeaderParsingException- if the accept header was not in a valid formatNotAcceptableException- if the accept header did not contain a content type that is supported by the queryorg.apache.jena.query.QueryParseException- if the query was not syntactically validInvalidQueryTypeException- if the query was not SELECT, ASK, CONSTRUCT, or DESCRIBE
-
getMediaType
public abstract String getMediaType()
What media type was selected, based on the Accept header?
-
executeAndFormat
public abstract void executeAndFormat(OutputStream out) throws RDFServiceException, IOException
Execute the query and write it to the output stream, in the selected format.- Throws:
RDFServiceExceptionIOException
-
-