|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.deri.iris.rules.compiler.View
public class View
A view on a relation, which represents how an instance of a sub-goal interprets a relation.
Essentially, this class is an adaptor accepts tuples from a relation and attempts to term match every term in the relation with the corresponding term in the tuple in the sub-goal.
Therefore, the relation and the viewCriteria tuple must have the same arity. However, the output (a relation) will have an arity corresponding to the number of unique variables in the view criteria.
e.g. for this sub-goal: p( ?X, 'c', f(?Y), ?Y ) applied to this relation
1, 'c', f(3), 4
1, 'c', f(4), 4
2, 'b', f(5), 5
3, 'c', f(g(1)), g(1)
would filter and produce a view that appears as:
X Y
= =
1, 4
3, g(1)
| Constructor Summary | |
|---|---|
View(IRelation relation,
ITuple viewCriteria,
IEquivalentTerms equivalentTerms,
IRelationFactory relationFactory)
Constructor. |
|
View(IRelation relation,
ITuple viewCriteria,
IRelationFactory relationFactory)
Constructor. |
|
View(IRelation relation,
ITuple viewCriteria,
List<IVariable> variables,
boolean simple,
IEquivalentTerms equivalentTerms,
IRelationFactory relationFactory)
Kind of copy constructor. |
|
View(IRelation relation,
ITuple viewCriteria,
List<IVariable> variables,
boolean simple,
IRelationFactory relationFactory)
Kind of copy constructor. |
|
| Method Summary | |
|---|---|
boolean |
add(ITuple tuple)
Adding to a View does not make sense. |
boolean |
addAll(IRelation relation)
Adding to a View does not make sense. |
boolean |
contains(ITuple tuple)
|
ITuple |
get(int index)
Get a tuple at a specific index. |
boolean |
isSimple()
Indicates if the view is simple. |
static boolean |
isSimpleView(ITuple viewCriteria)
Determine of the view is simple. |
int |
size()
Get the current number of tuples in this relation. |
String |
toString()
|
List<IVariable> |
variables()
Get the output variables in order. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public View(IRelation relation,
ITuple viewCriteria,
IRelationFactory relationFactory)
relation - The relation to create the view over.viewCriteria - The criteria to filter with.
public View(IRelation relation,
ITuple viewCriteria,
IEquivalentTerms equivalentTerms,
IRelationFactory relationFactory)
relation - The relation to create the view over.viewCriteria - The criteria to filter with.equivalentTerms - The equivalent terms.
public View(IRelation relation,
ITuple viewCriteria,
List<IVariable> variables,
boolean simple,
IRelationFactory relationFactory)
relation - The viewed relation.viewCriteria - The view criteria.variables - The computed output variables.simple - Indicates of the view is simple (pass thorugh)
public View(IRelation relation,
ITuple viewCriteria,
List<IVariable> variables,
boolean simple,
IEquivalentTerms equivalentTerms,
IRelationFactory relationFactory)
relation - The viewed relation.viewCriteria - The view criteria.variables - The computed output variables.simple - Indicates of the view is simple (pass thorugh)equivalentTerms - The equivalent terms.| Method Detail |
|---|
public static boolean isSimpleView(ITuple viewCriteria)
viewCriteria - The vew criteria.
public boolean isSimple()
public List<IVariable> variables()
public boolean add(ITuple tuple)
add in interface IRelationtuple - The (unique) tuple to add.
RuntimeException - if this method is called.public boolean addAll(IRelation relation)
addAll in interface IRelationrelation - The relation containing tuples to add.
RuntimeException - if this method is called.public boolean contains(ITuple tuple)
contains in interface IRelationpublic ITuple get(int index)
IRelation
get in interface IRelationindex - The index of the tuple in the relation, 0 <= index < size().
public int size()
IRelation
size in interface IRelationpublic String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||