com.bigdata.relation
Class AbstractRelation<E>

java.lang.Object
  extended by com.bigdata.relation.AbstractResource<IRelation<E>>
      extended by com.bigdata.relation.AbstractRelation<E>
Type Parameters:
E - The generic type of the [E]lements of the relation.
All Implemented Interfaces:
IMutableRelation<E>, IMutableResource<IRelation<E>>, IRelation<E>, ILocatableResource<IRelation<E>>
Direct Known Subclasses:
FullTextIndex, LexiconRelation, MagicRelation, SPORelation

public abstract class AbstractRelation<E>
extends AbstractResource<IRelation<E>>
implements IMutableRelation<E>

Base class for IRelation and IMutableRelation impls.

Version:
$Id: AbstractRelation.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson
TODO:
It would be interesting to do a GOM relation with its secondary index support and the addition of clustered indices. We would then get efficient JOINs via the rules layer for free and a high-level query language could be mapped onto those JOINs.

Nested Class Summary
 
Nested classes/interfaces inherited from class com.bigdata.relation.AbstractResource
AbstractResource.Options
 
Field Summary
 
Fields inherited from class com.bigdata.relation.AbstractResource
log
 
Constructor Summary
protected AbstractRelation(IIndexManager indexManager, String namespace, Long timestamp, Properties properties)
           
 
Method Summary
 String getFQN(IKeyOrder<? extends E> keyOrder)
          The fully qualified name of the index.
 IIndex getIndex(IKeyOrder<? extends E> keyOrder)
          Return the index for the IKeyOrder the timestamp for this view of the relation.
 IIndex getIndex(String fqn)
          Return the named index using the timestamp for this view of the relation (core impl).
protected  IndexMetadata newIndexMetadata(String name)
          Factory for IndexMetadata.
 
Methods inherited from class com.bigdata.relation.AbstractResource
acquireExclusiveLock, create, destroy, getChunkCapacity, getChunkOfChunksCapacity, getChunkTimeout, getContainer, getContainerNamespace, getExecutorService, getFullyBufferedReadThreshold, getIndexManager, getMaxParallelSubqueries, getNamespace, getProperties, getProperty, getProperty, getTimestamp, isForceSerialExecution, isNestedSubquery, toString, unlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.bigdata.relation.IMutableRelation
delete, insert
 
Methods inherited from interface com.bigdata.relation.IRelation
getAccessPath, getElementClass, getExecutorService, getIndexManager, getIndexNames, newElement
 
Methods inherited from interface com.bigdata.relation.IMutableResource
create, destroy
 
Methods inherited from interface com.bigdata.relation.locator.ILocatableResource
getContainerNamespace, getNamespace, getTimestamp
 

Constructor Detail

AbstractRelation

protected AbstractRelation(IIndexManager indexManager,
                           String namespace,
                           Long timestamp,
                           Properties properties)
Method Detail

getFQN

public String getFQN(IKeyOrder<? extends E> keyOrder)
The fully qualified name of the index.

Parameters:
keyOrder - The natural index order.
Returns:
The index name.

getIndex

public IIndex getIndex(IKeyOrder<? extends E> keyOrder)
Return the index for the IKeyOrder the timestamp for this view of the relation.

Parameters:
keyOrder - The natural index order.
Returns:
The index -or- null iff the index does not exist as of the timestamp for this view of the relation.
See Also:
FIXME For efficiency the concrete implementations need to override this saving a hard reference to the index and then using a switch like construct to return the correct hard reference. This behavior should be encapsulated.

getIndex

public IIndex getIndex(String fqn)
Return the named index using the timestamp for this view of the relation (core impl).

While both the IBigdataFederation imposes the ConcurrencyManager on all access to a named index, neither the Journal nor the TemporaryRawStore does this. Therefore this method encapsulates the unisolated index for the latter classes in order to impose the correct concurrency constraints. It does this using an UnisolatedReadWriteIndex. This allows the caller to use the returned index view without regard to concurrency controls (it will appear to be a thread-safe object).

Parameters:
fqn - The fully qualified name of the index.
Returns:
The named index -or- null iff the named index does not exist as of that timestamp.
Throws:
IllegalArgumentException - if name is null.
TODO:
hard references to the indices must be dropped when an abort is processed. this is a bit awkward. the abort() could be raised into the relation container (it is for the AbstractTripleStore) and into the relation itself to facilitate this. alternatively the index objects themselves could be notified of an abort and make themselves invalid (this really only applies to the unisolated index and to indices isolated by a transaction).

newIndexMetadata

protected IndexMetadata newIndexMetadata(String name)
Factory for IndexMetadata.

Parameters:
name - The fully qualified index name.
Returns:
A new IndexMetadata object for that index.


Copyright © 2006-2009 SYSTAP, LLC. All Rights Reserved.