Set<String> indexSpecs = parseIndexSpecList(indexSpecStr); indexSpecs = parseIndexSpecList(indexSpecStr); initIndexes(indexSpecs); properties = loadProperties(propFile); checkVersion(); Set<String> indexSpecs = getIndexSpecs(); initIndexes(indexSpecs); processUncompletedTransaction(txnStatus); Set<String> reqIndexSpecs = parseIndexSpecList(indexSpecStr); reindex(indexSpecs, reqIndexSpecs); storeProperties(propFile);
logger.info("Detected uncompleted commit, trying to complete"); try { commit(); logger.info("Uncompleted commit completed successfully"); logger.info("Detected uncompleted rollback, trying to complete"); try { rollback(); logger.info("Uncompleted rollback completed successfully"); logger.info("Detected unfinished transaction, trying to roll back"); try { rollback(); logger.info("Unfinished transaction rolled back successfully"); logger.info("Read invalid or unknown transaction status, trying to roll back"); try { rollback(); logger.info( "Successfully performed a rollback for invalid or unknown transaction status");
/** * If an index exists by context - use it, otherwise return null. * * @param readTransaction * @return All triples sorted by context or null if no context index exists * @throws IOException */ public RecordIterator getAllTriplesSortedByContext(boolean readTransaction) throws IOException { if (readTransaction) { // Don't read removed statements return getAllTriplesSortedByContext(0, TripleStore.REMOVED_FLAG); } else { // Don't read added statements return getAllTriplesSortedByContext(0, TripleStore.ADDED_FLAG); } }
private RecordIterator getTriples(int subj, int pred, int obj, int context, int flags, int flagsMask) throws IOException { TripleIndex index = getBestIndex(subj, pred, obj, context); boolean doRangeSearch = index.getPatternScore(subj, pred, obj, context) > 0; return getTriplesUsingIndex(subj, pred, obj, context, flags, flagsMask, index, doRangeSearch); }
private RecordIterator getTriplesUsingIndex(int subj, int pred, int obj, int context, int flags, int flagsMask, TripleIndex index, boolean rangeSearch) { byte[] searchKey = getSearchKey(subj, pred, obj, context, flags); byte[] searchMask = getSearchMask(subj, pred, obj, context, flagsMask); if (rangeSearch) { // Use ranged search byte[] minValue = getMinValue(subj, pred, obj, context); byte[] maxValue = getMaxValue(subj, pred, obj, context); return index.getBTree().iterateRangedValues(searchKey, searchMask, minValue, maxValue); } else { // Use sequential scan return index.getBTree().iterateValues(searchKey, searchMask); } }
protected double cardinality(int subj, int pred, int obj, int context) throws IOException { TripleIndex index = getBestIndex(subj, pred, obj, context); BTree btree = index.btree; double rangeSize; if (index.getPatternScore(subj, pred, obj, context) == 0) { rangeSize = btree.getValueCountEstimate(); } else { byte[] minValue = getMinValue(subj, pred, obj, context); byte[] maxValue = getMaxValue(subj, pred, obj, context); rangeSize = btree.getValueCountEstimate(minValue, maxValue); } return rangeSize; }
private byte[] getSearchKey(int subj, int pred, int obj, int context, int flags) { return getData(subj, pred, obj, context, flags); }
return tripleStore.cardinality(subjID, predID, objID, contextID);
/** * Creates a new {@link NativeSailStore}. */ public NativeSailStore(File dataDir, String tripleIndexes, boolean forceSync, int valueCacheSize, int valueIDCacheSize, int namespaceCacheSize, int namespaceIDCacheSize) throws IOException, SailException { boolean initialized = false; try { namespaceStore = new NamespaceStore(dataDir); valueStore = new ValueStore(dataDir, forceSync, valueCacheSize, valueIDCacheSize, namespaceCacheSize, namespaceIDCacheSize); tripleStore = new TripleStore(dataDir, tripleIndexes, forceSync); initialized = true; } finally { if (!initialized) { close(); } } }
@Override public void close() throws SailException { try { try { if (namespaceStore != null) { namespaceStore.close(); } } finally { try { if (valueStore != null) { valueStore.close(); } } finally { if (tripleStore != null) { tripleStore.close(); } } } } catch (IOException e) { logger.warn("Failed to close store", e); throw new SailException(e); } }
tripleStore.commit();
private RecordIterator getTriplesUsingIndex(int subj, int pred, int obj, int context, int flags, int flagsMask, TripleIndex index, boolean rangeSearch) { byte[] searchKey = getSearchKey(subj, pred, obj, context, flags); byte[] searchMask = getSearchMask(subj, pred, obj, context, flagsMask); if (rangeSearch) { // Use ranged search byte[] minValue = getMinValue(subj, pred, obj, context); byte[] maxValue = getMaxValue(subj, pred, obj, context); return index.getBTree().iterateRangedValues(searchKey, searchMask, minValue, maxValue); } else { // Use sequential scan return index.getBTree().iterateValues(searchKey, searchMask); } }
protected double cardinality(int subj, int pred, int obj, int context) throws IOException { TripleIndex index = getBestIndex(subj, pred, obj, context); BTree btree = index.btree; double rangeSize; if (index.getPatternScore(subj, pred, obj, context) == 0) { rangeSize = btree.getValueCountEstimate(); } else { byte[] minValue = getMinValue(subj, pred, obj, context); byte[] maxValue = getMaxValue(subj, pred, obj, context); rangeSize = btree.getValueCountEstimate(minValue, maxValue); } return rangeSize; }
private RecordIterator getTriples(int subj, int pred, int obj, int context, int flags, int flagsMask) throws IOException { TripleIndex index = getBestIndex(subj, pred, obj, context); boolean doRangeSearch = index.getPatternScore(subj, pred, obj, context) > 0; return getTriplesUsingIndex(subj, pred, obj, context, flags, flagsMask, index, doRangeSearch); }
private byte[] getSearchKey(int subj, int pred, int obj, int context, int flags) { return getData(subj, pred, obj, context, flags); }
return tripleStore.cardinality(subjID, predID, objID, contextID);
/** * Creates a new {@link NativeSailStore}. */ public NativeSailStore(File dataDir, String tripleIndexes, boolean forceSync, int valueCacheSize, int valueIDCacheSize, int namespaceCacheSize, int namespaceIDCacheSize) throws IOException, SailException { boolean initialized = false; try { namespaceStore = new NamespaceStore(dataDir); valueStore = new ValueStore(dataDir, forceSync, valueCacheSize, valueIDCacheSize, namespaceCacheSize, namespaceIDCacheSize); tripleStore = new TripleStore(dataDir, tripleIndexes, forceSync); initialized = true; } finally { if (!initialized) { close(); } } }
@Override public void close() throws SailException { try { try { if (namespaceStore != null) { namespaceStore.close(); } } finally { try { if (valueStore != null) { valueStore.close(); } } finally { if (tripleStore != null) { tripleStore.close(); } } } } catch (IOException e) { logger.warn("Failed to close store", e); throw new SailException(e); } }
Set<String> indexSpecs = parseIndexSpecList(indexSpecStr); indexSpecs = parseIndexSpecList(indexSpecStr); initIndexes(indexSpecs); properties = loadProperties(propFile); checkVersion(); Set<String> indexSpecs = getIndexSpecs(); initIndexes(indexSpecs); processUncompletedTransaction(txnStatus); Set<String> reqIndexSpecs = parseIndexSpecList(indexSpecStr); reindex(indexSpecs, reqIndexSpecs); storeProperties(propFile);