Package org.openrefine.wikidata.schema
Class WbDateConstant
java.lang.Object
org.openrefine.wikidata.schema.WbDateConstant
- All Implemented Interfaces:
WbExpression<org.wikidata.wdtk.datamodel.interfaces.TimeValue>
public class WbDateConstant
extends Object
implements WbExpression<org.wikidata.wdtk.datamodel.interfaces.TimeValue>
A constant for a time value, accepting a number of formats which determine
the precision of the parsed value.
- Author:
- Antonin Delpeuch
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Map<SimpleDateFormat,Integer> Map of formats accepted by the parser.static Pattern -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanorg.wikidata.wdtk.datamodel.interfaces.TimeValueevaluate(ExpressionContext ctxt) Evaluates the value expression in a given context, returns a Wikibase value suitable to be the target of a claim.inthashCode()static org.wikidata.wdtk.datamodel.interfaces.TimeValueParses a timestamp into a WikibaseTimeValue.
-
Field Details
-
acceptedFormats
Map of formats accepted by the parser. Each format is associated to the time precision it induces (an integer according to Wikibase's data model). -
calendarSuffixPattern
-
-
Constructor Details
-
WbDateConstant
Constructor. Used for deserialization from JSON. The object will be constructed even if the time cannot be parsed (it will evaluate to null) inevaluate(org.openrefine.wikidata.schema.ExpressionContext).- Parameters:
origDatestamp- the date value as a string
-
-
Method Details
-
evaluate
public org.wikidata.wdtk.datamodel.interfaces.TimeValue evaluate(ExpressionContext ctxt) throws SkipSchemaExpressionException 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.TimeValue>- Throws:
SkipSchemaExpressionException
-
parse
public static org.wikidata.wdtk.datamodel.interfaces.TimeValue parse(String datestamp) throws ParseException Parses a timestamp into a WikibaseTimeValue. The precision is automatically inferred from the format.- Parameters:
datestamp- the time to parse- Returns:
- Throws:
ParseException- if the time cannot be parsed
-
getOrigDatestamp
- Returns:
- the original datestamp
-
equals
-
hashCode
public int hashCode()
-