<?xml version="1.0" encoding="UTF-8"?>
<metanorma xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="2.9.0" schema-version="v2.2.0" flavor="ribose">
<bibdata type="standard">
<title language="en" type="main">LutaML — Language reference</title>
<docidentifier primary="true" type="Ribose Inc.">RS 3001</docidentifier><docnumber>RS 3001</docnumber><date type="published"><on>2024-03-10</on></date><contributor><role type="author"/><organization>
<name>Ribose Inc.</name>
<address><formattedAddress>167-169 Great Portland Street<br/>5th Floor<br/>London<br/>W1W 5PF<br/>United Kingdom</formattedAddress></address></organization></contributor><contributor><role type="author"/><person>
<name><completename>Ronald Tse</completename></name>
<affiliation><organization>
<name>Ribose</name>
</organization></affiliation></person></contributor><contributor><role type="author"><description>committee</description></role><organization>
<name>Ribose Inc.</name>
<subdivision type="Committee" subtype="technical">
<name>LutaML</name>
</subdivision></organization></contributor><contributor><role type="publisher"/><organization>
<name>Ribose Inc.</name>
<address><formattedAddress>167-169 Great Portland Street<br/>5th Floor<br/>London<br/>W1W 5PF<br/>United Kingdom</formattedAddress></address></organization></contributor><edition>1.0</edition><language>en</language><script>Latn</script><status><stage>published</stage></status><copyright><from>2026</from><owner><organization>
<name>Ribose Inc.</name>
<address><formattedAddress>167-169 Great Portland Street<br/>5th Floor<br/>London<br/>W1W 5PF<br/>United Kingdom</formattedAddress></address></organization></owner></copyright><ext><doctype>standard</doctype><flavor>ribose</flavor><security>unrestricted</security></ext></bibdata><metanorma-extension><semantic-metadata><stage-published>true</stage-published></semantic-metadata>
<presentation-metadata><toc-heading-levels>2</toc-heading-levels><html-toc-heading-levels>2</html-toc-heading-levels><doc-toc-heading-levels>2</doc-toc-heading-levels><pdf-toc-heading-levels>2</pdf-toc-heading-levels></presentation-metadata></metanorma-extension>
<boilerplate><copyright-statement>

<clause id="_81bb91f1-8ca7-1476-7150-6c55a0e1276d" obligation="normative"><p id="_2f99fb1a-6c8b-c002-e8cc-ea45a873756c">© Ribose Inc. 2026</p>
</clause>
</copyright-statement>

<legal-statement>

<clause id="_7e0f3c63-3fc9-65cf-37f7-b94afa0dbc5d" obligation="normative"><p id="_50bbfa02-61c3-8332-bad8-61e7389d1808">All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized otherwise in any form or by any means, electronic or mechanical, including photocopying, or posting on the internet or an intranet, without prior written permission. Permission can be requested from the address below.</p>
</clause>
</legal-statement>

<feedback-statement>

<clause id="_310a94ed-9b3b-55ae-882d-7b9734a5474e" obligation="normative"><p id="_e252883d-879c-4220-abfd-4f8ea82738e9" anchor="boilerplate-name" align="left">Ribose Inc.</p>

<p id="_ace8af1b-8faf-1380-6497-ea3b3ea492a9" anchor="boilerplate-address" align="left">167-169 Great Portland Street<br/>5th Floor<br/>London<br/>W1W 5PF<br/>United Kingdom<br/> <br/> <link target="mailto:copyright@ribose.com"/><br/> <link target="https://www.ribose.com">www.ribose.com</link></p>
</clause>
</feedback-statement>
</boilerplate><preface><introduction id="_3e52ff34-93a2-411f-4884-2f35c6658eea" obligation="informative">
<title id="_2b2e98d1-114a-3da4-8556-01ae0a724280">Introduction</title>
<p id="_d40034e3-59b1-02a2-ddad-358a311a34bc">LutaML is a language for defining information models and instances of those information models.</p>

<p id="_556a1c61-2a49-6b57-2aa2-146552b3f9b6">Traditionally, different languages have been developed to define information models for disparate purposes.</p>

<ul id="_23c75e01-4ee8-bce0-f4b8-2ed7914336f2"><li><p id="_c75fa310-cdec-1c1b-070d-20ad44e617e0">Data modeling languages are used to define and describe information models in a structured and formalized manner to document and interchange such model designs. Models defined in these formats are not meant to be directly usable in programming languages or serialization formats.</p>
</li>
<li><p id="_49310a45-dde4-b0e8-58dd-084413b106b6">Schema languages are used to define serialization formats that can be used to serialize and deserialize data in a specific format. These formats are not meant to be directly usable in programming languages or information models.</p>
</li>
<li><p id="_b97b5e66-7a0a-79b5-f77a-cad8baa0bdc5">Serialization formats are used to serialize and deserialize data according to some schema or in a “schema-less” model. These formats are not directly useable as information models.</p>
</li>
<li><p id="_ec7a79b3-62df-c4f7-883d-b2c851802ea8">Programming language constructs are used to define data structures that can be used in software applications. These constructs are not directly useable as information models or serialization formats nor communicated across systems.</p>
</li>
</ul>

<example id="_10233f32-0569-bdc6-21f1-e5c38a03e82a"><p id="_6075f285-2704-9cc8-f0f5-5c79d82fb813">Traditionally, multiple layers of languages and tools are used to work with information models:</p>

<ul id="_bb50d5ad-0720-3666-0597-7d3b5efcd46f"><li><p id="_1dd3ce81-c208-f63b-6f63-c3198af94587">UML for defining information models</p>
</li>
<li><p id="_514bf176-75b5-677a-1f61-2e65e9a77681">XML Schema or JSON Schema for defining serialization formats</p>
</li>
<li><p id="_dc1d34cd-024c-30dd-9f15-1f2b8d3adf14">Programming language implementations for both the models and their serialization mechanisms</p>
</li>
</ul>
</example>

<p id="_019729a0-9bf1-5db3-2375-9a3f5de07270">LutaML is a single language that incorporates all the above roles of information modeling.</p>

<p id="_5ab0b167-c970-1be2-11e8-3d910887db80">The goal of LutaML is to provide a single language that can be used to:</p>

<ul id="_aee72ea4-5cc6-1349-d14d-09f1e1634cb4"><li><p id="_5fd9b4fa-d918-9542-c204-68873e97b2e8">define information models that are human-readable and interchangeable</p>
</li>
<li><p id="_39834332-3e08-46bc-d7e1-5bead63c7ca8">specify serialization formats of information models</p>
</li>
<li><p id="_4b9afa65-028f-ddad-4358-730dff1507df">parse, validate, and utilize those information models in programming languages</p>
</li>
</ul>
</introduction></preface><sections>
<clause id="_050d150d-eb44-b36c-329e-2eb2c8b06231" type="scope" obligation="normative">
<title id="_f70b6ff6-6131-0e24-81e1-850dbe94b63d">Scope</title>
<p id="_b4900097-a912-7df3-e6fb-6c3a90682695">This document defines the core syntax and semantics of the Luta Modeling Language (LutaML), a domain-specific language for defining data models and instances of those data models.</p>

<p id="_ac36e88c-7192-a587-a2d3-6de185815a03">Other aspects of the LutaML language are defined in separate documents.</p>
</clause>



<terms id="_ee0daf21-2cc3-f307-5c3f-dc0664d9a58c" obligation="normative">
<title id="_dfb2eab2-f980-6365-3c47-81d0eb272962">Terms and definitions</title><p id="_1fbc7bf1-a8de-c3eb-ee88-3b4cf950e61b">For the purposes of this document, the following terms and definitions apply.</p>
<term id="_fdab7d19-6f56-2760-888c-1d73408d9e4d" anchor="term-information-model"><preferred><expression>
<name>information model</name>
</expression>
</preferred>
<definition id="_9e9c2d02-511e-ff84-da65-e9e406e9fcb7"><verbal-definition id="_c33093a6-c5ed-6896-f501-e61bb55dce67"><p id="_c66372b3-3f80-265e-08f3-9b3efc3ac31c">representation of information in a structured manner</p></verbal-definition></definition>
 </term>

<term id="_74356c28-a73e-1841-4f35-581dc7756b8a" anchor="term-model"><preferred><expression>
<name>model</name>
</expression>
</preferred>
<definition id="_7e91e223-6c5d-2522-e96e-3682fd0fbcef"><verbal-definition id="_3d58722c-e89e-852e-8bc0-5f37a9246b20"><p id="_255c8e66-013f-7bc7-a0ef-69bf891d7854">abstract representation of a category of information</p></verbal-definition></definition>


 <termnote id="_4f90f238-17ca-ca87-4225-d0efd7ad8d1f"><p id="_4ac378de-1f6e-99c4-4314-6ae2356f752d">Commonly, a collection of classes, enums, and relationships defining a data structure, facilitating the organization of information and its metadata.</p>
</termnote></term>

<term id="_4962be13-8277-90aa-90ad-28e2e034e90a" anchor="term-class"><preferred><expression>
<name>class</name>
</expression>
</preferred>
<definition id="_c8b04871-fcc0-0b4b-0b1f-c5401a71f0c8"><verbal-definition id="_f78f38c5-d0db-7b5a-6082-31185115be10"><p id="_92459697-0438-73dc-16ca-3637b14aaf43">defined characteristics of a type of object, including attributes and constraints</p></verbal-definition></definition>
 </term>

<term id="_e79de2a0-6a86-f490-5b0b-0c2045a78ef4" anchor="term-enum"><preferred><expression>
<name>enum</name>
</expression>
</preferred>
<definition id="_705c9112-33a7-4ac3-f3a9-62c5542f7a10"><verbal-definition id="_d2e1928e-ab66-cc71-cd4b-03d129992936"><p id="_523e904c-487a-7e90-b130-87edda899f63">predefined set of values</p></verbal-definition></definition>
 </term>

<term id="_8ab78b76-e66a-744e-341d-0d9899f07d0e" anchor="term-instance"><preferred><expression>
<name>instance</name>
</expression>
</preferred>
<definition id="_e0bc6c4e-01e0-e919-2148-a3123008330f"><verbal-definition id="_0519645a-0027-df5b-d084-e42b3b18f622"><p id="_c544a962-9158-8369-7e04-4eaea4cb39c9">data conforming to a class definition</p></verbal-definition></definition>
 </term>

<term id="_a297392b-f712-f039-d335-2b613a0dc20e" anchor="term-attribute"><preferred><expression>
<name>attribute</name>
</expression>
</preferred>
<definition id="_7f77817f-bf22-e010-6e89-901548f74317"><verbal-definition id="_fde386bb-e38e-12ba-9eec-4f4d7bbe4812"><p id="_f86990ff-b3cf-c039-add6-2bf68674a549">characteristic of a property of a <concept><refterm>class</refterm><renderterm>class</renderterm><xref target="term-class"/></concept></p></verbal-definition></definition>


 <termnote id="_e88b9d22-fb22-3b38-fe90-25e8ff92a232"><p id="_93412afb-91c9-1e22-5ce7-6e07e5f6c45b">Commonly defined by a name, type, and cardinality</p>
</termnote></term>

<term id="_781b7ab4-41e0-2608-feb8-19944bb9449b" anchor="term-reference"><preferred><expression>
<name>reference</name>
</expression>
</preferred>
<definition id="_3768458e-81ed-2dec-a3c0-8a471e733d42"><verbal-definition id="_95f0c8d2-e9e9-a68e-4fb7-b2d553516541"><p id="_df7569b7-5306-d1ff-e1a3-ffbf58a47066">relationship between instances</p></verbal-definition></definition>


 <termnote id="_a11b2bbf-e835-c387-efd7-e853745c1dca"><p id="_eebfd754-23b9-cfc0-4d3c-bf35fcfa25d5">Can be implemented as pointer to another instance or attribute.</p>
</termnote></term>

<term id="_77ba832f-f1fa-a4ac-34ab-c7eae059321f" anchor="term-cardinality"><preferred><expression>
<name>cardinality</name>
</expression>
</preferred>
<definition id="_725429b3-e8f8-7465-560d-89ecdbc1f4dd"><verbal-definition id="_8e099998-d4aa-720f-ca96-3003cc8074a4"><p id="_c1cb366d-c6b7-f386-60ec-00344770e946">allowed number of values for an attribute</p></verbal-definition></definition>


 <termnote id="_dba1bebc-cfb6-d462-b79b-8ce4cc7c8cc6"><p id="_c848a8fb-5e27-f0fb-5efb-40f7bba8a6b6">Commonly expressed as a range (e.g., 0..1, 1..n).</p>
</termnote></term>
</terms>

<clause id="_20d17012-0af4-9926-8ff7-70596427b386" obligation="normative">
<title id="_d503d0c4-9eef-366f-ac0e-0de0e152220c">Purpose</title>
<clause id="_ec1d1a3b-577c-a03b-8fdb-5d20e863a4eb" obligation="normative">
<title id="_87c2ee2f-a553-daac-6d47-4175177bfb0c">Data modeling</title>
<p id="_fdd0bda1-bac2-7ecc-679e-3a9827c42ef8">Information is stored and used as data in digital systems. Digital systems rely on defined structures to store, retrieve and manipulate data in a consistent manner.</p>

<p id="_833c306e-3994-d326-27ce-e09f92400be8">A data model is a structured representation of the data that describes the properties of the data, the relationships between different data elements, and any rules or constraints that govern the data.</p>

<p id="_64d1bdba-6f68-27ae-fee7-3c6361e98ff3">Data modeling is the process of creating a data model.</p>

<p id="_f15c0ebb-569a-5087-98ea-73fba2fe9bdb">Many data modeling languages exist, each with its own syntax and semantics.</p>

<example id="_e377769d-13ea-bc6a-ebb5-347a3adbe356"><p id="_c025f9f2-c698-8e00-91c6-2860b46f5ce5">UML (Unified Modeling Language) is a general-purpose modeling language that can be used to model a wide variety of information.</p>
</example>

<example id="_582d3d6e-4a09-7d9a-114b-b13bf8f968fa"><p id="_f411c4a2-ad8f-51fd-8221-b7a4907db282">EXPRESS is a data modeling language designed to represent information requirements.</p>
</example>

<p id="_b6fc7f4a-724e-20a2-5e5d-7d679ed94a3b">Commonly languages that define data models are called “conceptual modeling languages”.</p>

<p id="_52595edc-fbe5-771d-a319-4360ec8a1d4c">While many data modeling languages are used to define data models in a way that is independent of underlying technologies used, most data modeling languages do not provide a way to define how data is represented in an information system.</p>

<p id="_cef7ba25-8824-9a11-8cda-e043d6e05067">For example, information models in UML are mostly used for diagramming and documentation purposes, and do not provide a way to define how the data can be accessed or used in programming languages.</p>
</clause>

<clause id="_300e90b5-ed65-d80c-eebc-3e4addc97cf5" obligation="normative">
<title id="_e62a13ed-07da-66b5-962e-ed6fb1bd037f">Serialization</title>
<p id="_2fe2e6fc-f8d8-bd18-4ed6-7ca902d09d7a">Serialization is the process of converting data structures or objects into a format that can be stored or transmitted between systems. Typically, this involves converting the data into a string of bytes that can be written to a file or sent over a network.</p>

<p id="_0b5cd7fc-bfd6-a799-54cb-dbeffc8be68b">Serialization formats are very important in allowing systems to exchange structured information in an interoperable manner without loss of semantics.</p>

<example id="_5d07acdb-efa6-3ea1-f2fe-41334570b68f"><p id="_0461cfd5-4679-1969-80d6-b7a4e29c8c31">Common serialization formats include JSON, XML, and YAML.</p>
</example>

<p id="_8d6197a5-6d14-c6af-31a2-e434a4d73829">Serialization formats often come with a schema language that allows for the definition of particular data structures that data needs to conform to.</p>

<example id="_ec67c936-37d1-2590-1c79-5b00a2daad4a"><p id="_765abf56-04c7-ac48-b646-232b317a0a2f">XML Schema, JSON Schema, and YAML Schema represent the schema languages for XML, JSON, and YAML, respectively.</p>
</example>

<p id="_aa557bed-a584-ffac-7655-16fe87e83d6e">Typically, languages that define serialization formats are called “schema languages”.</p>

<p id="_5ff96fdf-88be-f263-f45e-b4b98fb0bf8e">A conceptual model may be realized (“implemented”) in multiple serialization formats. For example, some standards define a conceptual model in UML and provide manually-defined transformation rules to XML and JSON.</p>
</clause>

<clause id="_2656d594-9a6f-7df6-599a-2f9d99fc8121" obligation="normative">
<title id="_34cc34cd-b42a-ec3b-98f4-59f839ef3852">Access in programming languages</title>
<p id="_5088549b-f7fe-21d0-63da-88d34f44670e">Information defined by conceptual data models and serialization schema languages are not directly usable in a native manner in programming languages or APIs.</p>

<p id="_fbeaee3c-f53f-65a7-0b48-45f3f2e462a7">At the conceptual data model level, there is no direct mapping to programming language constructs. For example, a UML class diagram does not directly map to a Java class.</p>

<p id="_7e45303d-c2b8-f3fe-8e5d-61a423d60a34">There are tools that attempt to generate code from UML models, yet the generated code will require manual integration and intervention to be usable in software.</p>

<p id="_484380ed-2074-8922-0e9c-1a680eb8882e">At the serialization schema language level, there is again no direct access from the programming language to the schema language constructs. For example, a JSON Schema does not directly map to a Java class. Typically developers will write code that parses the schema and/or implement code to read and write data in the format defined by the schema.</p>

<p id="_99286186-6a56-a23b-543e-e3eaa3e5ae56">The lack of direct access to data models and serialization formats in programming languages makes it difficult to work with structured data in a consistent manner across different systems and technologies.</p>
</clause>

<clause id="_3349c23b-88f6-a4e9-3663-c70423ffc08b" obligation="normative">
<title id="_a594c8bd-f2fb-38b5-a23a-eafa51bd9c53">Interleaving conceptual modeling and serialization format modeling</title>
<p id="_39dcb8a9-3784-e031-1755-8638defa7eab">Conceptual modeling focuses on the definition of the existence and relationships of data elements.</p>

<p id="_36dce654-8d43-4696-439d-4cda9050cbda">Serialization data modeling focuses on low-level details of how data is represented in a particular format.</p>

<p id="_bd528ae8-8839-fbaa-ada5-2f0b4c0db44b">For example, a conceptual model may define that a <tt>Date</tt> object has <tt>year</tt>, <tt>month</tt>, <tt>day</tt> attributes, and each of them are of an  <tt>Integer</tt> type and potentially the numbering constraints for each attribute, and that there are certain restrictions to what the attributes can be at an attribute level (valid values of  <tt>month</tt> range from 1 to 12), or at the object level (only a leap year is allowed to have 29 days in February). It does not specify how many bytes are to be used to represent an  <tt>Integer</tt> or how the  <tt>Date</tt> object is to be written in a file.</p>

<p id="_1766f1cb-08a8-e916-156a-1ffc9b55b792">A serialization data model (using a schema language) may define that a <tt>Date</tt> object is represented as a sequence of 3 Integers, each representing the  <tt>year</tt>, the  <tt>month</tt>, and the <tt>day</tt>, respectively, and that the <tt>Integer</tt> type is represented as a 4-byte unsigned integer. While the schema language may support value constraints that the  <tt>month</tt> attribute must be between 1 and 12, it is unlikely that the schema language supports object-level complex constraints such as “only a leap year is allowed to have 29 days in February”. Schema languages typically do not have the expressive power to define such complex constraints.</p>

<p id="_ed5680b2-6533-94cc-a708-93714debd9ae">This presents a conundrum for the data modeler, who needs to define the entire structure and constraints, but also needs to decide where and how to define constraints that may not be definable in a schema language. This complexity explodes exponentially as the need for the same data to be represented in additional schema languages arises.</p>

<p id="_6941cddb-1ebd-c518-1116-cc3136849e31">How much of the constraints should be defined in the conceptual model? How much of the data model constraints should be defined in the serialization schema language? Do we need to define duplicated constraints in both the conceptual model and the serialization schema language if allowed? This is a question that haunts developers and data modelers alike.</p>
</clause>

<clause id="_8ebafd29-c9f2-87c6-8fd2-6848fafae2f1" obligation="normative">
<title id="_ac3b55bd-e566-e485-0597-443faeee0065">Challenges in data interchange</title>
<clause id="_e9a0b201-bd3c-c892-dee3-94bc2b94364d" obligation="normative">
<title id="_9ac12e4d-7e02-fc87-3f9c-9acb50508bf8">General</title>
<p id="_577ed0ef-2c2a-6cf1-310e-7df046119deb">Interchange of data between systems of a particular data model can be challenging due to multiple factors.</p>
</clause>

<clause id="_c37257b1-b20b-576d-3790-7faaffb1de3f" obligation="normative">
<title id="_e16996a6-7bc1-621f-5804-9607e1db24c1">Derivation of serialization formats from conceptual models</title>
<p id="_135b7622-1fea-f60c-2c67-a2c060a149a7">A successful, modern conceptual model is expected to support multiple serialization formats, given the variety of modern systems and tech stack components.</p>

<p id="_2705f7c8-1973-083b-f222-cf46efdb945b">While it is possible to define a conceptual model in a data modeling language, and then manually define transformation rules to convert the model into serialization formats, this is a time-consuming and error-prone process.</p>

<p id="_73e29e95-cb34-f228-fb49-d3d1b11bb0e7">This issue is exacerbated by the fact that the transformation rules are not always well-defined and may not be easily maintained. A change in the conceptual model may require changes in multiple serialization formats, and it is difficult to maintain synchronicity between the conceptual model and the serialization formats.</p>

<p id="_f17701f4-51ef-74e3-1d79-d491915d4c7f">The solution to this problem is to define a single source of truth for the data model, and then automatically derive the serialization formats from the data model.</p>

<p id="_f0d65236-8f3d-e17b-5b95-31942bd4a61f">Even with automatic derivation, there are additional concerns (addressed in this document):</p>

<ul id="_a31fbc30-eed8-2fd1-1be9-87e7ed088bd0"><li><p id="_0791ee36-b702-0d9f-156f-a7ddff093c5b">Versioning: How do we version the data model and the serialization formats?</p>
</li>
<li><p id="_5416f22f-9a46-7cbc-7052-b5fc6338ec2e">Migration: How do we migrate data from one version of the data model to another?</p>
</li>
<li><p id="_4cde4e0d-fefd-52e1-0cc7-ab8c31b699bd">Interoperability: How do we ensure that data can be exchanged between systems that use different versions of the data model?</p>
</li>
<li><p id="_c039f07f-4c49-5beb-5072-3bd5d3c193e9">Access: How do we work with different versions of the data model in a programming language?</p>
</li>
</ul>
</clause>

<clause id="_a2ed7d65-6cb9-6146-957e-9b602690320f" obligation="normative">
<title id="_407ac65a-2616-08e1-92c0-9415db187e2f">Complexity</title>
<p id="_1814da73-c52b-8804-c24e-ef44548f7e27">Modern technical stacks are composed of multiple systems that are built using different technologies and data modeling languages.</p>

<p id="_5242a2ca-f7cc-b457-9d0f-4562621fa2c8">Browser-based applications may use JSON to represent data, while server-side applications may use XML. Databases may use SQL to define data structures, while APIs may use JSON Schema to define data structures.</p>
</clause>

<clause id="_b18385a9-0f04-9fbb-8dcf-cb0b1c40bffb" obligation="normative">
<title id="_a9e32b51-7d23-9d5e-92d7-f95b800de7ac">Model definition language incompatibility</title>
<p id="_a10b9ed6-c4a4-399b-3fa6-3f19e9e33534">Different data modeling languages have different syntax and semantics. This makes it difficult to interchange data between systems that are defined using different data modeling languages.</p>

<p id="_868cbbc5-bac6-dd12-c38b-364a80726826">For example, a data model defined in UML may not be directly convertible to a data model defined in EXPRESS.</p>

<p id="_22f86622-4b27-6ff4-c32f-f84de889c935">When a schema language is used to define data structures, the schema language itself may not be directly convertible to another schema language.</p>

<p id="_3b7162e0-d0ad-8f54-bf32-ab04d1b5bb1f">For example, an XML Schema may not be directly convertible to a JSON Schema.</p>

<p id="_ded0adb9-d37c-f150-ccb6-4f87c29d0be3">Typical approaches used today include:</p>

<ul id="_ff322dd6-5f90-e6ea-b5cd-fb5bc1adadab"><li><p id="_a20e61da-5344-863d-7386-687c43d9421f">create a transformation toolchain that convert serialized formats to a defined serialization format, then use a codebase that can parse the defined serialization format</p>
</li>
<li><p id="_83c8690d-e74d-c75a-3b7d-3b01aa033d57">create a transformation toolchain that convert serialized formats to an intermediary representation, and then use a codebase that reads that intermediary representation.</p>
</li>
</ul>

<p id="_7d6b20ca-9a9f-458e-e6ef-a60f3c3769fb">Imagine that there are 5 serialization formats that need to be supported.</p>

<p id="_40f0e527-fb25-0e5a-53fc-aa8837144f90">Neither of these approaches is ideal, as they require additional work to be done, and may introduce errors in the transformation process.</p>
</clause>

<clause id="_73da3597-8a5c-07ae-6032-d951309e8c77" obligation="normative">
<title id="_ecdc8157-4714-06a8-d229-d4d6bebb87ae">Semantic incompatibility of conceptual modeling languages</title>
<clause id="_cfc39344-7eb6-659f-1856-a3f9e58e1738" obligation="normative">
<title id="_9cd6e5e5-1c05-06c0-9bf8-5079820d00b3">General</title>
<p id="_05bc230d-f7bd-620b-4863-a93e3ad39e09">Some modeling languages are at their core, incompatible with each other due to their different foundational principles and structures.</p>
</clause>

<clause id="_cfd31a53-3abb-1f4a-1b42-57bf8a4e7821" obligation="normative">
<title id="_a916824c-76cf-da46-d189-127b4b69ca62">Comparing UML and EXPRESS</title>
<p id="_c95a7266-1fb0-f20f-cc9b-949d1d85516e">Both UML and EXPRESS are conceptual modeling languages intended for general use.</p>

<p id="_8f5806b6-6afb-1209-d38e-ce7458a061aa">However, some UML concepts are not directly mappable to EXPRESS concepts:</p>

<ul id="_f3ec8be5-0189-c56d-0260-1a0c77187c00"><li><p id="_e89b7d5d-f205-0695-0739-7f904506b381">A UML class can have “methods”, but an EXPRESS <tt>ENTITY</tt> allows only validation logic (via  <tt>WHERE</tt>, <tt>RULES</tt>, or <tt>FUNCTION</tt>/<tt>PROCEDURE</tt>), which is declarative and stateless.</p>
</li>
<li><p id="_93c7ae85-2661-34c7-d19f-512286095104">EXPRESS <tt>SELECT</tt> types (flexible polymorphic unions) have no direct UML equivalent. UML generalizations or interfaces approximate  <tt>SELECT</tt> but lose EXPRESS’s runtime validation semantics.</p>
</li>
</ul>
</clause>

<clause id="_28519b8f-ac36-aab8-6398-243eb211427d" obligation="normative">
<title id="_33309c70-b7a8-f935-5c22-62346372b51b">Comparing UML and RDF</title>
<p id="_8a9d2288-cbbe-c27d-920a-89be4bdb3f77">UML is a class-based modeling language, while RDF is a graph-based modeling language.</p>

<ul id="_2397509e-b5c7-cd39-dcd9-b293953585a6"><li><p id="_d99665ec-ad58-7dac-82c0-0d26936a834c">The concept of encapsulation (private/public attributes) in UML is not supported in RDF.</p>
</li>
<li><p id="_10392122-cb9f-64a7-ef45-b8df0c0f269c">The property multiplicity constraints (e.g., 1..*) cannot be enforced in RDF.</p>
</li>
<li><p id="_43f87a02-8e74-48b0-1ed9-54df0425f56d">RDF applies graph-based relationships (arbitrary connections between resources) that are incompatible with the hierarchical class/object structure used in UML.</p>
</li>
</ul>
</clause>

<clause id="_c8f7e45e-f8aa-0220-11ad-4219ff773134" obligation="normative">
<title id="_b3addae3-892c-8c7c-e847-f8ca00c5d8f9">Approach</title>
<p id="_5c6ef1d8-b4cd-b59a-490c-4f0c3094a824">It is clear that a direct mapping between certain conceptual model languages is impossible without losing some semantics.</p>

<p id="_53580429-a0a1-4d6c-5d62-20ceaa2212a2">Some communities have attempted to define mappings between conceptual model languages, which often become rather complex as re-implementations of the modeling language in another language. The result is a loss of semantics, expressivity, and deviation from the conventions, benefits, and usability of the modeling language.</p>

<p id="_b6dd97e8-8b49-7f07-4067-6ad2bc07a9de">The solution to this problem is to take a common approach that works across different conceptual modeling languages, and then define additional rules for each language to supplement the common approach.</p>
</clause>
</clause>

<clause id="_2076a618-1ac0-f8b4-1ac8-16f2548545f3" obligation="normative">
<title id="_09975a93-46b6-5423-c3e6-1f32f0b2c923">Conversion difficulties between serialization formats</title>
<clause id="_e430442e-f00d-122a-efff-8a300c0add5e" obligation="normative">
<title id="_369f1a5e-7f0d-aa36-e0b9-292aa52191f3">General</title>
<p id="_aa69846b-4125-ed46-4356-afec07951c4f">Some serialization formats are not directly mappable to each other, due to the differences in syntax and semantics between the formats.</p>

<p id="_2fd6c888-8864-d305-28d5-977d32195b0e">This means that a document in one serialization format cannot be directly converted to another serialization format without modification.</p>

<p id="_1e742e45-5155-9fd1-0604-7443326df4aa">These features are critical in data representation and serialization contexts.</p>
</clause>

<clause id="_ada9f139-d520-1827-1c93-74ad6948d848" obligation="normative">
<title id="_d3410acc-ecde-bedd-8a0d-d1c4d73a442e">Comparing YAML Schema and JSON Schema</title>
<p id="_5f9214f5-35e1-a30b-ac83-4daeef3544bf">Though YAML Schema is derived from JSON Schema, there are differences between the two serialization formats that make direct conversion difficult without additional handling. These include:</p>

<ul id="_1aeed860-f820-7577-3c85-8f8fe03df2d4"><li><p id="_6edb94f2-7498-49f5-3123-c0f1c558b9f9">Content-level semantic differences</p>
<ul id="_c42b3316-c0d5-bedc-c10d-cb03798b1609"><li><p id="_a1229a7b-0459-5bb5-9058-07c3a05ed1bb">Data type mismatches. YAML supports data types not native to JSON, such as date-time, symbols, and binary data. As a result, a defined transform needs to be implemented to round-trip these data types between YAML and JSON.</p>
<example id="_b1df543a-54da-126a-6657-71be5b1a57d6"><p id="_7f99385e-5ce4-666a-7883-0873d4265266">A value that is of date-time type in YAML does not have a direct equivalent in JSON. Such value is likely to be represented as a string in JSON. In a round-trip operation, the JSON-to-YAML transform needs to detect that the string is a date-time value and convert it back to a date-time value in YAML.</p>
</example>
</li>
</ul>
</li>
<li><p id="_170f9b31-753a-063e-284f-059e5504dc40">Serialization-level semantic differences</p>
<ul id="_493d823f-5cc9-6152-537e-9dbbef171438"><li><p id="_919d0906-476b-ae88-f28b-36da0393f82c">YAML supports multi-line strings, while JSON does not. A multi-line string in YAML can be represented using modifier symbols on keys (such as the  <tt>|</tt> and <tt>&gt;</tt> characters), but these are serialization-level specifics that are not part of the content model, and hence JSON would have no representation for them.</p>
<example id="_d15e5ba6-599f-4203-3fd0-306f971a0088"><p id="_d0e82b13-b442-d8c5-d13e-fc7bfda7f319">Given YAML content that uses one of these multi-line structures, a round-trip between JSON and YAML would lose the multi-line structure and end up with a single-line string in the YAML serialization.</p>
</example>
</li>
<li><p id="_e50523a8-a709-0b03-4443-b11b2642038e">YAML supports anchors and references, while JSON does not. In YAML, it is possible to define an anchor for a value and then reference that anchor in another part of the YAML document in order to reuse the value. JSON does not have a direct equivalent for this feature.</p>
<example id="_0e4cb344-5098-6563-1968-3cbf59d912eb"><p id="_200db972-d846-cf66-5fd8-3fb4a071715c">Given a YAML document that uses anchors and references, a round-trip between JSON and YAML would lose the anchor and reference structure and end up with a repeated value in the YAML serialization.</p>
</example>
</li>
</ul>
</li>
</ul>
</clause>

<clause id="_62f521fc-76fe-08cc-8ae4-81639b001f2b" obligation="normative">
<title id="_7e756e64-e3a8-cb94-c4e2-6c2e90370b76">Comparing XML Schema (XSD) and JSON Schema</title>
<p id="_d3b51721-4b52-210f-0e39-76a376c5b9e7">XML Schema (XSD) is also not directly mappable to JSON Schema as XSD provides features that JSON Schema does not include, such as:</p>

<ul id="_42806c15-2264-ce09-4334-e908ef51fd2d"><li><p id="_74d926cb-6e78-78d1-0206-d7b96a498aa1">Content-level semantic differences</p>
<ul id="_1fe50f98-60b5-3d4f-2f5f-54196254c279"><li><p id="_c39d1aed-1617-9c8a-9461-7edd08b7928d">Data type mismatches. JSON Schema supports the data types of string, number, object, array, boolean, and null, while XSD supports these data types and many additional data types such as date, time, and duration.</p>
</li>
<li><p id="_fc91433d-ee45-c1f1-30cb-9b5d8073f220">Namespace support. XSD supports the concept of namespaces, while JSON Schema does not.</p>
</li>
<li><p id="_5583fc4b-b352-45b9-0ef0-d34411b957e7">Composing complex types. XSD offers the ability to define complex composite types and allows those to be reused in multiple places in the schema. JSON Schema does not have a direct equivalent for this feature.</p>
</li>
<li><p id="_023432af-be3e-f589-4a54-5ca0d877eab2">Value constraints. XSD supports placing constraints on string values using regular expressions, but JSON Schema does not have a direct equivalent for this feature.</p>
</li>
<li><p id="_8f487e27-1d4d-e205-44a2-9afbebcd9e56">Serialization order and structural constraints. XSD allows for the definition of element sequences, groups, choices, and unions. JSON Schema does not have a direct equivalent for these features.</p>
</li>
</ul>
</li>
<li><p id="_aa23b51f-a6f2-a02b-c633-d4e0eb076900">Serialization-level semantic differences</p>
<ul id="_f4f4b4a8-d4da-c269-ff31-a835da23a018"><li><p id="_484f831f-9b98-008c-044e-4eccd06f8f97">XML attributes. XSD allows for the definition of attributes on elements, while JSON Schema does not have a direct equivalent for this feature.</p>
</li>
<li><p id="_9864f87e-39fa-3a37-5986-0c9af66bd206">XML comments. XML allows comments in the schema, while JSON does not.</p>
</li>
<li><p id="_66a4dbc6-060c-4408-dbb7-1823a03d80e6">XML processing instructions. XML allows processing instructions in the schema, while JSON does not.</p>
</li>
<li><p id="_426ec8e1-ec3a-9de3-c5ed-f46696fc7eae">XML entities. XML allows entities in the schema, while JSON does not. This means that an XML file with entities will likely be represented as a string in JSON, causing a round-trip operation from XML to lose the entity structure.</p>
</li>
<li><p id="_de375edd-7465-40dd-3bef-7af1cbe08f3a">XML CDATA sections. XML allows CDATA sections in the schema, while JSON only has one type of string. This means that an XML file with CDATA sections will likely be represented as a string in JSON, causing a round-trip operation from XML to lose the CDATA structure.</p>
</li>
</ul>
</li>
</ul>
</clause>

<clause id="_26ae36f2-b2f3-8b91-2aa4-7ef4c11b4c92" obligation="normative">
<title id="_22ae28b2-d726-0e88-d607-3b21760557bd">Approach</title>
<p id="_7f7ad1f2-3ea7-fb25-e4db-5673b752483c">The solution to this problem is to define a common approach that works across different serialization formats, and then define additional rules for each format to supplement the common approach.</p>
</clause>
</clause>
</clause>

<clause id="_fbc6670a-4c14-90ed-8e65-5640d4082c9d" obligation="normative">
<title id="_0fdf777c-6c85-b9c4-5351-8d75c83b8951">Goals</title>
<p id="_34a99a76-bc9d-acef-c5ff-53a20be526ea">LutaML is a system that aims to simplify users to easily define data models and work with information that conforms to those data models.</p>

<p id="_5201027a-48ee-ff87-4419-879a9077cb44">The goal of LutaML is to allow these steps to flow seamlessly:</p>

<ol id="_5ad1c488-747f-c6e9-8be8-6c19105c2698" type="arabic"><li><p id="_65088c33-fead-285a-3375-5aa3ec4a1f23">Define a platform-independent data model in a human-readable format. (LutaML language)</p>
</li>
<li><p id="_5b20d763-4ed2-71c7-9772-1883567ba54e">Allow the data model to be directly useable in a programming language. (LutaML runtime)</p>
</li>
<li><p id="_16e67fc4-ab13-04d9-1b8f-28982506557d">Allow the data model to be expressed in a serialization schema language. (LutaML language)</p>
</li>
<li><p id="_a59ac4f7-3f92-9f16-56a8-7b4fb778efcb">Allow the data model to be directly serializable to a serialization format. (LutaML runtime)</p>
</li>
<li><p id="_60cf56be-d016-fd42-25af-6806db6bff16">Support the loading of data from a serialization format into a programming language. (LutaML runtime)</p>
</li>
<li><p id="_720e8105-d22d-56f7-4e8a-d1d071d33489">Allow importing a serialization schema language to define a data model. (LutaML runtime)</p>
</li>
<li><p id="_4de55691-0b01-f958-8586-0b93470b3667">Allow the conversion of serialization formats to another through the data model. (LutaML runtime)</p>
</li>
</ol>

<p id="_4346c53e-30af-5992-5676-5a9df5fb5e56">The LutaML language provides a way to represent structured data in a human-readable format.</p>
</clause>
</clause>

<clause id="_9adfe529-57c1-94d9-2e08-b1f0027fbb38" obligation="normative">
<title id="_917796fc-b2b1-af72-ac41-d00732e29e54">Principles</title>
<p id="_f5635ec8-30f4-c090-8cf6-d08c6a07b661">The principles of LutaML are:</p>

<ol id="_61eac82f-c1be-3240-ecde-376802a6f9c9" type="arabic"><li><p id="_ea4d8146-8c31-e4ee-ba79-82091ad4e39a">Provide a human-readable syntax for defining data models.</p>
</li>
<li><p id="_c07f7bf9-cc61-14fb-9692-764cebe72e7c">Consistent language constructs.</p>
</li>
<li><p id="_7f7f5e33-4812-f213-b8f7-d10d5bff89d2">The language should be simple and easy to understand, and does not require specialized knowledge for particular serialization formats unless advance features are needed.</p>
</li>
<li><p id="_6973d1e0-fa68-beeb-52b7-f09cc60b93e7">Support modular reuse of definitions across files.</p>
</li>
<li><p id="_50c3bde0-c2e2-6116-1e62-a87285b4cd78">Support instance representation of data models.</p>
</li>
</ol>
</clause>

<clause id="_0e42ef22-8946-5902-cbe2-d00cae54f5ff" obligation="normative">
<title id="_4f88f096-043f-5ef4-5463-32bf53d0dc73">Core syntax</title>
<p id="_e1a43c9f-6876-77d2-5b71-a2a31efa9e0c">The core syntax of LutaML is based on the following constructs:</p>

<ul id="_0d6b8f55-7b3a-4aaa-43af-0151991abf3a"><li><p id="_30bc965a-4ce8-3cbb-16fc-1abc91d20df2">primitive values</p>
</li>
<li><p id="_321d1e21-6bd6-1464-c7b9-faf98e35b38c">declaration</p>
</li>
<li><p id="_6b65b02f-8137-e1a3-2d37-1ad7f530042d">argument</p>
</li>
<li><p id="_e694da13-e578-9c13-3bc7-8294900cc1f5">block</p>
</li>
<li><p id="_3edb9c30-39a2-46c9-c7be-d0485a092158">comment</p>
</li>
</ul>

<clause id="_38b24219-735a-93bc-e890-67bb3a6f3d1b" obligation="normative">
<title id="_5de12ab2-a342-715e-017e-532dac69e47c">Language version</title>
<p id="_6e531c97-cb22-e221-f23e-cc0a978c1640">A document may declare the version of this language that it is written in:</p>

<sourcecode id="_9ab20501-9a2a-db25-3bdc-3d476d57a364" lang="lml"><body>lml "1.0"

class Ceramic {
}</body></sourcecode>


<p id="_690728f0-1249-0591-2f19-0fd836ed55bc">The declaration is optional. When present it is the first construct of the document, before any other declaration, and consists of the keyword <tt>lml</tt> followed by the version string in quotes.</p>

<p id="_03f99f3a-ecf9-e352-eab7-5d5fc4f7979b">The version is a dotted numeric version. A processor compares the declared version with the version of the grammar it implements, which is the version recorded in that grammar’s compiled artifact. A document declaring a newer version is not rejected: the processor reports a warning and continues with the grammar it implements. A document without a declaration is processed with the implemented grammar.</p>
</clause>

<clause id="_1bb14a6d-d8e6-1c00-ec1c-bcd2deb06c6e" obligation="normative">
<title id="_a9952db2-d34a-9258-a899-0b2c1dde92bf">Primitive values</title>
<p id="_37b5b886-0cb0-8bb4-9189-d844218185af">Primitive values are the basic building blocks of LutaML.</p>

<p id="_c5baa4f0-3af7-e81d-0e3e-07619a6caa3c">All primitive types have names that start with uppercase.</p>

<p id="_7ba0df06-2f5b-1965-4ecd-f00d1583c69c">LutaML supports the following primitive values:</p>

<ul id="_898f084e-ed0a-7a26-c4b7-7107ff015776"><li><p id="_777562a5-9454-b70b-d897-92d21ed4b643"><tt>String</tt> (e.g., <tt>"high-fire"</tt>),</p>
</li>
<li><p id="_7d82bb44-748d-020e-23dc-a5da455f5d2e"><tt>Integer</tt> (e.g., <tt>42</tt>).</p>
</li>
<li><p id="_c9a9b68a-719c-44a6-2266-b70773c6bf50"><tt>Float</tt> (e.g., <tt>3.5</tt>),</p>
</li>
<li><p id="_364c72ba-b356-9fba-93e4-de9bd9836234"><tt>Boolean</tt> (e.g., <tt>true</tt>),</p>
</li>
<li><p id="_43726f5b-78b6-42ac-a0e1-cf133e301c7c"><tt>TimeWithoutDate</tt> (e.g., <tt>12:00:00</tt>),</p>
</li>
<li><p id="_ac24fd41-323e-6a42-6a05-80f8b045e36f"><tt>DateTime</tt> (e.g., <tt>2024-01-01T12:00:00+00:00</tt>),</p>
</li>
<li><p id="_4bf8fb33-d292-a88f-777d-8e93c7c475c4"><tt>Time</tt> (e.g., <tt>2024-01-01T12:00:00+00:00</tt>),</p>
</li>
<li><p id="_d5641eb5-5cc9-19b7-609a-e137ed6fec73"><tt>Decimal</tt> (e.g., <tt>3.14159</tt>),</p>
</li>
<li><p id="_fd440207-72c0-bca7-a497-3d5bbd5b9aac"><tt>Hash</tt> (e.g., <tt>{ "key": "value" }</tt>)</p>
</li>
<li><p id="_b6329bd3-e1b3-7798-cbe8-85189e8dd183"><tt>Null</tt> (e.g., <tt>null</tt>)</p>
</li>
</ul>
</clause>

<clause id="_dffe4fcf-fabf-5aed-6a3a-b2bcd043d8f8" obligation="normative">
<title id="_f12f1229-82a4-700c-d7a3-2d6d1700404e">String values</title>
<p id="_f24b8c79-2171-1647-c0f6-e2a1c1fd77b9">A string value is delimited by double quotes or by single quotes.</p>

