BeanSessionStandardDataTypes

From Tupelo Wiki

List of standard types

The standard supported types are

  • Integer, int
  • Long, long
  • Float, float
  • Boolean, boolean
  • Double, double
  • java.util.Date (if a string, it is in ISO 8601 format)
  • java.lang.String
  • org.tupeloproject.kernel.rdf.Resource
  • org.tupeloproject.kernel.rdf.Triple
  • java.net.URI
  • java.net.URL


So a property may use one of these or any standard bean. Conversions will, generally, occur as needed. Of course, not all types are convertible, e.g., a string might not be interpretable as a URI.

All of these may be used in collections, maps (keys or values) or as arrays. For example, an array of longs could be the type of a property. Another example might be a property whose value is a map keyed by string with values that are a standard bean.

All resource types (uri references, literals, etc.) are also supported.

A comment on dates and ISO 8601

The internal storage of dates is as ISO 8601 strings, standardized on the UTC time zone. This format is

YYYY-MM-DDThh:mm:ss.xxx[tz]

where

  • YYYY = year
  • MM = month as a two digit number, e.g. May is encoded as 05
  • DD = day as a two digit number, e.g., the first of the month is encoded as 01
  • 'T' denotes that the time follows
  • hh = hours as a two digit value in the range 00 - 23
  • mm = minutes as a two digit value in the range of 00 - 59
  • ss = seconds as a two digit value in the range of 00 - 59
  • xxx the number of elapsed milliseconds. These may be omitted. More than 3 digits are ignored.
  • [tz] is the timezone. This is any of +-hhmm, +-hh:mm or just the letter 'Z' where the hours and minutes are offsets from UTC standard. The letter 'Z' is a shorthand for UTC.

Here are a few examples.

2002-05-02T21:47:30Z (no milliseconds)

2005-09-13T06:13:44.321Z

2005-09-13T12:13:44.321+06:00

2000-09-13T12:13:44-04:30 (fractional timezones are permitted)


There is a very useful utility class called org.tupeloproject.util.Iso8601 (http://dlt-dev.ncsa.uiuc.edu/javadoc/t2/current/org/tupeloproject/util/Iso8601.html) which will handle conversions, should you need them. The two methods are

  • Iso8601.string2Date
  • Iso8601.date2String

which respectively convert from a string to a java.util.Date and vice versa. E.g.

Iso8601.date2String(new Date(0L));

returns the epoch, 1970-01-01T00:00:00.000Z. Read the javadoc (http://dlt-dev.ncsa.uiuc.edu/javadoc/t2/current/org/tupeloproject/util/Iso8601.html) for more details on this class and its use.