Package org.openrefine.wikibase.schema
Class WbLocationConstant
- java.lang.Object
-
- org.openrefine.wikibase.schema.WbLocationConstant
-
- All Implemented Interfaces:
WbExpression<org.wikidata.wdtk.datamodel.interfaces.GlobeCoordinatesValue>
public class WbLocationConstant extends Object implements WbExpression<org.wikidata.wdtk.datamodel.interfaces.GlobeCoordinatesValue>
A constant for a geographical location. The accepted format is lat,lng or lat/lng.- Author:
- Antonin Delpeuch
-
-
Field Summary
Fields Modifier and Type Field Description static double
defaultPrecision
-
Constructor Summary
Constructors Constructor Description WbLocationConstant(String origValue)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object other)
org.wikidata.wdtk.datamodel.interfaces.GlobeCoordinatesValue
evaluate(ExpressionContext ctxt)
Evaluates the value expression in a given context, returns a Wikibase value suitable to be the target of a claim.String
getValue()
int
hashCode()
static org.wikidata.wdtk.datamodel.interfaces.GlobeCoordinatesValue
parse(String expr)
Parses a string to a location.void
validate(ValidationState validation)
Check that this expression is fully formed and ready to be evaluated.
-
-
-
Field Detail
-
defaultPrecision
public static final double defaultPrecision
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
WbLocationConstant
public WbLocationConstant(String origValue)
-
-
Method Detail
-
validate
public void validate(ValidationState validation)
Description copied from interface:WbExpression
Check that this expression is fully formed and ready to be evaluated.- Specified by:
validate
in interfaceWbExpression<org.wikidata.wdtk.datamodel.interfaces.GlobeCoordinatesValue>
- Parameters:
validation
- the state in which to log any validation errors
-
parse
public static org.wikidata.wdtk.datamodel.interfaces.GlobeCoordinatesValue parse(String expr) throws ParseException
Parses a string to a location.- Parameters:
expr
- the string to parse- Returns:
- the parsed location
- Throws:
ParseException
-
evaluate
public org.wikidata.wdtk.datamodel.interfaces.GlobeCoordinatesValue evaluate(ExpressionContext ctxt) throws SkipSchemaExpressionException
Description copied from interface:WbExpression
Evaluates the value expression in a given context, returns a Wikibase value suitable to be the target of a claim. As a premise to calling that method, we assume that callingWbExpression.validate(ValidationState)
did not log any error in the validation state.- Specified by:
evaluate
in interfaceWbExpression<org.wikidata.wdtk.datamodel.interfaces.GlobeCoordinatesValue>
- Throws:
SkipSchemaExpressionException
-
getValue
public String getValue()
- Returns:
- the original value as a string.
-
-