Package org.openrefine.wikidata.schema
Class WbQuantityExpr
java.lang.Object
org.openrefine.wikidata.schema.WbQuantityExpr
- All Implemented Interfaces:
WbExpression<org.wikidata.wdtk.datamodel.interfaces.QuantityValue>
public class WbQuantityExpr
extends Object
implements WbExpression<org.wikidata.wdtk.datamodel.interfaces.QuantityValue>
-
Constructor Summary
ConstructorsConstructorDescriptionWbQuantityExpr(WbExpression<? extends org.wikidata.wdtk.datamodel.interfaces.StringValue> amountExpr, WbExpression<? extends org.wikidata.wdtk.datamodel.interfaces.ItemIdValue> unitExpr) Creates an expression for a quantity, which contains two sub-expressions: one for the amount (a string with a particular format) and one for the unit, which is optional. -
Method Summary
Modifier and TypeMethodDescriptionorg.wikidata.wdtk.datamodel.interfaces.QuantityValueevaluate(ExpressionContext ctxt) Evaluates the value expression in a given context, returns a Wikibase value suitable to be the target of a claim.WbExpression<? extends org.wikidata.wdtk.datamodel.interfaces.StringValue>WbExpression<? extends org.wikidata.wdtk.datamodel.interfaces.ItemIdValue>
-
Constructor Details
-
WbQuantityExpr
public WbQuantityExpr(WbExpression<? extends org.wikidata.wdtk.datamodel.interfaces.StringValue> amountExpr, WbExpression<? extends org.wikidata.wdtk.datamodel.interfaces.ItemIdValue> unitExpr) Creates an expression for a quantity, which contains two sub-expressions: one for the amount (a string with a particular format) and one for the unit, which is optional. Setting unitExpr to null will give quantities without units. Setting it to a non-null value will make the unit mandatory: if the unit expression fails to evaluate, the whole quantity expression will fail too.
-
-
Method Details
-
evaluate
public org.wikidata.wdtk.datamodel.interfaces.QuantityValue evaluate(ExpressionContext ctxt) throws SkipSchemaExpressionException, QAWarningException Description copied from interface:WbExpressionEvaluates the value expression in a given context, returns a Wikibase value suitable to be the target of a claim.- Specified by:
evaluatein interfaceWbExpression<org.wikidata.wdtk.datamodel.interfaces.QuantityValue>- Throws:
SkipSchemaExpressionExceptionQAWarningException
-
getAmountExpr
-
getUnitExpr
-