SimpleObject

Created: 2025-09-15 Updated: 2025-12-15

In the SimpleModeling Reference Profile (SMRP), the abstract class SimpleEntity is defined as the base class for all entity objects. Except for special cases, all entity objects are expected to derive from SimpleEntity.

SimpleEntity provides a comprehensive set of attributes commonly needed by entity objects, allowing designers to define entity objects by simply adding domain-specific attributes.

SimpleObject is defined as the base class of SimpleEntity.

SimpleObject is an abstract object in SimpleModeling that defines the common attributes of domain objects.

Value objects can optionally use SimpleObject as their base class.

SimpleObject is composed by delegating various generic attribute groups, each of which can also be reused individually as components of value objects.

Definition in CML

This is the CML-based definition of SimpleObject and SimpleEntity.

In CML definitions, the literate modeling style allows descriptive explanations to be placed alongside the model definitions, making this information self-sufficient for understanding.

simpleobject.cml
SimpleObject
============

本モデルは、SimpleModeling.org におけるドメイン・モデルの汎用的なエンティティの
ベース・オブジェクトである SimpleObject を定義します。
この型は、名前・説明・ライフサイクル・公開・セキュリティ・監査・コンテキスト等の共通的な
属性群を委譲構造で保持し、
状態機械(PostStatus, Aliveness)によるエンティティの状態管理と組み合わせることで、
アプリケーションが使用するエンティティ群の一貫した管理モデルを実現します。

# Class

## SimpleObject

SimpleObjectは、サブクラスのSimpleEntityを経由して
全てのドメイン・エンティティのベース・クラスとなる
抽象オブジェクトです。
また必要に応じてバリュー・オブジェクトの基底クラスにもなります。

主に以下の特徴を持ちます:

- 各種属性群をバリュー・オブジェクトとして委譲
- 投稿状態・活性状態のステートマシンを保持
- 監査情報(バージョン・変更履歴)やコンテキスト情報(外部連携ID、表示優先度など)も包括

### Delegates

- NameAttributes
- ExplanatoryAttributes
- LifecycleAttributes
- PublicationAttributes
- SecurityAttributes
- ResourceAttributes
- AuditAttributes
- ContextualAttributes

### StateMachines

- PostStatus
- Aliveness

# Entity

## SimpleEntity

SimpleEntityは全てのエンティティのベース・クラスとなる抽象クラスです。
SimpleObjectの全性質を受け継いだ上で、永続的識別子(id)を設定しています。

### Base

- SimpleObject

### Attributes

| name | type       | mult | description                           |
|------+------------+------+---------------------------------------|
| id   | identifier |    1 | 永続的な論理識別子。URL、DSL、ソースコードなどで一貫して使用される。|

# Value

SimpleEntity, SimpleObjectで属性の定義に使用しているバリュー・オブジェクト
です。
カテゴリごとにバリュー・オブジェクトを定義しています。

目的の応じて個々のバリュー・オブジェクトを個別に部品として再利用することも可能です。

## NameAttributes

ドメイン・オブジェクトの名前を記述するバリュー・オブジェクトです。
目的別に複数の名前を持つことができます。

### Attributes

| name    | type       | mult | description                     |
|---------+------------+------+---------------------------------|
| name    | name       | 1    | オブジェクト名。プログラムで使用      |
| label   | i18n_label | ?    | ラベル名。UI表示用のラベル          |
| title   | i18n_title | ?    | タイトル名。ドキュメントや画面の見出し |
| code    | identifier | ?    | アプリケーション管理上のコード       |
| alias   | i18n_label | *    | 略称・別名などのシノニム群           |
| slug    | slug       | ?    | URLやルーティング用の短縮名         |
| shortid | identifier | ?    | 短縮ID(UI・印刷用など)            |

各種名前は用途に応じて以下のデータ型を用いています。

- プログラム内で使用される名前 : name
- プログラム内で使用される識別子 : identifier
- HTTPなどの運用に沿った名前 : slug
- UIなどで表示される名前 : i18n_label, i18n_title

