public class QueryStorage extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
QueryStorage(AppConfiguration appConfig)
Create a new object for accessing the store of user queries.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
askExists(HTTPRepository repository,
String queryName,
String userName) |
boolean |
canChange(IRI query,
String currentUser)
Determines whether the user with the given userName is allowed to update or delete the given query.
|
boolean |
canRead(IRI query,
String currentUser)
Determines whether the user with the given userName is allowed to read the given query.
|
boolean |
checkAccess(HTTPRepository repository)
Checks whether the current user/password credentials can really access the current repository.
|
void |
deleteQuery(IRI query,
String userName)
Delete the given query for the given user.
|
String |
getQueryText(HTTPRepository repository,
String owner,
String queryName)
Retrieves the specified query text.
|
static QueryStorage |
getSingletonInstance(AppConfiguration config) |
void |
saveQuery(HTTPRepository repository,
String queryName,
String userName,
boolean shared,
QueryLanguage queryLanguage,
String queryText,
boolean infer,
int rowsPerPage)
Save a query.
|
void |
selectSavedQueries(HTTPRepository repository,
String userName,
TupleResultBuilder builder)
Prepares a query to retrieve the queries accessible to the given user in the given repository.
|
IRI |
selectSavedQuery(HTTPRepository repository,
String owner,
String queryName)
Returns the URI for the saved query in the given repository with the given name, owned by the given owner.
|
void |
shutdown() |
void |
updateQuery(IRI query,
String userName,
boolean shared,
QueryLanguage queryLanguage,
String queryText,
boolean infer,
int rowsPerPage)
Update the entry for the given query.
|
protected QueryStorage(AppConfiguration appConfig) throws RepositoryException, IOException
appConfig - the application configuration, for obtaining the data directoryRepositoryException - if there is an issue creating the object to access the repositoryIOExceptionpublic static QueryStorage getSingletonInstance(AppConfiguration config) throws RepositoryException, IOException
RepositoryExceptionIOExceptionpublic void shutdown()
public boolean checkAccess(HTTPRepository repository) throws RepositoryException
repository - the current repositoryRepositoryException - if there is an issue closing the connectionpublic void saveQuery(HTTPRepository repository, String queryName, String userName, boolean shared, QueryLanguage queryLanguage, String queryText, boolean infer, int rowsPerPage) throws RDF4JException
repository - the repository the query is associated withqueryName - the name for the queryuserName - the user saving the queryshared - whether the query is to be shared with other usersqueryLanguage - the language, SeRQL or SPARQL, of the queryqueryText - the actual query textinfer - rowsPerPage - rows to display per page, may be 0 (all), 10, 50, 100, or 200)RDF4JExceptionpublic boolean canChange(IRI query, String currentUser) throws RepositoryException, QueryEvaluationException, MalformedQueryException
query - the node identifying the query of interestcurrentUser - the user to check access forRepositoryExceptionQueryEvaluationExceptionMalformedQueryExceptionpublic boolean canRead(IRI query, String currentUser) throws RepositoryException, QueryEvaluationException, MalformedQueryException
query - the node identifying the query of interestcurrentUser - the user to check access forRepositoryExceptionQueryEvaluationExceptionMalformedQueryExceptionpublic boolean askExists(HTTPRepository repository, String queryName, String userName) throws QueryEvaluationException, RepositoryException, MalformedQueryException
public void deleteQuery(IRI query, String userName) throws RepositoryException, UpdateExecutionException, MalformedQueryException
query - userName - RepositoryExceptionUpdateExecutionExceptionMalformedQueryExceptionpublic void updateQuery(IRI query, String userName, boolean shared, QueryLanguage queryLanguage, String queryText, boolean infer, int rowsPerPage) throws RepositoryException, UpdateExecutionException, MalformedQueryException
query - the query to updateuserName - the user nameshared - whether to share with other usersqueryLanguage - the query languagequeryText - the text of the queryinfer - rowsPerPage - the rows per page to display of the queryRepositoryException - if a problem occurs during the updateUpdateExecutionException - if a problem occurs during the updateMalformedQueryException - if a problem occurs during the updatepublic void selectSavedQueries(HTTPRepository repository, String userName, TupleResultBuilder builder) throws RepositoryException, MalformedQueryException, QueryEvaluationException, QueryResultHandlerException
repository - that the saved queries run againstuserName - that is requesting the saved queriesbuilder - receives a list of all the saved queries against the given repository and accessible to the
given userRepositoryException - if there's a problem connecting to the saved queries repositoryMalformedQueryException - if the query is not legal SPARQLQueryEvaluationException - if there is a problem while attempting to evaluate the queryQueryResultHandlerExceptionpublic IRI selectSavedQuery(HTTPRepository repository, String owner, String queryName) throws RDF4JException, BadRequestException
repository - The repository the query is associated with.owner - The user that saved the query.queryName - The name given to the query.RDF4JException - if issues occur performing the necessary queries.BadRequestException - if the the specified stored query doesn't existpublic String getQueryText(HTTPRepository repository, String owner, String queryName) throws RDF4JException, BadRequestException
repository - Repository that the saved query is associated with.owner - The user that saved the query.queryName - The name given to the saved query.RDF4JException - if a problem occurs accessing storageBadRequestException - if the specified query doesn't existCopyright © 2015-2021 Eclipse Foundation. All Rights Reserved.