CN103116496B - A kind of method and system generating instance graph from meta-model - Google Patents
A kind of method and system generating instance graph from meta-model Download PDFInfo
- Publication number
- CN103116496B CN103116496B CN201310059112.XA CN201310059112A CN103116496B CN 103116496 B CN103116496 B CN 103116496B CN 201310059112 A CN201310059112 A CN 201310059112A CN 103116496 B CN103116496 B CN 103116496B
- Authority
- CN
- China
- Prior art keywords
- relation
- class
- model
- meta
- abstract
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Landscapes
- Stored Programmes (AREA)
Abstract
The present invention relates to a kind of method and system of software development, especially a kind of method and system generating instance graph from meta-model, belong to the technical field of software development.According to technical scheme provided by the invention, a kind of method generating instance graph from meta-model, describedly generate the method for instance graph from meta-model and comprise the steps: a, required meta-model graphic file is provided, by the relationship map between the class that comprises in described meta-model graphic file and class in the first relation; B, in above-mentioned first relation, add required applied environment constraint condition, transfer the registration of Party membership, etc. from one unit to another to be formed in corresponding constraint; C, the second relation generating the concrete model corresponding with applied environment constraint condition in above-mentioned constraint, will be transferred the registration of Party membership, etc. from one unit to another; D, above-mentioned second relation inverse mapping is obtained second graph file.The present invention can guarantee to generate the manual correctness completing mode instance model link from meta-model in software development process, improves the efficiency of operation, wide accommodation, safe and reliable.
Description
Technical field
The present invention relates to a kind of method and system of software development, especially a kind of method and system generating instance graph from meta-model, belong to the technical field of software development.
Background technology
The main method of current software development mainly contains two classes, and a class is the thought based on software reuse, utilizes component software, middleware to form required software systems fast; Another kind of is the thought automatically generated based on software, utilizes the meta-model in corresponding field, through Auto-generation Model and then directly generate the software corresponding with model.Compare with the technology path utilizing component software, middleware to form required software systems fast, the main difference of the technology path that software generates automatically is that meta-model can be supplied to domain engineer as a kind of field descriptive language and use, required software code revised by the model generated by amendment meta-model by domain engineer, and domain engineer is not computer elite usually, programming technique can be ignorant of.
Corresponding field refers to some specific engineering fields, as Design of Automatic Control System, and Embedded System Design, the system integration, and even Software for Design etc.Develop the model that required software systems need to set up these field particular systems in these areas, as described the class figure of particular system.Carry out abstract to the various particular models in these fields, the model describing these particular models can be obtained, the meta-model described in Here it is.Meta-model also can be class figure.And the model meeting corresponding neighborhood system demand can be generated by meta-model, the example of the meta-model described in Here it is or instance graph.Utilize the meta-model in corresponding field, the technology directly generating the software corresponding with model through Auto-generation Model is still immature at present, and this process has many technological difficulties to need to solve.And be exactly one of technological difficulties that will solve by meta-model corresponding instance automatic generation method.In software development process, automatically generate instance model by meta-model and then generate the method for respective code, a kind of advanced method developing domain specific application software can be thought.At present more existing software development environment supports generate respective application software frame or partial code (as ROSE platform can according to the framework of class and method class figure generator program) automatically from instance model, but do not support automatically to generate instance model from meta-model.In these current existing software development environments, generate the work of instance model still by completing by hand from meta-model.For comparatively complicated software model, this craft from meta-model generation instance model completes mode and there is following problem:
(1) correctness of generated instance model can not, be ensured.
(2), development efficiency is reduced.
Summary of the invention
The object of the invention is to overcome the deficiencies in the prior art, a kind of method and system generating instance graph from meta-model are provided, it can guarantee to generate the manual correctness completing mode instance model link from meta-model in software development process, improve the efficiency of operation, wide accommodation, safe and reliable.
According to technical scheme provided by the invention, a kind of method generating instance graph from meta-model, the described method from meta-model generation instance graph comprises the steps:
A, provide required meta-model graphic file, by the relationship map between the class that comprises in described meta-model graphic file and class in the first relation;
B, in above-mentioned first relation, add required applied environment constraint condition, transfer the registration of Party membership, etc. from one unit to another to be formed in corresponding constraint;
C, the second relation generating the concrete model corresponding with applied environment constraint condition in above-mentioned constraint, will be transferred the registration of Party membership, etc. from one unit to another;
D, above-mentioned second relation inverse mapping is obtained second graph file.
Also comprise step e, second graph file is imported in visualization software development environment, obtained the instance graph needed by described visualization software development environment.
In described step a, meta-model graphic file comprises the class figure graphic file described by UML.
In described step b, the method for adding required applied environment constraint condition in the first relation is included in the first relation adds attribute column and property value.
Described first to close be the relation meeting relational database, and the relation between the class comprised in described meta-model graphic file and class corresponds to the row in the first relation.
Described step c comprises the steps:
C1, scan the first relation, the row of representation class in the first relation is generated the row of the class of corresponding instance in the second relation according to applied environment constraint condition;
C2, scan the first relation, will represent in the first relation that the row of category difference to generate the row of the category difference of corresponding instance in the second relation according to applied environment constraint condition.
In described step c1, in described first relation during the behavior abstract class of representation class, the part or all of non-abstract derived class corresponding to described abstract class generated in the second relation.
Described step c2 comprises the steps:
C21, when representing in the first relation that the two ends that category difference is capable are abstract class, then the abstract class of optional one end, and find the non-abstract derived class of described abstract class, for the non-abstract derived class of abstract class described in each, performs step c22;
C22, when representing in the first relation that Zhong You one end, two ends that category difference is capable is non-abstract class, when the other end is abstract class, then finding the non-abstract derived class of described abstract class, for the non-abstract derived class of abstract class non-described in each, performing step c23;
C23, when representing that the two ends that category difference is capable are non-abstract class in described first relation, directly generate the row of the category difference in the second relation between corresponding instance according to applied environment constraint condition.
Realize the system generating instance graph from meta-model, comprise
First visual modeling platform, for generator illustraton of model shape file, and by described meta-model graphic file input mapping block;
Mapping block, for receiving meta-model graphic file, and becomes the first relation by the relationship map between the class comprised in described meta-model graphic file and class;
Restriction relation adds module, receives applied environment constraint condition, and adds in the first relation by described applied environment constraint condition, is formed in constraint and transfers the registration of Party membership, etc. from one unit to another;
Application model relation generation module, receives in constraint and transfers the registration of Party membership, etc. from one unit to another, and according to applied environment constraint condition, will transfer the registration of Party membership, etc. from one unit to another generation second relation in constraint;
Inverse mapping module, receives the second relation, and by the class represented in the second relation and between relation inverse mapping obtain second graph file;
Second visual modeling platform, receives second graph file, and obtains required instance graph by second graph file.
Described first to close be the relation meeting relational database, and the relation between the class comprised in described meta-model graphic file and class corresponds to the row in the first relation.
Advantage of the present invention: the relation between class and class utilizing the first relation to represent to comprise in meta-model graphic file, obtain transferring the registration of Party membership, etc. from one unit to another in constraint by adding applied environment restriction relation, and generate the second relation according to applied environment restriction relation, second graph file is obtained by the second relation inverse mapping, second graph file obtains the instance graph of meta-model by visual modeling platform, can guarantee to generate the manual correctness completing mode instance model link from meta-model in software development process, improve the efficiency of operation, wide accommodation, safe and reliable.
Accompanying drawing explanation
Fig. 1 is structured flowchart of the present invention.
Fig. 2 is the schematic diagram of a kind of meta-model graphic file of the present invention.
Embodiment
Below in conjunction with concrete drawings and Examples, the invention will be further described.
In order to guarantee the correctness generating instance graph from meta-model, improve development efficiency, the method from meta-model generation instance graph of the present invention comprises the steps: simultaneously
A, provide required meta-model graphic file, by the relationship map between the class that comprises in described meta-model graphic file and class in the first relation;
Described meta-model graphic file is the class figure graphic file described by unitive search (unifiedmodelinglanguage), described class figure graphic file can create and derive in the software development environment supporting UML, in the embodiment of the present invention, meta-model graphic file is the first graphic file.Described first to close be the relation meeting relational database, and the relation between the class comprised in described meta-model graphic file and class corresponds to the row in the first relation.
In the embodiment of the present invention, " relation " refers to the relation in mathematics set theory, and " figure " in graphic file refers to the figure in mathematics graph theory.There is one_to_one corresponding between " relation " and " figure " of description same thing, thus accordingly by mapping conversion mutually, namely can be mapped by meta-model graphic file and obtain the first relation.
Because uml class figure describes the relation between class and class, therefore class figure can be expressed as the set on summit and the set on limit, and and then represent these two set by the first relation.For convenience's sake, by the set on summit and the set expression on limit in same relation, i.e. the elements of described two set correspond to a line of described relation, utilize the property value typochemical element of relation to belong to the set on summit or the set on limit.In the embodiment of the present invention, the class in meta-model graphic file is mapped as the set on summit, and the category difference in meta-model graphic file is mapped as the set on limit.
B, in above-mentioned first relation, add required applied environment constraint condition, transfer the registration of Party membership, etc. from one unit to another to be formed in corresponding constraint;
In principle, a meta-model graphic file can generate numerous different example.In order to make the instance graph generated from meta-model suit the requirements the demand of applied environment, the customizing messages of applied environment must be added in described first relation, such as to the generation instance number quantitative limitation on certain limit in meta-model graphic file etc.The information of these applied environments is exactly described required applied environment constraint condition.In the present invention, because the first pass is the relation meeting relational database, can be realized by the attribute value column of the first relation being added to corresponding attribute column and corresponding row described relation interpolation specific application environment constraint condition.
C, the second relation generating the concrete model corresponding with applied environment constraint condition in above-mentioned constraint, will be transferred the registration of Party membership, etc. from one unit to another;
Because the instance graph generated from meta-model graphic file remains a model described by uml class figure, therefore also can represent by a relation.In the embodiment of the present invention, second relation is exactly the relation representing described meta-model example.
In the embodiment of the present invention, the first relationship description meta-model graphic file, the instance model that the second relationship description is corresponding.A line in first relation can correspond to 0 row, a line or multirow in the second relation, and corresponding how many row depends on applied environment constraint condition actually.
In order to ensure clear layer, guarantee the correctness generating instance model, the present invention first relation generates the second relation by the applied environment constraint condition of adding, obtain second graph by the second relation by inverse mapping, reduce the complexity transferring the registration of Party membership, etc. from one unit to another the algorithm directly generating second graph file from constraint.
According to Object-Oriented Theory, abstract class can not have example, only has non-abstract class just can have example; Therefore step c comprises the steps:
C1, scan the first relation, the row of representation class in the first relation is generated the row of the class of corresponding instance in the second relation according to applied environment constraint condition;
For the row on all expression summits, generate some summits row of second relation according to constraint condition.If what certain summit row of described first relation represented is abstract class, then in second relation, generate some summits row of the part or all of non-abstract derived class of described abstract class according to described requirement.In described first relation, some line description summit, is referred to as summit row; Some row represents limit, is referred to as limit row.The example of generator model, the first example of class and the example on summit in generator model.If summit line description is abstract class, then can only generate the example of the non-abstract derived class of abstract class.
C2, scan the first relation, will represent in the first relation that the row of category difference to generate the row of the category difference of corresponding instance in the second relation according to applied environment constraint condition.
Described step c2 comprises the steps:
C21, when representing in the first relation that the two ends that category difference is capable are abstract class, then the abstract class of optional one end, and find the non-abstract derived class of described abstract class, for the non-abstract derived class of abstract class described in each, performs step c22;
C22, when representing in the first relation that Zhong You one end, two ends that category difference is capable is non-abstract class, when the other end is abstract class, then finding the non-abstract derived class of described abstract class, for abstract class non-described in each, performing step c23;
C23, when representing that the two ends that category difference is capable are non-abstract class in described first relation, directly generate the row of the category difference in the second relation between corresponding instance according to applied environment constraint condition.After performing step c23, determine next step execution point according to execution route.
The foundation of described step c2 is Object-Oriented Theory, according to OO principle, only finds during non-abstract class and directly could generate example.
D, above-mentioned second relation inverse mapping is obtained second graph file.
When after generation second relation, according to aforementioned explanation, by the relation between the class represented in the second relation and class, inverse mapping can obtain second graph file, in the embodiment of the present invention, second graph file is XML(ExtensibleMarkupLanguage) graphic file of form.
Described second graphic file is imported to described support UML development environment in and open, namely can obtain described meta-model instance graph.
After obtaining described instance graph, the even whole program of program frame of this instance graph can be generated further, as the function that can be generated to what degree and depend on development platform.Software of the present invention can generate the ingredient of development platform automatically as the software from meta-model to program.
As shown in Figure 1: in order to realize generating from meta-model the instance graph needed, system of the present invention comprises
First visual modeling platform, for generator illustraton of model shape file, and by described meta-model graphic file input mapping block;
Mapping block, for receiving meta-model graphic file, and becomes the first relation by the relationship map between the class comprised in described meta-model graphic file and class;
Restriction relation adds module, receives applied environment constraint condition, and adds in the first relation by described applied environment constraint condition, is formed in constraint and transfers the registration of Party membership, etc. from one unit to another;
Application model relation generation module, receives in constraint and transfers the registration of Party membership, etc. from one unit to another, and according to applied environment constraint condition, will transfer the registration of Party membership, etc. from one unit to another generation second relation in constraint;
Inverse mapping module, receives the second relation, and by the class represented in the second relation and between relation inverse mapping obtain second graph file;
Second visual modeling platform, receives second graph file, and obtains required instance graph by second graph file.
Described first visual modeling platform can adopt identical platform with the second visual modeling platform, in the embodiment of the present invention, can adopt VPSsuite4.2 platform.
Embodiment
As depicted in figs. 1 and 2: adopt and support that the drafting of the development environment VPSsuite4.2 platform of UML obtains meta-model graphic file, be the model of state machine model in Fig. 2, some physical processes or computation process can describe with state space.State space generally comprise original state, final state, state set and from a certain state to the transformation rule of another state or the right set of condition-action.State machine model describes the key element of state space, and state machine meta-model is the description to state machine model.
From UML semanteme, in Fig. 1, there are ten classes or summit, i.e. state machine, abstract summit state, original state, Abstract State, combined state, final state, simple state, action, transfer, event.Limit between these summits describes the relation between class.From state machine meta-model semanteme, summit state machine shows that this figure is the meta-model figure of a state machine, and this models show state machine is shifted by the conversion between state abstraction summit state and state and forms.Abstract summit state can be original state, complex state, final state or simple state, and transfer is the action under certain event triggers.
Described meta-model graphic file is known for method of the present invention, is input for algorithm of the present invention or software.
The rectangle frame of described meta-model graphic file is regarded as summit, connecting line between rectangle frame regards as limit, again all described summits are become corresponding record with limit faithful representation, described meta-model can be mapped in a relation, first relation described in Here it is.Described first relation can be realized by a relational database list file.
In the database table of expression first relation, add some attribute column and property value according to actual application environment.Such as, according to embody rule, the quantity of final state in meta-model example can be set, the quantity of simple state, the certain vertex on limit, etc.In the present embodiment, the example number setting summit transfer is 3.These settings described are by adding some attribute to the database table of expression first relation and property value realizes.
In the present embodiment, when generation the second relation, if scan the summit row describing abstract summit state, then according to the semanteme of abstract class, the corresponding row of original state, combined state, final state or simple state can only be generated in second relation.After generating the second relation, obtain second graph file by the second relation inverse mapping, in the present embodiment, the second graph file of described XML format is imported in VPSsuite4.2 platform, namely can obtain required instance graph.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, all any amendments done within the spirit and principles in the present invention, equivalent replacement and improvement etc., all should be included within protection scope of the present invention.
Claims (1)
1. generate a method for instance graph from meta-model, it is characterized in that, the described method from meta-model generation instance graph comprises the steps:
(a), provide required meta-model graphic file, by the relationship map between the class that comprises in described meta-model graphic file and class in the first relation;
(b), in above-mentioned first relation, add required applied environment constraint condition, transfer the registration of Party membership, etc. from one unit to another to be formed in corresponding constraint;
(c), the second relation generating the concrete model corresponding with applied environment constraint condition will be transferred the registration of Party membership, etc. from one unit to another in above-mentioned constraint;
(d), above-mentioned second relation inverse mapping is obtained second graph file;
Also comprise step (e), second graph file is imported in visualization software development environment, obtained the instance graph needed by described visualization software development environment;
In described step (a), meta-model graphic file comprises the class figure graphic file described by UML;
In described step (b), the method for adding required applied environment constraint condition in the first relation is included in the first relation adds attribute column and property value;
Described first to close be the relation meeting relational database, and the relation between the class comprised in described meta-model graphic file and class corresponds to the row in the first relation;
Described step (c) comprises the steps:
(c1), scan the first relation, the row of representation class in the first relation is generated the row of the class of corresponding instance in the second relation according to applied environment constraint condition;
(c2), scan the first relation, will represent in the first relation that the row of category difference to generate the row of the category difference of corresponding instance in the second relation according to applied environment constraint condition;
In described step (c1), in described first relation during the behavior abstract class of representation class, the part or all of non-abstract derived class corresponding to described abstract class generated in the second relation;
Described step (c2) comprises the steps:
(c21), when representing in the first relation that the two ends that category difference is capable are abstract class, then the abstract class of optional one end, and find the non-abstract derived class of described abstract class, for the non-abstract derived class of abstract class described in each, perform step (c22);
(c22), when representing in the first relation that Zhong You one end, two ends that category difference is capable is non-abstract class, when the other end is abstract class, then find the non-abstract derived class of described abstract class, for the non-abstract derived class of abstract class non-described in each, perform step (c23);
(c23), when representing that the two ends that category difference is capable are non-abstract class in described first relation, the row of the category difference in the second relation between corresponding instance is directly generated according to applied environment constraint condition.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310059112.XA CN103116496B (en) | 2013-02-25 | 2013-02-25 | A kind of method and system generating instance graph from meta-model |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310059112.XA CN103116496B (en) | 2013-02-25 | 2013-02-25 | A kind of method and system generating instance graph from meta-model |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103116496A CN103116496A (en) | 2013-05-22 |
CN103116496B true CN103116496B (en) | 2016-03-16 |
Family
ID=48414882
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310059112.XA Active CN103116496B (en) | 2013-02-25 | 2013-02-25 | A kind of method and system generating instance graph from meta-model |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103116496B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101794315A (en) * | 2010-03-31 | 2010-08-04 | 袁梅宇 | Object relationship mapping model with fixed database schema |
CN102662963A (en) * | 2012-03-08 | 2012-09-12 | 北京神州数码思特奇信息技术股份有限公司 | Method and module for meta-facility expansion |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7694284B2 (en) * | 2004-11-30 | 2010-04-06 | International Business Machines Corporation | Shareable, bidirectional mechanism for conversion between object model and XML |
-
2013
- 2013-02-25 CN CN201310059112.XA patent/CN103116496B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101794315A (en) * | 2010-03-31 | 2010-08-04 | 袁梅宇 | Object relationship mapping model with fixed database schema |
CN102662963A (en) * | 2012-03-08 | 2012-09-12 | 北京神州数码思特奇信息技术股份有限公司 | Method and module for meta-facility expansion |
Non-Patent Citations (1)
Title |
---|
UML元模型图实例自动生成算法;常珊珊等;《计算机工程与应用》;20120711(第20期);第91-97页 * |
Also Published As
Publication number | Publication date |
---|---|
CN103116496A (en) | 2013-05-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107743072B (en) | Efficient and extensible network simulation scene generation method | |
US20110055807A1 (en) | Integration environment generator | |
US9836573B2 (en) | Method and system for multilateral validation of wire harness design outputs | |
CN104360859A (en) | Visual service development method and system | |
CN109783886A (en) | Emerging system and method for GIM model and IFC model | |
US8965746B2 (en) | System and method for validating an electrical network model | |
US20220277119A1 (en) | A System and Method for Generating a Holistic Digital Twin | |
CN103116500A (en) | Method and device for structural body definition and structure output | |
CN104484518A (en) | Transfer method from demand model to simulation model | |
CN111880784A (en) | SIMSCRIPT language-oriented discrete event simulation graphical modeling method | |
CN105630563A (en) | Dynamic model configuration method of relay protection device specification based on XML (Extensible Markup Language) | |
CN103699746B (en) | CADDS5 piping three-dimensional design method based on data base and system | |
CN112580178B (en) | Graph-model bidirectional verification method and device for energy management system | |
Cao et al. | Automating Feature-Oriented Domain Analysis. | |
KR101397379B1 (en) | System for transformation meta-modeling | |
D'Ambrogio et al. | A Model Transformation Approach for the Development of HLA-based Distributed Simulation Systems. | |
CN103116496B (en) | A kind of method and system generating instance graph from meta-model | |
D'Ambrogio et al. | A MDA-based approach for the development of DEVS/SOA simulations | |
CN105204383A (en) | Generation method and device for application servo system | |
CN103164225B (en) | A kind of network configuration software architecture online evolution method based on hypergraph | |
CN102779036B (en) | For the Software tool of automatic technology | |
JP2010049439A (en) | System construction method using software model and modeling device | |
CN111291444B (en) | Modeling method, device, equipment and storage medium for aircraft assembly | |
CN109923564A (en) | Method for Computer-aided Design Technology system | |
O’Brien et al. | Challenges, approaches and architecture for distributed process integration in heterogeneous environments |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant |