Class ToString

java.lang.Object
org.wikidata.wdtk.datamodel.helpers.ToString

public class ToString extends Object
Static class for computing a toString of arbitrary data objects using only their Stringerfaces. This can be used to implement the toString() method of arbitrary Stringerface implementations. More efficient solutions might exist if the object that implements an Stringerface is of a specific known type, but the methods here could always be used as a fallback or default.

The methods here are only meant for human consumption. Generic methods for serializing certain data values in well-defined string formats are found in DataFormatter instead.

Author:
Markus Kroetzsch
  • Constructor Details

    • ToString

      public ToString()
  • Method Details

    • toString

      public static String toString(ItemIdValue o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(PropertyIdValue o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(LexemeIdValue o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(FormIdValue o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(SenseIdValue o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(MediaInfoIdValue o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(DatatypeIdValue o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(TimeValue o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(GlobeCoordinatesValue o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(StringValue o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(MonolingualTextValue o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(QuantityValue o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(UnsupportedValue o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(UnsupportedEntityIdValue o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(ValueSnak o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(SomeValueSnak o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(NoValueSnak o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(SnakGroup o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(Claim o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(Reference o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(Statement o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(StatementGroup o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(SiteLink o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(PropertyDocument o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(ItemDocument o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(LexemeDocument o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(FormDocument o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(SenseDocument o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toString

      public static String toString(MediaInfoDocument o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • toStringForStatementDocument

      protected static String toStringForStatementDocument(StatementDocument o)
    • toStringForTermedDocument

      protected static String toStringForTermedDocument(TermedDocument o)
      Returns a human-readable string representation of the given TermedDocument.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also:
    • getGlobeString

      protected static String getGlobeString(String globeIri)
      Returns a human-readable string representation of a reference to a globe on which coordinates may be present. Known globes (such as Earth) are replaced by their common English names.
      Parameters:
      globeIri - the globe item's IRI
      Returns:
      a string representation of the globe
    • getCalendarString

      protected static String getCalendarString(String calendarModel)
      Returns a human-readable string representation of a reference to a calendar model that is used for a time value. Known calendars (such as proleptic Gregorian calendar) are replaced by short English names. The term "proleptic" is omitted.
      Parameters:
      calendarModel - the calendar model item's IRI
      Returns:
      a string representation of the calendar model
    • getTimePrecisionString

      protected static String getTimePrecisionString(byte precision)
      Returns a human-readable string representation of a reference to a precision that is used for a time value.
      Parameters:
      precision - the numeric precision
      Returns:
      a string representation of the precision
    • toString

      public static String toString(EntityRedirectDocument o)
      Returns a human-readable string representation of the given object.
      Parameters:
      o - the object to represent as string
      Returns:
      a string representation of the object
      See Also: