README.adoc in metanorma-plugin-lutaml-0.6.0 vs README.adoc in metanorma-plugin-lutaml-0.6.6

- old
+ new

@@ -26,13 +26,13 @@ LutaML supports accessing EXPRESS models via the https://github.com/lutaml/expressir[Expressir] parser. -=== Usage of the `lutaml` macro +=== Usage of the `lutaml` command -Given an `example.exp` EXPRESS file with the content: +Given an `example.exp` EXPRESS file with content: [source,exp] ---- SCHEMA test_schema 'test'; @@ -55,11 +55,11 @@ TYPE my_type5 = EXTENSIBLE ENUMERATION; END_TYPE; END_SCHEMA; ---- -And the `lutaml` macro block: +And the `lutaml` block: [source,adoc] ----- [lutaml,example.exp,my_context] ---- @@ -135,16 +135,77 @@ [source,adoc] ----- = Document title Author :lutaml-express-index: index_name; /path/to/express_files; cache=/path/to/cache_file.yaml + [lutaml,index_name,context] ---- {% for schema in context.schemas %} == {{schema.id}} {% endfor %} ---- ----- + +=== Using `config.yaml` + +This functionality allows `[lutaml_express]` blocks to load a full set of +EXPRESS schemas in one index, and then provide a select ("filter") option +per-block via a separate YAML file. + +[source,adoc] +---- +:lutaml-express-index: all_schemas; ../schemas_all.yaml; + +[lutaml_express,all_schemas,context,leveloffset=+1,config_yaml=schemas.yaml] +--- +{% assign selected = context.schemas | where: "selected" %} +{% render "templates/resources/schema" for selected as schema %} +--- +---- + +Where `schemas_all.yml` provides all schemas: + +[source,yaml] +---- +--- +schemas: + action_schema: + path: "../../schemas/resources/action_schema/action_schema.exp" + application_context_schema: + path: "../../schemas/resources/application_context_schema/application_context_schema.exp" + approval_schema: + path: "../../schemas/resources/approval_schema/approval_schema.exp" +... +---- + +And `schemas.yaml` only selects 2 schemas: + +[source,yaml] +---- +--- +schemas: + action_schema: + anything: ... + application_context_schema: + anything: ... +---- + +The resulting block adds the `select` attribute to every schema of the the +"context" object, which allows you to filter those out for complex operations +via Liquid: + +[source,liquid] +---- +[lutaml_express,schemas_1,repo,leveloffset=+1,config_yaml=select.yaml] +--- +{% assign selected = repo.schemas | where: "selected" %} +... do things with `selected` ... +---- + +NOTE: This functionality is used in the ISO 10303 SRL to load the full schema +set at once but only render the selected schemas in individual documents. + == Usage with UML === Rendering a LutaML view: `lutaml_diagram`