Profile : Base DataType

This is a profile of basic data types used in domain models in SimpleModeling.

In SimpleModeling domain models, you can use the data types from this profile as attributes of objects such as entities and values, without requiring special declarations.

Background

Relation to UML

The basic primitive types defined by UMLare as follows:

Name Definition

Boolean

Logical value (true or false)

Integer

Integer value (range undefined)

Real

Real number (floating-point)

String

Unicode string

UnlimitedNatural

Non-negative integer (0 or greater) or infinity (*)

These define only the minimal data types required for the UML metamodel definition, and are far from sufficient as data types for business application development.

Furthermore, the range of numerical types is undefined or includes infinity. In practice, infinity is rarely used. What is needed are data types with the same value ranges as those provided by programming languages.

Relation to Scala/Java

The SimpleModeling reference model uses the following programming language environment:

  • Scala 3.3.6 (LTS)

  • Java 21 (LTS)

  • Cats 2.10.0

By allowing the domain model to directly use the basic data types defined in this environment, SimpleModeling facilitates interoperability between modeling and programming.

Relation to XML

XML data types are defined in XML Schema Part 2: Datatypes.

Since XML data types serve as a standard in the context of data exchange between systems, the relationship with basic data types will be clearly defined.

SimpleModeling Library

The basic data types required for modeling business applications are not sufficiently covered by UML primitive types or Scala/Java types alone.

To address this issue, the SimpleModeling runtime library provides additional basic data types that complement those introduced according to the above principles.

Item

The basic data types are defined by the following items.

  • Name

  • Definition

  • Value Range

  • Example

  • Scala/Java Type

  • XML Type

  • SimpleModeling Lib

Name

The name of the basic data type.

Definition

The definition of the basic data type.

Value Range

Constraints of the data type are presented when necessary.

For strings, constraints on the number of characters and allowed character types are specified.

Example

Specific examples of the data type are provided when necessary.

Scala/Java Type

When using the basic data type in a program, it refers to the primitive types, basic objects in Scala, or Java basic objects implicitly used by Scala.

XML Type

Data types defined in XML Schema.

They serve as useful guidelines for value ranges in data exchange.

SimpleModeling Lib

If a basic type is not provided by the standard Scala/Java libraries, it is supported by a corresponding object in the SimpleModeling core library.

A corresponding object is provided.

Therefore, for each basic data type defined in this profile,

a corresponding Scala object exists when generating Scala programs with tools like Cozy.

Integer Types

Name Definition Scala/Java Type XML Type SimpleModeling Lib

byte

8-bit signed integer (-128 to 127)

Byte

byte

-

short

16-bit signed integer (-32,768 to 32,767)

Short

short

-

int

32-bit signed integer (-2,147,483,648 to 2,147,483,647)

Int / Integer

int

-

long

64-bit signed integer

Long

long

-

integer

Arbitrary-precision integer

BigInt

integer

-

decimal

Arbitrary-precision decimal

BigDecimal

decimal

-

float

Single-precision float (approx. 7 digits)

Float

float

-

double

Double-precision float (approx. 15 digits)

Double

double

-

positiveInteger

Positive integer (≥1, arbitrary precision)

BigInt

positiveInteger

-

negativeInteger

Negative integer (≤ -1, arbitrary precision)

BigInt

negativeInteger

-

nonNegativeInteger

Non-negative integer (≥0, arbitrary precision)

BigInt

nonNegativeInteger

-

nonPositiveInteger

Non-positive integer (≤0, arbitrary precision)

BigInt

nonPositiveInteger

-

unsignedByte

Unsigned 8-bit integer (0–255)

Short

unsignedByte

-

unsignedShort

Unsigned 16-bit integer (0–65,535)

Int

unsignedShort

-

unsignedInt

Unsigned 32-bit integer (0–4,294,967,295)

Long

unsignedInt

-

unsignedLong

Unsigned 64-bit integer (0–18,446,744,073,709,551,615)

BigInt

unsignedLong

-

positiveInt

Positive 32-bit integer (1–2,147,483,647)

-

-

PositiveInt

negativeInt

Negative 32-bit integer (-1 to -2,147,483,648)

-

-

NegativeInt

nonNegativeInt

Non-negative 32-bit integer (0–2,147,483,647)

-

-

NonNegativeInt

nonPositiveInt

Non-positive 32-bit integer (-2,147,483,648 to 0)

-

-

NonPositiveInt

positiveLong

Positive 64-bit integer (≥1)

