com.bigdata.relation
Class RelationFusedView<E>

java.lang.Object
  extended by com.bigdata.relation.RelationFusedView<E>
Type Parameters:
E -
All Implemented Interfaces:
IRelation<E>, ILocatableResource<IRelation<E>>

public class RelationFusedView<E>
extends Object
implements IRelation<E>

A factory for fused views reading from both of the source IRelations.

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

Constructor Summary
RelationFusedView(IRelation<E> relation1, IRelation<E> relation2)
           
 
Method Summary
 IAccessPath<E> getAccessPath(IPredicate<E> predicate)
          Return the best IAccessPath for a relation given a predicate with zero or more unbound variables.
 String getContainerNamespace()
          Not implemented for a fused view.
 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 first relation in the view.
 Set<String> getIndexNames()
          Return the fully qualified name of each index maintained by this relation.
 String getNamespace()
          Not implemented for a fused view.
 IRelation<E> getRelation1()
           
 IRelation<E> getRelation2()
           
 long getTimestamp()
          Not implemented for a fused view.
 E newElement(IPredicate<E> predicate, IBindingSet bindingSet)
          Create and return a new element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RelationFusedView

public RelationFusedView(IRelation<E> relation1,
                         IRelation<E> relation2)
Parameters:
relation1 -
relation2 -
Method Detail

getRelation1

public IRelation<E> getRelation1()

getRelation2

public IRelation<E> getRelation2()

getAccessPath

public IAccessPath<E> getAccessPath(IPredicate<E> predicate)
Description copied from interface: IRelation
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.

Specified by:
getAccessPath in interface IRelation<E>
Parameters:
predicate - The constraint on the elements to be visited.
Returns:
The best IAccessPath for that IPredicate.

getIndexNames

public Set<String> getIndexNames()
Description copied from interface: IRelation
Return the fully qualified name of each index maintained by this relation.

Specified by:
getIndexNames in interface IRelation<E>
Returns:
An immutable set of the index names for the relation.

getExecutorService

public ExecutorService getExecutorService()
Description copied from interface: IRelation
The service used to run asynchronous or parallel tasks for the IRelation.

Specified by:
getExecutorService in interface IRelation<E>

newElement

public E newElement(IPredicate<E> predicate,
                    IBindingSet bindingSet)
Description copied from interface: IRelation
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.

Specified by:
newElement in interface IRelation<E>
Parameters:
predicate - The predicate that is the head of some IRule.
bindingSet - A set of bindings for that IRule.
Returns:
The new element.

getElementClass

public Class<E> getElementClass()
Description copied from interface: IRelation
Return the class for the generic type of this relation. This information is used to dynamically create arrays of that generic type.

Specified by:
getElementClass in interface IRelation<E>

getIndexManager

public IIndexManager getIndexManager()
The IIndexManager for the first relation in the view.

Specified by:
getIndexManager in interface IRelation<E>

getTimestamp

public long getTimestamp()
Not implemented for a fused view. (The elements of the view can have different timestamps - this is especially true when one is a TemporaryStore.)

Specified by:
getTimestamp in interface ILocatableResource<IRelation<E>>
Throws:
UnsupportedOperationException - always.

getNamespace

public String getNamespace()
Not implemented for a fused view.

Specified by:
getNamespace in interface ILocatableResource<IRelation<E>>
Throws:
UnsupportedOperationException - always.

getContainerNamespace

public String getContainerNamespace()
Not implemented for a fused view.

Specified by:
getContainerNamespace in interface ILocatableResource<IRelation<E>>
Returns:
The identifier of the containing resource -or- null if there is no containing resource.
Throws:
UnsupportedOperationException - always.


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