private ModelAndView getRemoveNamespaceResult(HttpServletRequest request, String prefix) throws ServerHTTPException { try (RepositoryConnection repositoryCon = RepositoryInterceptor.getRepositoryConnection(request)) { repositoryCon.removeNamespace(prefix); } catch (RepositoryException e) { throw new ServerHTTPException("Repository error: " + e.getMessage(), e); } return new ModelAndView(EmptySuccessView.getInstance()); } }
private ModelAndView getExportNamespaceResult(HttpServletRequest request, String prefix) throws ServerHTTPException, ClientHTTPException { try (RepositoryConnection repositoryCon = RepositoryInterceptor.getRepositoryConnection(request)) { String namespace = repositoryCon.getNamespace(prefix); if (namespace == null) { throw new ClientHTTPException(SC_NOT_FOUND, "Undefined prefix: " + prefix); } Map<String, Object> model = new HashMap<String, Object>(); model.put(SimpleResponseView.CONTENT_KEY, namespace); return new ModelAndView(SimpleResponseView.getInstance(), model); } catch (RepositoryException e) { throw new ServerHTTPException("Repository error: " + e.getMessage(), e); } }
private ModelAndView getUpdateNamespaceResult(HttpServletRequest request, String prefix) throws IOException, ClientHTTPException, ServerHTTPException { String namespace = IOUtil.readString(request.getReader()); namespace = namespace.trim(); if (namespace.length() == 0) { throw new ClientHTTPException(SC_BAD_REQUEST, "No namespace name found in request body"); } // FIXME: perform some sanity checks on the namespace string try (RepositoryConnection repositoryCon = RepositoryInterceptor.getRepositoryConnection(request)) { repositoryCon.setNamespace(prefix, namespace); } catch (RepositoryException e) { throw new ServerHTTPException("Repository error: " + e.getMessage(), e); } return new ModelAndView(EmptySuccessView.getInstance()); }
private ModelAndView getClearNamespacesResult(HttpServletRequest request, HttpServletResponse response) throws ServerHTTPException { try (RepositoryConnection repositoryCon = RepositoryInterceptor.getRepositoryConnection(request)) { try { repositoryCon.clearNamespaces(); } catch (RepositoryException e) { throw new ServerHTTPException("Repository error: " + e.getMessage(), e); } return new ModelAndView(EmptySuccessView.getInstance()); } } }
public void evaluate(TupleQueryResultHandler handler) throws QueryEvaluationException, TupleQueryResultHandlerException { SPARQLProtocolSession client = getHttpClient(); try { conn.flushTransactionState(Protocol.Action.QUERY); client.sendTupleQuery(queryLanguage, queryString, baseURI, dataset, includeInferred, getMaxExecutionTime(), handler, getBindingsArray()); } catch (IOException e) { throw new HTTPQueryEvaluationException(e.getMessage(), e); } catch (RepositoryException e) { throw new HTTPQueryEvaluationException(e.getMessage(), e); } catch (MalformedQueryException e) { throw new HTTPQueryEvaluationException(e.getMessage(), e); } } }
public void evaluate(RDFHandler handler) throws QueryEvaluationException, RDFHandlerException { SPARQLProtocolSession client = getHttpClient(); try { conn.flushTransactionState(Protocol.Action.QUERY); client.sendGraphQuery(queryLanguage, queryString, baseURI, dataset, includeInferred, getMaxExecutionTime(), handler, getBindingsArray()); } catch (IOException e) { throw new HTTPQueryEvaluationException(e.getMessage(), e); } catch (RepositoryException e) { throw new HTTPQueryEvaluationException(e.getMessage(), e); } catch (MalformedQueryException e) { throw new HTTPQueryEvaluationException(e.getMessage(), e); } } }
public boolean evaluate() throws QueryEvaluationException { SPARQLProtocolSession client = getHttpClient(); try { return client.sendBooleanQuery(queryLanguage, getQueryString(), baseURI, dataset, getIncludeInferred(), getMaxExecutionTime(), getBindingsArray()); } catch (IOException e) { throw new QueryEvaluationException(e.getMessage(), e); } catch (RepositoryException e) { throw new QueryEvaluationException(e.getMessage(), e); } catch (MalformedQueryException e) { throw new QueryEvaluationException(e.getMessage(), e); } }
public void evaluate(RDFHandler handler) throws QueryEvaluationException, RDFHandlerException { SPARQLProtocolSession client = getHttpClient(); try { client.sendGraphQuery(queryLanguage, getQueryString(), baseURI, dataset, getIncludeInferred(), getMaxExecutionTime(), handler, getBindingsArray()); } catch (IOException e) { throw new QueryEvaluationException(e.getMessage(), e); } catch (RepositoryException e) { throw new QueryEvaluationException(e.getMessage(), e); } catch (MalformedQueryException e) { throw new QueryEvaluationException(e.getMessage(), e); } }
public boolean evaluate() throws QueryEvaluationException { SPARQLProtocolSession client = getHttpClient(); try { return client.sendBooleanQuery(queryLanguage, getQueryString(), baseURI, dataset, getIncludeInferred(), getMaxExecutionTime(), getBindingsArray()); } catch (IOException e) { throw new QueryEvaluationException(e.getMessage(), e); } catch (RepositoryException e) { throw new QueryEvaluationException(e.getMessage(), e); } catch (MalformedQueryException e) { throw new QueryEvaluationException(e.getMessage(), e); } }
public TupleQueryResult evaluate() throws QueryEvaluationException { SPARQLProtocolSession client = getHttpClient(); try { return client.sendTupleQuery(QueryLanguage.SPARQL, getQueryString(), baseURI, dataset, getIncludeInferred(), getMaxExecutionTime(), getBindingsArray()); } catch (IOException e) { throw new QueryEvaluationException(e.getMessage(), e); } catch (RepositoryException e) { throw new QueryEvaluationException(e.getMessage(), e); } catch (MalformedQueryException e) { throw new QueryEvaluationException(e.getMessage(), e); } }
@Override public boolean evaluate() throws QueryEvaluationException { SPARQLProtocolSession client = getHttpClient(); try { return client.sendBooleanQuery(queryLanguage, getQueryString(), baseURI, dataset, getIncludeInferred(), getMaxExecutionTime(), getBindingsArray()); } catch (IOException e) { throw new QueryEvaluationException(e.getMessage(), e); } catch (RepositoryException e) { throw new QueryEvaluationException(e.getMessage(), e); } catch (MalformedQueryException e) { throw new QueryEvaluationException(e.getMessage(), e); } }
@Override public void evaluate(TupleQueryResultHandler handler) throws QueryEvaluationException, TupleQueryResultHandlerException { SPARQLProtocolSession client = getHttpClient(); try { client.sendTupleQuery(QueryLanguage.SPARQL, getQueryString(), baseURI, dataset, getIncludeInferred(), getMaxExecutionTime(), handler, getBindingsArray()); } catch (IOException e) { throw new QueryEvaluationException(e.getMessage(), e); } catch (RepositoryException e) { throw new QueryEvaluationException(e.getMessage(), e); } catch (MalformedQueryException e) { throw new QueryEvaluationException(e.getMessage(), e); } }
@Override public void evaluate(RDFHandler handler) throws QueryEvaluationException, RDFHandlerException { SPARQLProtocolSession client = getHttpClient(); try { client.sendGraphQuery(queryLanguage, getQueryString(), baseURI, dataset, getIncludeInferred(), getMaxExecutionTime(), handler, getBindingsArray()); } catch (IOException e) { throw new QueryEvaluationException(e.getMessage(), e); } catch (RepositoryException e) { throw new QueryEvaluationException(e.getMessage(), e); } catch (MalformedQueryException e) { throw new QueryEvaluationException(e.getMessage(), e); } }
public TupleQueryResult evaluate() throws QueryEvaluationException { SPARQLProtocolSession client = getHttpClient(); try { conn.flushTransactionState(Protocol.Action.QUERY); return client.sendTupleQuery(queryLanguage, queryString, baseURI, dataset, getIncludeInferred(), getMaxExecutionTime(), getBindingsArray()); } catch (IOException e) { throw new HTTPQueryEvaluationException(e.getMessage(), e); } catch (RepositoryException e) { throw new HTTPQueryEvaluationException(e.getMessage(), e); } catch (MalformedQueryException e) { throw new HTTPQueryEvaluationException(e.getMessage(), e); } }
public GraphQueryResult evaluate() throws QueryEvaluationException { SPARQLProtocolSession client = getHttpClient(); try { conn.flushTransactionState(Protocol.Action.QUERY); return client.sendGraphQuery(queryLanguage, queryString, baseURI, dataset, getIncludeInferred(), getMaxExecutionTime(), getBindingsArray()); } catch (IOException e) { throw new HTTPQueryEvaluationException(e.getMessage(), e); } catch (RepositoryException e) { throw new HTTPQueryEvaluationException(e.getMessage(), e); } catch (MalformedQueryException e) { throw new HTTPQueryEvaluationException(e.getMessage(), e); } }
private void actionClear(AjaxRequestTarget aTarget) { try { kbService.clear(kbModel.getObject().getKb()); info(getString("kb.details.local.contents.clear.feedback", kbModel.bind("kb"))); aTarget.add(this); aTarget.addChildren(getPage(), IFeedback.class); } catch (RepositoryException e) { error("Error clearing KB: " + e.getMessage()); log.error("Error clearing KB", e); aTarget.addChildren(getPage(), IFeedback.class); } }
public GraphQueryResult evaluate() throws QueryEvaluationException { SPARQLProtocolSession client = getHttpClient(); try { // TODO getQueryString() already inserts bindings, use emptybindingset // as last argument? return client.sendGraphQuery(queryLanguage, getQueryString(), baseURI, dataset, getIncludeInferred(), getMaxExecutionTime(), getBindingsArray()); } catch (IOException e) { throw new QueryEvaluationException(e.getMessage(), e); } catch (RepositoryException e) { throw new QueryEvaluationException(e.getMessage(), e); } catch (MalformedQueryException e) { throw new QueryEvaluationException(e.getMessage(), e); } }
public boolean evaluate() throws QueryEvaluationException { SPARQLProtocolSession client = getHttpClient(); try { conn.flushTransactionState(Protocol.Action.QUERY); return client.sendBooleanQuery(queryLanguage, queryString, baseURI, dataset, getIncludeInferred(), getMaxExecutionTime(), getBindingsArray()); } catch (IOException e) { throw new HTTPQueryEvaluationException(e.getMessage(), e); } catch (RepositoryException e) { throw new HTTPQueryEvaluationException(e.getMessage(), e); } catch (MalformedQueryException e) { throw new HTTPQueryEvaluationException(e.getMessage(), e); } } }
public void evaluate(RDFHandler handler) throws QueryEvaluationException, RDFHandlerException { SPARQLProtocolSession client = getHttpClient(); try { client.sendGraphQuery(queryLanguage, getQueryString(), baseURI, dataset, getIncludeInferred(), getMaxExecutionTime(), handler, getBindingsArray()); } catch (IOException e) { throw new QueryEvaluationException(e.getMessage(), e); } catch (RepositoryException e) { throw new QueryEvaluationException(e.getMessage(), e); } catch (MalformedQueryException e) { throw new QueryEvaluationException(e.getMessage(), e); } }
private void actionClear(AjaxRequestTarget aTarget) { try { kbService.clear(kbModel.getObject().getKb()); info(getString("kb.details.local.contents.clear.feedback", kbModel.bind("kb"))); aTarget.add(this); aTarget.addChildren(getPage(), IFeedback.class); } catch (RepositoryException e) { error("Error clearing KB: " + e.getMessage()); log.error("Error clearing KB", e); aTarget.addChildren(getPage(), IFeedback.class); } }