@Override protected void throwInterruptedException() throws SailException { throw new SailException("execution took too long"); } };
private boolean upgradeStore(File dataDir, String version) throws IOException, SailException { if (version == null) { // either a new store or a pre-2.8.2 store ValueStore valueStore = new ValueStore(dataDir); try { valueStore.checkConsistency(); return true; // good enough } catch (SailException e) { // valueStore is not consistent - possibly contains two entries for // string-literals with the same lexical value (e.g. "foo" and // "foo"^^xsd:string). Log an error and indicate upgrade should // not be executed. logger.error( "VALUE INCONSISTENCY: could not automatically upgrade native store to RDF 1.1-compatibility: {}. Failure to upgrade may result in inconsistent query results when comparing literal values.", e.getMessage()); return false; } finally { valueStore.close(); } } else { return false; // no upgrade needed } } }
@Override protected void finalize() throws Throwable { logger.debug("finalizing {}", dataDir); if (disk == this) { try { store.close(); } catch (SailException e) { logger.error(e.toString(), e); } finally { FileUtil.deltree(dataDir); dataDir = null; store = null; disk = null; } } super.finalize(); } };
@Override public TupleQueryResult evaluate() throws QueryEvaluationException { TupleExpr tupleExpr = getParsedQuery().getTupleExpr(); try { CloseableIteration<? extends BindingSet, QueryEvaluationException> bindingsIter; SailConnection sailCon = getSailConnection(); bindingsIter = sailCon.evaluate(tupleExpr, getActiveDataset(), getBindings(), getIncludeInferred()); bindingsIter = enforceMaxQueryTime(bindingsIter); return new TupleQueryResultImpl(new ArrayList<String>(tupleExpr.getBindingNames()), bindingsIter); } catch (SailException e) { throw new QueryEvaluationException(e.getMessage(), e); } }
@Override protected void finalize() throws Throwable { logger.debug("finalizing {}", dataDir); if (disk == this) { try { store.close(); } catch (SailException e) { logger.error(e.toString(), e); } finally { FileUtil.deltree(dataDir); dataDir = null; store = null; disk = null; } } super.finalize(); } };
@Override protected void throwInterruptedException() throws SailException { throw new SailException("execution took too long"); } };
@Override protected void initializeInternal() throws RepositoryException { try { sail.initialize(); } catch (SailLockedException e) { String l = e.getLockedBy(); String r = e.getRequestedBy(); String m = e.getMessage(); throw new RepositoryLockedException(l, r, m, e); } catch (SailException e) { throw new RepositoryException(e.getMessage(), e); } }
@Override protected void throwInterruptedException() throws SailException { throw new SailException("execution took too long"); } };
@Override public TupleQueryResult evaluate() throws QueryEvaluationException { TupleExpr tupleExpr = getParsedQuery().getTupleExpr(); try { CloseableIteration<? extends BindingSet, QueryEvaluationException> bindingsIter; SailConnection sailCon = getSailConnection(); bindingsIter = sailCon.evaluate(tupleExpr, getActiveDataset(), getBindings(), getIncludeInferred()); bindingsIter = enforceMaxQueryTime(bindingsIter); return new TupleQueryResultImpl(new ArrayList<String>(tupleExpr.getBindingNames()), bindingsIter); } catch (SailException e) { throw new QueryEvaluationException(e.getMessage(), e); } }
@Override protected void throwInterruptedException() throws SailException { throw new SailException("execution took too long"); } };
throw new QueryEvaluationException(e.getMessage(), e);
protected SailException causeIOException(IOException e) { return new SailException(e); } }
throw new QueryEvaluationException(e.getMessage(), e);
protected SailException causeIOException(IOException e) { return new SailException(e); } }
private void failOrWarn(String message) throws SailException { if (incompleteQueryFails) { throw new SailException("Invalid Text Query: " + message); } else { logger.warn(message); } }
public LiteralSearchStatementScanner(long startTime, Resource subj, IRI pred, String literalSearchQuery, Resource... contexts) throws SailException { super(startTime, subj, pred, null, contexts); if (elasticIndexURL == null || elasticIndexURL.length() == 0) { throw new SailException("ElasticSearch Index URL is not properly configured."); } this.literalSearchQuery = literalSearchQuery; }
private void failOrWarn(Exception exception) throws SailException { if (incompleteQueryFails) { throw exception instanceof SailException ? (SailException)exception : new SailException(exception); } else { logger.warn(exception.getMessage(), exception); } }
private Set<String> getIndexSpecs() throws SailException { String indexesStr = properties.getProperty(INDEXES_KEY); if (indexesStr == null) { throw new SailException(INDEXES_KEY + " missing in TripleStore's properties file"); } Set<String> indexSpecs = parseIndexSpecList(indexesStr); if (indexSpecs.isEmpty()) { throw new SailException("No " + INDEXES_KEY + " found in TripleStore's properties file"); } return indexSpecs; }
private Set<String> getIndexSpecs() throws SailException { String indexesStr = properties.getProperty(INDEXES_KEY); if (indexesStr == null) { throw new SailException(INDEXES_KEY + " missing in TripleStore's properties file"); } Set<String> indexSpecs = parseIndexSpecList(indexesStr); if (indexSpecs.isEmpty()) { throw new SailException("No " + INDEXES_KEY + " found in TripleStore's properties file"); } return indexSpecs; }
/** * Tries to obtain an exclusive write lock on this store. This method will block until either the lock is * obtained or an interrupt signal is received. * * @throws SailException * if the thread is interrupted while waiting to obtain the lock. */ void acquireExclusiveWriteLock() { if (exclusiveWriteLock.isHeldByCurrentThread()) { return; } try { exclusiveWriteLock.lockInterruptibly(); } catch (InterruptedException e) { throw new SailException(e); } }