i18_label, i18n_titleは複数言語を同時格納できるマルチロケールのデータ型で、
国際化されたアプリケーション開発に必要です。

## ExplanatoryAttributes

ドメイン・オブジェクトの内容を説明するバリュー・オブジェクトです。

### Attributes

| name         | type      | mult | description                       |
|--------------+-----------+------+-----------------------------------|
| headline     | i18n_text | ?    | 印象的な見出し・キャッチコピー         |
| brief        | i18n_text | ?    | 簡潔な1文の説明(一覧・UI補助など)     |
| tooltip      | i18n_text | ?    | UI用の補助説明(title属性など)       |
| summary      | i18n_text | ?    | 数文の要約(機能・構造の要点)         |
| abstract     | i18n_text | ?    | 論文・技術文書の導入的な要約文         |
| description  | i18n_text | ?    | 詳細な本文説明(段落・複数段落可)      |
| remarks      | i18n_text | ?    | 補足・注意・備考など(本体外の補足情報) |

各属性のデータ型にi18n_textを用いており、国際化されています。

## LifecycleAttributes

ドメイン・オブジェクトのライフサイクルを管理するためのバリュー・オブジェクトです。

### Attributes

| name        | type       | mult | description                    |
|-------------+------------+------+--------------------------------|
| created_at  | datetime   |    1 | 作成日時                         |
| updated_at  | datetime   |    ? | 最終更新日時                     |
| created_by  | identifier |    1 | 作成者ID                        |
| updated_by  | identifier |    ? | 更新者ID                        |

## PublicationAttributes

ドメイン・オブジェクトの公開期間や使用期間を管理するためのバリュー・オブジェクトです。

### Attributes

| name       | type     | mult | description |
|------------+----------+------+-------------|
| publish_at | datetime | ?    | 公開日時      |
| public_at  | datetime | ?    | 公開開始日時  |
| close_at   | datetime | ?    | 公開終了日時  |
| start_at   | datetime | ?    | 利用開始日時  |
| end_at     | datetime | ?    | 利用終了日時  |

## SecurityAttributes

ドメイン・オブジェクトのセキュリティのためのバリュー・オブジェクトです。

### Attributes

| name               | type       | mult | description     |
|--------------------+------------+------+-----------------|
| owner_id           | identifier |    1 | 所有者ID         |
| group_id           | identifier |    1 | 所属グループID    |
| rights_owner_read  | boolean    |    1 | 所有者の参照権限   |
| rights_owner_write | boolean    |    1 | 所有者の更新権限   |
| rights_group_read  | boolean    |    1 | グループの参照権限 |
| rights_group_write | boolean    |    1 | グループの更新権限 |
| rights_other_read  | boolean    |    1 | 他者の参照権限     |
| rights_other_write | boolean    |    1 | 他者の更新権限     |
| privilege_id       | identifier |    ? | 権限セットID      |

## ResourceAttributes

ドメイン・オブジェクトの「Webリソース」としてのメタ情報(Atom/RSS、OGP、CCライセンス等)を記述するためのバリュー・オブジェクトです。

### Attributes

| name         | type        | mult | description        |
|--------------+-------------+------+--------------------|
| mimetype     | mime_type   | ?    | MIMEタイプ          |
| rights       | string      | ?    | 著作権・利用権        |
| source       | string      | ?    | 出典・元データ        |
| authors      | i18n_string | *    | 著者リスト           |
| contributors | i18n_string | *    | 貢献者リスト         |

## AuditAttributes

ドメイン・オブジェクトの監査に関するバリュー・オブジェクトです。

### Attributes

| name       | type  | mult | description                         |
|------------+-------+------+-------------------------------------|
| version    | token | ?    | 明示的なバージョン識別子                |
| revision   | long  | ?    | 更新版数(自動インクリメント)           |
| change_log | text  | ?    | 変更理由・履歴の記述                    |
| audit_note | text  | ?    | 履歴管理用の補足メモ(レビュー用メモなど) |

