/** * Overridden to use local cache of the index reference. */ @Override public IIndex getIndex(final IKeyOrder<? extends BigdataValue> keyOrder) { if (keyOrder == LexiconKeyOrder.ID2TERM) { return getId2TermIndex(); } else if (keyOrder == LexiconKeyOrder.TERM2ID) { return getTerm2IdIndex(); } else if (keyOrder == LexiconKeyOrder.BLOBS) { return getBlobsIndex(); } else { throw new AssertionError("keyOrder=" + keyOrder); } }
/** * Overridden to use local cache of the index reference. */ @Override public IIndex getIndex(final IKeyOrder<? extends BigdataValue> keyOrder) { if (keyOrder == LexiconKeyOrder.ID2TERM) { return getId2TermIndex(); } else if (keyOrder == LexiconKeyOrder.TERM2ID) { return getTerm2IdIndex(); } else if (keyOrder == LexiconKeyOrder.BLOBS) { return getBlobsIndex(); } else { throw new AssertionError("keyOrder=" + keyOrder); } }
/** * Shows some interesting details about the terms index. * * @param cxn The connection. */ public static void showLexiconIndexDetails(final BigdataSailConnection cxn) { final IIndex ndx = cxn.getTripleStore().getLexiconRelation().getBlobsIndex(); final IndexMetadata md = ndx.getIndexMetadata(); System.out.println("Lexicon:"); System.out.println(md.toString()); System.out.println(md.getTupleSerializer().toString()); }
/** * Shows some interesting details about the terms index. * * @param cxn The connection. */ public static void showLexiconIndexDetails(final BigdataSailConnection cxn) { final IIndex ndx = cxn.getTripleStore().getLexiconRelation().getBlobsIndex(); final IndexMetadata md = ndx.getIndexMetadata(); System.out.println("Lexicon:"); System.out.println(md.toString()); System.out.println(md.getTupleSerializer().toString()); }
/** * Visits all RDF {@link Value}s in the {@link LexiconKeyOrder#BLOBS} index * in {@link BlobIV} order (efficient index scan). */ @SuppressWarnings("unchecked") public Iterator<Value> blobsIterator() { final IIndex ndx = getBlobsIndex(); return new Striterator(ndx.rangeIterator(null, null, 0/* capacity */, IRangeQuery.VALS, null/* filter */)).addFilter(new Resolver() { private static final long serialVersionUID = 1L; protected Object resolve(final Object val) { return ((ITuple<?>) val).getObject(); } }); }
/** * Visits all RDF {@link Value}s in the {@link LexiconKeyOrder#BLOBS} index * in {@link BlobIV} order (efficient index scan). */ @SuppressWarnings("unchecked") public Iterator<Value> blobsIterator() { final IIndex ndx = getBlobsIndex(); return new Striterator(ndx.rangeIterator(null, null, 0/* capacity */, IRangeQuery.VALS, null/* filter */)).addFilter(new Resolver() { private static final long serialVersionUID = 1L; protected Object resolve(final Object val) { return ((ITuple<?>) val).getObject(); } }); }
/** * Override configuration - BLOBS index uses a non-default threashold. */ public void test_blobsSupport_nonDefaultBlobsIndexThresholdConfiguration() { final Properties p = new Properties(getProperties()); final int overrideThreshold = Integer.valueOf(AbstractTripleStore.Options.DEFAULT_BLOBS_THRESHOLD) * 2; p.setProperty(AbstractTripleStore.Options.BLOBS_THRESHOLD, Integer.toString(overrideThreshold)); final AbstractTripleStore store = getStore(p); try { final IIndex blobsIndex = store.getLexiconRelation().getBlobsIndex(); assertNotNull(blobsIndex); assertEquals(store.getLexiconRelation().getLexiconConfiguration().getBlobsThreshold(), overrideThreshold); } finally { store.__tearDownUnitTest(); } }
/** * Override configuration - BLOBS index uses a non-default threashold. */ public void test_blobsSupport_nonDefaultBlobsIndexThresholdConfiguration() { final Properties p = new Properties(getProperties()); final int overrideThreshold = Integer.valueOf(AbstractTripleStore.Options.DEFAULT_BLOBS_THRESHOLD) * 2; p.setProperty(AbstractTripleStore.Options.BLOBS_THRESHOLD, Integer.toString(overrideThreshold)); final AbstractTripleStore store = getStore(p); try { final IIndex blobsIndex = store.getLexiconRelation().getBlobsIndex(); assertNotNull(blobsIndex); assertEquals(store.getLexiconRelation().getLexiconConfiguration().getBlobsThreshold(), overrideThreshold); } finally { store.__tearDownUnitTest(); } }
/** * Override configuration - BLOBS index is disabled. */ public void test_blobsSupport_noBlobsIndexConfiguration() { final Properties p = new Properties(getProperties()); p.setProperty(AbstractTripleStore.Options.BLOBS_THRESHOLD, Integer.toString(Integer.MAX_VALUE)); final AbstractTripleStore store = getStore(p); try { try { // Note: Defined to throw an exception if the index does not exist. store.getLexiconRelation().getBlobsIndex(); fail("Expecting: " + IllegalStateException.class); } catch (IllegalStateException ex) { if (log.isInfoEnabled()) log.info("Ignoring expected exception: " + ex); } assertEquals(store.getLexiconRelation().getLexiconConfiguration().getBlobsThreshold(), Integer.MAX_VALUE); } finally { store.__tearDownUnitTest(); } }
/** * Override configuration - BLOBS index is disabled. */ public void test_blobsSupport_noBlobsIndexConfiguration() { final Properties p = new Properties(getProperties()); p.setProperty(AbstractTripleStore.Options.BLOBS_THRESHOLD, Integer.toString(Integer.MAX_VALUE)); final AbstractTripleStore store = getStore(p); try { try { // Note: Defined to throw an exception if the index does not exist. store.getLexiconRelation().getBlobsIndex(); fail("Expecting: " + IllegalStateException.class); } catch (IllegalStateException ex) { if (log.isInfoEnabled()) log.info("Ignoring expected exception: " + ex); } assertEquals(store.getLexiconRelation().getLexiconConfiguration().getBlobsThreshold(), Integer.MAX_VALUE); } finally { store.__tearDownUnitTest(); } }
/** * Default configuration - verify that BLOBS index exists. */ public void test_blobsSupport_defaultConfiguration() { final AbstractTripleStore store = getStore(); try { final IIndex blobsIndex = store.getLexiconRelation().getBlobsIndex(); assertNotNull(blobsIndex); assertEquals(store.getLexiconRelation().getLexiconConfiguration().getBlobsThreshold(), Integer.valueOf(AbstractTripleStore.Options.DEFAULT_BLOBS_THRESHOLD).intValue()); } finally { store.__tearDownUnitTest(); } }
/** * Default configuration - verify that BLOBS index exists. */ public void test_blobsSupport_defaultConfiguration() { final AbstractTripleStore store = getStore(); try { final IIndex blobsIndex = store.getLexiconRelation().getBlobsIndex(); assertNotNull(blobsIndex); assertEquals(store.getLexiconRelation().getLexiconConfiguration().getBlobsThreshold(), Integer.valueOf(AbstractTripleStore.Options.DEFAULT_BLOBS_THRESHOLD).intValue()); } finally { store.__tearDownUnitTest(); } }
@Override final public long getTermCount() { long rangeCount = 0L; rangeCount += getLexiconRelation().getTerm2IdIndex().rangeCount(); IIndex blobsIndex = null; try { blobsIndex = getLexiconRelation().getBlobsIndex(); rangeCount += blobsIndex.rangeCount(); } catch(IllegalStateException ex) { // No blobs index. fall through } // rangeCount += getLexiconRelation().getBlobsIndex().rangeCount(); return rangeCount; }
@Override final public long getTermCount() { long rangeCount = 0L; rangeCount += getLexiconRelation().getTerm2IdIndex().rangeCount(); IIndex blobsIndex = null; try { blobsIndex = getLexiconRelation().getBlobsIndex(); rangeCount += blobsIndex.rangeCount(); } catch(IllegalStateException ex) { // No blobs index. fall through } // rangeCount += getLexiconRelation().getBlobsIndex().rangeCount(); return rangeCount; }
/** * Override configuration - BLOBS index uses a non-default threashold. */ public void test_blobsSupport_nonDefaultBlobsIndexThresholdConfiguration() { final Properties p = new Properties(getProperties()); final int overrideThreshold = Integer.valueOf(AbstractTripleStore.Options.DEFAULT_BLOBS_THRESHOLD) * 2; p.setProperty(AbstractTripleStore.Options.BLOBS_THRESHOLD, Integer.toString(overrideThreshold)); final AbstractTripleStore store = getStore(p); try { final IIndex blobsIndex = store.getLexiconRelation().getBlobsIndex(); assertNotNull(blobsIndex); assertEquals(store.getLexiconRelation().getLexiconConfiguration().getBlobsThreshold(), overrideThreshold); } finally { store.__tearDownUnitTest(); } }
/** * Override configuration - BLOBS index is disabled. */ public void test_blobsSupport_noBlobsIndexConfiguration() { final Properties p = new Properties(getProperties()); p.setProperty(AbstractTripleStore.Options.BLOBS_THRESHOLD, Integer.toString(Integer.MAX_VALUE)); final AbstractTripleStore store = getStore(p); try { try { // Note: Defined to throw an exception if the index does not exist. store.getLexiconRelation().getBlobsIndex(); fail("Expecting: " + IllegalStateException.class); } catch (IllegalStateException ex) { if (log.isInfoEnabled()) log.info("Ignoring expected exception: " + ex); } assertEquals(store.getLexiconRelation().getLexiconConfiguration().getBlobsThreshold(), Integer.MAX_VALUE); } finally { store.__tearDownUnitTest(); } }
/** * Default configuration - verify that BLOBS index exists. */ public void test_blobsSupport_defaultConfiguration() { final AbstractTripleStore store = getStore(); try { final IIndex blobsIndex = store.getLexiconRelation().getBlobsIndex(); assertNotNull(blobsIndex); assertEquals(store.getLexiconRelation().getLexiconConfiguration().getBlobsThreshold(), Integer.valueOf(AbstractTripleStore.Options.DEFAULT_BLOBS_THRESHOLD).intValue()); } finally { store.__tearDownUnitTest(); } }
private BigdataValue __getBlob(final BlobIV<?> iv) { final IIndex ndx = getBlobsIndex();
private BigdataValue __getBlob(final BlobIV<?> iv) { final IIndex ndx = getBlobsIndex();
blobsIndex = getLexiconRelation().getBlobsIndex(); rangeCount += blobsIndex.rangeCount(fromKey, toKey); } catch(IllegalStateException ex) {