-

-

PositiveLong

negativeLong

Negative 64-bit integer (≤-1)

-

-

NegativeLong

nonNegativeLong

Non-negative 64-bit integer (≥0)

-

-

NonNegativeLong

nonPositiveLong

Non-positive 64-bit integer (≤0)

-

-

NonPositiveLong

Integer types are broadly categorized into the following three groups.

Basic Scala/Java Types

Basic types in Scala and Java used for interoperability between modeling and programming.

XML Data Types

Types based on XML schema, used for external data exchange with other systems.

Application-Oriented Types

Types designed around practical constraints and use cases in business and web applications.

In business applications, non-negative (≥0) and positive (≥1) integers with int or long precision are frequently used, so data types are defined to represent them.

Floating Point Types

Name Definition Example Scala/Java Type XML Type

float

Single-precision floating-point (approx. 7 digits)

3.14, -2.7e+5

Float

float

double

Double-precision floating-point (approx. 15 digits)

3.1415926535, 6.02e+23

Double

double

Boolean Type

Name Definition Value Range Scala/Java Type XML Type

boolean

Boolean value

true, false

Boolean

boolean

Quantity Types

Name Definition Example Scala/Java Type XML Type SimpleModeling Lib

quantity

Measurable quantity (e.g., length, weight, temperature)

3.5, 100

-

-

Quantity

amount

Abstract quantity such as money or points

1200, 49.99

-

-

Amount

quantity_unit

Unit of measurable quantity (e.g., m, kg, s)

m, kg,

-

-

QuantityUnit

measurement_unit

Unit for quantity, amount, or rate

USD, %, mmHg

-

-

MeasurementUnit

rate

Ratio between 0 and 1

0.85, 1.0

-

-

Rate

percentage

Percentage (ratio in % form)

85.0, 100.0

-

-

Percentage

Quantity types represent measurable physical quantities, monetary values, and ratios — any data that conveys size or amount.

Unlike primitive types such as numeric or boolean types, "Quantity Types" emphasize the business semantics of the values.

Unlike plain numeric types, they are defined in a semantically meaningful context and may include unit or format information.

Text

Name Definition Length Limit Character Set Scala/Java Type XML Type SimpleModeling Lib

string

General-purpose string used for names, codes, identifiers, etc.

None

Any (full Unicode)

String

string

-

normalized_string

Normalized string with tabs and newlines removed

None

No tabs/newlines/leading/trailing spaces

(String)

normalizedString

NormalizedString

token

Trimmed token such as word or identifier

1–1024

No spaces/newlines; alphanum + limited symbols

(String)

token

Token

identifier

Unique identifier like UUID or codes

1–1024

ASCII alphanum + underscore

(String)

(string)

Identifier

slug

Short, URL-safe identifier

1–64

Lowercase alphanum + hyphen

(String)

(string)

Slug

pathname

File or directory path

1–1024

UTF-8 string with / separators

(String)

(string)

PathName

filename

Filename with extension

1–64

Alphanum + _, -, .

(String)

(string)

FileName

name

Short label or name for identification

1–64

Readable UTF-8 without control chars

(String)

(string)

Name

title

Title for book, article, item, etc.

1–255

Any Unicode including symbols

(String)

(string)

Title

label

Short UI label like button or field name

1–255

Readable UTF-8 without control chars

(String)

(string)

Label

text

Natural language text

8192

Full natural language with punctuation

(String)

(string)

Text

String types are fundamental data types used for a wide variety of purposes such as human-readable text, identification codes, structured paths, and labels.

String types are fundamentally designed to store Unicode code points.

Each string type defines constraints on the number of characters (code points) it can store and the kinds of characters that are permitted, depending on its intended purpose.

In SimpleModeling, string types are classified according to their purpose and structural constraints as follows:

General-purpose Strings

Types used for general-purpose or lightly structured text. (e.g., string, normalized_string, token)

Identifiers and Codes

Used for uniquely identifying or structurally encoding values. (e.g., identifier, slug, pathname, filename)

Labels and Names

Used for UI display or human-readable naming. (e.g., name, title, label)

Natural Language Text

Used for full natural language content such as sentences or paragraphs. (e.g., text)

These types enable clearer and safer modeling for input validation, UI rendering, search, and consistency checking.

Temporal Types

Name Definition Example Scala/Java Type XML Type

local_date

Calendar date

2025-07-11

java.time.LocalDate

date

local_time

Time without timezone

14:30:00

