Class SSSOMUtils
This class is intended to group various static methods that may be used throughout the library.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
SSSOMUtils
public SSSOMUtils()
-
-
Method Details
-
format
Formats a double value.In an attempt to reduce serialisation differences across implementations, the SSSOM specification, and especially the specification for the “canonical SSSOM/TSV format”, recommends that values of double-typed slots (e.g.
confidence
) be written with up to three digits after the decimal point as needed, rounding to the nearest neighbour (rounding up if both neighbours are equidistant). This is what this method does.- Parameters:
value
- The double value to format as a string.- Returns:
- A string serialisation of the value, compliant with the format recommendations from the SSSOM specification.
-
format
Formats a date value.The SSSOM specification says nothing on how to serialise date-typed slots, but LinkML says “for xsd dates, datetimes, and times, [the value] must be a string conforming to the relevant ISO type”. Presumably this means ISO-8601.
- Parameters:
value
- The date value to format as a string.- Returns:
- A string serialisation of the value.
-
format
Formats a date and time value.There are no date-time slots in SSSOM, but SSSOM-Java supports extension values with such a type.
- Parameters:
value
- The date-time value to format.- Returns:
- A string serialisation of the value.
-
format
Formats a value of an unknown type.This is a convenience method to format an object whose type is not known at compile-time. It merely checks the runtime type of the object then calls the appropriate formatting method.
- Parameters:
value
- The object to format.- Returns:
- A string serialisation of the value (or
null
if the value itself isnull
).
-