Package org.openrefine.expr
Interface Evaluable
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
GrelEvaluable
,JythonEvaluable
public interface Evaluable extends Serializable
Interface for evaluable expressions in any arbitrary language.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Object
evaluate(Properties bindings)
Evaluate this expression in the given environment (bindings).default Set<String>
getColumnDependencies(String baseColumn)
Returns the names of the columns this expression depends on.default String
getFullSource()
String
getLanguagePrefix()
String
getSource()
Returns the source string which generated this expression.default boolean
isLocal()
default Evaluable
renameColumnDependencies(Map<String,String> substitutions)
Translates this expression by simultaneously substituting column names as the supplied map specifies.
-
-
-
Method Detail
-
evaluate
Object evaluate(Properties bindings)
Evaluate this expression in the given environment (bindings).
-
getSource
String getSource()
Returns the source string which generated this expression. This does not include the language prefix, which can be obtained bygetLanguagePrefix()
.
-
getLanguagePrefix
String getLanguagePrefix()
- Returns:
- the language prefix used to generate this evaluable.
-
isLocal
default boolean isLocal()
- Returns:
- true when the evaluable can be computed fully (and quickly) from the local context (the given row or record). If it relies on any other information (external web service, aggregation over the project), then it should return false, indicating that the return value may need to be cached by the caller.
-
getColumnDependencies
default Set<String> getColumnDependencies(String baseColumn)
Returns the names of the columns this expression depends on.- Parameters:
baseColumn
- the name of the column this expression is based on (null if none)- Returns:
- null if the columns could not be isolated: in this case, the expression might depend on all columns in the project.
-
renameColumnDependencies
default Evaluable renameColumnDependencies(Map<String,String> substitutions)
Translates this expression by simultaneously substituting column names as the supplied map specifies.This is only possible if the extraction of column dependencies with
getColumnDependencies(String)
succeeds (return a non-null value).- Parameters:
substitutions
- a map specifying new names for some columns. If a column name is not present in the map, it is assumed that the column is not renamed.- Returns:
- a new expression with updated column names.
-
getFullSource
default String getFullSource()
- Returns:
- the source prefixed by the language prefix
-
-