<p id="_9f3ae7d1-97a4-f8b6-f6a6-7f4eeef66670">Exactly two escape sequences are recognized in each quote kind: the delimiter escape (<tt>\"</tt> inside double quotes, <tt>\'</tt> inside single quotes) and  <tt>\\</tt>, which denotes a backslash. No other escape sequence is defined; a backslash followed by any other character does not form a string value.</p>

<p id="_1a22a743-6ab6-41a6-31ac-3827a97772ab">An empty string is distinct from an absent value: <tt>""</tt> denotes a present string of length zero.</p>

<p id="_5e4c23c7-ef53-5205-269a-a81e1a459135">The <tt>null</tt> literal is a data value: it appears wherever a value is written, including as an element of a list.</p>

<example id="_6123f1f2-d6ac-0d9c-9093-f4457fc8b084"><sourcecode id="_b6f14746-f0eb-6e20-597f-c5dde53c62e7" lang="lml"><body>class Glaze {
  attribute name, String
  attribute description, String
  attribute note, String
}

instance "Glaze" {
  name = "Raku \"kiln\" fired"          // embedded quotes
  description = 'say "hi" and \'bye\''  // the other quote kind
  note = ""                                // present, empty
}</body></sourcecode> </example>
</clause>

<clause id="_325edf2d-01cd-7bb2-0afe-d92413dd3167" obligation="normative">
<title id="_fdd59087-06b9-1623-60d0-8442591ef26e">Declaration, arguments and blocks</title>
<p id="_f5a03277-c112-db9c-b4c1-6d1f8458b5d0">A declaration is a keyword that represents an action or a statement.</p>

<p id="_c8e95687-559a-515d-4070-f9111d25162f">Syntax:</p>

<sourcecode id="_2e23c7bf-9ec1-8de1-8aa0-39dd28f01ecb" lang="lml"><body>{declaration} {*argument} {*block}</body></sourcecode>


<p id="_a1b35c91-e3da-61ef-cb9d-c8a4bd37fab1">Where,</p>

<dl id="_59ebd356-3d05-6c1d-0e45-ca6e24992fec"><dt><tt>{declaration}</tt></dt>
<dd id="_be4dfc84-688b-a192-1300-f4f672a54307"><p id="_7b4d86de-0ecd-432b-6300-61df51feff14">the declaration keyword <tt>{*argument}</tt>:: zero or more arguments <tt>{*block}</tt>:: an optional blocks</p>
</dd>
</dl>

<p id="_97710fdd-2765-7904-47a2-d4f3a83d8938">An argument is a string, which can be a primitive value or a reference to another object.</p>

<p id="_e52f58a6-528e-0fa2-2c9a-b53f655bfc56">A block is delimited by curly braces and provides a context for inner declarations.</p>

<example id="_5a0c080f-a65e-8a51-cace-a9f48b5752fb"><p id="_24b9da52-a47e-e5ef-d8aa-38c5beeb1bb6">This example shows the <tt>class</tt> declaration that takes an argument <tt>Studio</tt> to represent the name of the class.</p>

<sourcecode id="_93fdfade-a93b-c24d-f43c-0c2b73e0ebcf" lang="lml"><body>class Studio
// or
class Studio {
}</body></sourcecode>

</example>

<example id="_80c41cb1-8709-87b4-56b1-9cdffc2d2360"><p id="_d0f4d815-64bd-bdfb-8145-e67a7782cecc">This example shows the <tt>class</tt> declaration that takes an argument <tt>Studio</tt> as its name with a block given, where it contains an attribute.</p>

<sourcecode id="_b8c4ac1c-d6c4-4cbb-5870-c335156c1633" lang="lml"><body>class Studio {
  attribute ...
}</body></sourcecode>

</example>
</clause>

<clause id="_aa4c057d-9be3-434d-bb8c-97b0a7824647" anchor="declaration-modifiers" obligation="normative">
<title id="_95440059-e065-dde3-a8dc-7687ef661730">Declaration modifiers</title>
<p id="_58ab16f4-c229-a997-c27b-891fa48b030d">A declaration modifier is a keyword that qualifies a declaration. The modifiers are:</p>

<ul id="_16f942f3-cfc4-cea3-1149-3aecf001f678"><li><p id="_e4e4df3b-acd2-ec09-4dd6-3438bded037f">visibility: <tt>public</tt>, <tt>private</tt>, <tt>protected</tt>, <tt>package</tt></p>
</li>
<li><p id="_20424e07-7385-6509-9617-0a963ab829de">specializer: <tt>abstract</tt>, <tt>interface</tt></p>
</li>
</ul>

<p id="_da1c2352-ff83-9ffe-cafe-ab41d8cf673b"><tt>public</tt> visibility is the default. The <tt>package</tt> visibility level corresponds to the UML package visibility (<tt>~</tt>) of attributes.</p>

<p id="_2af9d3f2-c549-920c-eaa9-82c7e1d1877b">A modifier is expressed canonically as a declaration inside the block:</p>

<sourcecode id="_68abf652-077f-edac-d66a-1de1ab1b816b" lang="lml"><body>class {name} {
  visibility {level}
}

class {name} {
  abstract true
}</body></sourcecode>


<p id="_54316ef2-9da7-28d6-c5fa-73e82523497f">Where,</p>

<dl id="_f4fcf58a-b309-5271-4a5a-c3bb1c61f48d"><dt><tt>{level}</tt></dt>
<dd id="_98231de0-e348-13a2-10ed-7b10b30482b1"><p id="_b6a9423d-f9bd-c916-508a-122925687b38">one of <tt>public</tt>, <tt>private</tt>, <tt>protected</tt>, <tt>package</tt></p>
</dd>
</dl>

<p id="_82a6d58c-2eba-4091-cd24-cc224a59df96">The keyword prefix before a declaration is a shortcut that expands to the block declarations:</p>

<sourcecode id="_52f00b1b-4612-98e7-8d56-336f2ae114ad" lang="lml"><body>{modifier} {declaration} {name} {block}</body></sourcecode>


<example id="_5db498f2-485c-308a-4450-d6830804dd64"><p id="_14b8cbb9-918a-90b8-0464-39f0d7875dcf">This example declares a private abstract class.</p>

<sourcecode id="_d69c472e-9323-5173-490f-3d18df1c3817" lang="lml"><body>private class Glaze {
  abstract true
}</body></sourcecode>

</example>

<p id="_5229f092-6e83-56b6-079a-3ea0886a73a1">expands to:</p>

<example id="_89403f2f-4ddc-db60-ea99-d656caeeebd6"><sourcecode id="_48392a40-fbad-4cd3-ae8b-ffe41eacb4e2" lang="lml"><body>class Glaze {
  visibility private
  abstract true
}</body></sourcecode> </example>

<p id="_4b4104b8-639a-3c1f-313d-c9fcf19f35e9">Modifiers apply to the <tt>class</tt>, <tt>enum</tt>, <tt>data_type</tt>, <tt>primitive</tt> and <tt>package</tt> declarations.</p>

<p id="_1be56888-3808-8bcf-97c2-571587d3136d">When both the prefix and the block declaration are present, the block declaration prevails.</p>
</clause>

<clause id="_16265f74-faf0-6c49-c8dc-c4dfc4e5efdd" obligation="normative">
<title id="_d046a5c6-f44d-4356-8ca6-6cd576f6b0bb">Comment</title>
<clause id="_4479a339-798a-94a3-5b6b-d187f2f448ff" obligation="normative">
<title id="_7a675f3d-a886-7b6d-db89-8e8a4e246974">General</title>
<p id="_ee973ae8-75e6-5cef-7d94-e2d6fa7ed3f4">A comment is text that is ignored by the processor.</p>

<p id="_93c3b4d1-76e0-3755-f5c1-45174f73c88d">Comments are lexical trivia: they are consumed and discarded between any two tokens of the language — at the start of a document, between declarations, between a keyword and its name, and at the end of a line or the end of input. A comment-opening sequence inside a quoted string does not start a comment.</p>
</clause>

<clause id="_5c40bd9b-552e-159a-fd4f-a6376e2b50ce" obligation="normative">
<title id="_6f9a2816-cf2b-b15a-002d-83d64bc235f7">Single-line comment</title>
<p id="_bdd6cff9-c9d8-63b9-e024-72eb672811cb">A single-line comment is also called a “tail comment”, a comment that appears at the end of a line.</p>

<p id="_50412245-99f1-c9b0-98a7-c8a577fb06db">The <tt>//</tt> character sequence can appear at the beginning of a line or after whitespace.</p>

<p id="_45e43908-b2ed-f7e7-fba2-15b36e78311f">Syntax:</p>

<sourcecode id="_16840333-dc12-e3d8-e543-3f82e7dc218d" lang="lml"><body>// {text}
or
{expression} // {text}</body></sourcecode>


<p id="_01510ca7-0f6a-36d3-bc69-c2454cab136b">Where,</p>

<dl id="_6e32a9ad-0925-e2c5-fe24-eec67892d1c4"><dt><tt>{text}</tt></dt>
<dd id="_a482aff2-ec4c-4fcf-b417-2219da9d5574"><p id="_681e0f41-0b27-ef94-8293-88ff4dda7172">the comment text</p>
</dd>
</dl>

<example id="_e8f16102-1523-4cd2-cf5b-0de559f0a8e3"><sourcecode id="_c034a6d3-f78a-fc31-379d-11838507d1ff" lang="lml"><body>// This is a comment</body></sourcecode> </example>

<example id="_11ecf235-d191-5078-b2a7-b92bda80cf32"><sourcecode id="_4b50420d-9afe-f439-e5ac-d9819744a3b2" lang="lml"><body>class Studio { // This is a comment
  attribute location, String
}</body></sourcecode> </example>

<example id="_b263a71e-c5aa-a0cd-6c57-b72aef1e5876"><sourcecode id="_576a7d34-2470-e321-6763-eba6a338f401" lang="lml"><body>// TODO: attributes <callout target="_67f6a0b0-fbca-42f1-8eeb-83df7c43bd17">1</callout>
class Ceramic {
  // Write docs <callout target="_2487f2f4-2e7f-48a2-b8a3-32e18aaf8c77">2</callout>
  + glazeType: GlazeType // Glaze type <callout target="_66b1cf6c-20da-4cbd-98e3-f8fe910e7147">3</callout>
}</body><callout-annotation id="_411ff5f8-247c-a7c2-ff8b-3d4b93a5af91" anchor="_67f6a0b0-fbca-42f1-8eeb-83df7c43bd17"><p id="_8220b44d-c3e4-fe67-f8e2-50af0a5fb7ab">A line beginning with <tt>//</tt> is a comment.</p>
</callout-annotation><callout-annotation id="_73f70342-441d-3ee6-ff37-e1a140888db6" anchor="_2487f2f4-2e7f-48a2-b8a3-32e18aaf8c77"><p id="_f230abd7-d7c9-c809-865c-70ed2b38aa4d">A line beginning with whitespaces followed by <tt>//</tt> is a comment.</p>
</callout-annotation><callout-annotation id="_b7628be4-ec39-f817-700b-ff4f7fd186b2" anchor="_66b1cf6c-20da-4cbd-98e3-f8fe910e7147"><p id="_ad43c76c-f416-f8c9-e809-461231b7b9ff">A line with <tt>//</tt> contains a tail comment: the text after <tt>//</tt> is a comment.</p>
</callout-annotation></sourcecode>


</example>
</clause>

<clause id="_e79660c4-dd6b-3b89-ca2b-36d97c9b5267" obligation="normative">
<title id="_ecdd5881-089b-c68e-fe08-4cb94eaa99ce">Multi-line comment</title>
<p id="_bfe9be49-917a-93b4-c2a4-b5c201c57c8e">Comments can also be multi-line.</p>

<p id="_e261b448-bef0-94d0-07f5-e5d47cfbe65c">Syntax:</p>

<sourcecode id="_ee9aef6f-e93b-d8ef-1849-009edd5559d9" lang="lml"><body>/* {text} */</body></sourcecode>


<p id="_729478b6-4d97-80aa-9efc-8833ee2b55b1">Where,</p>

<dl id="_ffdcaef1-2456-092e-5110-2951534b27d5"><dt><tt>{text}</tt></dt>
<dd id="_01ae9d4e-f335-ed45-2262-d1e781ae3de4"><p id="_9d1062ed-f2ff-720e-5a2c-21bd985a303d">the comment text</p>
</dd>
</dl>

<example id="_f12db5e8-dd90-5bb2-66be-9184b8d1e9ea"><sourcecode id="_a86982ef-e580-90b6-cd4b-54fcec84c56c" lang="lml"><body>/* This is a
multi-line comment */
/*
  This is also a
  multi-line comment
*/</body></sourcecode> </example>
</clause>

<clause id="_5713c9f3-babe-3805-35ba-9fcaef608259" obligation="normative">
<title id="_ec8e7891-676d-22cf-1803-b3dbc3d79e2c">Definition</title>
<p id="_9be0793d-a250-252a-7eb7-f208e60b7b46">The <tt>definition</tt> block is used to define a multiline description for a class.</p>

<p id="_d524c260-70fb-d527-0083-64e486fac5fc">Syntax:</p>

<sourcecode id="_8c45f998-73b3-aa7d-4a3a-933a0d3ee694" lang="lml"><body>definition {text}</body></sourcecode>


<p id="_6f1f8b5d-6b4f-e1fb-09a2-8bf761377002">Where,</p>

<dl id="_32924620-77c1-9796-621d-ec90d2ff600c"><dt><tt>{text}</tt></dt>
<dd id="_a8048424-9db5-6a97-ccf0-5d70ca7a022f"><p id="_18ecc9dc-bcd9-9b39-3dc7-31d818aea417">the description text <tt>{block}</tt>:: description text block</p>
</dd>
</dl>

<example id="_e018f66b-951e-6f5f-6228-ade5905cc3bb"><sourcecode id="_9d0258f2-6c6d-8f21-b43b-e6eb6ccccc65" lang="lml"><body>definition "Non-reflective finish"</body></sourcecode> </example>

<p id="_9abc1c06-55d2-ba0c-2054-588d7a00c017">Content within the block is considered to be multi-line textual content. No declarations are available within the block.</p>

<sourcecode id="_d6a59069-10ba-7d12-2f81-7b795b840c7a" lang="lml"><body>definition {block}</body></sourcecode>


<p id="_70ba5531-8008-85e2-3922-fed66159ee70">Where,</p>

<dl id="_682f5fe3-c924-eb21-1ef0-ea73756349d1"><dt><tt>{text}</tt></dt>
<dd id="_33beaff7-8392-fce7-983b-a95490432f3b"><p id="_87e6976e-d7f4-b255-8c4f-7feea516d766">the description text <tt>{block}</tt>:: description text block</p>
</dd>
</dl>

<example id="_80b27928-4292-c8d9-35cf-9c8f0faba484"><sourcecode id="_571204b3-8068-0ec7-1d7c-b7240f10eb08" lang="lml"><body>definition {
  Non-reflective finish.

  A matte finish is a non-reflective finish that is often used in ceramics.
}</body></sourcecode> </example>

<example id="_3735a381-d5b0-d202-7309-ca455ac0cb9a">
<name id="_95b6e294-de73-d9fb-944a-3165d4d6e401">Declaring a class named “Ceramic” with a description</name>
<sourcecode id="_73e6b7ad-b9ad-7dc2-90b2-3f8e4eb150dd"><body>class Ceramic {
  definition {
    This class represents a ceramic object.
  }
}</body></sourcecode>

</example>
</clause>
</clause>
</clause>

<clause id="_06711535-cf7a-e1f9-360d-b245239838d4" obligation="normative">
<title id="_2f8db4be-ed6e-999a-7022-e5f0a448c65c">Representable objects</title>
<clause id="_b5a0cc53-4a60-5240-3598-a3fbbb1931c0" obligation="normative">
<title id="_1d0a0e6e-9129-6d18-fb0a-a14109f5544f">General</title>
<p id="_244ab581-4842-34b8-3ee4-64b80f1373bd">LutaML supports the following constructs.</p>
</clause>

<clause id="_a30df842-b48d-b3d4-cbd7-ced02cec65f3" obligation="normative">
<title id="_1921896b-25f2-ed65-6783-085cd617f768">Package</title>
<p id="_26cf08c8-ad24-2d29-b2d5-641847e1bf30">The <tt>package</tt> construct is used to define a collection of classes and enums.</p>

<p id="_cfb80c6f-16f1-2c0d-ac4c-d398953950b2">Syntax:</p>

<sourcecode id="_2a5b66dc-686b-5086-3fc9-7708924491eb" lang="lml"><body>package {name} {block}</body></sourcecode>


<p id="_3847d747-71cf-0709-f4fc-d121f4bbfa12">Where,</p>

<dl id="_b10dfed1-7819-7340-8ec7-f37066fbcd12"><dt><tt>{name}</tt></dt>
<dd id="_ecabacaf-add8-2eee-4592-55fd0f9e8013"><p id="_bd015aa4-bca7-474c-e95d-5b6feaae6a9b">the name of the package <tt>{*block}</tt>:: an optional block</p>
</dd>
</dl>

<example id="_344045a3-7349-1410-4b41-91f77976c1c6"><sourcecode id="_e5c7029b-3276-0617-fd31-a03acaf3088c" lang="lml"><body>package Ceramics {
  enum FiringProfile { values { "low", "medium", "high" } }

  class CeramicTile {
    attribute dimensions, float { cardinality 2 }  // [length, width]
    attribute firing_profile, FiringProfile
  }
}</body></sourcecode> </example>

<p id="_682687ef-295a-5fc3-1ae2-72bb604c2799">The package construct can be nested. You can also define other packages within a package, which helps in organizing related classes and enums.</p>

<example id="_474dc8ec-c570-68b5-5987-19459ef50c6d"><sourcecode id="_e2cfd674-92f9-6f52-dbd6-e6056909fa09" lang="lml"><body>class Dimension {
  attribute length, float
  attribute width, float
  attribute height, float
}

package Ceramics {
  class Ceramic {
    attribute volume, float
    attribute color, String

    // Refers to outermost "root package"
    attribute dimensions, Dimension

    // Refers to "Material" package
    attribute tiles, Material::CeramicTile { cardinality 0..n }
  }

  package Materials {
    enum FiringProfile { values { "low", "medium", "high" } }

    class CeramicTile {
      // Refers to outermost "root package"
      attribute dimensions, Dimension

      // Refers to local "Materials" package
      attribute firing_profile, FiringProfile
    }
  }
}</body></sourcecode> </example>

<p id="_3b560465-602a-5086-76b0-1661afad9532">Within the block, the following declarations are available:</p>

<ul id="_c2fe0941-8f77-385d-a14a-1278cfa62794"><li><p id="_8fb84c4c-0fc3-8e8d-ff28-2faf6a3136b8"><tt>class</tt></p>
</li>
<li><p id="_28396d22-b490-73d9-b331-1e56bef49e11"><tt>enum</tt></p>
</li>
<li><p id="_ace2319d-6923-eef9-567e-096820df379f"><tt>definition</tt></p>
</li>
<li><p id="_add240f6-3a26-d308-5da0-8c3d594ce13c"><tt>package</tt></p>
</li>
</ul>
</clause>

<clause id="_c1019efb-99d0-1a6c-97ef-f24882962742" obligation="normative">
<title id="_20e2b28a-e391-40a5-40a7-43799ff26d6d">Class</title>
<p id="_4809448f-491a-96f1-0a5d-ab0c6daec627">The <tt>class</tt> construct is used to define a class which is a collection of attributes.</p>

<p id="_2d2bd87a-f236-1fac-6f1f-275840376bfd">A class declaration may carry declaration modifiers (<xref target="declaration-modifiers"/>) before the declaration or as block declarations, and its block may contain the canonical  <tt>visibility</tt> and <tt>abstract</tt> declarations.</p>

<p id="_504ee2ae-ee9c-4c70-c784-2fb2754cd071">Syntax:</p>

<sourcecode id="_e72e639c-7ffe-a7e0-221b-fb29a1181236" lang="lml"><body>{modifier} class {name} {block}</body></sourcecode>


<p id="_b586d90f-a3e2-6a93-c5b9-eafb4e80f7db">Where,</p>

<dl id="_3b328cea-680b-63c2-29df-4b02201f2251"><dt><tt>{modifier}</tt></dt>
<dd id="_2afd0070-3ae1-4a8e-cd72-c0d11a1844c8"><p id="_bc28af57-f1c3-417a-5f42-2d58d6e9070f">zero or more declaration modifiers <tt>{name}</tt>:: the name of the class <tt>{*block}</tt>:: an optional block</p>
</dd>
</dl>

<example id="_877f701d-b97a-1c74-484f-60d40734d6f6"><sourcecode id="_e3b8581e-e80c-1e25-0104-f35024beb959" lang="lml"><body>class Studio {
  attribute location, String {
    definition "Location of the studio"
  }
  attribute potter, String {
    definition "Name of the potter"
  }
  attribute kiln, String {
    definition "Type of kiln used"
  }
}</body></sourcecode> </example>

<example id="_d11a8fce-2660-9dd9-1e6c-36e3b59a68f2"><sourcecode id="_6eccdc2c-5d39-a63e-c549-3fa5b8c45972" lang="lml"><body>class TemperatureWithUnit {
  attribute value, Float {
    definition "Temperature value"
  }
  attribute unit, String {
    definition "Unit of temperature"
  }
}</body></sourcecode> </example>

<p id="_a5d2a35a-e508-fda4-4f6a-876b1a9cad8f">Class attributes can be restricted to a specific set of values using the <tt>values</tt> declaration.</p>

<example id="_e97509ea-c8bf-8a1f-0a3f-e715a2127b8e"><sourcecode id="_9557efdf-13d6-1c55-9905-2e5e6105e2b5" lang="lml"><body>class GlazeTechnique {
  attribute name, String {
    values { "Celadon", "Raku", "Majolica" }
  }
}</body></sourcecode>


<p id="_960a8797-9368-e047-37a1-e5049d8f316f">Or</p>

<sourcecode id="_817f3181-f975-aace-ee59-509b3491f229" lang="lml"><body>enum GlazeTechniqueEnum {
  value "Celadon"
  value "Raku"
  value "Majolica"
}
class GlazeTechnique {
  attribute name, String {
    values GlazeTechniqueEnum
  }
}</body></sourcecode>

</example>

<p id="_386b6354-3462-253a-eeb9-07708e78c89c">It is possible to also define values with model instances. See  <xref target="instance_representation"/> for syntax to declare model instances.</p>

<example id="_8903168d-8fdb-574f-76b2-561eff3cd4d7"><p id="_2f58ed7c-83e8-1c62-5104-8ef425a8997f">Given this class:</p>

<sourcecode id="_b53abdb2-b5bd-eb3c-969b-87b1761fd9f7" lang="lml"><body>class Ceramic {
  attribute type, String {
    definition "Type of ceramic material"
  }
  attribute firing_temperature, Integer {
    definition "Temperature at which the ceramic is fired"
  }
}</body></sourcecode>


<p id="_75a8a430-0cc7-9a06-822c-8f2c93459507">The values can be defined as:</p>

<sourcecode id="_01f24560-ac7e-4621-faf9-a77b13ad1e95" lang="lml"><body>class CeramicCollection {
  attribute featured_piece, Ceramic {
    definition "Featured ceramic piece"

    values {
      instance Ceramic {
        type = "Porcelain"
        firing_temperature = 1300
        definition {
          Porcelain is a ceramic material made from kaolin clay.
        }
      }
      instance Ceramic {
        type = "Stoneware"
        firing_temperature = 1200

        definition {
          Stoneware is a durable ceramic that is fired at high temperatures.
        }
      }
      instance Ceramic {
        type = "Earthenware"
        firing_temperature = 1000
        definition {
          Earthenware is a porous ceramic that is fired at lower temperatures.
        }
      }
    }
  }
}</body></sourcecode>


<p id="_01743f94-f8e4-d197-aae3-42d5d96cc77b">Or</p>

<sourcecode id="_210da8e6-f8f8-64f1-998e-756b22046fb8" lang="lml"><body>class CeramicCollection {
  attribute featured_piece, Ceramic {
    definition "Featured ceramic piece"

    value {
      instance Ceramic {
        type = "Porcelain"
        firing_temperature = 1300
        definition {
          Porcelain is a ceramic material made from kaolin clay.
        }
      }
    }
    value {
      instance Ceramic {
        type = "Stoneware"
        firing_temperature = 1200

        definition {
          Stoneware is a durable ceramic that is fired at high temperatures.
        }
      }
    }
    value {
      instance Ceramic {
        type = "Earthenware"
        firing_temperature = 1000
        definition {
          Earthenware is a porous ceramic that is fired at lower temperatures.
        }
      }
    }
  }
}</body></sourcecode>

</example>

<p id="_8ada9052-c07a-4dbe-4bde-08cdbe027ab3">Within the block, the following declarations are available:</p>

<ul id="_80834f61-36ca-4133-7e41-4266f7c0310c"><li><p id="_b668864f-e98b-8bd3-368c-5e85d3160d4a"><tt>attribute</tt></p>
</li>
<li><p id="_ff1d1d77-7181-2139-f8df-dd2532642ae8"><tt>definition</tt></p>
</li>
<li><p id="_5dd15fc4-7472-9d9a-ac8c-499385b32ae8"><tt>values</tt> / <tt>value</tt></p>
</li>
</ul>
</clause>

<clause id="_41b97e23-e67a-a267-7442-115f29159c0b" obligation="normative">
<title id="_a69d94fb-f2b2-6a9a-af7a-96fe41a187ab">Attribute</title>
<p id="_8de15e62-b20e-1121-fee5-8997fcd69ca8">The <tt>attribute</tt> construct is used to define an attribute of a class.</p>

<p id="_8961edf3-a9b5-92b8-a0a0-717b1136731e">Syntax:</p>

<sourcecode id="_c4cbfe09-fe44-4148-5865-0acca845309c" lang="lml"><body>attribute {name}, {type} {block}</body></sourcecode>


<p id="_79b13c3b-65d2-4cef-2c5c-5dc424c42f0c">Where,</p>

<dl id="_72d3840f-7235-08f5-7206-8753b54d3ebc"><dt><tt>{name}</tt></dt>
<dd id="_eee23dc3-a516-b0fb-4fc1-ac84848beac1"><p id="_ea1d222c-8262-6a25-302a-c6a5c92bded7">the name of the attribute <tt>{type}</tt>:: the type of the attribute <tt>{*block}</tt>:: an optional block</p>
</dd>
</dl>

<example id="_f4f69d6a-4545-145f-8e4f-0b8aebe1b4d5"><sourcecode id="_ba489dc1-6105-34a7-ff7f-2c1ff9bba01d" lang="lml"><body>attribute location, String {
  definition "Location of the studio"
}</body></sourcecode> </example>

<example id="_e6f44435-84dc-19ea-3db4-dadc7c6288cb"><sourcecode id="_b585e763-1da7-06cf-ce5e-fd7aaefd5d87" lang="lml"><body>attribute dimensions, Float {
  definition "Dimensions of the ceramic piece"
}</body></sourcecode> </example>

<p id="_e341d788-b0e0-9968-d8ee-717c1b0709d1">An attribute can have a cardinality constraint when it is a collection.</p>

<p id="_ae4b1090-2542-7de6-1f80-8ded4d7a3a3e">Syntax:</p>

<sourcecode id="_3e579ede-99a6-4412-2f6d-e36aab9dfb32" lang="lml"><body>attribute {name}, {type} { cardinality {min}..{max} }</body></sourcecode>


<p id="_90d4caf4-4827-6758-b4c4-e6c07982d0be">Where,</p>

<dl id="_24714f87-ef63-4fa5-19bd-4059d067024b"><dt><tt>{min}</tt></dt>
<dd id="_4a859fa3-90ac-ff76-5f1b-837d7fa2e5b6"><p id="_d6630ff5-a30e-fb4c-dc46-8e7a47bf1380">the minimum number of values <tt>{max}</tt>:: the maximum number of values</p>
</dd>
</dl>

<example id="_598f46e6-a993-6e4b-ad7a-b24c9b86aec3"><sourcecode id="_54ae31ba-3e1f-1d5c-cd9c-34596d9c14bc" lang="lml"><body>attribute batch_ids, String { cardinality 0..n }</body></sourcecode> </example>

<p id="_c8242ec4-766d-da19-bc22-ec1ced6657fe">An attribute can have a values constraint.</p>

<p id="_fc48ba55-d409-341e-ecd3-6cc51277d5be">Syntax:</p>

<sourcecode id="_4d3cba8b-23e0-3c41-e6d4-38499b76c779" lang="lml"><body>attribute {name}, {type} { values {value1, value2, ...} }</body></sourcecode>


<p id="_df8b2a61-ced0-232f-91eb-aa7df4c3a9e7">Where,</p>

<dl id="_dc4d6cca-06f4-ded3-9895-8d44abe0700c"><dt><tt>{value1, value2, ...}</tt></dt>
<dd id="_92b28fac-ba86-9a2a-782b-fa324be0131b"><p id="_3be735d7-0a33-2d0e-53f2-18dcb47f86bd">the values that the attribute can take, or an Enum.</p>
</dd>
</dl>

<example id="_b28807e4-d0d8-3193-a2ff-fb12cf0f2fe9"><sourcecode id="_741e0021-9354-9f5b-b353-f033294c9a9a" lang="lml"><body>attribute firing_profile, FiringProfile {
  values { "low", "medium", "high" }
}</body></sourcecode> </example>

<example id="_1c321330-0a6e-1906-91c3-870991ec5bba"><sourcecode id="_53eb7b27-45ea-95c4-5d46-e0b5980c9a64" lang="lml"><body>enum FiringProfileEnum {
  value "low"
  value "medium"
  value "high"
}
class FiringProfile {
  attribute firing_profile, FiringProfile {
    values FiringProfileEnum
  }
}</body></sourcecode> </example>

<p id="_b8e1220f-8ec2-b0cc-9e00-2fdf431fdac0">An attribute that accepts a string value accepts value validation using regular expressions.</p>

<p id="_ce1dfa4c-3e14-ee7c-05ed-d052151a9d66">Syntax:</p>

<sourcecode id="_111dde9d-867e-514a-ee84-f36239cabaac" lang="lml"><body>attribute {name}, String { pattern {regex} }</body></sourcecode>


<p id="_d3e72037-2fe4-354b-95d0-ba6cd9b881cb">Where,</p>

<dl id="_50e7b30b-75a5-bac6-ef6d-6e40e8f6a000"><dt><tt>{regex}</tt></dt>
<dd id="_9b4e23f8-a568-2e38-e4fe-b92f22d20a29"><p id="_0ffeba47-ab4f-3b7a-bcc3-1bec9d0ffb67">the regular expression to validate the string value</p>
</dd>
</dl>

<example id="_a119fa3a-fbe8-b3bd-e014-93358caa5312"><p id="_2905334d-d227-4e24-227e-8a2faba174ff">In this example, the <tt>color</tt> attribute takes hex color values such as <tt>#ccddee</tt>.</p>

<p id="_fd092fd9-c7dc-8ca0-110d-bbd92578cbba">A regular expression can be used to validate values assigned to the attribute. In this case, it is  <tt>/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/</tt>.</p>

<sourcecode id="_f8683293-e35c-4efa-5536-2d2703345f16" lang="lml"><body>attribute color, String {
  pattern /\A#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})\z/
}</body></sourcecode>

</example>

<p id="_4be3ed55-5516-15b0-c26c-1eb56cfd7058">An attribute can have a default value using the <tt>default</tt> option. The  <tt>default</tt> option can be set to a value or a lambda that returns a value.</p>

<p id="_4e75a719-f424-630b-ab9b-33ae2e38d483">Syntax:</p>

<sourcecode id="_9799403b-771d-2f52-b4fe-7c54d1d18ccd" lang="lml"><body>attribute {name}, {type} { default: {value} }</body></sourcecode>


<example id="_fdb48a07-4fff-6eb2-f43f-8654cf360fba">
<name id="_419d8334-8f1c-0385-162f-2bf2aaadc7d0">Using the <tt>default</tt> option to set a default value for an attribute</name>
<sourcecode id="_b84f7c26-deff-a68d-f5ab-e75755751422" lang="lml"><body>class Glaze {
  attribute color, String { default: "Clear" }
  attribute temperature, Integer { default: 1050 }
}</body></sourcecode>

</example>

<p id="_769b2a55-c2f6-7a90-2782-693999c433f9">Within the block, the following declarations are available:</p>

<ul id="_67d02d54-7c83-09ce-610d-5b519a7a6790"><li><p id="_e76f9ba3-3e4b-f679-4943-f910c791a1be"><tt>definition</tt></p>
</li>
<li><p id="_969637fc-25bd-0123-c166-b8e264e18893"><tt>values</tt></p>
</li>
<li><p id="_a8e9d48a-6c9a-9dfb-8c4d-24f48f8843a5"><tt>cardinality</tt></p>
</li>
</ul>
</clause>

<clause id="_872f90f2-7228-ba24-7eae-4dde5f085259" obligation="normative">
<title id="_2515eefc-5cd7-190c-3807-dadce762a48e">Value</title>
<p id="_63b10cc1-d163-5e6a-6bdf-5ae33c1d3c8e">The <tt>value</tt> construct is used to define a value.</p>

<p id="_91b5a2f8-2242-5aa3-2aef-f9eea37cac73">Syntax:</p>

<sourcecode id="_af817ebf-4933-6270-96da-7e00a59ec117" lang="lml"><body>value {name} {block}</body></sourcecode>


<p id="_1ea0dfe8-2a65-696c-a712-f1894a7ed7a1">Where,</p>

<dl id="_bb3b58ba-403e-7026-99e0-0a0cc176b52b"><dt><tt>{name}</tt></dt>
<dd id="_3f27feec-2b0e-81ac-0771-c199d058a5d2"><p id="_525c6f13-d319-e02f-c8ad-e53f8cea40ce">the name of the value <tt>{*block}</tt>:: an optional block</p>
</dd>
</dl>

<example id="_daa21140-413a-1e4a-af62-624afe451192"><sourcecode id="_8b349712-3a8d-f2c0-73c8-22f2dcf2f5f8" lang="lml"><body>value "Porcelain" {
  definition "Ceramic material made from kaolin clay"
}</body></sourcecode> </example>
</clause>

<clause id="_70e0768a-c4ae-9b0a-14ca-e485352597b8" obligation="normative">
<title id="_eb5604bc-9cd9-44ed-bd9a-03acff6f7e3f">Enums</title>
<p id="_a19dbcee-d517-972e-b397-e427dc20a225">An <tt>enum</tt> construct is used to defined a named collection of values. Objects inside an Enum may be primitive values or instances of objects.</p>

<p id="_3a88730d-fe1c-ce13-8a9a-5afdffd985bd">Syntax:</p>

<sourcecode id="_27876d2d-7e86-24f0-147c-6cc5b4096b20" lang="lml"><body>enum {name} { // enum block
  value {value-name} {value-block}
}</body></sourcecode>


<p id="_6c0f359c-b47f-73d6-8d14-0b81f95373ef">Where,</p>

<dl id="_c7b2c3e7-f7e0-4344-96c2-6095048af7c2"><dt><tt>{name}</tt></dt>
<dd id="_21fd257b-7fac-8d34-fe8e-cf42eee760d6"><p id="_00ebce21-6ca4-d71b-b614-2c94800f12dd">the name of the enum <tt>{*block}</tt>:: an optional block <tt>{value-name}</tt>:: the name of the value <tt>{*value-block}</tt>:: an optional block</p>
</dd>
</dl>

<example id="_54dc3f2d-1f61-48f4-26ef-d1de22a3b387"><sourcecode id="_55f2c0d1-b17e-cded-5492-23b669eec038" lang="lml"><body>enum GlazeTechnique {
  definition "Techniques for glazing ceramics"

  value "Celadon" {
    definition "Technique that creates glaze in a pale green color"
  }
  value "Raku" {
    definition "Technique that creates a crackled glaze"
  }
  value "Majolica" {
    definition "Technique that creates a white glaze"
  }
}</body></sourcecode> </example>

<example id="_9f836fe7-b296-f206-d4d6-9008a07e3442"><sourcecode id="_b10e7234-7a6f-036c-2f5a-6850c9e52640" lang="lml"><body>enum GlazeType {
  value "matte" { description "Non-reflective finish" }
  value "gloss" { description "Reflective finish" }
}</body></sourcecode> </example>

<p id="_24196661-16cc-f9b1-0305-9c5ce3538780">Enums accept instances as values as well.</p>

<example id="_3c46f345-d08e-ad30-5591-7ccd7a0c83f4"><sourcecode id="_3833c883-632b-c61d-ba02-ca71c5c9c84a" lang="lml"><body>class GlazeType {
  attribute name, String
  attribute description, String
}

enum GlazeTypes {
  definition "Types of glaze finishes"

  value "matte" {
    instance {
      name = "matte"
      definition = "Non-reflective finish"
    }
  }
  value "gloss" {
    instance {
      name = "gloss"
      definition = "Reflective finish"
    }
  }
}</body></sourcecode> </example>

<p id="_bdb197c5-b478-c116-16eb-c4a64c19397f">Within the block, the following declarations are available:</p>

<ul id="_321fccee-7bf7-076f-a0bc-d23a18585757"><li><p id="_28ea5c95-9c04-0ad9-f652-cd500cf5b9ad"><tt>value</tt></p>
</li>
<li><p id="_6424198c-417a-4f1d-99f0-81167eb90969"><tt>definition</tt></p>
</li>
</ul>
</clause>
</clause>

<clause id="_7fe8b14b-4ce2-abc6-3039-fa7585f9c750" obligation="normative">
<title id="_01eacfa1-8393-54c3-1578-2e769bc988d1">Serialization</title>
<clause id="_95cbee5f-d2d8-4638-6a15-e7453face534" obligation="normative">
<title id="_5f4b6e39-1b0d-5578-3593-0f263f988427">General</title>
<p id="_b88f24eb-2fd1-03d2-1056-9c6ef4f6a9e7">LutaML supports the following constructs for serialization.</p>
</clause>

<clause id="_e65eca1f-0c2f-c505-6ac6-5beee6e66cca" obligation="normative">
<title id="_ba3aa0dd-468f-d184-3717-4a4c4d1d30ea">XML</title>
<clause id="_e8a26bdc-e239-8fa7-bab8-56429b7a01fb" obligation="normative">
<title id="_109b0870-2685-d256-8438-bf114eeac136">General</title>
<p id="_1063c608-443d-bd56-9b2a-d5cf499d39ab">LutaML supports the serialization of data models to XML.</p>

<p id="_8f940c43-6273-5365-7cb6-f43948ac7608">Syntax:</p>

<sourcecode id="_f820cddd-1b6d-e012-4bda-c9a9508e1763" lang="lml"><body>mapping xml {block}</body></sourcecode>


<p id="_98f1887f-4ee7-b2e2-461b-8c5f57890b56">Where,</p>

<dl id="_9cf50215-4db8-f851-cb90-3167d3af48cf"><dt><tt>{block}</tt></dt>
<dd id="_a517f3b0-c0d3-078e-0755-e19513cc4492"><p id="_f66a0597-3c06-9775-d9f8-a391a74df724">an XML mapping block. Mappings are declared inside the class (in-class form; the enclosing class is the implied target) or as sibling constructs linked to their class —  <tt>mapping xml &lt;ClassName&gt; {block}</tt>.</p>
</dd>
</dl>

<example id="_4e226be3-332d-3a70-821c-5b9de8d213af"><sourcecode id="_f881c70d-6a9c-25ea-bf6f-816ccac3c9eb" lang="lml"><body>class Studio {
  attribute location, String
  attribute potter, String
  attribute kiln, String

  mapping xml {
    map_element "location" location
    map_element "potter" potter
    map_attribute "kiln" kiln
  }
}</body></sourcecode>


<p id="_171dd873-ddc9-677e-9fa5-91045f7335d4">An instance of the class <tt>Studio</tt> will be serialized to XML as:</p>

<sourcecode id="_1a54e745-9d09-bfb4-aba8-aba46cd0c412" lang="xml"><body>&lt;studio&gt;
  &lt;location&gt;Paris&lt;/location&gt;
  &lt;potter&gt;Marie&lt;/potter&gt;
  &lt;kiln&gt;Electric&lt;/kiln&gt;
&lt;/studio&gt;</body></sourcecode>

</example>

<p id="_86ffc947-7f3b-1cf8-a727-c2994aa70c7b">Within the block, the following declarations are available:</p>

<ul id="_de235249-5ed6-53b9-77b2-d4de2bc1d114"><li><p id="_d8b59580-e1cf-44b6-89a5-ab99d824af29"><tt>element</tt> — the element (tag) name</p>
</li>
<li><p id="_3f7a5ad5-a940-bbfb-29d5-20f2351007ab"><tt>namespace &lt;ref&gt;</tt> — a context-declared namespace reference</p>
</li>
<li><p id="_dca704ed-e1b0-1253-bdd4-702668b33e59"><tt>map_element</tt></p>
</li>
<li><p id="_7090c7dd-a179-9f07-92ab-e16a349a6d8d"><tt>map_attribute</tt></p>
</li>
<li><p id="_e8dde7c3-8202-3907-2f46-81580ef08306"><tt>map_content</tt></p>
</li>
<li><p id="_b942249a-67f5-cf11-0cc9-afaa7114cd84"><tt>mixed_content</tt></p>
</li>
</ul>
</clause>

<clause id="_91eb4fe3-32eb-829b-c9f9-b779322acef4" obligation="normative">
<title id="_9d5e5b8c-904d-70b2-9f5a-db5cc74074b4">Setting the element name</title>
<p id="_2d6482ed-29ea-9b6a-0a3a-2cca99bba868">By default, the element name is a lowercased version of the class name.</p>

<sourcecode id="_cfe53c38-8955-a1a5-9fd7-199950f1712d" lang="lml"><body>mapping xml {
  element "xml_element_name" <callout target="_1c5d8477-9134-436b-8b1d-7c4da5b1612d">1</callout>
}</body><callout-annotation id="_49e2351d-fe22-e173-0e24-13eeaa0cdccf" anchor="_1c5d8477-9134-436b-8b1d-7c4da5b1612d"><p id="_53f9a938-6ca8-8a79-c89e-89504bef16f8">The name of the root element.</p>
</callout-annotation></sourcecode>



<example id="_3da5c292-f902-d32d-6361-61d45e45b636"><sourcecode id="_24b56845-652f-ab5a-2996-99bf956d017c" lang="lml"><body>class Studio {
  attribute location, String
  attribute potter, String
  attribute kiln, String

  mapping xml {
    element "local-studios"
    map_element "location" location
    map_element "potter" potter
    map_attribute "kiln" kiln
  }
}</body></sourcecode>


<p id="_4036fe2b-2858-9aed-c47d-46bc83c5e91f">An instance of the class <tt>Studio</tt> will be serialized to XML as:</p>

<sourcecode id="_57b4d638-8e0a-aeda-9ea9-01cf4575af3e" lang="xml"><body>&lt;local-studios&gt;
  &lt;location&gt;Paris&lt;/location&gt;
  &lt;potter&gt;Marie&lt;/potter&gt;
  &lt;kiln&gt;Electric&lt;/kiln&gt;
&lt;/local-studios&gt;</body></sourcecode>

</example>
</clause>

<clause id="_87e16f62-cb9e-0d96-86fd-841f021ce30a" obligation="normative">
<title id="_c1121c0d-c701-b4d5-e3c4-e6a2732979d2">Omitting root element</title>
<p id="_c248164a-5e7f-ec42-90d7-c0542c233486">By default, there exists a root element in a model represented in XML. In cases where the root element is not to be present, it can be omitted.</p>
</clause>

<clause id="_62fb4690-a44f-ff82-eddb-28f5ccc19d0f" obligation="normative">
<title id="_351334ab-e0bf-4bf5-a7c9-818d6f5dff0e">Omitting the element (type-only model)</title>
<p id="_aab3bbe1-24a5-1f5a-ba1d-5df54f48b2ca">A model without an <tt>element</tt> declaration is a type-only model: its attributes serialize as child elements wherever the type is used, with no element of their own. The  <tt>no_root</tt> method of earlier drafts is deprecated — omit the  <tt>element</tt> declaration instead.</p>

<example id="_18bce0ee-866b-65a0-6390-676f8f95f5c0"><sourcecode id="_89ca2bb7-8845-19fe-4077-f26a2948cd5f" lang="lml"><body>class StudioLocation {
  attribute location, String
  attribute potter, String
  attribute kiln, String

  mapping xml {
    map_element "location" location
    map_element "potter" potter
    map_attribute "kiln" kiln
  }
}</body></sourcecode>


<p id="_6476348b-f335-682b-657c-f5d2dc0952c1"><tt>StudioLocation</tt> serializes without its own element wherever embedded.</p>
</example>
</clause>

<clause id="_923adc82-a0d9-7249-7bd5-ca32a0be0b93" obligation="normative">
<title id="_f7fe6027-4b8b-f052-1b83-078443a7aea5">map_element</title>
<p id="_88cbff3b-348b-4701-7d5d-6fdab890b074">The <tt>map_element</tt> construct is used to map an XML element to a model attribute.</p>

<p id="_94cf1b2e-ae50-8e0a-ecff-a4b519b5aeee">Syntax:</p>

<sourcecode id="_bc8354d1-9612-f6b2-12b6-d4049cbecba3" lang="lml"><body>map_element "&lt;wire&gt;" &lt;attribute&gt;</body></sourcecode>


<p id="_e38d683a-080f-a3fa-a1d6-2e5098d3f49e">Where,</p>

<dl id="_3a9c718d-98bd-ed2f-f324-d37018e130b5"><dt><tt>{name}</tt></dt>
<dd id="_8b7d580c-e376-1faf-c0fb-5daef23e023a"><p id="_031cb836-bb93-a846-a1d7-6694537a058a">the name of the element <tt>{*block}</tt>:: an optional block</p>
</dd>
</dl>

<example id="_8fc20676-b710-9e11-aa8c-35fc9ffcc1fe"><sourcecode id="_d1f8bd9f-a8d3-6b79-44e1-6e072f8d6a6f" lang="lml"><body>class Studio {
  attribute location, String

  mapping xml {
    map_element "geo-location" location
  }
}</body></sourcecode>   <sourcecode id="_cfac7bf3-4825-ab92-8af8-056d0b045b1d" lang="xml"><body>&lt;studio&gt;
  &lt;geo-location&gt;Paris&lt;/geo-location&gt;
&lt;/studio&gt;</body></sourcecode> </example>

<p id="_39e24a5d-8199-2ae9-5da7-50c8a8c29df2">In <tt>map_element</tt>, if the target attribute is a LutaML model, the newly specified element name overrides the defined  <tt>root</tt> name of the model.</p>

<example id="_c9f0f729-121c-d5c0-9680-04a38f69de30"><sourcecode id="_3e33f03e-b4d7-0802-68c0-fac1c0837483"><body>class LocationElement {
  attribute location, String

  xml do
    element "location"
    map_element "place" location
  end
}

class Studio {
  attribute location, LocationElement

  mapping xml {
    element "studio"
    map_element "geo" location
  }
}</body></sourcecode>   <sourcecode id="_296c5607-4467-c734-1584-acbfde87fc68" lang="xml"><body>&lt;studio&gt;
  &lt;geo&gt;&lt;place&gt;Paris&lt;/place&gt;&lt;/geo&gt;
&lt;/studio&gt;</body></sourcecode> </example>
</clause>

<clause id="_b6d82d95-e083-461a-bf68-7f6f2732cbfd" obligation="normative">
<title id="_a4b6fc15-beec-3a8b-25b9-c73ccbe32945">map_attribute</title>
<p id="_d01c5734-9c2b-9000-334b-55ed47b471d1">The <tt>map_attribute</tt> construct is used to map an XML attribute to a model attribute.</p>

<p id="_96d34d2c-b4f1-5945-942b-e77213a28f5a">Syntax:</p>

<sourcecode id="_2fb4d599-71da-346b-17f6-963174e85ce9" lang="lml"><body>map_attribute "&lt;wire&gt;" &lt;attribute&gt;</body></sourcecode>


<p id="_92b7ae0e-415c-0171-9763-671d39dac3ea">Where,</p>

<dl id="_091cd431-7025-73e6-7842-1748e276ee6b"><dt><tt>{name}</tt></dt>
<dd id="_76c2da38-488d-bad5-918b-be7c6e4633e7"><p id="_c885236b-cd13-31f5-e16f-41e8b831e358">the name of the attribute <tt>{*block}</tt>:: an optional block</p>
</dd>
</dl>

<example id="_c261ccd0-5c05-f9eb-98ac-39aa9a4bb085"><sourcecode id="_87450028-6946-e83f-70f6-b748b65d3e69" lang="lml"><body>class Studio {
  attribute location, String
  attribute identifier, String
  attribute kiln, String

  mapping xml {
    map_element "geo-location" location
    map_attribute "identifier" identifier
    map_attribute "kiln" kiln
  }
}</body></sourcecode>   <sourcecode id="_20d7fc15-525d-8f6a-52c0-562ca52af7b4" lang="xml"><body>&lt;studio identifier="1234" klin="Electric"&gt;
  &lt;geo-location&gt;Paris&lt;/geo-location&gt;
&lt;/studio&gt;</body></sourcecode> </example>
</clause>

<clause id="_dc42fce6-0305-ca0c-a7f7-9cb61f80d31c" obligation="normative">
<title id="_2fac70db-b972-b040-3221-a0e8eaafc25b">map_content</title>
<p id="_a046a590-1fa9-cb51-6822-22bde90d9638">The <tt>map_content</tt> construct is used to map the content of an XML element to a model attribute.</p>

<p id="_bdb8e34d-23d9-595f-0e93-cd45140cd606">Syntax:</p>

<sourcecode id="_1fbeed27-e9cc-7ee6-2af8-b45056d8dc07" lang="lml"><body>map_content &lt;attribute&gt;</body></sourcecode>


<p id="_42fae31f-b803-3dce-9809-6518e9e15499">Where,</p>

<dl id="_fdb73a87-d1dd-8f95-a0aa-84e8077e284e"><dt><tt>{*block}</tt></dt>
<dd id="_2a479392-3dc6-b615-6d86-354537f89bf9"><p id="_ef228242-a4e2-136c-36c1-1c02b637be9a">an optional block</p>
</dd>
</dl>

<example id="_92be1351-3543-c994-85bf-c3d851c6daff"><sourcecode id="_8abcd24f-e772-fd29-9ae2-294543b14283" lang="lml"><body>class Studio {
  attribute location, String

  mapping xml {
    map_content location
  }
}</body></sourcecode>   <sourcecode id="_e5b46314-49f5-2eb7-683b-1104db30ecaa" lang="xml"><body>&lt;studio&gt;Paris&lt;/studio&gt;</body></sourcecode> </example>
</clause>

<clause id="_49c5394d-f75d-8bed-c775-b2cca5cbe833" obligation="normative">
<title id="_d765e955-9077-510e-8889-a96fc8ce14eb">Namespaces</title>
<p id="_2f6686c4-4ed0-d25a-e699-c5ec6b309068">Namespaces can be defined in the XML serialization.</p>

<p id="_6019d87e-f4d7-ac5e-29e4-f38914294030">The <tt>namespace</tt> construct is used to define a namespace in the element.</p>

<ul id="_6da1f980-a24e-7281-8195-6a6089b76e56"><li><p id="_b025c964-67fd-f6e6-241a-bfb90b820cc9">In XML, this namespace declares the “default namespace” for all unnamespaced elements within this element.</p>
</li>
<li><p id="_0c49ed2f-0410-a72c-531b-cf16a63d193c">Attributes are not affected by the namespace.</p>
</li>
<li><p id="_3050dd64-f15c-b0bc-b0d0-71fd994ef914">A namespace URI is optional, allowing for flexibility in definition.</p>
</li>
</ul>

<p id="_b85681db-d540-c3f1-b41c-129a9963c1ab">Syntax:</p>

<sourcecode id="_1277ccc8-80ed-e51e-1587-226680e1ae04" lang="lml"><body>namespace {prefix} {uri}</body></sourcecode>


<p id="_dfe06574-be95-b03b-4d94-05e8cb7266a0">Where,</p>

<dl id="_fec3a474-6cb8-d665-dac9-0b96945141b5"><dt><tt>{prefix}</tt></dt>
<dd id="_530304b3-cd43-4866-3e0a-05f3e5bc8d70"><p id="_f867a7f1-28d5-a491-f5b8-47107a1a1fd3">the namespace prefix <tt>{uri}</tt>:: the namespace URI (optional)</p>
</dd>
</dl>

<example id="_8f6ecf3a-105f-a9d8-92ae-f0db318df8c8"><sourcecode id="_aad95451-7e29-3a59-a201-8e4461796624" lang="lml"><body>class Studio {
  attribute location, String

  mapping xml {
    namespace "geo" "http://example.com/geo"
    map_element "location" location
  }
}</body></sourcecode>   <sourcecode id="_1265ea3c-d5f8-afe6-144c-4fc117a5d1a6" lang="xml"><body>&lt;studio xmlns:geo="http://example.com/geo"&gt;
  &lt;location&gt;Paris&lt;/location&gt;
&lt;/studio&gt;</body></sourcecode> </example>
</clause>
</clause>

<clause id="_63c8e7ac-d36d-21aa-c992-496eae5a41dd" obligation="normative">
<title id="_4b2202e4-d0d6-25c7-34ad-6053cc2fc539">Key-value formats</title>
<p id="_dfccff26-114a-5437-6286-81478ef2ba13">Key-value formats are serialization formats that represent data as a collection of key-value pairs.</p>

<p id="_232b1a7f-b3ad-050b-2ac6-043652dae70f"><bookmark id="_2470fa35-c387-1091-a80c-7ecca2793942" anchor="_9661b7bf-e210-4287-a1a4-bbbedbe4aa16"/>These include YAML, JSON, TOML and others.</p>


<clause id="_5ac9c2d0-b789-2d49-687d-c52bab313614" obligation="normative">
<title id="_2fae856a-96e6-ffa4-3f7c-0a116c576947">map</title>
<p id="_d512d23c-c437-4d48-947c-eff9ab2fae58">The <tt>map</tt> construct is used to map a collection of elements to a model attribute.</p>

<p id="_7e092e47-6eb4-eee8-bc3f-8deaa899f222">Syntax:</p>

<sourcecode id="_12b04368-c48c-9016-efcb-9a95236d5aef" lang="lml"><body>mapping yaml {
  map "&lt;wire&gt;" &lt;attribute&gt;
}</body></sourcecode>


<p id="_2268a530-d32e-2caa-7d97-61b61f89f7c4">Where the wire name and the model attribute are juxtaposed; a single term (<tt>map &lt;attribute&gt;</tt>) uses the attribute name as the wire name.</p>

<example id="_3b2e94c3-908f-ebf6-8cdd-b9612a406771"><sourcecode id="_6cdd57bb-12e9-a3a2-ec4b-404255809dfb" lang="lml"><body>class Studio {
  attribute location, String

  mapping yaml {
    map "location" location
  }
}</body></sourcecode>   <sourcecode id="_c0029e8c-2cef-22e9-4aa6-e8e4e4a5ca11" lang="yaml"><body>- location: Paris
- location: Berlin
- location: London</body></sourcecode> </example>
</clause>
</clause>

<clause id="_ec04ff6d-d618-0293-7091-877caece3443" obligation="normative">
<title id="_583295aa-ede0-e0ff-94aa-578c13ae97c2">Collection mappings</title>
<clause id="_af9ca9f9-e421-f0f3-b6ca-ea0bbb17ceb3" obligation="normative">
<title id="_cbc2e4b1-d9bb-e78a-ca18-fa3bc37ab955">map_key</title>
<admonition id="_77171387-16da-4695-fc09-7f6799fa198b" type="warning"><p id="_19dfb952-031c-bdcc-25ec-c9693bc478dd">Only for key-value formats.</p>
</admonition>
<p id="_72c20455-1bf7-aff4-7d4c-b215698fb347">The <tt>map_key</tt> construct is used to map the key of a serialization object to a model attribute.</p>

<p id="_7ee805fd-1482-15de-26ed-bd36b6a574e9">Syntax:</p>

<sourcecode id="_b0c1e3c9-dd1a-0d39-fc3c-1bb00c92fc1b" lang="lml"><body>map_key to_instance &lt;attribute&gt;</body></sourcecode>


<p id="_21626353-7c24-5dec-4157-e709b1a54deb">Where,</p>

<dl id="_9f5d2e46-52be-3de0-0088-3d278c76d96d"><dt><tt>{name}</tt></dt>
<dd id="_12482efe-306d-fad9-1517-e2ee91d3e7d4"><p id="_7f163883-1c10-c72f-d2ef-5fb91a6f4c61">the name of the key <tt>{*block}</tt>:: an optional block</p>
</dd>
</dl>

<example id="_3e1591a8-bd4b-b70f-a76e-4f8bb6040d7b"><sourcecode id="_23f83f44-63b2-b0f5-cd1a-fb51f26c73f9" lang="lml"><body>class Studio {
  attribute location, String
}

class StudioCollection &lt; Collection {
  instances Studio

  mapping yaml {
    map_key to_instance location
  }
}</body></sourcecode>   <sourcecode id="_c12eec98-3de3-279c-bfbf-71db101d291e" lang="yaml"><body>- 01_paris: Paris
- 02_berlin: Berlin
- 03_london: London</body></sourcecode> </example>
</clause>

<clause id="_90a57a91-3a29-ff3b-ba0c-ccf489e0d8ca" obligation="normative">
<title id="_565454e4-9f91-d2f3-ce77-5f02947285c1">map_value</title>
<admonition id="_49540e2d-8338-1cbc-9404-dc8b656ec000" type="warning"><p id="_751ec906-c5cd-a622-eaad-3e9d193cde0f">Only for key-value formats.</p>
</admonition>
<p id="_9917185a-e849-4776-e884-e1552417cc36">The <tt>map_value</tt> construct is used to map the value of a serialization object to a model attribute.</p>

<p id="_019aa483-7cc8-e2d9-0945-b4ef17e73f36">Syntax:</p>

<sourcecode id="_46c56ea7-681c-26f5-7cc7-f50340dacdab" lang="lml"><body>map_value to_instance &lt;attribute&gt;</body></sourcecode>


<p id="_f62f0497-bf55-7fa7-ec66-874aa5b5d4f7">Where,</p>

<dl id="_f627350f-9cfd-b39a-c77f-ac2889309145"><dt><tt>{name}</tt></dt>
<dd id="_f20170b7-2022-5709-1ae9-972ec54ff0d4"><p id="_6878a410-cb67-374e-c165-5c6d9aea5ac4">the name of the value <tt>{*block}</tt>:: an optional block</p>
</dd>
</dl>

<example id="_9bafda18-8d82-2abe-c924-2c23e3b7b582"><sourcecode id="_2e0d8455-4fba-869d-65da-92f7acd9a778" lang="lml"><body>class Studio {
  attribute location, String
}

class StudioCollection &lt; Collection {
  instances Studio

  mapping yaml {
    map_key to_instance location
    map_value to_instance location
  }
}</body></sourcecode>   <sourcecode id="_6f5bb2ab-874e-c7a7-2706-f5f0287fe0ba" lang="yaml"><body>- 01_paris:
    location: Paris
- 02_berlin:
    location: Berlin
- 03_london:
    location: London</body></sourcecode> </example>
</clause>
</clause>
</clause>

<clause id="_b6076ffb-80f0-7fd1-5bd9-b3e0c96df60d" obligation="normative">
<title id="_c9ff8917-23fe-db1d-2591-85d74b984bd7">Instance representation</title>
<clause id="_2a8e8575-e817-a908-0346-3fa234933a53" obligation="normative">
<title id="_ffbfe19a-f99c-7491-ef6f-2515e70bd96f">Instance</title>
<p id="_e84a5661-631e-f76d-d34e-4a0e5f8ef2a2">An <tt>instance</tt> construct is used to define an instance of a class.</p>

<p id="_3cba2bde-1138-fca9-644b-ff66042d5256">To assign values to attributes, the attribute name is followed by an equal sign and the value.</p>

<p id="_f8c02405-71d4-4a32-91c0-8e2da598fdd6">An optional attribute without an assignment is absent. An explicit <tt>null</tt> assignment denotes the null value, and an empty string <tt>""</tt> denotes a present, empty string.</p>

<p id="_86869d39-fddc-230f-1c6b-7c32ecececc4">Syntax:</p>

<sourcecode id="_ec6dba49-0d06-59d4-5db4-0fca460bf714" lang="lml"><body>instance {name} {block}</body></sourcecode>


<p id="_656a2314-9e63-cd8d-c745-2518685d0d55">Where,</p>

<dl id="_cfec786b-6c00-80c2-97c4-c9510673d08e"><dt><tt>{name}</tt></dt>
<dd id="_da3eef28-5244-b1e2-7524-cf49e0fb50ee"><p id="_76e87662-661e-047d-0978-78f38b337022">the name of the instance <tt>{*block}</tt>:: an optional block</p>
</dd>
</dl>

<example id="_4b57a494-b271-367f-e205-395be492df71"><sourcecode id="_020f32ce-a57e-1e43-6f32-f6221e905cd7" lang="lml"><body>class Studio {
  attribute location, String
  attribute potter, String
  attribute kiln, String
}

instance "Studio" {
  location = "Paris"
  potter = "Marie"
  kiln = "Electric"
  definition {
    Marie's studio in Paris.
  }
}</body></sourcecode> </example>

<example id="_d96884f2-37a1-ff36-8312-45a06e528c50"><sourcecode id="_8d6462af-1791-2eac-20e8-7ee371f7bb6c" lang="lml"><body>class CeramicTile {
  attribute dimensions, Float { cardinality 2 }
  attribute firing_profile, FiringProfile
  definition {
    Types of ceramic tiles.
  }
}

instance "square" CeramicTile {
  dimensions = [30.5, 30.5]
  firing_profile = "high"

  definition {
    A square ceramic tile used for various applications.
  }
}</body></sourcecode> </example>

<p id="_9b36924c-85bd-7f91-bc90-c2cb47b70f5f">Within the block, the following declarations are available:</p>

<ul id="_4edb770f-a4d7-1096-96ac-31153e72015a"><li><p id="_9b80f0b6-3873-e354-4884-25b872128370">attributes of the class</p>
</li>
<li><p id="_f22e5022-b4f9-b8d6-fd67-d37e7edcea2a"><tt>definition</tt></p>
</li>
<li><p id="_8b510004-0ad9-bd23-6c21-ae68a60978ff"><tt>values</tt></p>
</li>
</ul>
</clause>

<clause id="_09b7c77c-8b83-057b-81e6-1f923400dae7" obligation="normative">
<title id="_a22fde0b-3288-7035-ba26-1472c2527336">Instance collection</title>
<p id="_6d927107-63b8-913f-bc1c-03a648e4e637">Instances are representations of classes with values assigned to their attributes as a collection.</p>

<p id="_804213f9-79d5-2133-7594-54af092de56b">Syntax:</p>

<sourcecode id="_efde4084-b2c5-2145-cf26-fbb197bc23c5" lang="lml"><body>instances {name} {block}</body></sourcecode>


<p id="_c8c40be8-44f5-8597-ebe2-1b972ac7eeec">Where,</p>

<dl id="_6f0f59aa-4c9c-c23e-7102-1471330d7dc7"><dt><tt>{name}</tt></dt>
<dd id="_5873321f-89fb-88d2-1762-53a16ae8784e"><p id="_f080f729-acd4-6211-ccbf-765ab1584b66">the name of the instance <tt>{*block}</tt>:: an optional block</p>
</dd>
</dl>

<example id="_4ca44170-f8ed-eff0-cb7f-5b1b63317801"><sourcecode id="_1c5b1d48-ab9f-ce62-c44d-b0ef701e0b70" lang="lml"><body>instances "Studios" {
  instance Studio {
    location = "Paris"
    potter = "Marie"
    kiln = "Electric"
  }

  instance Studio {
    location = "Berlin"
    potter = "Hans"
    kiln = "Gas"
  }
}</body></sourcecode> </example>

<example id="_3d7fcc95-44ac-457b-e9ea-5900591b93da"><sourcecode id="_ac3da18e-05e3-62d4-121b-fb5557060730" lang="lml"><body>instances "Tiles" {
  instance "square" CeramicTile {
    dimensions = [30.5, 30.5]
    firing_profile = "high"
  }

  instance "circle" CeramicTile {
    dimensions = [20.5, 20.5]
    firing_profile = "medium"
  }
}</body></sourcecode> </example>

<p id="_b44b8dd4-ffa3-f4f6-11ca-06ccdd8f4898">Within the block, the following declarations are available:</p>

<ul id="_fa53ba95-04a1-39be-2c5d-25e7d64e78a1"><li><p id="_6b66b5c7-25e0-4c82-7bce-2c53d6d4e604"><tt>instance</tt></p>
</li>
</ul>
</clause>

<clause id="_ea9e3388-bb91-967c-408b-361903332fd6" obligation="normative">
<title id="_e723feb9-5afe-fc89-3e83-2f8358faff77">Value type</title>
<clause id="_b7cdc09c-a51d-cb7e-ec5f-9a3618e691bb" obligation="normative">
<title id="_28767807-a0ae-b37b-b7e5-50b517044c66">References</title>
<p id="_f92f7572-c408-edae-0fe7-e7d2e5a82814">References are used to link instances together.</p>

<p id="_b793eff3-4a9f-1562-75ea-dfa9c5c22d53">Syntax:</p>

<sourcecode id="_ae215c46-9b1d-9a68-99c9-e692a2b3d902" lang="lml"><body>ref:(path)</body></sourcecode>


<p id="_4ca747e1-d9a0-c2bb-9525-5023de86147c">Where,</p>

<dl id="_acc6c968-bdf7-6271-43ce-d0f812fa9489"><dt><tt>{path}</tt></dt>
<dd id="_dc0d06da-b48e-8e0f-664f-903b9998de21"><p id="_4ebf3460-d7bf-c142-c304-c7554336e88e">the path to the instance</p>
</dd>
</dl>

<example id="_33c82844-a7e1-cf3d-e4c6-1d87a5c41615"><sourcecode id="_628f397f-ccef-2138-60d3-979df4aeaa6e" lang="lml"><body>instances Glazes {
  GlazeFormula "blue_matte" {
    components = ["silica", "cobalt"]
  }

  CeramicTile "tile_002" {
    glaze = ref:(Glazes.blue_matte)
  }
}</body></sourcecode> </example>
</clause>
</clause>
</clause>

<clause id="_c075553d-24da-b865-0780-4e29391734c7" obligation="normative">
<title id="_197f9814-b315-a62f-59a8-b40ca44f7500">Reuse and referencing</title>
<p id="_56cb7d89-a3e1-0c0b-01c8-b6da37f6eeac">Lutaml supports modularity through external file inclusions.</p>

<clause id="_021d6174-c620-4dc5-4f02-5ce19937fa4f" obligation="normative">
<title id="_defbc711-99c2-386f-7cf6-1fee2d4da42d">External file inclusion</title>
<p id="_91d8cd82-6a6f-a629-bdea-83ae9c3235b9">Use <tt>require</tt> to import definitions from other files.</p>

<sourcecode id="_7d57d56f-49a2-1eb7-2d0f-5e683157ddfa" lang="lml"><body>require "materials.lml"
instances Tiles {
  Materials::CeramicTile "tile_001" {
    dimensions = [30.0, 30.0]
    firing_profile = "medium"
  }

  Materials::CeramicTile "tile_002" {
    dimensions = [40.0, 60.0]
    firing_profile = "high"
  }
}</body></sourcecode>

</clause>

<clause id="_e101088f-c6b0-9ab1-78bc-83ecd2b727a7" obligation="normative">
<title id="_d114818c-d59d-226b-023d-41e89c3df816">Internal references</title>
<p id="_8b1fe7ca-397a-9904-0ced-84f733a53038">Link instances using <tt>ref:</tt>.</p>

<sourcecode id="_7b0a4c4b-91d0-31c2-bea7-bc6619bffd0f" lang="lml"><body>instances Production {
  GlazeFormula "gloss_blue" { ... }

  CeramicTile "tile_001" {
    glaze = ref:(GlazeFormula.gloss_blue)
  }
}</body></sourcecode>

</clause>

<clause id="_9e6fb160-4476-5c10-146b-7b47dfa82c3d" obligation="normative">
<title id="_5b006d69-855c-d2e3-47d6-a98088b84b2d">Namespacing</title>
<p id="_0a35bccb-15a4-693d-383d-69a3af6ae5cd">Class names are scoped to their model (e.g., <tt>Materials::CeramicTile</tt>).</p>
</clause>
</clause>

<clause id="_a1cf2ea3-1b38-73c3-7236-86ec83857a24" obligation="normative">
<title id="_b1340816-c214-0c75-6b5b-1d863259a32d">Validation rules</title>
<clause id="_b7181e75-cac2-f530-4ada-e3ace47648e2" obligation="normative">
<title id="_182fd666-f45c-73ca-27bb-05658314579c">Attribute constraints</title>
<ol id="_39d24c7f-eb94-cbe0-6a8e-4c3a1e060597" type="arabic"><li><p id="_ea01d230-1129-0e52-8369-1e73304e8c69">Mandatory fields (<tt>cardinality 1</tt>) must be populated.</p>
</li>
<li><p id="_92dad977-0504-244d-c853-ee1074311db7">Values must match the declared type (e.g., <tt>float</tt> for <tt>thickness</tt>).</p>
</li>
</ol>
</clause>

<clause id="_c236c950-80f9-2b52-8d2e-58b343a95647" obligation="normative">
<title id="_684a001f-b18b-5dae-e3f6-1ee274b17d28">Class constraints</title>
<ol id="_cef822b6-e218-fc3a-fec2-29d12d40742d" type="arabic"><li><p id="_6c776d28-c400-e4fb-8ecd-2142a665d661">Unique names within a model.</p>
</li>
<li><p id="_f0b61021-3d82-6a03-8c23-dcf431f3d6a8">Attribute names unique within a class.</p>
</li>
</ol>
</clause>

<clause id="_cf7e68fd-819a-bce4-ed50-f14f92aacad5" obligation="normative">
<title id="_1057a0e4-8309-6b4e-2c12-833334c0f25f">Reference validity</title>
<ul id="_796b6f6b-1b15-beed-4ee4-c7b0a3243530"><li><p id="_167b9d2d-b42e-f248-167f-2c3713fb7c49"><tt>ref:</tt> must resolve to a valid instance path.</p>
</li>
<li><p id="_6c998757-f1ee-6e02-27e8-f4055ac3c81c">Circular references are invalid.</p>
</li>
</ul>
</clause>
</clause>

<clause id="_352989e0-52aa-aa6c-4f12-6077d7f1de24" obligation="normative">
<title id="_e4e1a8fb-08dd-eb3a-dd5b-919f284d5545">Examples</title>
<clause id="_ac6e468c-9698-e8e3-e4cf-dba0a2e1b770" obligation="normative">
<title id="_2b572f85-b628-8f02-6826-94d6fb69926a">Ceramic product definition</title>
<sourcecode id="_28a23a8a-7e96-d12f-92d5-e508b84e49f2" lang="lml"><body>models Ceramics {
  enum FiringProfile { values { "low", "medium", "high" } }

  class CeramicTile {
    attribute dimensions, float { cardinality 2 }  // [length, width]
    attribute firing_profile, FiringProfile
  }
}

instances Tiles {
  Ceramics::CeramicTile "tile_001" {
    dimensions = [30.5, 30.5]
    firing_profile = "high"
  }
}</body></sourcecode>

</clause>

<clause id="_1ad75581-c576-5c3f-3b19-2876a1796385" obligation="normative">
<title id="_2e8bb942-2237-d1af-fca8-08fc57290538">Glaze formula reference</title>
<sourcecode id="_5a97f485-2bcb-fed9-1580-d3077b4c6a4f" lang="lml"><body>instances Glazes {
  GlazeFormula "blue_matte" {
    components = ["silica", "cobalt"]
  }

  CeramicTile "tile_002" {
    glaze = ref:(Glazes.blue_matte)
  }
}</body></sourcecode>

</clause>
</clause>

<clause id="_d0118430-e253-fb99-ec10-b6ef1cc10779" obligation="normative">
<title id="_4490658b-0a0a-5925-afa2-b36e2f8c364f">Canonical form</title>
<note id="_5d36bea9-5dd3-0675-3a42-de404637a79a"><p id="_67272e65-8a4e-6b6d-3600-285ec2926253">This section is informative. It defines a canonical rendering of a document: the form produced by a conforming formatter. Documents are not required to be canonical; canonicalization is a formatting operation with defined results, not a validity constraint.</p>
</note>

<p id="_cea90253-ff10-458d-5902-af7c85d63b9e">The canonical rendering of a document observes the following rules.</p>

<dl id="_d4fd73dc-4b00-fb7c-5a79-0a1d5520e8a7"><dt>Member order.</dt>
<dd id="_7b55ba45-7509-fb2a-da4d-a3f11a7c40ae"><p id="_ff40fd72-349d-805c-e37a-c732d3258d7e">Because information models are unordered across member kinds, the canonical order is: the language-version prologue when the document declares one, then  <tt>requires</tt>, namespaces, packages (each package’s members recurse in the same order), classes, enums, data types, primitives, serialization mappings, associations, diagrams, and instances. Within a group, declaration order is preserved.</p>
</dd>
<dt>Layout.</dt>
<dd id="_9600e511-ec58-7b1b-020a-f2c1ac3d0ba3"><p id="_202ab15b-a6bd-1f18-2c6d-151c41e5a693">Indentation is two spaces per level. One blank line separates members at every level. A document ends with a single trailing newline.</p>
</dd>
<dt>Attribute forms.</dt>
<dd id="_745463a0-ea4a-070b-4044-75c64d8af2b4"><p id="_bef51a0c-1d87-75da-cb4f-4783d52584d2">An attribute with only a name and a type and the default cardinality renders in the terse form  <tt>attribute {name}, {type}</tt>. Any other attribute renders in the block form, with members in this order: type, cardinality, value set, default, pattern, then remaining properties sorted by name. Cardinality renders  <tt>[a..b]</tt>; an unbounded maximum renders <tt>n</tt>; <tt>[0..1]</tt> is the default and is omitted.</p>
</dd>
<dt>Modifiers and quoting.</dt>
<dd id="_18fa8ca2-2b4c-13a3-f148-b702b62d825c"><p id="_993c84d3-ba17-e760-dd8e-b8e2612d2856">Visibility renders only when not public. Values and keys quote alike: bare only for runs of  <tt>[A-Za-z0-9_]</tt>, otherwise double quotes with the escapes defined under  <em>String values</em>.</p>
</dd>
<dt>Null and absence.</dt>
<dd id="_b41616ba-264a-3ea0-9a2f-6bf1140482e7"><p id="_a9e09051-f7fd-f8a5-855d-f83ae589eb09">In model definitions an optional member that is nil is omitted entirely. In instance data the value rules apply:  <tt>null</tt> denotes the null value, <tt>""</tt> a present empty string, and an unassigned optional attribute is absent.</p>
</dd>
<dt>Canonicalization properties.</dt>
<dd id="_77d74f25-8f92-e3e7-6826-8f65a39c9cd7"><p id="_aa4dfe7f-3dbe-6a90-36b6-04903c150b7c">Canonicalizing a document is deterministic: the same document model always renders to the same text, and rendering a canonical document again yields the same text. Comments are lexical trivia and are not retained by the document model, so a canonical rendering does not reproduce them. Where a processor retains a comment in its document model, canonical rendering preserves the comment’s content but not necessarily its original kind.</p>
</dd>
</dl>
</clause>

<clause id="_9107eb46-c261-2927-1c19-027db986e732" obligation="normative">
<title id="_649f253d-1d34-cbf4-8465-f12baa472c67">Annex: Value semantics</title>
<p id="_4aea5bed-e3a2-5de1-b70a-a04ff04fc2ce">This annex states the value model formally. It is normative and codifies the rules given under  <em>String values</em>, <em>Null</em>, and <em>Attribute</em>.</p>

<clause id="_63903de9-c585-d489-8e8e-3133dc657553" obligation="normative">
<title id="_a8275b2a-c2e5-e78d-bcde-ef5b07b5b16b">The value lattice</title>
<p id="_eae892df-2041-f6e5-3714-5962f201cc9d">An attribute value position is in exactly one of three states:</p>

<table id="_cf88b1d1-80bc-8d84-4fb2-9f0bf337d9e0"><colgroup><col width="33.3333%"/><col width="66.6667%"/></colgroup><thead><tr id="_e553aabf-2942-8ca2-2fed-239a663445b8"><th id="_9a298377-4697-5ee8-1fe4-6e89163afefc" valign="top" align="left">State</th>
<th id="_a3e01933-e74b-9343-14cc-c0fce537cc32" valign="top" align="left">Wire form</th>
</tr></thead>
<tbody><tr id="_2a90bfbe-43fd-1d73-af9c-c29a190008cb"><td id="_09fd8d9c-9c9e-65a4-b9bd-455ffd2ffb7c" valign="top" align="left">absent</td>
<td id="_ac7810ff-36ca-1bec-653e-9e6519ba3fce" valign="top" align="left">the attribute is not assigned in the instance</td>
</tr><tr id="_ae530cb8-afeb-76ec-d7dc-0249b970a739"><td id="_f1121461-ade6-6ecc-a80e-6a9b7cd19a55" valign="top" align="left">null</td>
<td id="_eccc43e3-441a-2185-8aad-7c076ee14dac" valign="top" align="left"><tt>null</tt></td>
</tr><tr id="_5b02eff1-8961-3341-17f8-a29b72931c2c"><td id="_4a90176f-03ba-2850-a059-a4ca28b1037e" valign="top" align="left">present-empty</td>
<td id="_f0694b8a-9ead-2632-2fb6-7d55d064f322" valign="top" align="left"><tt>""</tt></td>
</tr></tbody>
</table>

<p id="_84f18934-9e94-a799-ffe0-f4de8e6b6ece">The states are pairwise distinct: <tt>null</tt> denotes the null value, <tt>""</tt> denotes a present string of length zero, and an unassigned attribute is absent. No state is an alias for another. A processor preserves the distinction across parse and emit operations.</p>
</clause>

<clause id="_cf3b7529-e15c-f097-636d-c0689a2b7754" obligation="normative">
<title id="_c84790a3-bdcd-814c-4f99-328d6d37258a">The escape algebra</title>
<p id="_bf5005c9-d2f4-101c-caee-32f968d3e8cd">A quoted string body is the sequence between the opening and closing quote. Within double quotes exactly two escapes are recognized:  <tt>\"</tt> and  <tt>\\</tt>. Within single quotes exactly two escapes are recognized: <tt>\'</tt> and <tt>\\</tt>. The mapping is:</p>

<table id="_72235ae5-eee7-a2b4-2151-6d76eaf50fa3"><colgroup><col width="50%"/><col width="50%"/></colgroup><thead><tr id="_c0fae043-8773-765c-99dd-8de80ae652c1"><th id="_9093d500-912f-bbe1-c94c-785760a9c1e3" valign="top" align="left">Body</th>
<th id="_762688a1-68aa-69af-44b4-c12273a2a33c" valign="top" align="left">Value</th>
</tr></thead>
<tbody><tr id="_3908fe39-d4a2-733d-6eb2-66980a159ff9"><td id="_6cdccedc-aeac-5c6e-deb9-bb4fc6505ed0" valign="top" align="left"><tt>a\"b</tt> (double-quoted)</td>
<td id="_f565b6af-d779-564e-9ccc-f4e35634bb83" valign="top" align="left"><tt>a"b</tt></td>
</tr><tr id="_32227a7d-a5f2-deee-8b14-4c35e3889b6a"><td id="_2a9701df-3fee-5ed1-1cc0-f8906bc62eed" valign="top" align="left"><tt>a\'b</tt> (single-quoted)</td>
<td id="_6f6bd843-2591-a3fc-822f-8a6fa24b3e73" valign="top" align="left"><tt>a'b</tt></td>
</tr><tr id="_c771a84f-f391-1ab2-a0be-02f335439c1d"><td id="_3db77087-35ed-2dc2-4459-7748cde0c551" valign="top" align="left"><tt>a\\b</tt></td>
<td id="_6819a285-cd9c-5c66-892f-51ed216ae797" valign="top" align="left"><tt>a\b</tt></td>
</tr><tr id="_767928da-7846-fc11-0a1a-45a1c55c14f6"><td id="_be4302a8-bead-0080-9a13-cf898ec35ed5" valign="top" align="left">the empty body</td>
<td id="_c9371798-04f2-4318-df3e-e88d548625de" valign="top" align="left">the empty string</td>
</tr></tbody>
</table>

<p id="_01b54338-9617-5219-89da-fbb127681133">The grammar accepts no backslash before any other character, so <em>unescape</em> is total over grammar-accepted bodies and <em>unescape(escape(value)) = value</em> for every representable value. The representable set is every string over the language’s character set; escape is injective over that set.</p>
</clause>

<clause id="_7e9b6be7-1996-cd5a-6508-ac20f2886f11" obligation="normative">
<title id="_3469d184-4b64-11a6-1f0b-90d099295a4a">The padding law</title>
<p id="_f35d7202-b682-d2a2-625c-049b1d374b7c">A quoted body is verbatim: spaces and tabs inside the quotes are part of the value, including leading and trailing padding. Name and type tokens are interior-bounded: a token is a run of token characters optionally followed by spaces and another run, never a trailing space. A processor does not strip quoted bodies.</p>
</clause>

<clause id="_70e08524-1fc1-b6f6-1c9f-a752181f04b1" obligation="normative">
<title id="_c3312195-50a7-851c-9e93-6d49f862bbdc">The key and value symmetry law</title>
<p id="_dc4470e9-8976-efcf-ec4e-bfe394459df9">Attribute keys and attribute values admit the same bare-word predicate: a bare word is a non-empty run of  <tt>[A-Za-z0-9_]</tt>. Every other key or value string is written in quotes with the escapes above. Parsed from the same quoting form, a key and a value denote the same string. A canonical rendering may choose the quoted form where a bare word is admissible; it does not emit a bare word outside the predicate.</p>

<p id="_68cc683c-fcc8-37e8-2660-7c0f563380be">The corresponding corpus fixtures are <tt>24_null_and_empty.lml</tt> (the lattice),  <tt>25_string_escapes.lml</tt> (the escape algebra and padding), and <tt>26_quoted_keys.lml</tt> (key and value symmetry), under <tt>spec/fixtures/rs3001/</tt> in the lutaml-lml repository. The executable laws are L1 (value fidelity), L2 (key fidelity), L3 (document semantics), and L4 (idempotence) in  <tt>spec/lutaml/lml/property_laws_spec.rb</tt>.</p>
</clause>
</clause>
</sections><bibliography><references id="_4bfc5fd3-96f8-5e23-a2a6-02fd57f69993" normative="true" obligation="informative">
<title id="_461cd77a-5cfe-f57e-70ab-04e5c4142c2b">Normative references</title><p id="_cf4fafa1-7328-7d25-f309-bb194339feef">There are no normative references in this document.</p>
</references></bibliography>
<annotation-container><annotation id="_275ae496-2358-3a51-ced8-232cfc04aa8a" reviewer="(Unknown)" type="todo" date="2026-10-23T00:00:00Z" from="_9661b7bf-e210-4287-a1a4-bbbedbe4aa16" to="_9661b7bf-e210-4287-a1a4-bbbedbe4aa16"><p id="_e8f71075-e596-a36d-d1ce-2fc88b1e00dd">General behavior</p>
</annotation></annotation-container></metanorma>
