@Override @SuppressWarnings("rawtypes") public DefaultResourceLocator getResourceLocator() { return (DefaultResourceLocator) getLocalIndexManager() .getResourceLocator(); }
@Override @SuppressWarnings("rawtypes") public DefaultResourceLocator getResourceLocator() { return (DefaultResourceLocator) getLocalIndexManager() .getResourceLocator(); }
@Override public IResourceLocator<?> getResourceLocator() { return delegate.getResourceLocator(); }
@Override public IResourceLocator<?> getResourceLocator() { return delegate.getResourceLocator(); }
/** * {@link ITx#READ_COMMITTED} view. */ public BigdataFileSystem getReadCommitted() { if (INFO) log.info(""); return (BigdataFileSystem) indexManager.getResourceLocator().locate( GLOBAL_FILE_SYSTEM_NAMESPACE, ITx.READ_COMMITTED); }
/** * {@link ITx#READ_COMMITTED} view. */ public BigdataFileSystem getReadCommitted() { if (INFO) log.info(""); return (BigdataFileSystem) indexManager.getResourceLocator().locate( GLOBAL_FILE_SYSTEM_NAMESPACE, ITx.READ_COMMITTED); }
/** * Return true iff the namespace exists at the moment when this check is * performed. * <p> * Note: It is not possible to use this with any guarantees that the namespace * still exists once control is returned to the caller unless the caller is * holding an unisolated connection. * * @see BLZG-2041 (BigdataSail should not locate the AbstractTripleStore until a connection is requested) */ public boolean exists() { // Attempt to resolve the namespace. return indexManager.getResourceLocator().locate(namespace, ITx.UNISOLATED) != null; }
/** * Return true iff the namespace exists at the moment when this check is * performed. * <p> * Note: It is not possible to use this with any guarantees that the namespace * still exists once control is returned to the caller unless the caller is * holding an unisolated connection. * * @see BLZG-2041 (BigdataSail should not locate the AbstractTripleStore until a connection is requested) */ public boolean exists() { // Attempt to resolve the namespace. return indexManager.getResourceLocator().locate(namespace, ITx.UNISOLATED) != null; }
/** * Return a read-only view of the {@link AbstractTripleStore} for the given * namespace will read from the commit point associated with the given * timestamp. * * @param namespace * The namespace. * @param timestamp * The timestamp. * * @return The {@link AbstractTripleStore} -or- <code>null</code> if none is * found for that namespace and timestamp. */ private AbstractTripleStore getTripleStore( final IIndexManager indexManager, final String namespace, final long timestamp) { // resolve the default namespace. final AbstractTripleStore tripleStore = (AbstractTripleStore) indexManager .getResourceLocator().locate(namespace, timestamp); return tripleStore; }
/** * 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(); }
private AbstractTripleStore resolveKB() { long timestamp = this.timestamp; if (timestamp == ITx.READ_COMMITTED) { /** * Note: This code is request the view as of the the last commit * time. If we use ITx.READ_COMMITTED here then it will cause * the Journal to provide us with a ReadCommittedIndex and that * has a synchronization hot spot! */ timestamp = indexManager.getLastCommitTime(); } final AbstractTripleStore kb = (AbstractTripleStore) indexManager .getResourceLocator().locate(namespace, timestamp); if (kb == null) { throw new RuntimeException("Not found: namespace=" + namespace + ", timestamp=" + TimestampUtility.toString(timestamp)); } return kb; }
private AbstractTripleStore resolveKB() { long timestamp = this.timestamp; if (timestamp == ITx.READ_COMMITTED) { /** * Note: This code is request the view as of the the last commit * time. If we use ITx.READ_COMMITTED here then it will cause * the Journal to provide us with a ReadCommittedIndex and that * has a synchronization hot spot! */ timestamp = indexManager.getLastCommitTime(); } final AbstractTripleStore kb = (AbstractTripleStore) indexManager .getResourceLocator().locate(namespace, timestamp); if (kb == null) { throw new RuntimeException("Not found: namespace=" + namespace + ", timestamp=" + TimestampUtility.toString(timestamp)); } return kb; }
@SuppressWarnings("unchecked") private void getWriteRelations(IIndexManager indexManager, IStep p, Map<String, IRelation> c, long timestamp) { if (p.isRule()) { final IRule r = (IRule) p; final String relationIdentifier = r.getHead().getOnlyRelationName(); if (!c.containsKey(relationIdentifier)) { final IRelation relation = (IRelation) indexManager .getResourceLocator().locate(relationIdentifier, timestamp); c.put(relationIdentifier, relation); } } else { final Iterator<IStep> itr = ((IProgram)p).steps(); while (itr.hasNext()) { getWriteRelations(indexManager, itr.next(), c, timestamp); } } }
@SuppressWarnings("unchecked") private void getWriteRelations(IIndexManager indexManager, IStep p, Map<String, IRelation> c, long timestamp) { if (p.isRule()) { final IRule r = (IRule) p; final String relationIdentifier = r.getHead().getOnlyRelationName(); if (!c.containsKey(relationIdentifier)) { final IRelation relation = (IRelation) indexManager .getResourceLocator().locate(relationIdentifier, timestamp); c.put(relationIdentifier, relation); } } else { final Iterator<IStep> itr = ((IProgram)p).steps(); while (itr.hasNext()) { getWriteRelations(indexManager, itr.next(), c, timestamp); } } }
final synchronized public LexiconRelation getLexiconRelation() { if (lexiconRelation == null) { long t = getTimestamp(); if (TimestampUtility.isReadWriteTx(t)) { /* * A read-write tx must use the unisolated view of the lexicon. */ t = ITx.UNISOLATED; } // lexicon namespace, since this index is inside the lexicon final String ns = getNamespace(); if (log.isDebugEnabled()) log.debug(ns); lexiconRelation = (LexiconRelation) getIndexManager() .getResourceLocator().locate(ns, t); } return lexiconRelation; } private LexiconRelation lexiconRelation;
final synchronized public LexiconRelation getLexiconRelation() { if (lexiconRelation == null) { long t = getTimestamp(); if (TimestampUtility.isReadWriteTx(t)) { /* * A read-write tx must use the unisolated view of the lexicon. */ t = ITx.UNISOLATED; } // lexicon namespace, since this index is inside the lexicon final String ns = getNamespace(); if (log.isDebugEnabled()) log.debug(ns); lexiconRelation = (LexiconRelation) getIndexManager() .getResourceLocator().locate(ns, t); } return lexiconRelation; } private LexiconRelation lexiconRelation;
/** * Return a read-only view of the {@link AbstractTripleStore} for the given * namespace will read from the commit point associated with the given * timestamp. * * @param namespace * The namespace. * @param timestamp * The timestamp. * * @return The {@link AbstractTripleStore} -or- <code>null</code> if none is * found for that namespace and timestamp. */ private AbstractTripleStore getTripleStore( final IIndexManager indexManager, final String namespace, final long timestamp) { // resolve the default namespace. final AbstractTripleStore tripleStore = (AbstractTripleStore) indexManager .getResourceLocator().locate(namespace, timestamp); return tripleStore; }
/** * Locate and return the view of the identified relation. * * @param namespace * The namespace of the relation. * @param timestamp * The timestamp of the view of that relation. * * @return The {@link ILocatableResource} -or- <code>null</code> if the * relation did not exist for that timestamp. */ public ILocatableResource<?> getResource(final String namespace, final long timestamp) { /* * Note: This uses the federation as the index manager when locating a * resource for scale-out since that let's us look up the relation in * the global row store, which is being used as a catalog. */ final IIndexManager tmp = getFederation() == null ? getIndexManager() : getFederation(); return (ILocatableResource<?>) tmp.getResourceLocator().locate( namespace, timestamp); }
/** * 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;