|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.relation.rule.Program
public class Program
Mutable program may be used to create a variety of rule executions.
| Field Summary | |
|---|---|
protected static org.apache.log4j.Logger |
log
|
| Constructor Summary | |
|---|---|
|
Program(String name,
boolean parallel)
An empty program. |
protected |
Program(String name,
boolean parallel,
boolean closure)
An empty program. |
|
Program(String name,
boolean parallel,
IQueryOptions queryOptions)
An empty program. |
| Method Summary | |
|---|---|
void |
addClosureOf(IRule rule)
Adds a sub-program consisting of the fixed point closure of the given rule. |
void |
addClosureOf(IRule[] rules)
Adds a sub-program consisting of the fixed point closure of the given rules. |
void |
addStep(IStep step)
Add another step in the program. |
void |
addSteps(Iterator<? extends IStep> steps)
Adds the steps to the program. |
String |
getName()
The name of the program. |
IQueryOptions |
getQueryOptions()
Return additional constraints that must be imposed during query evaluation. |
boolean |
isClosure()
true iff the fixed point closure of the IProgram
should be computed. |
boolean |
isParallel()
true iff the IProgram.steps() MAY be executed in parallel. |
boolean |
isRule()
true iff the step is an IRule and
false iff the step is an IProgram. |
int |
stepCount()
The #of steps in the program (non-recursive). |
Iterator<IStep> |
steps()
The sequence of sub-program ISteps. |
IStep[] |
toArray()
An array containing the steps in the program (non-recursive). |
String |
toString()
A human readable representation of the IStep. |
protected StringBuilder |
toString(int depth)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final transient org.apache.log4j.Logger log
| Constructor Detail |
|---|
public Program(String name,
boolean parallel)
name - A label for the program.parallel - true iff the steps in the program are
parallelizable (this does not imply that they will be executed
in parallel, only that they do not have dependencies among the
steps and hence are in principle parallelizable).
public Program(String name,
boolean parallel,
IQueryOptions queryOptions)
name - A label for the program.parallel - true iff the steps in the program are
parallelizable (this does not imply that they will be executed
in parallel, only that they do not have dependencies among the
steps and hence are in principle parallelizable).queryOptions - Options that will be imposed if the iprogram is evaluated as a
query.
protected Program(String name,
boolean parallel,
boolean closure)
name - A label for the program.parallel - true iff the steps in the program are
parallelizable (this does not imply that they will be executed
in parallel, only that they do not have dependencies among the
steps and hence are in principle parallelizable).closure - true iff the steps in the program must be run
until a fixed point is achieved.| Method Detail |
|---|
public String getName()
IStep
getName in interface ISteppublic final boolean isRule()
ISteptrue iff the step is an IRule and
false iff the step is an IProgram.
isRule in interface ISteppublic boolean isParallel()
IProgramtrue iff the IProgram.steps() MAY be executed in parallel.
When false the steps WILL be executed sequentially and
(for mutation) the buffered writes will be flushed after each step.
Note: Sequential execution of a program makes a multi-IRule
program MUCH easier to debug as the rules are executed one by one and the
buffer is flushed after each rule so you can directly see the #of
elements consider by the IRule for each IPredicate in the
tail and the #of ISolutions generated by the IRule.
isParallel in interface IProgrampublic boolean isClosure()
IProgramtrue iff the fixed point closure of the IProgram
should be computed.
Note: Closure is computed in rounds. The rounds continue until the
IMutableRelation(s) on which the steps are writing reach a fixed
point (no new solutions are added to the relation(s) within a given
round). If a program has a fixed point, then the same closure will be
obtained by either sequential or parallel execution of the steps within
each round and in general parallel execution of the steps is perferred as
it has better performance. However, the steps MAY be executed
sequentially to facilitate debugging.
isClosure in interface IProgrampublic IQueryOptions getQueryOptions()
IStep
getQueryOptions in interface ISteppublic int stepCount()
IProgram
stepCount in interface IProgrampublic Iterator<IStep> steps()
IProgramISteps.
steps in interface IProgrampublic IStep[] toArray()
IProgram
toArray in interface IProgrampublic void addStep(IStep step)
step - The step.public void addSteps(Iterator<? extends IStep> steps)
steps - The steps.public void addClosureOf(IRule[] rules)
rules - The rules.
IllegalArgumentException - if rules or any element of rules is
null.
IllegalStateException - if this program is parallel.public void addClosureOf(IRule rule)
rule - The rule.
IllegalArgumentException - if rule is null.
IllegalStateException - if this program is parallel.protected StringBuilder toString(int depth)
public String toString()
IStepIStep.
toString in interface ISteptoString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||