public interface IPredicate<E> extends BOp, Cloneable, Serializable
IAccessPath
.
The slots in the predicate corresponding to variables are named and those
names establish binding patterns access IPredicate
s. Access is
provided to slots by ordinal index regardless of whether or not they are
named variables.Modifier and Type | Interface and Description |
---|---|
static interface |
IPredicate.Annotations
Interface declaring well known annotations.
|
Modifier and Type | Method and Description |
---|---|
IPredicate<E> |
asBound(IBindingSet bindingSet)
Return a new instance in which all occurrences of the variable appearing
in the binding set have been replaced by their bound values.
|
Object |
asBound(int index,
IBindingSet bindingSet)
Extract the as bound value from the predicate.
|
Predicate<E> |
asBound(IVariable<?> var,
IConstant<?> val)
Return a new instance in which all occurrences of the given variable have
been replaced by the specified constant.
|
boolean |
equals(Object other)
Compares the bindings of two predicates for equality.
|
IConstant<?> |
get(E e,
int index)
Deprecated.
by
IElement.get(int) which does exactly what this
method is trying to do. |
IVariableOrConstant |
get(int index)
Return the variable or constant at the specified index.
|
IAccessPathExpander<E> |
getAccessPathExpander()
Returns the object that may be used to selectively override the
evaluation of the predicate.
|
IFilter |
getAccessPathFilter()
Return the optional filter to be evaluated once tuples have been
converted into relation elements by the access path (local to the
caller).
|
IFilter |
getIndexLocalFilter()
Return the optional filter to be evaluated local to the index.
|
IKeyOrder<E> |
getKeyOrder()
Return the
IKeyOrder override for this IPredicate by the
query optimizer. |
String |
getOnlyRelationName()
Resource identifier (aka namespace) identifies the
IRelation
associated with this IPredicate . |
int |
getPartitionId()
The index partition identifier and
-1 if no partition
identifier was specified. |
int |
getRelationCount()
Deprecated.
per
getRelationName(int) . |
String |
getRelationName(int index)
Deprecated.
Unions of predicates must be handled explicitly as a union of
pipeline operators reading against the different predicate.
|
long |
getTimestamp()
The timestamp or transaction identifier on which the operator will read
or write.
|
int |
getVariableCount()
Deprecated.
This is only used in a few places, which should probably use
BOpUtility.getArgumentVariableCount(BOp) instead. |
int |
getVariableCount(IKeyOrder<E> keyOrder)
The #of arguments in the predicate required for the specified
IKeyOrder which are unbound. |
int |
hashCode()
The hash code is defined as
|
boolean |
isFullyBound(IKeyOrder<E> keyOrder)
Figure out if all positions in the predicate which are required to form
the key for this access path are bound in the predicate.
|
boolean |
isOptional()
true iff the predicate is optional when evaluated as the
right-hand side of a join. |
boolean |
isRemoteAccessPath()
Return
true if this is a remote access path. |
IPredicate<E> |
setArg(int index,
IVariableOrConstant arg)
Return a copy of this predicate with a different
IVariableOrConstant
for the arg specified by the supplied index parameter. |
IPredicate<E> |
setBOpId(int bopId)
Sets the
BOp.Annotations.BOP_ID annotation. |
IPredicate<E> |
setPartitionId(int partitionId)
Sets the index partition identifier constraint.
|
IPredicate<E> |
setRelationName(String[] relationName)
Deprecated.
This will be modified to use a scalar relation name per
getOnlyRelationName() . |
String |
toString()
Representation of the predicate without variable bindings.
|
String |
toString(IBindingSet bindingSet)
Representation of the predicate with variable bindings.
|
annotations, argIterator, args, arity, clone, getEvaluationContext, getId, getProperty, getRequiredProperty, isController, setProperty, toArray, toArray, toShortString, toString
getProperty
String getOnlyRelationName()
IRelation
associated with this IPredicate
.IllegalStateException
- if there is more than on element in the view.ILocatableResourceAnnotations.RELATION_NAME
String getRelationName(int index)
index
- The index into the array of relation names in the view.int getRelationCount()
getRelationName(int)
.int getPartitionId()
-1
if no partition
identifier was specified.-1
if the
predicate is not locked to a specific index partition.IPredicate.Annotations.PARTITION_ID
,
PartitionLocator
,
AccessPath
,
JoinMasterTask
IPredicate<E> setPartitionId(int partitionId)
partitionId
- The index partition identifier.IPredicate
.IllegalArgumentException
- if the index partition identified is a negative integer.IllegalStateException
- if the index partition identifier was already specified.IPredicate.Annotations.PARTITION_ID
boolean isOptional()
true
iff the predicate is optional when evaluated as the
right-hand side of a join. An optional predicate will match once after
all matches in the data have been exhausted. By default, the match will
NOT bind any variables that have been determined to be bound by the
predicate based on the computed IEvaluationPlan
.
For mutation, some IRelation
s may require that all variables
appearing in the head are bound. This and similar constraints can be
enforced using IConstraint
s on the IRule
.
true
iff this predicate is optional when evaluating
a JOIN.IAccessPathExpander<E> getAccessPathExpander()
IAccessPathExpander
.IPredicate.Annotations.ACCESS_PATH_EXPANDER
IFilter getIndexLocalFilter()
IFilter getAccessPathFilter()
IKeyOrder<E> getKeyOrder()
IKeyOrder
override for this IPredicate
by the
query optimizer.IKeyOrder
or null
if the
IKeyOrder
was not overridden.IPredicate.Annotations.KEY_ORDER
boolean isFullyBound(IKeyOrder<E> keyOrder)
int getVariableCount()
BOpUtility.getArgumentVariableCount(BOp)
instead.int getVariableCount(IKeyOrder<E> keyOrder)
IKeyOrder
which are unbound.keyOrder
- The key order.IKeyOrder
.boolean isRemoteAccessPath()
true
if this is a remote access path.IVariableOrConstant get(int index)
get
in interface BOp
index
- The index.IllegalArgumentException
- if the index is less than zero or GTE the BOp.arity()
of
the IPredicate
.IConstant<?> get(E e, int index)
IElement.get(int)
which does exactly what this
method is trying to do.Note: there is no general means available to implement this method of an awareness of the internal structure of the element type. General purpose record types, such as GOM or relation records, can generally implement this method in the context of the "schema" imposed by the predicate.
e
- The element, which must implement IElement
.index
- The index.UnsupportedOperationException
- If this operation is not supported by the IPredicate
implementation or for the given element type.Predicate<E> asBound(IVariable<?> var, IConstant<?> val)
Note: The optimal IKeyOrder
often changes when binding a variable
on a predicate.
var
- The variable.val
- The constant.IllegalArgumentException
- if either argument is null
.IPredicate<E> asBound(IBindingSet bindingSet)
Note: The optimal IKeyOrder
often changes when binding a variable
on a predicate.
bindingSet
- The binding set.IPredicate
-or- null
if the
IPredicate
can not be unified with the
IBindingSet
.(RDR query does too much work)
Object asBound(int index, IBindingSet bindingSet)
index
- The index into that predicate.bindingSet
- The binding set.null
if no binding is available
(the predicate is not bound at that index and the variable at
that index in the predicate is not bound in the binding set).IndexOutOfBoundsException
- unless the index is in [0:{@link #arity()-1], inclusive.IllegalArgumentException
- if the bindingSet is null
.IPredicate<E> setRelationName(String[] relationName)
getOnlyRelationName()
.IPredicate
in which the relationName(s)
replace the existing set of relation name(s).relationName
- The relation name(s).IllegalArgumentException
- if relationName is empty.IllegalArgumentException
- if relationName is null
IllegalArgumentException
- if any element of relationName is null
String toString()
String toString(IBindingSet bindingSet)
bindingSet
- The variable bindingsboolean equals(Object other)
int hashCode()
get(0).hashCode()*31ˆ(n-1) + get(1).hashCode()*31ˆ(n-2) + ... + get(n-1).hashCode()using
int
arithmetic, where n
is the
BOp.arity()
of the predicate, and ^
indicates
exponentiation.
Note: This is similar to how String.hashCode()
is defined.
IPredicate<E> setBOpId(int bopId)
BOp.Annotations.BOP_ID
annotation.bopId
- The bop id.IPredicate
.IPredicate<E> setArg(int index, IVariableOrConstant arg)
IVariableOrConstant
for the arg specified by the supplied index parameter.long getTimestamp()
IllegalStateException
- if ITimestampAnnotations.TIMESTAMP
was not specified.ITimestampAnnotations.TIMESTAMP
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.