Metamodel

    The name of the XMeta engine comes from a special model, which can be used as the first model in the system, and any other model in the system can theoretically pass it directly or indirectly. Edited it out, hence the name metamodel.

1. Discovery process of metamodel

    In the dynamic model, the object is represented by the tree-structured data, for example, it can be represented by XML, then an object can be represented as XML.

    When using XML to represent objects, we define the structure of the object in the following way.

  • Use <thing name="xxx"/> to represent an XML node.
  • Use <attribute name="xxx"/> to represent attributes in an XML node.

    For example, the following XML.

<Person name="Zhangsan" age="40">
    <Child name="Xiaoming" age="10"/>
</Person>

    The structure of this XML is as follows.

<thing name="Person">
    <attribute name="name"/>
    <attribute name="age"/>
    <thing name="Child">
        <attribute name="name"/>
        <attribute name="age"/>
    </thing>
</thing>

    Through the above definition of XML structure, then we can calculate the structure of any XML, we can find that the calculated result is still XML, then we can iterate the calculation, and finally find that we can iterate to an XML, this XML is as follows.

<thing name="thing"">
    <attribute name="name"/>
    <thing name="attribute">
        <attribute name="name"/>
    </thing>
    <thing name="thing">
        <attribute name="name/>
        <thing name="attribute">
            <attribute name="name"/>
        </thing>
        <thing name="thing">
        ....
        </thing>
    </thing>
</thing>

    This is an XML with the same node at every level and infinite levels.

    Since this XML has infinite layers, it cannot be represented directly. In order to be able to represent it, we introduce the concept of inheritance, so that it can be simplified into the following XML.

<thing name="thing"">
    <attribute name="name"/>
    <attribute name="extends"/>
    <thing name="attribute">
        <attribute name="name"/>
    </thing>
    <thing name="thing" extends="_root"/>
</thing>

    Here we add an extends attribute, in the <thing name="thing" extends="_root"/> child node, the extends="_root" attribute indicates this node Inherit the root node, so that this child node also has child nodes under the root node, so logically it is an XML with infinite layers.    

    Since it is the structure of any XML structure, in the XML editor that uses the XML structure to edit XML, you can use it to directly or indirectly edit other arbitrary XML, so it can As the first model in the system, the metamodel.

2. Metamodel and Philosophy

    The existence of metamodels can also raise philosophical questions, which are related to the nature of metamodels.

  • Metamodel and Lao Tzu
    When using the metamodel to edit other models, it can be found that its basic function is to name, so it reminds me of Laozi's: the beginning of the nameless world, the mother of all things named.
    Since any model can be edited directly or indirectly through the meta-model, then there are: Tao produces one, one life two, two produces three, and three produces all things.
     
  • Metamodel and God
    Since any model can be edited directly or indirectly through the metamodel, the metamodel is the builder of any model.
    Since the metamodel is its own structure, through which it can edit itself, the metamodel is also its own parent and child.
    The above is similar to the nature of God.

    The above are just some coincidences. In fact, metamodels can explain many philosophical problems. Unfortunately, few people can understand them.

Copyright ©  2007-2019 XWorker.org  版权所有  沪ICP备08000575号