]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.databoard/src-isv/spec/Standard Library.mediawiki
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.databoard / src-isv / spec / Standard Library.mediawiki
index 7c6e026ce70dfec6b953106f3318e25e8c9e6c61..cc46a4e46800092655bd871a1732fb6b283ac3d8 100644 (file)
-=Standard Library=\r
-There is a standard library of named datatypes. The following types are built-in in Simantics systems. \r
-\r
-== Datatype==\r
-The datatype description of types themselves. This type is used when serializing types in binary file and network connections.\r
\r
- type DataType =\r
-      | BooleanType  { metadata : Map(String, String) }\r
-      | ByteType     { metadata : Map(String, String), unit : Optional(String), range : Optional(Range) }\r
-      | IntegerType  { metadata : Map(String, String), unit : Optional(String), range : Optional(Range) }\r
-      | LongType     { metadata : Map(String, String), unit : Optional(String), range : Optional(Range) }\r
-      | FloatType    { metadata : Map(String, String), unit : Optional(String), range : Optional(Range) }\r
-      | DoubleType   { metadata : Map(String, String), unit : Optional(String), range : Optional(Range) }\r
-      | StringType   { metadata : Map(String, String), pattern : Optional(String), mimeType : Optional(String), length : Optional(String) }\r
-      | RecordType   referable { metadata : Map(String, String), referable : Boolean, components : Component[] }\r
-      | ArrayType    { metadata : Map(String, String), componentType : DataType, length : Optional(Range) }\r
-      | MapType      { metadata : Map(String, String), keyType : DataType, valueType : DataType }\r
-      | OptionalType { metadata : Map(String, String), componentType : DataType }\r
-      | UnionType    { metadata : Map(String, String), components : Component[] }\r
-      | VariantType  { metadata : Map(String, String) }\r
\r
\r
- type Range = { lower : Limit, upper : Limit }\r
- type Limit = Nolimit | Inclusive { value : Double } | Exclusive { value : Double } | InclusiveLong { value : Long } | ExclusiveLong { value : Long }\r
- type Component = { name : String, type : DataType }\r
- type DataTypeDefinition = { name : String, type : DataType }\r
-\r
-==Utility types==\r
-[http://java.sun.com/j2se/1.5.0/docs/api/java/util/UUID.html UUID] represents an universally unique identifier (UUID), a 128-bit value.\r
-\r
-  type UUID = { mostSigBits : Long, leastSigBits : Long }\r
-\r
-Localized text is a map of user readable text for multiple languages. \r
-The key is [http://www.loc.gov/standards/iso639-2/englangn.html ISO-639] language code, and value is the text for that language.\r
-Default language is ''en'', it is highly encouraged to always provide english text in addition to all others.\r
-  type LocalizedText = Map(String, String)\r
-\r
-Void type is represented as empty record.\r
-  type Void = {}\r
-\r
-URI type is a textual reference.\r
-  type URI = String\r
-\r
-==Time Types==\r
-These great time types are borrowed from JSR-310.\r
-\r
-[https://jsr-310.dev.java.net/nonav/doc-2010-02-09/javax/time/Instant.html Instant] is an instantaneous point on the time-line. \r
-It represents nano seconds since epoch (1970-01-01T00:00:00Z) ignoring leap seconds.\r
-In order to represent the data a 96 bit number is required. To achieve this the data is stored as seconds, measured using a long, and nanoseconds, measured using an int. The nanosecond part will always be between 0 and 999,999,999 representing the nanosecond part of the second. \r
-\r
-  type Instant = { \r
-      seconds : Long, \r
-      nanoSeconds : Integer(range=[0..999999999])\r
-  }\r
-\r
-[https://jsr-310.dev.java.net/nonav/doc-2010-02-09/javax/time/Duration.html Duration] is the time between two instants on the time-line. \r
-In order to represent the data a 96 bit number is required. To achieve this the data is stored as seconds, measured using a long, and nanoseconds, measured using an int. \r
-The nanosecond part will always be between 0 and 999,999,999 representing the nanosecond part of the second. \r
-For example, the negative duration of PT-0.1S is represented as -1 second and 900,000,000 nanoseconds. \r
-\r
-  type Duration = { \r
-      seconds : Long, \r
-      nanoSeconds : Integer(range=[0..999999999]) \r
-  } \r
-\r
-[https://jsr-310.dev.java.net/nonav/doc-2010-02-09/javax/time/calendar/LocalDate.html LocalDate] is a date without a time zone in the ISO-8601 calendar system, such as '2007-12-03'. \r
-\r
-  type LocalDate = { \r
-      year : Integer, \r
-      monthOfYear : Integer(range=[1..12]), \r
-      dayOfMonth : Integer(range=[1..31]) \r
-  }\r
-\r
-[https://jsr-310.dev.java.net/nonav/doc-2010-02-09/javax/time/calendar/LocalTime.html LocalTime] is a time without time zone in the ISO-8601 calendar system, such as '10:15:30'. \r
-This type stores all time fields, to a precision of nanoseconds. It does not store or represent a date or time zone. Thus, for example, the value "13:45.30.123456789" can be stored in a LocalTime. \r
-\r
-  type LocalTime = { \r
-      hourOfDay : Integer(range=[0..23]),\r
-      minuteOfHour : Integer(range=[0..59]),\r
-      secondOfMinute : Integer(range=[0..59]),\r
-      nanoOfSecond : Integer(range=[0..999999999])\r
-  }\r
-\r
-[https://jsr-310.dev.java.net/nonav/doc-2010-02-09/javax/time/calendar/LocalDateTime.html LocalDateTime] is a date-time without a time zone in the ISO-8601 calendar system, such as '2007-12-03T10:15:30'. \r
-This type stores all date and time fields, to a precision of nanoseconds. It does not store or represent a time zone. Thus, for example, the value "2nd October 2007 at 13:45.30.123456789" can be stored in an LocalDateTime. \r
\r
-  type LocalDateTime = {\r
-      year : Integer, \r
-      monthOfYear : Integer(range=[1..12]), \r
-      dayOfMonth : Integer(range=[1..31]),\r
-      hourOfDay : Integer(range=[0..23]),\r
-      minuteOfHour : Integer(range=[0..59]),\r
-      secondOfMinute : Integer(range=[0..59]),\r
-      nanoOfSecond : Integer(range=[0..999999999])\r
-  }\r
-\r
-[https://jsr-310.dev.java.net/nonav/doc-2010-02-09/javax/time/calendar/ZonedDateTime.html ZonedDateTime] is a date-time with a time zone in the ISO-8601 calendar system, such as '2007-12-03T10:15:30+01:00 Europe/Paris'. This type stores all date and time fields, to a precision of nanoseconds, as well as a time zone and zone offset. Thus, for example, the value "2nd October 2007 at 13:45.30.123456789 +02:00 in the Europe/Paris time zone" can be stored in a ZonedDateTime. The purpose of storing the time zone is to distinguish the ambiguous case where the local time-line overlaps, typically as a result of the end of daylight time. \r
-  type ZonedDateTime = {\r
-     date : LocalDate,\r
-     time : LocalTime,\r
-     zone : TimeZone\r
-  }\r
-\r
-[https://jsr-310.dev.java.net/nonav/doc-2010-02-09/javax/time/calendar/TimeZone.html TimeZones] are geographical regions where the same rules for time apply. The rules are defined by governments and change frequently. \r
-\r
-Each group defines a naming scheme for the regions of the time zone. The format of the region is specific to the group. For example, the 'TZDB' group typically use the format {area}/{city}, such as 'Europe/London'.\r
-\r
-Each group typically produces multiple versions of their data. The format of the version is specific to the group. For example, the 'TZDB' group use the format {year}{letter}, such as '2009b'.\r
-\r
-In combination, a unique ID is created expressing the time-zone, formed from {groupID}:{regionID}#{versionID}.\r
-\r
-The version can be set to an empty string. This represents the "floating version". The floating version will always choose the latest applicable set of rules. Applications will probably choose to use the floating version, as it guarantees usage of the latest rules.\r
-\r
-In addition to the group/region/version combinations, TimeZone can represent a fixed offset. This has an empty group and version ID. It is not possible to have an invalid instance of a fixed time zone.\r
-\r
-The purpose of capturing all this information is to handle issues when manipulating and persisting time zones. For example, consider what happens if the government of a country changed the start or end of daylight savings time. If you created and stored a date using one version of the rules, and then load it up when a new version of the rules are in force, what should happen? The date might now be invalid, for example due to a gap in the local time-line. By storing the version of the time zone rules data together with the date, it is possible to tell that the rules have changed and to process accordingly.\r
-\r
-TimeZone merely represents the identifier of the zone.\r
-\r
-  type TimeZone = { zoneId : String }\r
-\r
+=Standard Library=
+There is a standard library of named datatypes. The following types are built-in in Simantics systems. 
+
+== Datatype==
+The datatype description of types themselves. This type is used when serializing types in binary file and network connections.
+ type DataType =
+      | BooleanType  { metadata : Map(String, String) }
+      | ByteType     { metadata : Map(String, String), unit : Optional(String), range : Optional(Range) }
+      | IntegerType  { metadata : Map(String, String), unit : Optional(String), range : Optional(Range) }
+      | LongType     { metadata : Map(String, String), unit : Optional(String), range : Optional(Range) }
+      | FloatType    { metadata : Map(String, String), unit : Optional(String), range : Optional(Range) }
+      | DoubleType   { metadata : Map(String, String), unit : Optional(String), range : Optional(Range) }
+      | StringType   { metadata : Map(String, String), pattern : Optional(String), mimeType : Optional(String), length : Optional(String) }
+      | RecordType   referable { metadata : Map(String, String), referable : Boolean, components : Component[] }
+      | ArrayType    { metadata : Map(String, String), componentType : DataType, length : Optional(Range) }
+      | MapType      { metadata : Map(String, String), keyType : DataType, valueType : DataType }
+      | OptionalType { metadata : Map(String, String), componentType : DataType }
+      | UnionType    { metadata : Map(String, String), components : Component[] }
+      | VariantType  { metadata : Map(String, String) }
+ type Range = { lower : Limit, upper : Limit }
+ type Limit = Nolimit | Inclusive { value : Double } | Exclusive { value : Double } | InclusiveLong { value : Long } | ExclusiveLong { value : Long }
+ type Component = { name : String, type : DataType }
+ type DataTypeDefinition = { name : String, type : DataType }
+
+==Utility types==
+[http://java.sun.com/j2se/1.5.0/docs/api/java/util/UUID.html UUID] represents an universally unique identifier (UUID), a 128-bit value.
+
+  type UUID = { mostSigBits : Long, leastSigBits : Long }
+
+Localized text is a map of user readable text for multiple languages. 
+The key is [http://www.loc.gov/standards/iso639-2/englangn.html ISO-639] language code, and value is the text for that language.
+Default language is ''en'', it is highly encouraged to always provide english text in addition to all others.
+  type LocalizedText = Map(String, String)
+
+Void type is represented as empty record.
+  type Void = {}
+
+URI type is a textual reference.
+  type URI = String
+
+==Time Types==
+These great time types are borrowed from JSR-310.
+
+[https://jsr-310.dev.java.net/nonav/doc-2010-02-09/javax/time/Instant.html Instant] is an instantaneous point on the time-line. 
+It represents nano seconds since epoch (1970-01-01T00:00:00Z) ignoring leap seconds.
+In order to represent the data a 96 bit number is required. To achieve this the data is stored as seconds, measured using a long, and nanoseconds, measured using an int. The nanosecond part will always be between 0 and 999,999,999 representing the nanosecond part of the second. 
+
+  type Instant = { 
+      seconds : Long, 
+      nanoSeconds : Integer(range=[0..999999999])
+  }
+
+[https://jsr-310.dev.java.net/nonav/doc-2010-02-09/javax/time/Duration.html Duration] is the time between two instants on the time-line. 
+In order to represent the data a 96 bit number is required. To achieve this the data is stored as seconds, measured using a long, and nanoseconds, measured using an int. 
+The nanosecond part will always be between 0 and 999,999,999 representing the nanosecond part of the second. 
+For example, the negative duration of PT-0.1S is represented as -1 second and 900,000,000 nanoseconds. 
+
+  type Duration = { 
+      seconds : Long, 
+      nanoSeconds : Integer(range=[0..999999999]) 
+  } 
+
+[https://jsr-310.dev.java.net/nonav/doc-2010-02-09/javax/time/calendar/LocalDate.html LocalDate] is a date without a time zone in the ISO-8601 calendar system, such as '2007-12-03'. 
+
+  type LocalDate = { 
+      year : Integer, 
+      monthOfYear : Integer(range=[1..12]), 
+      dayOfMonth : Integer(range=[1..31]) 
+  }
+
+[https://jsr-310.dev.java.net/nonav/doc-2010-02-09/javax/time/calendar/LocalTime.html LocalTime] is a time without time zone in the ISO-8601 calendar system, such as '10:15:30'. 
+This type stores all time fields, to a precision of nanoseconds. It does not store or represent a date or time zone. Thus, for example, the value "13:45.30.123456789" can be stored in a LocalTime. 
+
+  type LocalTime = { 
+      hourOfDay : Integer(range=[0..23]),
+      minuteOfHour : Integer(range=[0..59]),
+      secondOfMinute : Integer(range=[0..59]),
+      nanoOfSecond : Integer(range=[0..999999999])
+  }
+
+[https://jsr-310.dev.java.net/nonav/doc-2010-02-09/javax/time/calendar/LocalDateTime.html LocalDateTime] is a date-time without a time zone in the ISO-8601 calendar system, such as '2007-12-03T10:15:30'. 
+This type stores all date and time fields, to a precision of nanoseconds. It does not store or represent a time zone. Thus, for example, the value "2nd October 2007 at 13:45.30.123456789" can be stored in an LocalDateTime. 
+  type LocalDateTime = {
+      year : Integer, 
+      monthOfYear : Integer(range=[1..12]), 
+      dayOfMonth : Integer(range=[1..31]),
+      hourOfDay : Integer(range=[0..23]),
+      minuteOfHour : Integer(range=[0..59]),
+      secondOfMinute : Integer(range=[0..59]),
+      nanoOfSecond : Integer(range=[0..999999999])
+  }
+
+[https://jsr-310.dev.java.net/nonav/doc-2010-02-09/javax/time/calendar/ZonedDateTime.html ZonedDateTime] is a date-time with a time zone in the ISO-8601 calendar system, such as '2007-12-03T10:15:30+01:00 Europe/Paris'. This type stores all date and time fields, to a precision of nanoseconds, as well as a time zone and zone offset. Thus, for example, the value "2nd October 2007 at 13:45.30.123456789 +02:00 in the Europe/Paris time zone" can be stored in a ZonedDateTime. The purpose of storing the time zone is to distinguish the ambiguous case where the local time-line overlaps, typically as a result of the end of daylight time. 
+  type ZonedDateTime = {
+     date : LocalDate,
+     time : LocalTime,
+     zone : TimeZone
+  }
+
+[https://jsr-310.dev.java.net/nonav/doc-2010-02-09/javax/time/calendar/TimeZone.html TimeZones] are geographical regions where the same rules for time apply. The rules are defined by governments and change frequently. 
+
+Each group defines a naming scheme for the regions of the time zone. The format of the region is specific to the group. For example, the 'TZDB' group typically use the format {area}/{city}, such as 'Europe/London'.
+
+Each group typically produces multiple versions of their data. The format of the version is specific to the group. For example, the 'TZDB' group use the format {year}{letter}, such as '2009b'.
+
+In combination, a unique ID is created expressing the time-zone, formed from {groupID}:{regionID}#{versionID}.
+
+The version can be set to an empty string. This represents the "floating version". The floating version will always choose the latest applicable set of rules. Applications will probably choose to use the floating version, as it guarantees usage of the latest rules.
+
+In addition to the group/region/version combinations, TimeZone can represent a fixed offset. This has an empty group and version ID. It is not possible to have an invalid instance of a fixed time zone.
+
+The purpose of capturing all this information is to handle issues when manipulating and persisting time zones. For example, consider what happens if the government of a country changed the start or end of daylight savings time. If you created and stored a date using one version of the rules, and then load it up when a new version of the rules are in force, what should happen? The date might now be invalid, for example due to a gap in the local time-line. By storing the version of the time zone rules data together with the date, it is possible to tell that the rules have changed and to process accordingly.
+
+TimeZone merely represents the identifier of the zone.
+
+  type TimeZone = { zoneId : String }
+
   
\ No newline at end of file