Mirror of the Rel4tion website/wiki source, view at <http://rel4tion.org>

[[ 🗃 ^yEzqv rel4tion-wiki ]] :: [📥 Inbox] [📤 Outbox] [🐤 Followers] [🤝 Collaborators] [🛠 Commits]

Clone

HTTPS: git clone https://vervis.peers.community/repos/yEzqv

SSH: git clone USERNAME@vervis.peers.community:yEzqv

Branches

Tags

master :: projects / kort /

manual.mdwn

[[!toc]]

Intro

Kort is a simple, line-based language for expressing [[/projects/Smaoin]] statements. It can be viewed and slightly edited by humans, but major editing and writing are quite inconvenient. Kort is meant to be a tool for interchange of semantic data between machines and a simple format for testing, conversions, comparisons and other automated tasks.

Despite being mainly a tool for Smaoin, it’s possible to have statements of arbitrary length (at least 3 components). For Smaoin, only 4-component statements are valid, but perhaps other systems or future development can use statements of other lengths (e.g. to support ternary relations).

Lines

A Kort document is a sequences of lines, separated by ASCII linefeed characters. Each line is either a comment or a statement. Documents must be encoded in UTF-8.

A comment begins with two dashes (--). It is meaningless semantically, i.e. statements aren’t generated from it. The parser can ignore comment lines. They are meant only for humans to read.

A statement line specifies the 4 components of a statement, separated by ASCII tab characters, 1 tab or more between each two consequtively specified components. The order of the components is: identifier, property, subject, object. The object can be a value or a resource. The other three components must be resources.

Statements can have any number of elements after the property, but there must be at least one. For Smaoin based data, this number of elements must be 2: the subject and the object.

Entities

A resource Uid is specified between angle brackets (<>) as a sequence of non-whitespace Graphical Unicode characters. The text between the brackets is taken literally as the Uid, except for several escape sequences:

  1. \ must be escaped as \\
  2. > must be escaped as \>
  3. A Uid starting with % must have the first % escaped as \%
  4. A Uid starting with literal % is not a Uid but a placeholder which can later be replaced with an actual Uid. The part after the %, if exists, is a placeholder name. All placeholders sharing a name get the same (but unique) Uid.

A value consists of a literal and a type. The format is:

  1. {{
  2. A literal string
  3. }}::
  4. A type Uid or placeholder (between < and >)

Let’s see how values of the Smaoin fundamental data types are specified. Note that what determines the type is the type Uid, not the literal behind the braces. But e.g. specifying {{XYZ}} and the Boolean type is an invalid value in Smaoin.

Boolean:

[x] and [_] for true and false respectively.

Character:

Unicode characters with basic type Graphical can be specified as-is, but there are escape sequences:

Number:

A number can be represented in one of 3 forms:

  1. Hexadecimal non-negative integer, e.g. 0x0f47b5, 0x51D98A354EA
  2. Ratio of decimal integers, possibly with a preceding minus sign, e.g. -2/3, 24343/97
  3. Real number consisting of a significand (decimal number with optional minus and decimal point) and an exponent (decimal number with optional minux), separated with $. The number meant by signiifcand s and exponent e is s * 10^e. Examples: -852, 852.36, -68$20, 46.2$-12.

String:

Strings are written as sequences of Unicode characters. A character with basic type Graphical can be written as-is, but there are exceptions and escape sequences:

Data:

Chunks are expressed as [[!wikipedia Base64]] strings without spaces and with optional padding using = characters. The alphabet is A-Z, a-z, 0-9, + and / in this order.

[See repo JSON]