java.time.LocalTime

time

local_datetime

Date and time without timezone

2025-07-11T14:30:00

java.time.LocalDateTime

datetime

offset_time

Time with offset

14:30:00+09:00

java.time.OffsetTime

time

offset_datetime

Date-time with offset

2025-07-11T14:30:00+09:00

java.time.OffsetDateTime

datetime

zoned_datetime

Date-time with timezone ID

2025-07-11T14:30:00+09:00Asia/Tokyo

java.time.ZonedDateTime

datetime

duration

Elapsed time

PT5H30M, PT20S

java.time.Duration

-

period

Calendar period

P2Y3M

java.time.Period

-

instant

Instant in UTC

2025-07-11T05:30:00Z

java.time.Instant

-

year

Year

2025

java.time.Year

-

year_month

Year and month

2025-07

java.time.YearMonth

-

month_day

Month and day

07-11

java.time.MonthDay

-

timezone

Timezone ID

Asia/Tokyo

java.time.ZoneId

-

zone_offset

UTC offset

+09:00, Z

java.time.ZoneOffset

-

Temporal types are a group of data types designed to represent time-related information such as dates, times, durations, and time zones.

In SimpleModeling, temporal types are categorized by their use cases as follows:

Calendar Types

Types that represent calendar information such as year, month, day, hour, minute, and second. (e.g., local_date, local_time, local_datetime)

Zoned and Offset Types

Types representing date-times with time zone or offset information. (e.g., offset_datetime, zoned_datetime)

Duration and Period

Types for representing elapsed time and calendar-based periods. (e.g., duration, period)

Instant and Precision Types

Types representing absolute instants in UTC or precise calendar values. (e.g., instant, year, year_month, month_day)

Timezone Information

Types for representing timezone IDs and UTC offsets. (e.g., timezone, zone_offset)

Note that in earlier versions of Java, java.util.TimeZone was used to represent time zones, but since Java 8, the use of java.time.ZoneId is recommended instead.

These types are essential in various contexts such as scheduling, timestamping, and historical record management.

Internationalization Types

Name Definition Example Scala/Java Type XML Type SimpleModeling Lib

locale

Language and region

ja_JP, en_US

java.util.Locale

(xs:string)

-

locale_language

ISO 639 language code

ja, en

-

xs:language

LocaleLanguage

locale_country

ISO 3166 country code

JP, US

-

(xs:string)

LocaleCountry

locale_script

ISO 15924 script code

Latn, Hani

-

(xs:string)

LocaleScript

charset

Character encoding

UTF-8, Shift_JIS

java.nio.charset.Charset

(xs:string)

-

currency

ISO 4217 currency code

JPY, USD

java.util.Currency

(xs:string)

-

i18n_string

Translated text by locale

-

-

-

I18nString

i18n_message

Multilingual message with arguments

-

-

-

I18nMessage

i18n_template

Template with placeholders

-

-

-

I18nTemplate

Internationalization types represent information related to multilingual and multicultural support, such as language, region, character encoding, currency, and translated text.

I/O Types

Name Definition Example Scala/Java Type XML Type SimpleModeling Lib

url

Absolute URL including scheme and host

https://example.org

java.net.URL

anyURI

-

uri

General URI (may be relative)

/images/logo.svg

java.net.URI

anyURI

-

mime_type

MIME media type

image/png

-

-

MimeType

content_type

MIME type with parameters

text/html; charset=UTF-8

-

-

ContentType

file_suffix

File extension without dot

jpg, pdf

-

-

FileSuffix

I/O types represent information used to connect to and identify external systems and data resources, such as URLs, file extensions, and MIME types.

Miscellaneous

Name Definition Example Scala/Java Type XML Type SimpleModeling Lib

binary

Binary data

-

ArrayByte

hexBinary, base64Binary

-

uuid

Universally unique identifier

123e4567-e89b-12d3-a456-426614174000

java.util.UUID

-

-

Extended Types (for Reference)

Name Definition Scala/Java Type XML Type SimpleModeling Lib

clob

Large character object (e.g., comments, article body)

-

-

Clob

blob

Large binary object

-

-

Blob

This section provides, for reference, data types that extend basic string or binary types in terms of structure or application context.

The clob and blob types are intended to handle large data that cannot fit into memory, or would consume too much memory if fully loaded.

In practice, they often involve complex mechanisms such as temporary file storage, and thus are not strictly considered primitive types.

However, they are designed to offer a developer experience comparable to that of basic data types.