/** * Constructor used to wrap an existing {@link AbstractTripleStore} * instance. * <p> * Note: Since BLZG-2041, this delegates through to the core constructor * which accepts (namespace, IIndexManager). * * @param database * The instance. */ public BigdataSail(final AbstractTripleStore database) { this(database, database.getIndexManager()); }
@Override public boolean isCluster() { return db.getIndexManager() instanceof IBigdataFederation<?>; }
/** * Constructor used to wrap an existing {@link AbstractTripleStore} * instance. * <p> * Note: Since BLZG-2041, this delegates through to the core constructor * which accepts (namespace, IIndexManager). * * @param database * The instance. */ public BigdataSail(final AbstractTripleStore database) { this(database, database.getIndexManager()); }
@Override public boolean isCluster() { return db.getIndexManager() instanceof IBigdataFederation<?>; }
/** * Return the object used to access the as-configured graph. */ private IGraphAccessor newGraphAccessor(final AbstractTripleStore kb) { /* * Use a read-only view (sampling depends on access to the BTree rather * than the ReadCommittedIndex). */ final BigdataGraphAccessor graphAccessor = new BigdataGraphAccessor( kb.getIndexManager(), kb.getNamespace(), kb .getIndexManager().getLastCommitTime()); return graphAccessor; }
/** * Core ctor. You must use this variant for a scale-out triple store. * <p> * To create a {@link BigdataSail} backed by an {@link IBigdataFederation} * use the {@link ScaleOutTripleStore} ctor and then * {@link AbstractTripleStore#create()} the triple store if it does not * exist. * <p> * Note: Since BLZG-2041, this delegates through to the core constructor * which accepts (namespace, IIndexManager). * * @param database * An existing {@link AbstractTripleStore}. * @param mainIndexManager * When <i>database</i> is a {@link TempTripleStore}, this is the * {@link IIndexManager} used to resolve the * {@link QueryEngine}. Otherwise it must be the same object as * the <i>database</i>. */ public BigdataSail(final AbstractTripleStore database, final IIndexManager mainIndexManager) { this(database.getNamespace(), database.getIndexManager(), mainIndexManager); }
/** * Return the object used to access the as-configured graph. */ private IGraphAccessor newGraphAccessor(final AbstractTripleStore kb) { /* * Use a read-only view (sampling depends on access to the BTree rather * than the ReadCommittedIndex). */ final BigdataGraphAccessor graphAccessor = new BigdataGraphAccessor( kb.getIndexManager(), kb.getNamespace(), kb .getIndexManager().getLastCommitTime()); return graphAccessor; }
protected TempTripleStore createTempTripleStore() { // log.info("creating temp triple store for owl:sameAs backchainer"); // System.err.println("creating temp triple store for owl:sameAs backchainer"); final Properties props = db.getProperties(); // do not store terms props.setProperty(AbstractTripleStore.Options.LEXICON, "false"); // only store the SPO index props.setProperty(AbstractTripleStore.Options.ONE_ACCESS_PATH, "true"); // @todo MikeP : test w/ SPO bloom filter enabled and see if this improves performance. props.setProperty(AbstractTripleStore.Options.BLOOM_FILTER, "false"); return new TempTripleStore(db.getIndexManager().getTempStore(), props, db); }
protected TempTripleStore createTempTripleStore() { // log.info("creating temp triple store for owl:sameAs backchainer"); // System.err.println("creating temp triple store for owl:sameAs backchainer"); final Properties props = db.getProperties(); // do not store terms props.setProperty(AbstractTripleStore.Options.LEXICON, "false"); // only store the SPO index props.setProperty(AbstractTripleStore.Options.ONE_ACCESS_PATH, "true"); // @todo MikeP : test w/ SPO bloom filter enabled and see if this improves performance. props.setProperty(AbstractTripleStore.Options.BLOOM_FILTER, "false"); return new TempTripleStore(db.getIndexManager().getTempStore(), props, db); }
/** * <strong>DO NOT INVOKE FROM APPLICATION CODE</strong> - this method * deletes the KB instance and destroys the backing database instance. It is * used to help tear down unit tests. */ final public void __tearDownUnitTest() { if(isOpen()) destroy(); getIndexManager().destroy(); }
/** * The {@link SPORelation} (triples and their access paths). */ final public SPORelation getSPORelation() { if (spoRelationRef.get() == null) { /* * Note: double-checked locking pattern (mostly non-blocking). Only * synchronized if not yet resolved. The AtomicReference is reused * as the monitor to serialize the resolution of the SPORelation in * order to have that operation not contend with any other part of * the API. */ synchronized (this) { if (spoRelationRef.get() == null) { spoRelationRef.set((SPORelation) getIndexManager() .getResourceLocator().locate( getNamespace() + "." + SPORelation.NAME_SPO_RELATION, getTimestamp())); } } } return spoRelationRef.get(); }
/** * <strong>DO NOT INVOKE FROM APPLICATION CODE</strong> - this method * deletes the KB instance and destroys the backing database instance. It is * used to help tear down unit tests. */ final public void __tearDownUnitTest() { if(isOpen()) destroy(); getIndexManager().destroy(); }
/** * The {@link SPORelation} (triples and their access paths). */ final public SPORelation getSPORelation() { if (spoRelationRef.get() == null) { /* * Note: double-checked locking pattern (mostly non-blocking). Only * synchronized if not yet resolved. The AtomicReference is reused * as the monitor to serialize the resolution of the SPORelation in * order to have that operation not contend with any other part of * the API. */ synchronized (this) { if (spoRelationRef.get() == null) { spoRelationRef.set((SPORelation) getIndexManager() .getResourceLocator().locate( getNamespace() + "." + SPORelation.NAME_SPO_RELATION, getTimestamp())); } } } return spoRelationRef.get(); }
@Override public ICloseableIterator<BindingSet> call( final BindingSet[] bindingSets) throws Exception { if (log.isInfoEnabled()) { log.info(bindingSets.length); log.info(Arrays.toString(bindingSets)); log.info(serviceParams); } final AbstractTripleStore tripleStore = createParams .getTripleStore(); final Future<TupleQueryResult> ft = AbstractApiTask.submitApiTask( tripleStore.getIndexManager(), new StoredQueryTask(tripleStore.getNamespace(), tripleStore .getTimestamp(), bindingSets)); try { final TupleQueryResult tupleQueryResult = ft.get(); return new Sesame2BigdataIterator<BindingSet, QueryEvaluationException>( tupleQueryResult); } finally { ft.cancel(true/* mayInterruptIfRunning */); } }
@Override public ICloseableIterator<BindingSet> call( final BindingSet[] bindingSets) throws Exception { if (log.isInfoEnabled()) { log.info(bindingSets.length); log.info(Arrays.toString(bindingSets)); log.info(serviceParams); } final AbstractTripleStore tripleStore = createParams .getTripleStore(); final Future<TupleQueryResult> ft = AbstractApiTask.submitApiTask( tripleStore.getIndexManager(), new StoredQueryTask(tripleStore.getNamespace(), tripleStore .getTimestamp(), bindingSets)); try { final TupleQueryResult tupleQueryResult = ft.get(); return new Sesame2BigdataIterator<BindingSet, QueryEvaluationException>( tupleQueryResult); } finally { ft.cancel(true/* mayInterruptIfRunning */); } }
@Override protected void setUp() throws Exception { super.setUp(); store = getStore(getProperties()); context = new BOpContextBase(null/* fed */, store.getIndexManager()); valueFactory = store.getValueFactory(); /* * Note: This needs to be an absolute URI. */ baseURI = "http://www.bigdata.com"; }
@Override protected void setUp() throws Exception { super.setUp(); store = getStore(getProperties()); context = new BOpContextBase(null/* fed */, store.getIndexManager()); valueFactory = store.getValueFactory(); /* * Note: This needs to be an absolute URI. */ baseURI = "http://www.bigdata.com"; }
/** * The {@link LexiconRelation} handles all things related to the indices * mapping RDF {@link Value}s onto internal 64-bit term identifiers. */ final synchronized public LexiconRelation getLexiconRelation() { if (lexiconRelation == null && lexicon) { long t = getTimestamp(); if (TimestampUtility.isReadWriteTx(t)) { /* * A read-write tx must use the unisolated view of the lexicon. */ t = ITx.UNISOLATED; } lexiconRelation = (LexiconRelation) getIndexManager() .getResourceLocator().locate( getNamespace() + "." + LexiconRelation.NAME_LEXICON_RELATION, t); } return lexiconRelation; } private LexiconRelation lexiconRelation;
/** * The {@link LexiconRelation} handles all things related to the indices * mapping RDF {@link Value}s onto internal 64-bit term identifiers. */ final synchronized public LexiconRelation getLexiconRelation() { if (lexiconRelation == null && lexicon) { long t = getTimestamp(); if (TimestampUtility.isReadWriteTx(t)) { /* * A read-write tx must use the unisolated view of the lexicon. */ t = ITx.UNISOLATED; } lexiconRelation = (LexiconRelation) getIndexManager() .getResourceLocator().locate( getNamespace() + "." + LexiconRelation.NAME_LEXICON_RELATION, t); } return lexiconRelation; } private LexiconRelation lexiconRelation;
@Override protected void setUp() throws Exception { super.setUp(); store = getStore(getProperties()); context = new BOpContextBase(null/* fed */, store.getIndexManager()); valueFactory = store.getValueFactory(); /* * Note: This needs to be an absolute URI. */ baseURI = "http://www.bigdata.com"; }