Class XSDNumUtils

java.lang.Object
org.apache.jena.sparql.util.XSDNumUtils

public class XSDNumUtils extends Object
  • Constructor Details

    • XSDNumUtils

      public XSDNumUtils()
  • Method Details

    • xsdParseDouble

      public static double xsdParseDouble(String lexicalForm)
      Parse an XSD double lexical form. Adds in the cases not covered by Double.parseDouble(java.lang.String). INF is strictly upper case, but we accept lower case. -NaN and +NaN are not accepted.
    • xsdParseFloat

      public static float xsdParseFloat(String lexicalForm)
      Parse an XSD float lexical form. Adds in the cases not covered by Float.parseFloat(java.lang.String). INF is strictly upper case, but we accept lower case. -NaN and +NaN are not accepted.
    • isNaN

      public static boolean isNaN(NodeValue nv)
      isNaN() - for xsd:double and xsd:float. The argument must be numeric; if not, this function throws ExprEvalException.
    • xsdParseDecimal

      public static BigDecimal xsdParseDecimal(String lexicalForm)
      Parse an XSD decimal.
    • stringForm

      public static String stringForm(BigDecimal decimal)
      Produce a lexical form for BigDecimal that is compatible with Turtle syntax (i.e it has a decimal point). This is also the function used by TDB2 to turn decimal NodeId values into the lexical form of an xsd:decimal.
    • stringForm

      public static String stringForm(double d)
    • stringForm

      public static String stringForm(float f)
    • stringFormatARQ

      public static String stringFormatARQ(BigDecimal bd)
      The format of xsd:decimal used in ARQ expression evaluation. This is XSD 1.0 for long-term consistency (integer values for xsd:decimal have ".0").
    • stringFormatXSD10

      public static String stringFormatXSD10(BigDecimal bd)
      Strict XSD 1.0 format for xsd:decimal.

      Decimal canonical form where integer values has a ".0" (as in XSD 1.0).

      In XSD 1.0, canonical integer-valued decimal has a trailing ".0". In XSD 1.1 and F&O v 3.1, xs:string cast of a decimal which is integer valued, does not have the trailing ".0".

    • stringFormatXSD11

      public static String stringFormatXSD11(BigDecimal bd)
      Strict XSD 1.1 format for xsd:decimal.

      Decimal canonical form where integer values has no ".0" (as in XSD 1.1).

      In XSD 1.0, canonical integer-valued decimal has a trailing ".0". In XSD 1.1 and F&O v 3.1, xs:string cast of a decimal which is integer valued, does not have the trailing ".0".

    • canonicalDecimalStrNoIntegerDot

      public static String canonicalDecimalStrNoIntegerDot(BigDecimal bd)
      Decimal format, cast-to-string.

      Decimal canonical form where integer values have no ".0" (as in XSD 1.1).

      In XSD 1.1, canonical integer-valued decimal has a trailing ".0". In F&O v 3.1, xs:string cast of a decimal which is integer valued, does not have the trailing ".0".

    • canonicalDecimalStrWithDot

      public static String canonicalDecimalStrWithDot(BigDecimal decimal)
      Integer-valued decimals have a trailing ".0". (In XML Schema Datatype 1.1 they did not have a ".0".)

    • canonicalDecimal

      public static BigDecimal canonicalDecimal(BigDecimal decimal)
      Return a canonical decimal with a trailing ".0". This is canonicalizing the value/scale.

      This is the BigDecimal form used to encode into NodeIds in TDB2.

      It has a trailing ".0" for integer values so it is Turtle compatible, but otherwise has no trailing zeros.

      For TDB2, we require a consistent, fixed value/scale form for any value to be encoded in a TDB2 NodeId and when reconstructed to get the same lexical form.

      See Also: