Class WbLanguageConstant

java.lang.Object
org.openrefine.wikidata.schema.WbLanguageConstant
All Implemented Interfaces:
WbExpression<String>

public class WbLanguageConstant extends Object implements WbExpression<String>
A constant that represents a Wikimedia language code.
Author:
Antonin Delpeuch
  • Field Details

    • _langId

      protected String _langId
    • _langLabel

      protected String _langLabel
  • Constructor Details

    • WbLanguageConstant

      public WbLanguageConstant(String langId, String langLabel)
  • Method Details

    • normalizeLanguageCode

      public static String normalizeLanguageCode(String lang)
    • normalizeLanguageCode

      public static String normalizeLanguageCode(String lang, String mediaWikiApiEndpoint)
      Checks that a language code is valid and returns its preferred version (converting deprecated language codes to their better values).
      Parameters:
      lang - a Wikimedia language code
      mediaWikiApiEndpoint - the MediaWiki API endpoint of the Wikibase
      Returns:
      the normalized code, or null if the code is invalid.
    • evaluate

      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.
      Specified by:
      evaluate in interface WbExpression<String>
      Throws:
      SkipSchemaExpressionException
    • getLang

      public String getLang()
      Returns:
      the language code for this language
    • getLabel

      public String getLabel()
      Returns:
      the name of the language in itself
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object