com.bigdata.relation
Interface IRelation<E>

All Superinterfaces:
ILocatableResource<IRelation<E>>
All Known Subinterfaces:
IMutableRelation<E>
All Known Implementing Classes:
AbstractRelation, FullTextIndex, LexiconRelation, MagicRelation, RelationFusedView, SPORelation

public interface IRelation<E>
extends ILocatableResource<IRelation<E>>

An abstraction corresponding to a set of elements using some schema (think a table containing a set of rows). Each relation is backed by one or more indices and knows how to return the IAccessPath that is most efficient given an IPredicate expressing a query against the IRelation.

Version:
$Id: IRelation.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson

Method Summary
 IAccessPath<E> getAccessPath(IPredicate<E> predicate)
          Return the best IAccessPath for a relation given a predicate with zero or more unbound variables.
 Class<E> getElementClass()
          Return the class for the generic type of this relation.
 ExecutorService getExecutorService()
          The service used to run asynchronous or parallel tasks for the IRelation.
 IIndexManager getIndexManager()
          The IIndexManager for the IRelation.
 Set<String> getIndexNames()
          Return the fully qualified name of each index maintained by this relation.
 E newElement(IPredicate<E> predicate, IBindingSet bindingSet)
          Create and return a new element.
 
Methods inherited from interface com.bigdata.relation.locator.ILocatableResource
getContainerNamespace, getNamespace, getTimestamp
 

Method Detail

getIndexManager

IIndexManager getIndexManager()
The IIndexManager for the IRelation.


getExecutorService

ExecutorService getExecutorService()
The service used to run asynchronous or parallel tasks for the IRelation.


getAccessPath

IAccessPath<E> getAccessPath(IPredicate<E> predicate)
Return the best IAccessPath for a relation given a predicate with zero or more unbound variables.

If there is an IIndex that directly corresponeds to the natural order implied by the variable pattern on the predicate then the access path should use that index. Otherwise you should choose the best index given the constraints and make sure that the IAccessPath incorporates additional filters that will allow you to filter out the irrelevant ITuples during the scan - this is very important when the index is remote!

If there are any IElementFilters then the access path MUST incorporate those constraints such that only elements that satisify the constraints may be visited.

Whether the constraints arise because of the lack of a perfect index for the access path or because they were explicitly specified for the IPredicate, those constraints should be translated into constraints imposed on the underlying ITupleIterator and sent with it to be evaluated local to the data.

Note: Filters should be specified when the IAccessPath is constructed so that they will be evalated on the data service rather than materializing the elements and then filtering then. This can be accomplished by adding the filter as a constraint on the predicate when specifying the access path.

Parameters:
predicate - The constraint on the elements to be visited.
Returns:
The best IAccessPath for that IPredicate.

getIndexNames

Set<String> getIndexNames()
Return the fully qualified name of each index maintained by this relation.

Returns:
An immutable set of the index names for the relation.

newElement

E newElement(IPredicate<E> predicate,
             IBindingSet bindingSet)
Create and return a new element. The element is constructed from the predicate given the bindings. Typically, this is used when generating an ISolution for an IRule during either a query or mutation operations. The element is NOT inserted into the relation.

Parameters:
predicate - The predicate that is the head of some IRule.
bindingSet - A set of bindings for that IRule.
Returns:
The new element.
Throws:
IllegalArgumentException - if any parameter is null.
IllegalStateException - if the predicate is not fully bound given those bindings.

getElementClass

Class<E> getElementClass()
Return the class for the generic type of this relation. This information is used to dynamically create arrays of that generic type.



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