## ContextualAttributes

ドメイン・オブジェクトの実行文脈(例: 所属アプリ、表示グループ、外部システム連携)を記録するためのバリュー・オブジェクトです。

### Attributes

| name           | type       | mult | description             |
|----------------+------------+------+-------------------------|
| externalid     | token      | ?    | 外部連携用ID              |
| display_level  | int        | ?    | 表示優先度                |
| context_id     | identifier | ?    | 所属コンテキスト(論理空間) |
| context_app_id | identifier | ?    | アプリケーション識別子      |

## MediaAttributes

エンティティに紐づけられるメディア・コンテンツを記述する属性群です。

### Attributes

| name        | type       | mult | description        |
|-------------+------------+------+--------------------|
| url         | url        | ?    | 外部リンク/ページURL |
| images      | Image      | *    | 画像                |
| audios      | Audio      | *    | 音声                |
| videos      | Video      | *    | 動画                |
| attachments | Attachment | *    | アタッチメント        |

# StateMachine

状態遷移モデルは、業務オブジェクトのライフサイクルを明示的に制御するためのものです。
ユーザーによる操作、またはシステムによる制御フローの設計に活用されます。

- PostStatus: 公開状態のステートマシン(下書き → 公開 → アーカイブ など)
- Aliveness: 活性状態(通常/一時停止/削除)によるアクセス制御

## PostStatus

ドメイン・オブジェクトの公開を管理する状態機械です。

### States

| name       | label     | description
|------------|-----------+------------------------------------------------------|
| draft      | 非公開     | 作成中・編集中の状態(ユーザーに非公開)              |
| published  | 公開       | 一般公開状態。誰でも閲覧可能                           |
| archived   | アーカイブ | 公開終了後に非表示として保管された状態(再公開可能)    |
| disabled   | 非公開     | 管理者等により強制的に非表示とされた状態(再開不可)    |

### Transitions

| from      | to        | trigger       | guard | description
|-----------+-----------+---------------+--------+--------------------------------------------------|
| draft     | published | publish       |        | 作成・編集を終えて公開する
| draft     | disabled  | cancel        |        | 編集を中止し、無効化する(破棄的操作)
| published | archived  | archive       |        | 公開を終了し、アーカイブとして保存
| published | disabled  | disable       |        | 管理者等による強制非表示(不正など)
| archived  | published | republish     |        | アーカイブ状態から再度公開する

## Aliveness

ドメイン・オブジェクトの有効性を管理する状態機械です。

### States

| name      | label   | description
|-----------+---------+--------------------------------
| available | 運用中  | 通常利用中の状態
| suspended | 休止中  | 一時停止中。再開可能。
| deleted   | 削除済み| 論理削除された状態

### Transitions

| from      | to        | trigger      | guard | description
|-----------+-----------+--------------+--------+-----------------------------
| available | suspended | suspend      |        | 利用を一時停止する
| suspended | available | resume       |        | 利用を再開する
| available | deleted   | delete       |        | 利用を終了(削除)
| suspended | deleted   | delete       |        | 停止状態から削除

Usage of SimpleEntity

Entity objects are persistent objects managed by databases and similar systems. One such use case is representing articles such as news or blog posts. SimpleEntity defines attributes intended for such article-like objects.

In fact, these attributes are often needed even for non-article entities such as SalesOrder or Reservation. For example, displaying a list of Reservations may require various name formats and descriptions depending on the UI layout, and publishing Reservations via AtomFeed would require appropriate metadata. Anticipating such use cases, we provide a base class that consolidates commonly used attributes.

The following attribute groups are defined in SimpleEntity (via SimpleObject):

  • NameAttributes : Name

  • ExplanatoryAttributes : Object Description

  • LifecycleAttributes : Lifecycle

  • PublicationAttributes : Publication

  • SecurityAttributes : Security

  • AuditAttributes : Audit

  • ContextualAttributes : Contextual Metadata

