Package org.openrefine.wikidata.schema
Class WbVariableExpr<T>
java.lang.Object
org.openrefine.wikidata.schema.WbVariableExpr<T>
- Type Parameters:
T- the type of Wikibase value returned by the expression.
- All Implemented Interfaces:
WbExpression<T>
- Direct Known Subclasses:
WbDateVariable,WbEntityVariable,WbItemVariable,WbLanguageVariable,WbLocationVariable,WbStringVariable
A base class for expressions which draw their values from a particular
column.
- Author:
- Antonin Delpeuch
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanequalAsVariables(Object other, Class<? extends WbVariableExpr<?>> targetClass) Helper for equality methods of subclasses.evaluate(ExpressionContext ctxt) Evaluates the expression in a given context, returningabstract TfromCell(Cell cell, ExpressionContext ctxt) Method that should be implemented by subclasses, converting an OpenRefine cell to a Wikibase value.Returns the column name used by the variable.inthashCode()voidsetColumnName(String columnName) Changes the column name used by the variable.
-
Constructor Details
-
WbVariableExpr
public WbVariableExpr()Constructs a variable without setting the column name yet.
-
-
Method Details
-
getColumnName
Returns the column name used by the variable.- Returns:
- the OpenRefine column name
-
setColumnName
Changes the column name used by the variable. This is useful for deserialization, as well as updates when column names change. -
evaluate
Evaluates the expression in a given context, returning- Specified by:
evaluatein interfaceWbExpression<T>- Throws:
QAWarningExceptionSkipSchemaExpressionException
-
fromCell
public abstract T fromCell(Cell cell, ExpressionContext ctxt) throws SkipSchemaExpressionException, QAWarningException Method that should be implemented by subclasses, converting an OpenRefine cell to a Wikibase value. Access to other values and emitting warnings is possible via the supplied EvaluationContext object.- Parameters:
cell- the cell to convertctxt- the evaluation context- Returns:
- the corresponding Wikibase value
- Throws:
SkipSchemaExpressionExceptionQAWarningException
-
equalAsVariables
Helper for equality methods of subclasses.- Parameters:
other- the object to comparecolumnName- the column name to compare totargetClass- the target class for equality- Returns:
-
hashCode
public int hashCode()
-