private RecordIterator getAllTriplesSortedByContext(int flags, int flagsMask) throws IOException { for (TripleIndex index : indexes) { if (index.getFieldSeq()[0] == 'c') { // found a context-first index return getTriplesUsingIndex(-1, -1, -1, -1, flags, flagsMask, index, false); } } return null; }
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); }
public int removeTriples(int subj, int pred, int obj, int context) throws IOException { RecordIterator iter = getTriples(subj, pred, obj, context, 0, 0); return removeTriples(iter); }
public ValueStore(File dataDir, boolean forceSync, int valueCacheSize, int valueIDCacheSize, int namespaceCacheSize, int namespaceIDCacheSize) throws IOException { super(); dataStore = new DataStore(dataDir, FILENAME_PREFIX, forceSync); valueCache = new ConcurrentCache<Integer, NativeValue>(valueCacheSize); valueIDCache = new ConcurrentCache<NativeValue, Integer>(valueIDCacheSize); namespaceCache = new ConcurrentCache<Integer, String>(namespaceCacheSize); namespaceIDCache = new ConcurrentCache<String, Integer>(namespaceIDCacheSize); setNewRevision(); }
public TripleIndex(String fieldSeq) throws IOException { tripleComparator = new TripleComparator(fieldSeq); btree = new BTree(dir, getFilenamePrefix(fieldSeq), 2048, RECORD_LENGTH, tripleComparator, forceSync); }
@Override public SailSource getInferredSailSource() { if (isIsolationDisabled()) { // no isolation, use NativeSailStore directly return master.getInferredSailSource(); } else { return super.getInferredSailSource(); } } };
public RecordIterator getTriples(int subj, int pred, int obj, int context) throws IOException { // Return all triples except those that were added but not yet committed return getTriples(subj, pred, obj, context, 0, ADDED_FLAG); }
@Override protected void removeFilteredTermIteration(Iterator<Statement> iter, Resource subj, IRI pred, Value obj, Resource... contexts) { MemoryOverflowModel.this.removeTermIteration(iter, subj, pred, obj, contexts); } };
protected TripleIndex getBestIndex(int subj, int pred, int obj, int context) { int bestScore = -1; TripleIndex bestIndex = null; for (TripleIndex index : indexes) { int score = index.getPatternScore(subj, pred, obj, context); if (score > bestScore) { bestScore = score; bestIndex = index; } } return bestIndex; }
/** * Creates a new revision object for this value store, invalidating any IDs cached in NativeValue objects * that were created by this value store. */ private void setNewRevision() { revision = new ValueStoreRevision(this); }
@Override protected void removeFilteredTermIteration(Iterator<Statement> iter, Resource subj, IRI pred, Value obj, Resource... contexts) { SailSourceModel.this.removeTermIteration(iter, subj, pred, obj, contexts); } };
@Override public SailSink sink(IsolationLevel level) throws SailException { return new NativeSailSink(explicit); }
@Override public void clear(Resource... contexts) throws SailException { removeStatements(null, null, null, explicit, contexts); }
public void sync() throws IOException { if (contentsChanged) { // Flush the changes to disk writeNamespacesToFile(); contentsChanged = false; } }
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 getAllTriplesSortedByContext(int flags, int flagsMask) throws IOException { for (TripleIndex index : indexes) { if (index.getFieldSeq()[0] == 'c') { // found a context-first index return getTriplesUsingIndex(-1, -1, -1, -1, flags, flagsMask, index, false); } } return null; }
public RecordIterator getTriples(int subj, int pred, int obj, int context, boolean readTransaction) throws IOException { if (readTransaction) { // Don't read removed statements return getTriples(subj, pred, obj, context, 0, TripleStore.REMOVED_FLAG); } else { // Don't read added statements return getTriples(subj, pred, obj, context, 0, TripleStore.ADDED_FLAG); } }
@Override protected void removeFilteredTermIteration(Iterator<Statement> iter, Resource subj, IRI pred, Value obj, Resource... contexts) { MemoryOverflowModel.this.removeTermIteration(iter, subj, pred, obj, contexts); } };
protected TripleIndex getBestIndex(int subj, int pred, int obj, int context) { int bestScore = -1; TripleIndex bestIndex = null; for (TripleIndex index : indexes) { int score = index.getPatternScore(subj, pred, obj, context); if (score > bestScore) { bestScore = score; bestIndex = index; } } return bestIndex; }
/** * Creates a new revision object for this value store, invalidating any IDs cached in NativeValue objects * that were created by this value store. */ private void setNewRevision() { revision = new ValueStoreRevision(this); }