The following state machines are also defined:

  • PostStatus : Publication Status

  • Aliveness : Aliveness State

Usage of SimpleObject

SimpleEntity is a persistent entity object and thus defines an id attribute required for persistence, which makes it unsuitable for non-persistent objects like value objects.

To accommodate use with value objects, a separate class named SimpleObject was defined to hold only common attributes, and SimpleEntity was made a subclass of SimpleObject.

Internationalization

In this article, the file simpleobject.cml is prepared in both Japanese and English versions, but in actual operation, it is also possible to include both Japanese and English descriptions side by side as shown below.

Tools can extract and utilize the respective Japanese and English descriptions as needed.

References

Glossary

SimpleEntity

SimpleObject is an abstract object defined in the SimpleModeling Reference Profile that specifies common attributes for domain objects. SimpleEntity provides a comprehensive set of attributes commonly needed by entity objects, allowing designers to define entity objects by simply adding domain-specific attributes.

SimpleModeling Reference Profile (SMRP)

This is the reference profile of SimpleModeling. To concretely illustrate Literate Model-Driven Development with SimpleModeling, a reference profile is defined.

SimpleObject

SimpleObject is an abstract object defined in the SimpleModeling Reference Profile that specifies common attributes for domain objects. It delegates generic attribute groups—such as NameAttributes and LifecycleAttributes—as value objects, making it reusable as a base class for both entity objects and value objects. SimpleEntity inherits from SimpleObject and adds attributes such as the identifier (id) required for persistence, forming the foundation of entity objects.

SimpleModeling

SimpleModeling is a modeling-centered software development methodology and technology system for constructing a Domain Model from Knowledge, formalizing it in CML, realizing it as executable software through Cozy and AI, and running it on Textus.

entity object

An Entity Object is an object in a domain model that has a unique identifier (ID) and is continuously identified and tracked throughout its lifecycle. Entities are mutable and treated as the same object even if their state changes, as long as they retain the same ID.

Attribute

An Attribute is a Structural Feature representing a value or reference that Instances of a Classifier may hold. An Attribute may be characterized by a name, Type, Multiplicity, default value, and Constraints.

Domain Object

A Domain Object is an object that represents concepts from the real-world domain targeted by a software system, encapsulating business logic and conceptual structure. It serves as a central building block of the domain model, encompassing elements such as entities, value objects, services, rules, and events. Domain objects are not just data structures or processing units within the system, but parts of a model that reflect the semantics and behavior of the problem domain.

value object

A Value Object is an object in a domain model that represents a semantically meaningful group of values, such as attributes or descriptions. It does not have a persistent identity like an entity, is immutable, and equality is based on its values.

Object

An Object is an Instance classified by a Class or another Classifier and may have structure, State, and Behavior. It is treated as an individual that can be referred to separately from other Instances of the same Classifier.

CML (Cozy Modeling Language)

CML (Cozy Modeling Language) is the SimpleModeling formal modeling language for describing the Executable Model portion of an Object Model that connects to program generation and execution.

Model

A Model is an abstraction that represents a subject according to a particular Purpose and Concern so that it can be understood, reasoned about, evaluated, or constructed. It is not the subject itself; it preserves the elements, relationships, and meanings required for its purpose.

Literate Model

Undefined

Lifecycle

A Lifecycle is the range of States and Transitions through which a subject passes, while retaining its Identity, from creation to termination.

Security

Security is the quality of protecting information and functions according to legitimate authority and preventing unauthorized disclosure, use, modification, destruction, or repudiation. It includes Concerns such as Confidentiality, Integrity, Authenticity, and Accountability.

StateMachine

In UML, a StateMachine is a Behavior that expresses the event-driven Behavior of a system element by traversing a graph of States through Transitions triggered by Event occurrences.

State

In UML, a State models a situation during which an invariant condition holds. The current State of an Object may determine accepted Events and Operations, applicable Constraints, and possible next Transitions.

Persistence

Undefined