Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start draft of KDL Data Model #228

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions MODEL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# KDL Data Model

This document specifies an abstract data model of KDL document language.

*This is version `0.0.0` of KDL Data model. It has not been released yet.*

## Introduction

KDL is defined by [KDL Specification](SPEC.md) as a formal language with
components such as nodes, identifiers, strings, comments, and whitespace.
Some of these components can be expressed in mutliple ways and some of
these components are typically ignored when a KDL document is parsed.

KDL Data model defines a conceptual structure of semantically relevant elements
expressed in KDL syntax. The data model is required to process KDL documents
independent from syntax and implementations with [KDL Query
Language](QUERY-SPEC.md) and [KDL Schema Language](SCHEMA-SPEC.md).

## Elements

Every KDL document represents a [document](#document).

Sequences and sets can be empty.

A Unicode string is a sequence of Unicode code points.

### Document

A document is a sequence of [nodes](#node).

Documents must not contain itself via node direct or indirect children to avoid
circular structures.

### Node

A node consists of three mandatory and two optional elements:

* a **name** being a Unicode string
* an optional **tag** being a Unicode string
* a sequence of **arguments**, each being a [value](#value)
* a set of **properties**, each consisting of
* a name being Unicode string unique within the set
* a [value](#value)
* an optional list of **children** being a [document](#document)

### Value

A value is one of:

* a Unicode string
* a **number**, consisting of an integer part and a decimal part
* a **boolean**, being one of the special values *true* and *false*
* the special value *null*

## Application Notes

Implementations may want to limit the set of processable KDL documents by
limiting properties of the data model such as the following:

* A node with empty string tag (e.g. `("")node`) differs from a node without
tag (`node`).

* A node with empty children (e.g. `node {}`) differs from a node without
children (`node`).

* KDL does not differ between integer numbers and numbers with fractional part
nor does it define a fixed limit to the length or precision of numbers.

* property names differ also if their distinct strings become equivalent after
Unicode normalization.

Applications must make clear whether they support full KDL data model or a
specific subset and whether they modify KDL documents to fit to their limited
model. Applications may further extend their document model with additional
information such as line numbers beyond the scope of this specification.