Closed ronaldtse closed 3 years ago
In order to list out all attributes of an entity, suppose we are in a Metanorma Liquid environment[...]
@w00lf assuming we have a syntax of accessing the EXPRESS model internals, how do we expose this information in Liquid?
In order to list out all attributes of an entity, suppose we are in a Metanorma Liquid environment[...]
@w00lf assuming we have a syntax of accessing the EXPRESS model internals, how do we expose this information in Liquid?
I will create a wrapper interface inside lutaml gem, it will accept express repository as input object and will have find
method to access objects, each lutaml flavor will inherit this wrapper and overwrite find
method according to the internal objects.
@w00lf could you help describe the syntax here for reference? Thanks!
@w00lf could you help describe the syntax here for reference? Thanks!
Sure, the final wrapper inside Lutaml will pack variables and methods of Schema/Entity into Hash like structure so that we can access them inside liquid code like so:
{% for schema in my_context.schemas %}
== {{schema.id}}
{% for entity in schema.entities %}
=== {{entity.id}}
supertypes -> {{entity.supertypes.id}}
explicit -> {{entity.explicit.first.id}}
{% endfor %}
{% endfor %}
We also can iterate through all entity attributes through liquid for loop, example:
{% for attribute in entity %}
{{entity[0]}} - will render attribute` name
{{entity[1]}} - will render attribute` value
{% endfor %}
@w00lf can you add this to the README of metanorma-plugin-lutaml
gem? Thanks!
@w00lf can you add this to the README of
metanorma-plugin-lutaml
gem? Thanks!
Done - https://github.com/metanorma/metanorma-plugin-lutaml/pull/2
Thanks guys!
EXPRESS remark tags allow the syntax of
{schema}.{entity}....
to access a data model. However, in LutaML we also want to access other things that belongs to the model, including:We need to come up with a way of accessing such information, e.g.
action_schema.action_directive_relationship.WR1 | tagged_remarks
action_schema.action_directive_relationship.WR1#tagged_remarks
action_schema.action_directive_relationship.WR1::tagged_remarks
In order to list out all attributes of an entity, suppose we are in a Metanorma Liquid environment, the code could be:
which can give out text like: