WO2016095509A1 - Conversion method and conversion apparatus for object-oriented model data - Google Patents

Conversion method and conversion apparatus for object-oriented model data Download PDF

Info

Publication number
WO2016095509A1
WO2016095509A1 PCT/CN2015/083982 CN2015083982W WO2016095509A1 WO 2016095509 A1 WO2016095509 A1 WO 2016095509A1 CN 2015083982 W CN2015083982 W CN 2015083982W WO 2016095509 A1 WO2016095509 A1 WO 2016095509A1
Authority
WO
WIPO (PCT)
Prior art keywords
object class
relationship
mapping
database table
data
Prior art date
Application number
PCT/CN2015/083982
Other languages
French (fr)
Chinese (zh)
Inventor
张恒
唐雄
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2016095509A1 publication Critical patent/WO2016095509A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor

Definitions

  • This paper relates to the field of object model technology, and in particular to a method and a conversion device for object-oriented model data.
  • 3GPP 3rd Generation Partnership Project
  • MO managed objects
  • MOM Managed Object Model
  • MOM is an object-oriented abstraction of all manageable resources of a base station, which defines a method of modeling management resources and a structure of information transfer between the management party and the managed party.
  • MOM describes base station information or communication network data in an object-oriented manner.
  • Each base station is described in terms of MOM, and all base stations MOMs in the entire network are connected together to form a larger and more complete network.
  • the MOM model of each base station is a complete tree with more than 200 types of nodes, forming an integrated logical view that clearly describes all the resource information of the base station; it can be divided into four types of resources, and defines between the object instances. relationship.
  • the relationship definition of the MOM model is simple, and the relationship between object instances is more and more complicated.
  • the MOM model mainly follows the 3GPP protocol, and the relational database cannot fully follow the MOM model or the 3GPP protocol. Therefore, if the MOM model data is completely mapped into relational database data, it is undoubtedly very complicated, and complex mapping adaptation is required.
  • the MOM model is converted to table data of a relational database.
  • This paper provides an object-oriented model data conversion method and conversion device, which aims to solve the technical problem of how to realize the simple and effective conversion of object-oriented model data to relational database data.
  • a method for transforming object-oriented model data comprising:
  • the step of converting the object class into data in the database table according to the mapping condition comprises:
  • the step of converting the object class into data in the database table according to the mapping condition comprises:
  • the step of converting the object class into data in the database table according to the mapping condition comprises:
  • the step of searching according to the relationship between the object class and the object class and other object classes includes:
  • mapping relationship According to the mapping relationship, the object class and the parent-child relationship, the association relationship, or the combination relationship between the object class and other object classes are searched.
  • An apparatus for converting object-oriented model data comprising:
  • the obtaining module is configured to: obtain a database table and a pre-configured mapping relationship, and acquire an object class and a mapping condition of the object-oriented model corresponding to the database table according to the mapping relationship;
  • the conversion module is configured to: convert the object class into data in the database table according to the mapping condition.
  • the conversion module includes:
  • the first determining unit is configured to: obtain a value of the object class, and determine whether the value of the object class is a value of the corresponding object class in the mapping relationship;
  • the first searching unit is configured to: if the value of the object class is not the value of the object class, search according to the relationship between the object class and the object class and other object classes in the mapping relationship;
  • the first conversion unit is configured to: convert the value of the found object class into data in the database table according to the mapping condition.
  • the conversion module includes:
  • the second determining unit is configured to: obtain an attribute of the object class, and determine whether the attribute of the object class is an attribute of the corresponding object class in the mapping relationship;
  • the second search unit is configured to: if the attribute of the object class is not an attribute of the object class, perform a search according to the relationship between the object class and the object class and other object classes in the mapping relationship;
  • the second conversion unit is configured to: convert the attributes of the found object class into data in the database table according to the mapping condition.
  • the conversion module includes:
  • the third determining unit is configured to: acquire a relationship between the object classes, and determine whether the relationship between the object classes is a relationship between the corresponding object class and other objects in the mapping relationship;
  • the third search unit is configured to: if the relationship between the object classes is not the relationship between the object class and other objects, according to the relationship between the object class and the object class and other object classes in the mapping relationship Find
  • the third conversion unit is configured to: convert the relationship between the found object classes into data in the database table according to the mapping condition.
  • a computer readable storage medium storing computer executable instructions for performing the method of any of the above.
  • An object-oriented model data conversion method and conversion device when converting an object class of an object-oriented model into data in a database table, pre-configuring a mapping relationship between the object class and the database table, and obtaining a database table corresponding according to the mapping relationship
  • the object class and the mapping condition of the object-oriented model can then be converted into the data in the database table according to the mapping condition.
  • the mapping relationship between the object class and the database table is pre-configured, and it is determined that the mapping condition is met. Conversion, thus enabling a structured and efficient transformation of object-oriented model data to relational database data, the implementation process is relatively simple.
  • FIG. 1 is a schematic flow chart of an embodiment of an object-oriented model data conversion method according to the present invention
  • FIG. 2 is a schematic flow chart of a refinement of an embodiment of step S102 in FIG. 1;
  • FIG. 3 is a schematic diagram of relationships between object classes in the object-oriented model of FIG. 1;
  • step S102 in FIG. 1 is a schematic flow chart of another embodiment of step S102 in FIG. 1;
  • FIG. 5 is a schematic diagram showing a refinement process of still another embodiment of step S102 in FIG. 1;
  • FIG. 6 is a schematic diagram of functional modules of an embodiment of an object-oriented model data conversion apparatus according to the present invention.
  • FIG. 7 is a schematic diagram of a refinement function module of an embodiment of the conversion module of FIG. 6;
  • FIG. 8 is a schematic diagram of a refinement function module of another embodiment of the conversion module of FIG. 6;
  • FIG. 9 is a schematic diagram of a refinement function module of still another embodiment of the conversion module of FIG. 6.
  • FIG. 9 is a schematic diagram of a refinement function module of still another embodiment of the conversion module of FIG. 6.
  • An embodiment of the present invention provides a method for converting object-oriented model data.
  • the method for converting object-oriented model data includes:
  • Step S101 Obtain a database table and a pre-configured mapping relationship, and obtain an object class and a mapping condition corresponding to the database table according to the mapping relationship.
  • This embodiment can be applied to data management of a wireless base station.
  • the mapping relationship is mainly configured by mapping the object class of the object-oriented model and the relational database table, that is, the mapping relationship between each object class (the name of the object class) and the database table (the name of the database table).
  • this object class is mandatory, and other object classes are optional.
  • the mapping relationship between the object class and the relational database table of the object-oriented model of the embodiment includes a one-to-one mapping relationship, a one-to-many mapping relationship, and a many-to-one mapping relationship, that is, an object class corresponding to a database table,
  • An object class corresponds to a mapping relationship between multiple database tables and multiple object classes corresponding to one database table.
  • mapping condition indicates under what conditions the object class is converted into data in the database table.
  • the database table is traversed, and each database table is processed. According to the mapping relationship configuration, the corresponding object class list and the corresponding mapping conditions can be obtained.
  • Step S102 Convert the object class into data in the database table according to the mapping condition.
  • the object class list corresponding to each database table is converted.
  • the mapping condition is met
  • the corresponding object class is converted into the data in the database table, and then the next in the object class list is processed.
  • An object class skipping the object class when the mapping condition is not met The next object class.
  • the object class corresponding to the next database table is converted into data in the database table.
  • the mapping between the object class and the database table field is obtained, and the data conversion is performed sequentially when the mapping condition is satisfied, that is, the object class is converted into data in the database table, and finally the data is generated according to the format of the relational database table.
  • the object class is converted into data in the database table, and the value of the object class may be converted into data in the database table, or the attribute of the object class may be converted into data in the database table, or may be Convert the relationship of an object class to data in a database table.
  • the mapping relationship between the object class and the database table is pre-configured, and the object-oriented model corresponding to the database table can be obtained according to the mapping relationship.
  • the object class and the mapping condition can then be converted into the data in the database table according to the mapping condition.
  • the mapping relationship between the object class and the database table is pre-configured, and the conversion is determined when the mapping condition is satisfied, so that the implementation can be implemented.
  • the object-oriented model data to the relational database data is organized and effective, and the implementation process is relatively simple.
  • the foregoing step S102 includes:
  • Step S1021 obtaining the value of the object class, determining whether the value of the object class is the value of the corresponding object class in the mapping relationship, and if so, proceeding to step S1022, and if not, proceeding to step S1023;
  • Step S1022 Convert the value of the object class to the data in the database table according to the mapping condition
  • Step S1023 Perform a search according to the relationship between the object class and the object class and other object classes in the mapping relationship;
  • Step S1024 converting the value of the found object class into data in the database table according to the mapping condition.
  • the value of the object class can be converted into data in the database table, and the first step is to determine the desired Whether the value of the changed object class is the value of the object class itself. If it is the value of the object class, the value of the object class is directly converted into the data in the database table when the mapping condition is satisfied; if it is not the object class The value needs to be searched according to the relationship between the object class and the object class and other object classes.
  • the relationship between the object classes in the object-oriented model shown in FIG. 3 includes parent-child relationship and association relationship. And the combination relationship. In this embodiment, the object class and the parent-child relationship, the association relationship, or the combination relationship between the object class and the other object class may be searched.
  • One end of the diamond represents the parent object, and the other end represents the child object; one end of the arrow represents the referenced object, and the other end represents the reference object; the combination relationship is a combination of the parent-child relationship and the association relationship.
  • the search for these relationships can be cross-level.
  • the parent-child relationship lookup the parent relationship and the child relationship. For example, looking for the object class 0 from the object class 3 can be found directly through the parent relationship (3->1->0); instead, the object class 3 is found from the object class 0, Can be found directly through the child relationship (0->1->3).
  • Association relationship lookup that is, reference and referenced relationship, for example, looking up object class 6 from object class 3, can be found directly through the referenced relationship (3->7->6); from object class 6 to find object class 3, can be directly Find by reference relationship (6->7->3).
  • Combination relationship search parent relationship, child relationship, reference relationship, combination of referenced relationship, for example, to find object class 3 from object class 5, you can first find object class 6 through child relationship, and then find object class 3 by reference relationship.
  • the value of the found object class is converted into the data in the database table on the premise that the mapping condition is satisfied.
  • the foregoing step S102 includes:
  • Step S2021 acquiring the attribute of the object class, determining whether the attribute of the object class is the attribute of the corresponding object class in the mapping relationship, if yes, proceeding to step S2022, and if not, proceeding to step S2023;
  • Step S2022 Convert the attribute of the object class to the data in the database table according to the mapping condition
  • Step S2023 searching according to the relationship between the object class and the object class and other object classes in the mapping relationship;
  • Step S2024 Convert the attributes of the found object class into data in the database table according to the mapping condition.
  • the attribute of the object class can be converted into the data in the database table.
  • This embodiment can be based on this object.
  • the class and the parent-child relationship, association relationship, or combination relationship between the object class and other object classes are searched. When the attribute of the object class is found, the attributes of the found object class are converted into data in the database table on the premise that the mapping condition is satisfied.
  • the foregoing step S102 includes:
  • Step S3021 Obtain a relationship between the object classes, determine whether the relationship between the object classes is a relationship between the corresponding object class and other objects in the mapping relationship, and if yes, proceed to step S3022, and if not, Then proceeds to step S3023;
  • Step S3022 Convert the relationship between the object classes into data in the database table according to the mapping condition
  • Step S3023 searching according to the relationship between the object class and the object class and other object classes in the mapping relationship
  • Step S3024 Convert the relationship between the found object classes into data in the database table according to the mapping condition.
  • the relationship between the object classes can be converted into data in the database table.
  • the object class and the parent-child relationship, association relationship, or combination relationship between the object class and other object classes are searched.
  • the relationship between the object classes is found, the relationship between the found object classes is converted into a database under the condition that the mapping condition is satisfied.
  • the data in the table is determined whether the relationship between the object classes to be converted is the relationship between the object class itself and other objects, and if the object class and other objects are The relationship is directly converted to the data in the database table when the mapping condition is satisfied; if not, the relationship between the object class and the object class and other object classes needs to be searched
  • the embodiment of the present invention further provides an apparatus for converting object-oriented model data.
  • the object-oriented model data conversion apparatus includes:
  • the obtaining module 101 is configured to: acquire a database table and a pre-configured mapping relationship, and acquire an object class and a mapping condition of the object-oriented model corresponding to the database table according to the mapping relationship;
  • This embodiment can be applied to data management of a wireless base station.
  • the mapping relationship is mainly configured by mapping the object class of the object-oriented model and the relational database table, that is, the mapping relationship between each object class (the name of the object class) and the database table (the name of the database table).
  • the mapping relationship between the object class and the relational database table of the object-oriented model of the embodiment includes a one-to-one mapping relationship, a one-to-many mapping relationship, and a many-to-one mapping relationship, that is, an object class corresponding to a database table,
  • An object class corresponds to a mapping relationship between multiple database tables and multiple object classes corresponding to one database table.
  • mapping condition indicates under what conditions the object class is converted into data in the database table.
  • the database table is traversed, and each database table is processed. According to the mapping relationship configuration, the corresponding object class list and the corresponding mapping conditions can be obtained.
  • the conversion module 102 is configured to convert the object class into data in the database table according to the mapping condition.
  • the object class list corresponding to each database table is converted.
  • the mapping condition is met
  • the corresponding object class is converted into the data in the database table, and then the next in the object class list is processed.
  • the object class corresponding to the next database table is converted into data in the database table.
  • mapping between the object class and the database table field is obtained, and the data conversion is performed sequentially when the mapping condition is met, that is, the object class is converted into data in the database table, and finally Generate data in the format of a relational database table.
  • the object class is converted into data in the database table, and the value of the object class may be converted into data in the database table, or the attribute of the object class may be converted into data in the database table, or may be Convert the relationship of an object class to data in a database table.
  • the foregoing conversion module 102 includes:
  • the first determining unit 1021 is configured to: acquire a value of the object class, and determine whether the value of the object class is a value of a corresponding object class in the mapping relationship;
  • the first searching unit 1022 is configured to: if the value of the object class is not the value of the object class, search according to the relationship between the object class and the object class and other object classes in the mapping relationship;
  • the first converting unit 1023 is configured to convert the value of the found object class into data in the database table according to the mapping condition.
  • the value of the object class can be converted into data in the database table.
  • the relationships between object classes in the presented object-oriented model including parent-child relationships, associations, and composite relationships. In this embodiment, the object class and the parent-child relationship, the association relationship, or the combination relationship between the object class and the other object class may be searched.
  • One end of the diamond represents the parent object, and the other end represents the child object; one end of the arrow represents the referenced object, and the other end represents the reference object; the combination relationship is a combination of the parent-child relationship and the association relationship.
  • the search for these relationships can be cross-level.
  • the parent-child relationship lookup the parent relationship and the child relationship. For example, looking for the object class 0 from the object class 3 can be found directly through the parent relationship (3->1->0); instead, the object class 3 is found from the object class 0, Can be found directly through the child relationship (0->1->3).
  • Association relationship lookup that is, reference and referenced relationship, for example, looking up object class 6 from object class 3, can be found directly through the referenced relationship (3->7->6); from object class 6 to find object class 3, can be directly Find by reference relationship (6->7->3).
  • Combination relationship lookup parent relationship, child relationship, reference relationship, group of referenced relationships For example, if you find the object class 3 from the object class 5, you can first find the object class 6 through the child relationship, and then find the object class 3 by referring to the relationship.
  • the value of the found object class is converted into the data in the database table on the premise that the mapping condition is satisfied.
  • the foregoing conversion module 102 may further include:
  • the second determining unit 2021 is configured to: acquire an attribute of the object class, and determine whether the attribute of the object class is an attribute of the corresponding object class in the mapping relationship;
  • the second searching unit 2022 is configured to: if the attribute of the object class is not an attribute of the object class, search according to the relationship between the object class and the object class and other object classes in the mapping relationship;
  • the second converting unit 2023 is configured to: convert the attributes of the found object class into data in the database table according to the mapping condition.
  • the attribute of the object class can be converted into the data in the database table.
  • This embodiment can be based on this object.
  • the class and the parent-child relationship, association relationship, or combination relationship between the object class and other object classes are searched. When the attribute of the object class is found, the attributes of the found object class are converted into data in the database table on the premise that the mapping condition is satisfied.
  • the conversion module 102 may further include:
  • the third determining unit 3021 is configured to: acquire a relationship between the object classes, and determine whether the relationship between the object classes is a relationship between the corresponding object class and other objects in the mapping relationship;
  • the third searching unit 3022 is configured to: if the relationship between the object classes is not the relationship between the object class and other objects, according to the mapping relationship between the object class and the object class and other object classes Make a search;
  • the third converting unit 3023 is configured to: between the found object classes according to the mapping condition The relationship is converted to data in the database table.
  • the relationship between the object classes can be converted into data in the database table.
  • the object class and the parent-child relationship, association relationship, or combination relationship between the object class and other object classes are searched.
  • the relationship between the found object classes is converted into data in the database table under the condition that the mapping condition is satisfied.
  • all or part of the steps of the above embodiments may also be implemented by using an integrated circuit. These steps may be separately fabricated into individual integrated circuit modules, or multiple modules or steps may be fabricated into a single integrated circuit module. achieve.
  • the devices/function modules/functional units in the above embodiments may be implemented by a general-purpose computing device, which may be centralized on a single computing device or distributed over a network of multiple computing devices.
  • the device/function module/functional unit in the above embodiment When the device/function module/functional unit in the above embodiment is implemented in the form of a software function module and sold or used as a stand-alone product, it can be stored in a computer readable storage medium.
  • the above mentioned computer readable storage medium may be a read only memory, a magnetic disk or an optical disk or the like.
  • the mapping relationship between the object class and the database table is pre-configured, and the conversion is performed when the mapping condition is satisfied, so that the object-oriented model data to the relational database data can be realized in a structured and effective manner, and the implementation process is simple.

Abstract

A conversion method and a conversion apparatus for object-oriented model data. The conversion method for object-oriented model data comprises the following steps: acquiring a database table and a preconfigured mapping relationship, and acquiring an object class of an object-oriented model corresponding to the database table according to the mapping relationship and a mapping condition; and converting the object class into data in the database table according to the mapping condition.

Description

面向对象模型数据的转换方法及转换装置Object-oriented model data conversion method and conversion device 技术领域Technical field
本文涉及对象模型技术领域,尤其涉及一种面向对象模型数据的转换方法及转换装置。This paper relates to the field of object model technology, and in particular to a method and a conversion device for object-oriented model data.
背景技术Background technique
随着通讯技术的快速发展及面向对象技术的广泛应用,第三代合作伙伴计划(3rd Generation Partnership Project,3GPP)推荐采用管理对象(Managed Object,MO)方式进行数据的处理,用以提高操作的便捷性。With the rapid development of communication technology and the wide application of object-oriented technology, the 3rd Generation Partnership Project (3GPP) recommends the use of managed objects (MO) for data processing to improve operations. Convenience.
MOM(Managed Object Model,管理对象模型)是对基站所有可管理资源的面向对象的抽象,其定义了模型化管理资源的方法和在管理方与被管理方之间信息传递的结构。MOM是以面向对象的方式描述基站信息或者通信网络数据。每个基站均以MOM进行描述,整个网络中的所有基站MOM连接在一起,形成了更大更完整的网络。每个基站的MOM模型都是一颗完整的树,共有200多类节点,形成一张综合逻辑视图,清晰描述基站的所有资源信息;可以划分为4类资源,并且定义了对象实例之间的关系。MOM (Managed Object Model) is an object-oriented abstraction of all manageable resources of a base station, which defines a method of modeling management resources and a structure of information transfer between the management party and the managed party. MOM describes base station information or communication network data in an object-oriented manner. Each base station is described in terms of MOM, and all base stations MOMs in the entire network are connected together to form a larger and more complete network. The MOM model of each base station is a complete tree with more than 200 types of nodes, forming an integrated logical view that clearly describes all the resource information of the base station; it can be divided into four types of resources, and defines between the object instances. relationship.
MOM模型的关系定义简洁,对象实例之间的关系比较多、比较复杂。MOM模型主要遵循3GPP协议,关系型数据库则不能完全遵循MOM模型或者说是3GPP协议,因此如果要将MOM模型数据完全映射成关系数据库数据无疑是非常复杂,需要进行复杂的映射适配才可将MOM模型转换为关系数据库的表数据。The relationship definition of the MOM model is simple, and the relationship between object instances is more and more complicated. The MOM model mainly follows the 3GPP protocol, and the relational database cannot fully follow the MOM model or the 3GPP protocol. Therefore, if the MOM model data is completely mapped into relational database data, it is undoubtedly very complicated, and complex mapping adaptation is required. The MOM model is converted to table data of a relational database.
上述内容仅用于辅助理解本文的技术方案,并不代表承认上述内容是现有技术。The above content is only used to assist in understanding the technical solutions herein, and does not constitute an admission that the above is prior art.
发明内容Summary of the invention
本文提供一种面向对象模型数据的转换方法及转换装置,旨在解决如何实现面向对象模型数据到关系数据库数据的简单、有效转换的技术问题。 This paper provides an object-oriented model data conversion method and conversion device, which aims to solve the technical problem of how to realize the simple and effective conversion of object-oriented model data to relational database data.
一种面向对象模型数据的转换方法,包括:A method for transforming object-oriented model data, comprising:
获取数据库表及预先配置的映射关系,根据所述映射关系获取所述数据库表对应的面向对象模型的对象类及映射条件;Obtaining a database table and a pre-configured mapping relationship, and acquiring an object class and a mapping condition of the object-oriented model corresponding to the database table according to the mapping relationship;
根据所述映射条件将所述对象类转换为所述数据库表中的数据。Converting the object class to data in the database table according to the mapping condition.
可选地,所述根据所述映射条件将所述对象类转换为所述数据库表中的数据的步骤包括:Optionally, the step of converting the object class into data in the database table according to the mapping condition comprises:
获取所述对象类的值,判断所述对象类的值是否为所述映射关系中对应的本对象类的值;Obtaining a value of the object class, and determining whether the value of the object class is a value of a corresponding object class in the mapping relationship;
若否,则根据所述映射关系中本对象类及本对象类与其他对象类之间的关系进行查找;If not, searching according to the relationship between the object class and the object class and other object classes in the mapping relationship;
根据所述映射条件将查找到的对象类的值转换为所述数据库表中的数据。Converting the value of the found object class to the data in the database table according to the mapping condition.
可选地,所述根据所述映射条件将所述对象类转换为所述数据库表中的数据的步骤包括:Optionally, the step of converting the object class into data in the database table according to the mapping condition comprises:
获取所述对象类的属性,判断所述对象类的属性是否为所述映射关系中对应的本对象类的属性;Obtaining an attribute of the object class, and determining whether the attribute of the object class is an attribute of the corresponding object class in the mapping relationship;
若否,则根据所述映射关系中本对象类及本对象类与其他对象类之间的关系进行查找;If not, searching according to the relationship between the object class and the object class and other object classes in the mapping relationship;
根据所述映射条件将查找到的对象类的属性转换为所述数据库表中的数据。Converting the attributes of the found object class to the data in the database table according to the mapping condition.
可选地,所述根据所述映射条件将所述对象类转换为所述数据库表中的数据的步骤包括:Optionally, the step of converting the object class into data in the database table according to the mapping condition comprises:
获取所述对象类之间的关系,判断所述对象类之间的关系是否为所述映射关系中对应的本对象类与其他对象的关系;Obtaining a relationship between the object classes, and determining whether the relationship between the object classes is a relationship between the corresponding object class and other objects in the mapping relationship;
若否,则根据所述映射关系中本对象类及本对象类与其他对象类之间的关系进行查找;If not, searching according to the relationship between the object class and the object class and other object classes in the mapping relationship;
根据所述映射条件将查找到的对象类之间的关系转换为所述数据库表中 的数据。Converting the relationship between the found object classes into the database table according to the mapping condition The data.
可选地,所述根据本对象类及本对象类与其他对象类之间的关系进行查找的步骤包括:Optionally, the step of searching according to the relationship between the object class and the object class and other object classes includes:
根据所述映射关系中本对象类及本对象类与其他对象类之间的父子关系、关联关系或组合关系进行查找。According to the mapping relationship, the object class and the parent-child relationship, the association relationship, or the combination relationship between the object class and other object classes are searched.
一种面向对象模型数据的转换装置,所述面向对象模型数据的转换装置包括:An apparatus for converting object-oriented model data, the object-oriented model data conversion apparatus comprising:
获取模块,设置为:获取数据库表及预先配置的映射关系,根据所述映射关系获取所述数据库表对应的面向对象模型的对象类及映射条件;The obtaining module is configured to: obtain a database table and a pre-configured mapping relationship, and acquire an object class and a mapping condition of the object-oriented model corresponding to the database table according to the mapping relationship;
转换模块,设置为:根据所述映射条件将所述对象类转换为所述数据库表中的数据。The conversion module is configured to: convert the object class into data in the database table according to the mapping condition.
可选地,所述转换模块包括:Optionally, the conversion module includes:
第一判断单元,设置为:获取所述对象类的值,判断所述对象类的值是否为所述映射关系中对应的本对象类的值;The first determining unit is configured to: obtain a value of the object class, and determine whether the value of the object class is a value of the corresponding object class in the mapping relationship;
第一查找单元,设置为:若所述对象类的值不是本对象类的值,则根据所述映射关系中本对象类及本对象类与其他对象类之间的关系进行查找;The first searching unit is configured to: if the value of the object class is not the value of the object class, search according to the relationship between the object class and the object class and other object classes in the mapping relationship;
第一转换单元,设置为:根据所述映射条件将查找到的对象类的值转换为所述数据库表中的数据。The first conversion unit is configured to: convert the value of the found object class into data in the database table according to the mapping condition.
可选地,所述转换模块包括:Optionally, the conversion module includes:
第二判断单元,设置为:获取所述对象类的属性,判断所述对象类的属性是否为所述映射关系中对应的本对象类的属性;The second determining unit is configured to: obtain an attribute of the object class, and determine whether the attribute of the object class is an attribute of the corresponding object class in the mapping relationship;
第二查找单元,设置为:若所述对象类的属性不是本对象类的属性,则根据所述映射关系中本对象类及本对象类与其他对象类之间的关系进行查找;The second search unit is configured to: if the attribute of the object class is not an attribute of the object class, perform a search according to the relationship between the object class and the object class and other object classes in the mapping relationship;
第二转换单元,设置为:根据所述映射条件将查找到的对象类的属性转换为所述数据库表中的数据。The second conversion unit is configured to: convert the attributes of the found object class into data in the database table according to the mapping condition.
可选地,所述转换模块包括: Optionally, the conversion module includes:
第三判断单元,设置为:获取所述对象类之间的关系,判断所述对象类之间的关系是否为所述映射关系中对应的本对象类与其他对象的关系;The third determining unit is configured to: acquire a relationship between the object classes, and determine whether the relationship between the object classes is a relationship between the corresponding object class and other objects in the mapping relationship;
第三查找单元,设置为:若所述对象类之间的关系不是本对象类与其他对象的关系,则根据所述映射关系中本对象类及本对象类与其他对象类之间的关系进行查找;The third search unit is configured to: if the relationship between the object classes is not the relationship between the object class and other objects, according to the relationship between the object class and the object class and other object classes in the mapping relationship Find
第三转换单元,设置为:根据所述映射条件将查找到的对象类之间的关系转换为所述数据库表中的数据。The third conversion unit is configured to: convert the relationship between the found object classes into data in the database table according to the mapping condition.
一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令用于执行上述任一项的方法。A computer readable storage medium storing computer executable instructions for performing the method of any of the above.
一种面向对象模型数据的转换方法及转换装置,在将面向对象模型的对象类转换为数据库表中的数据时,预先配置对象类与数据库表的映射关系,根据映射关系可获取数据库表对应的面向对象模型的对象类及映射条件,然后可根据映射条件将对象类转换为数据库表中的数据,本发明实施例由于预先配置对象类与数据库表的映射关系,并确定在满足映射条件时进行转换,因此能够实现面向对象模型数据到关系数据库数据的有条理、有效的转换,实现流程较简单。An object-oriented model data conversion method and conversion device, when converting an object class of an object-oriented model into data in a database table, pre-configuring a mapping relationship between the object class and the database table, and obtaining a database table corresponding according to the mapping relationship The object class and the mapping condition of the object-oriented model can then be converted into the data in the database table according to the mapping condition. In the embodiment of the present invention, the mapping relationship between the object class and the database table is pre-configured, and it is determined that the mapping condition is met. Conversion, thus enabling a structured and efficient transformation of object-oriented model data to relational database data, the implementation process is relatively simple.
附图概述BRIEF abstract
图1为本发明面向对象模型数据的转换方法一实施例的流程示意图;1 is a schematic flow chart of an embodiment of an object-oriented model data conversion method according to the present invention;
图2为图1中步骤S102一实施例的细化流程示意图;2 is a schematic flow chart of a refinement of an embodiment of step S102 in FIG. 1;
图3为图1中面向对象模型中的对象类之间的关系的示意图;3 is a schematic diagram of relationships between object classes in the object-oriented model of FIG. 1;
图4为图1中步骤S102另一实施例的细化流程示意图;4 is a schematic flow chart of another embodiment of step S102 in FIG. 1;
图5为图1中步骤S102再一实施例的细化流程示意图;FIG. 5 is a schematic diagram showing a refinement process of still another embodiment of step S102 in FIG. 1;
图6为本发明面向对象模型数据的转换装置一实施例的功能模块示意图;6 is a schematic diagram of functional modules of an embodiment of an object-oriented model data conversion apparatus according to the present invention;
图7为图6中转换模块一实施例的细化功能模块示意图; 7 is a schematic diagram of a refinement function module of an embodiment of the conversion module of FIG. 6;
图8为图6中转换模块另一实施例的细化功能模块示意图;8 is a schematic diagram of a refinement function module of another embodiment of the conversion module of FIG. 6;
图9为图6中转换模块再一实施例的细化功能模块示意图。FIG. 9 is a schematic diagram of a refinement function module of still another embodiment of the conversion module of FIG. 6. FIG.
本发明的实施方式Embodiments of the invention
本发明实施例提供一种面向对象模型数据的转换方法,参照图1,在一实施例中,该面向对象模型数据的转换方法包括:An embodiment of the present invention provides a method for converting object-oriented model data. Referring to FIG. 1, in an embodiment, the method for converting object-oriented model data includes:
步骤S101,获取数据库表及预先配置的映射关系,根据所述映射关系获取所述数据库表对应的对象类及映射条件;Step S101: Obtain a database table and a pre-configured mapping relationship, and obtain an object class and a mapping condition corresponding to the database table according to the mapping relationship.
本实施例可应用于无线基站的数据管理中。This embodiment can be applied to data management of a wireless base station.
本实施例中,映射关系的配置主要是配置面向对象模型的对象类与关系型数据库表的映射关系,即每个对象类(对象类的名称)与数据库表(数据库表的名称)的映射关系。In this embodiment, the mapping relationship is mainly configured by mapping the object class of the object-oriented model and the relational database table, that is, the mapping relationship between each object class (the name of the object class) and the database table (the name of the database table). .
映射关系中,可以配置两类对象类:本对象类和其他对象类,本对象类为必配,其他对象类选配。In the mapping relationship, you can configure two types of object classes: this object class and other object classes. This object class is mandatory, and other object classes are optional.
本实施例的面向对象模型的对象类与关系型数据库表的映射关系包括一对一的映射关系、一对多的映射关系及多对一的映射关系,即包括一个对象类对应一个数据库表、一个对象类对应多个数据库表及多个对象类对应一个数据库表的映射关系。The mapping relationship between the object class and the relational database table of the object-oriented model of the embodiment includes a one-to-one mapping relationship, a one-to-many mapping relationship, and a many-to-one mapping relationship, that is, an object class corresponding to a database table, An object class corresponds to a mapping relationship between multiple database tables and multiple object classes corresponding to one database table.
本实施例中,映射条件即表明在什么条件下才将对象类转换为数据库表中的数据。In this embodiment, the mapping condition indicates under what conditions the object class is converted into data in the database table.
本实施例中,在进行转换时,遍历数据库表,针对每张数据库表进行处理,根据映射关系配置,可以获取到对应的对象类列表以及对应的映射条件。In this embodiment, when the conversion is performed, the database table is traversed, and each database table is processed. According to the mapping relationship configuration, the corresponding object class list and the corresponding mapping conditions can be obtained.
步骤S102,根据所述映射条件将所述对象类转换为所述数据库表中的数据。Step S102: Convert the object class into data in the database table according to the mapping condition.
本实施例中,对每张数据库表对应的对象类列表进行转换处理,在满足映射条件的情况下,将对应的对象类转换为所述数据库表中的数据,然后处理对象类列表中的下一个对象类;在不满足映射条件时,跳过该对象类而处 理下一对象类。In this embodiment, the object class list corresponding to each database table is converted. When the mapping condition is met, the corresponding object class is converted into the data in the database table, and then the next in the object class list is processed. An object class; skipping the object class when the mapping condition is not met The next object class.
然后继续处理下一个数据库表,将下一个数据库表对应的对象类转换为数据库表中的数据。Then continue to process the next database table, the object class corresponding to the next database table is converted into data in the database table.
本实施例中,在转换时,获取对象类与数据库表字段映射配置,在满足映射条件时依次进行数据转换,即将对象类转换为数据库表中的数据,最后按照关系型数据库表的格式生成数据。In this embodiment, at the time of conversion, the mapping between the object class and the database table field is obtained, and the data conversion is performed sequentially when the mapping condition is satisfied, that is, the object class is converted into data in the database table, and finally the data is generated according to the format of the relational database table. .
本实施例中,将对象类转换为数据库表中的数据,可以是将对象类的值转换为数据库表中的数据,也可以是将对象类的属性转换为数据库表中的数据,也可以是将对象类的关系转换为数据库表中的数据。In this embodiment, the object class is converted into data in the database table, and the value of the object class may be converted into data in the database table, or the attribute of the object class may be converted into data in the database table, or may be Convert the relationship of an object class to data in a database table.
与相关技术相比,本实施例在将面向对象模型的对象类转换为数据库表中的数据时,预先配置对象类与数据库表的映射关系,根据映射关系可获取数据库表对应的面向对象模型的对象类及映射条件,然后可根据映射条件将对象类转换为数据库表中的数据,本实施例由于预先配置对象类与数据库表的映射关系,并确定在满足映射条件时进行转换,因此能够实现面向对象模型数据到关系数据库数据的有条理、有效的转换,实现流程较简单。Compared with the related art, in this embodiment, when the object class of the object-oriented model is converted into the data in the database table, the mapping relationship between the object class and the database table is pre-configured, and the object-oriented model corresponding to the database table can be obtained according to the mapping relationship. The object class and the mapping condition can then be converted into the data in the database table according to the mapping condition. In this embodiment, the mapping relationship between the object class and the database table is pre-configured, and the conversion is determined when the mapping condition is satisfied, so that the implementation can be implemented. The object-oriented model data to the relational database data is organized and effective, and the implementation process is relatively simple.
在一实施例中,如图2所示,在上述图1的实施例的基础上,上述步骤S102包括:In an embodiment, as shown in FIG. 2, based on the foregoing embodiment of FIG. 1, the foregoing step S102 includes:
步骤S1021,获取所述对象类的值,判断所述对象类的值是否为所述映射关系中对应的本对象类的值,若是,则进入步骤S1022,若否,则进入步骤S1023;Step S1021, obtaining the value of the object class, determining whether the value of the object class is the value of the corresponding object class in the mapping relationship, and if so, proceeding to step S1022, and if not, proceeding to step S1023;
步骤S1022,根据所述映射条件将本对象类的值转换为所述数据库表中的数据;Step S1022: Convert the value of the object class to the data in the database table according to the mapping condition;
步骤S1023,根据所述映射关系中本对象类及本对象类与其他对象类之间的关系进行查找;Step S1023: Perform a search according to the relationship between the object class and the object class and other object classes in the mapping relationship;
步骤S1024,根据所述映射条件将查找到的对象类的值转换为所述数据库表中的数据。Step S1024, converting the value of the found object class into data in the database table according to the mapping condition.
本实施例可以将对象类的值转换为数据库表中的数据,首先判断所要转 换的对象类的值是否为本对象类自身的值,如果是本对象类的值,则在满足映射条件时直接将本对象类的值转换为数据库表中的数据;如果不是本对象类的值,则需要根据本对象类及本对象类与其他对象类之间的关系进行查找,结合参阅图3,图3展现的面向对象模型中的对象类之间的关系,包括父子关系、关联关系及组合关系。本实施例可以根据本对象类及本对象类与其他对象类之间的父子关系、关联关系或组合关系进行查找。In this embodiment, the value of the object class can be converted into data in the database table, and the first step is to determine the desired Whether the value of the changed object class is the value of the object class itself. If it is the value of the object class, the value of the object class is directly converted into the data in the database table when the mapping condition is satisfied; if it is not the object class The value needs to be searched according to the relationship between the object class and the object class and other object classes. Referring to FIG. 3, the relationship between the object classes in the object-oriented model shown in FIG. 3 includes parent-child relationship and association relationship. And the combination relationship. In this embodiment, the object class and the parent-child relationship, the association relationship, or the combination relationship between the object class and the other object class may be searched.
其中,菱形的一端表示父对象,另一端表示子对象;箭头的一端表示被引用对象,另一端表示引用对象;组合关系为父子关系及关联关系两者的综合。这些关系的查找可以跨级。例如父子关系查找:即父关系和子关系,比如,从对象类3找对象类0,可以直接通过父关系找到(3->1->0);而相反,从对象类0找对象类3,可以直接通过子关系找到(0->1->3)。关联关系查找:即引用和被引用关系,比如,从对象类3找对象类6,可以直接通过被引用关系找到(3->7->6);从对象类6找对象类3,可以直接通过引用关系找到(6->7->3)。组合关系查找:父关系、子关系、引用关系、被引用关系的组合,比如,从对象类5找对象类3,可以先通过子关系找到对象类6,再通过引用关系找到对象类3。One end of the diamond represents the parent object, and the other end represents the child object; one end of the arrow represents the referenced object, and the other end represents the reference object; the combination relationship is a combination of the parent-child relationship and the association relationship. The search for these relationships can be cross-level. For example, the parent-child relationship lookup: the parent relationship and the child relationship. For example, looking for the object class 0 from the object class 3 can be found directly through the parent relationship (3->1->0); instead, the object class 3 is found from the object class 0, Can be found directly through the child relationship (0->1->3). Association relationship lookup: that is, reference and referenced relationship, for example, looking up object class 6 from object class 3, can be found directly through the referenced relationship (3->7->6); from object class 6 to find object class 3, can be directly Find by reference relationship (6->7->3). Combination relationship search: parent relationship, child relationship, reference relationship, combination of referenced relationship, for example, to find object class 3 from object class 5, you can first find object class 6 through child relationship, and then find object class 3 by reference relationship.
本实施例中,当查找到对象类的值时,在满足映射条件的前提下,将查找到的对象类的值转换为数据库表中的数据。In this embodiment, when the value of the object class is found, the value of the found object class is converted into the data in the database table on the premise that the mapping condition is satisfied.
在另一实施例中,如图4所示,在上述图1的实施例的基础上,上述步骤S102包括:In another embodiment, as shown in FIG. 4, based on the foregoing embodiment of FIG. 1, the foregoing step S102 includes:
步骤S2021,获取所述对象类的属性,判断所述对象类的属性是否为所述映射关系中对应的本对象类的属性,若是,则进入步骤S2022,若否,则进入步骤S2023;Step S2021, acquiring the attribute of the object class, determining whether the attribute of the object class is the attribute of the corresponding object class in the mapping relationship, if yes, proceeding to step S2022, and if not, proceeding to step S2023;
步骤S2022,根据所述映射条件将本对象类的属性转换为所述数据库表中的数据;Step S2022: Convert the attribute of the object class to the data in the database table according to the mapping condition;
步骤S2023,根据所述映射关系中本对象类及本对象类与其他对象类之间的关系进行查找; Step S2023: searching according to the relationship between the object class and the object class and other object classes in the mapping relationship;
步骤S2024,根据所述映射条件将查找到的对象类的属性转换为所述数据库表中的数据。Step S2024: Convert the attributes of the found object class into data in the database table according to the mapping condition.
本实施例可以将对象类的属性转换为数据库表中的数据,首先判断所要转换的对象类的属性是否为本对象类自身的属性,如果是本对象类的属性,则在满足映射条件时直接将本对象类的属性转换为数据库表中的数据;如果不是本对象类的属性,则需要根据本对象类及本对象类与其他对象类之间的关系进行查找,本实施例可以根据本对象类及本对象类与其他对象类之间的父子关系、关联关系或组合关系进行查找。当查找到对象类的属性时,在满足映射条件的前提下,将查找到的对象类的属性转换为数据库表中的数据。In this embodiment, the attribute of the object class can be converted into the data in the database table. First, it is determined whether the attribute of the object class to be converted is the attribute of the object class itself. If the attribute of the object class is the attribute of the object class, the mapping condition is directly met. Convert the attributes of this object class to the data in the database table; if it is not the attribute of the object class, you need to search according to the relationship between the object class and the object class and other object classes. This embodiment can be based on this object. The class and the parent-child relationship, association relationship, or combination relationship between the object class and other object classes are searched. When the attribute of the object class is found, the attributes of the found object class are converted into data in the database table on the premise that the mapping condition is satisfied.
在再一实施例中,如图5所示,在上述图1的实施例的基础上,上述步骤S102包括:In still another embodiment, as shown in FIG. 5, based on the foregoing embodiment of FIG. 1, the foregoing step S102 includes:
步骤S3021,获取所述对象类之间的关系,判断所述对象类之间的关系是否为所述映射关系中对应的本对象类与其他对象的关系,若是,则进入步骤S3022,若否,则进入步骤S3023;Step S3021: Obtain a relationship between the object classes, determine whether the relationship between the object classes is a relationship between the corresponding object class and other objects in the mapping relationship, and if yes, proceed to step S3022, and if not, Then proceeds to step S3023;
步骤S3022,根据所述映射条件将所述对象类之间的关系转换为所述数据库表中的数据;Step S3022: Convert the relationship between the object classes into data in the database table according to the mapping condition;
步骤S3023,根据所述映射关系中本对象类及本对象类与其他对象类之间的关系进行查找;Step S3023: searching according to the relationship between the object class and the object class and other object classes in the mapping relationship;
步骤S3024,根据所述映射条件将查找到的对象类之间的关系转换为所述数据库表中的数据。Step S3024: Convert the relationship between the found object classes into data in the database table according to the mapping condition.
本实施例可以将对象类之间的关系转换为数据库表中的数据,首先判断所要转换的对象类之间的关系是否为本对象类自身与其他对象的关系,如果是本对象类与其他对象的关系,则在满足映射条件时直接将其转换为数据库表中的数据;如果不是,则需要根据本对象类及本对象类与其他对象类之间的关系进行查找,本实施例可以根据本对象类及本对象类与其他对象类之间的父子关系、关联关系或组合关系进行查找。当查找到该对象类之间的关系时,在满足映射条件的前提下,将查找到的对象类之间的关系转换为数据库 表中的数据。In this embodiment, the relationship between the object classes can be converted into data in the database table. First, it is determined whether the relationship between the object classes to be converted is the relationship between the object class itself and other objects, and if the object class and other objects are The relationship is directly converted to the data in the database table when the mapping condition is satisfied; if not, the relationship between the object class and the object class and other object classes needs to be searched according to the relationship between the object class and the other object class. The object class and the parent-child relationship, association relationship, or combination relationship between the object class and other object classes are searched. When the relationship between the object classes is found, the relationship between the found object classes is converted into a database under the condition that the mapping condition is satisfied. The data in the table.
本发明实施例还提供一种面向对象模型数据的转换装置,如图6所示,在一实施例中,所述面向对象模型数据的转换装置包括:The embodiment of the present invention further provides an apparatus for converting object-oriented model data. As shown in FIG. 6, in an embodiment, the object-oriented model data conversion apparatus includes:
获取模块101,设置为:获取数据库表及预先配置的映射关系,根据所述映射关系获取所述数据库表对应的面向对象模型的对象类及映射条件;The obtaining module 101 is configured to: acquire a database table and a pre-configured mapping relationship, and acquire an object class and a mapping condition of the object-oriented model corresponding to the database table according to the mapping relationship;
本实施例可应用于无线基站的数据管理中。This embodiment can be applied to data management of a wireless base station.
本实施例中,映射关系的配置主要是配置面向对象模型的对象类与关系型数据库表的映射关系,即每个对象类(对象类的名称)与数据库表(数据库表的名称)的映射关系。本实施例的面向对象模型的对象类与关系型数据库表的映射关系包括一对一的映射关系、一对多的映射关系及多对一的映射关系,即包括一个对象类对应一个数据库表、一个对象类对应多个数据库表及多个对象类对应一个数据库表的映射关系。In this embodiment, the mapping relationship is mainly configured by mapping the object class of the object-oriented model and the relational database table, that is, the mapping relationship between each object class (the name of the object class) and the database table (the name of the database table). . The mapping relationship between the object class and the relational database table of the object-oriented model of the embodiment includes a one-to-one mapping relationship, a one-to-many mapping relationship, and a many-to-one mapping relationship, that is, an object class corresponding to a database table, An object class corresponds to a mapping relationship between multiple database tables and multiple object classes corresponding to one database table.
本实施例中,映射条件即表明在什么条件下才将对象类转换为数据库表中的数据。In this embodiment, the mapping condition indicates under what conditions the object class is converted into data in the database table.
本实施例中,在进行转换时,遍历数据库表,针对每张数据库表进行处理,根据映射关系配置,可以获取到对应的对象类列表以及对应的映射条件。In this embodiment, when the conversion is performed, the database table is traversed, and each database table is processed. According to the mapping relationship configuration, the corresponding object class list and the corresponding mapping conditions can be obtained.
转换模块102,设置为:根据所述映射条件将所述对象类转换为所述数据库表中的数据。The conversion module 102 is configured to convert the object class into data in the database table according to the mapping condition.
本实施例中,对每张数据库表对应的对象类列表进行转换处理,在满足映射条件的情况下,将对应的对象类转换为所述数据库表中的数据,然后处理对象类列表中的下一个对象类;在不满足映射条件时,跳过该对象类而处理下一对象类。In this embodiment, the object class list corresponding to each database table is converted. When the mapping condition is met, the corresponding object class is converted into the data in the database table, and then the next in the object class list is processed. An object class; when the mapping condition is not met, the object class is skipped and the next object class is processed.
然后继续处理下一个数据库表,将下一个数据库表对应的对象类转换为数据库表中的数据。Then continue to process the next database table, the object class corresponding to the next database table is converted into data in the database table.
本实施例中,在转换时,获取对象类与数据库表字段映射配置,在满足映射条件时依次进行数据转换,即将对象类转换为数据库表中的数据,最后 按照关系型数据库表的格式生成数据。In this embodiment, during the conversion, the mapping between the object class and the database table field is obtained, and the data conversion is performed sequentially when the mapping condition is met, that is, the object class is converted into data in the database table, and finally Generate data in the format of a relational database table.
本实施例中,将对象类转换为数据库表中的数据,可以是将对象类的值转换为数据库表中的数据,也可以是将对象类的属性转换为数据库表中的数据,也可以是将对象类的关系转换为数据库表中的数据。In this embodiment, the object class is converted into data in the database table, and the value of the object class may be converted into data in the database table, or the attribute of the object class may be converted into data in the database table, or may be Convert the relationship of an object class to data in a database table.
在一实施例中,如图7所示,上述转换模块102包括:In an embodiment, as shown in FIG. 7, the foregoing conversion module 102 includes:
第一判断单元1021,设置为:获取所述对象类的值,判断所述对象类的值是否为所述映射关系中对应的本对象类的值;The first determining unit 1021 is configured to: acquire a value of the object class, and determine whether the value of the object class is a value of a corresponding object class in the mapping relationship;
第一查找单元1022,设置为:若所述对象类的值不是本对象类的值,则根据所述映射关系中本对象类及本对象类与其他对象类之间的关系进行查找;The first searching unit 1022 is configured to: if the value of the object class is not the value of the object class, search according to the relationship between the object class and the object class and other object classes in the mapping relationship;
第一转换单元1023,设置为:根据所述映射条件将查找到的对象类的值转换为所述数据库表中的数据。The first converting unit 1023 is configured to convert the value of the found object class into data in the database table according to the mapping condition.
本实施例可以将对象类的值转换为数据库表中的数据,首先判断所要转换的对象类的值是否为本对象类自身的值,如果是本对象类的值,则在满足映射条件时直接将本对象类的值转换为数据库表中的数据;如果不是本对象类的值,则需要根据本对象类及本对象类与其他对象类之间的关系进行查找,结合参阅图3,图3展现的面向对象模型中的对象类之间的关系,包括父子关系、关联关系及组合关系。本实施例可以根据本对象类及本对象类与其他对象类之间的父子关系、关联关系或组合关系进行查找。In this embodiment, the value of the object class can be converted into data in the database table. First, it is determined whether the value of the object class to be converted is the value of the object class itself. If the value of the object class is the value of the object class, the mapping condition is directly met. Convert the value of this object class to the data in the database table; if it is not the value of the object class, you need to find the relationship between the object class and the object class and other object classes, see Figure 3, Figure 3 The relationships between object classes in the presented object-oriented model, including parent-child relationships, associations, and composite relationships. In this embodiment, the object class and the parent-child relationship, the association relationship, or the combination relationship between the object class and the other object class may be searched.
其中,菱形的一端表示父对象,另一端表示子对象;箭头的一端表示被引用对象,另一端表示引用对象;组合关系为父子关系及关联关系两者的综合。这些关系的查找可以跨级。例如父子关系查找:即父关系和子关系,比如,从对象类3找对象类0,可以直接通过父关系找到(3->1->0);而相反,从对象类0找对象类3,可以直接通过子关系找到(0->1->3)。关联关系查找:即引用和被引用关系,比如,从对象类3找对象类6,可以直接通过被引用关系找到(3->7->6);从对象类6找对象类3,可以直接通过引用关系找到(6->7->3)。组合关系查找:父关系、子关系、引用关系、被引用关系的组 合,比如,从对象类5找对象类3,可以先通过子关系找到对象类6,再通过引用关系找到对象类3。One end of the diamond represents the parent object, and the other end represents the child object; one end of the arrow represents the referenced object, and the other end represents the reference object; the combination relationship is a combination of the parent-child relationship and the association relationship. The search for these relationships can be cross-level. For example, the parent-child relationship lookup: the parent relationship and the child relationship. For example, looking for the object class 0 from the object class 3 can be found directly through the parent relationship (3->1->0); instead, the object class 3 is found from the object class 0, Can be found directly through the child relationship (0->1->3). Association relationship lookup: that is, reference and referenced relationship, for example, looking up object class 6 from object class 3, can be found directly through the referenced relationship (3->7->6); from object class 6 to find object class 3, can be directly Find by reference relationship (6->7->3). Combination relationship lookup: parent relationship, child relationship, reference relationship, group of referenced relationships For example, if you find the object class 3 from the object class 5, you can first find the object class 6 through the child relationship, and then find the object class 3 by referring to the relationship.
本实施例中,当查找到对象类的值时,在满足映射条件的前提下,将查找到的对象类的值转换为数据库表中的数据。In this embodiment, when the value of the object class is found, the value of the found object class is converted into the data in the database table on the premise that the mapping condition is satisfied.
在另一实施例中,如图8所示,上述转换模块102还可以包括:In another embodiment, as shown in FIG. 8, the foregoing conversion module 102 may further include:
第二判断单元2021,设置为:获取所述对象类的属性,判断所述对象类的属性是否为所述映射关系中对应的本对象类的属性;The second determining unit 2021 is configured to: acquire an attribute of the object class, and determine whether the attribute of the object class is an attribute of the corresponding object class in the mapping relationship;
第二查找单元2022,设置为:若所述对象类的属性不是本对象类的属性,则根据所述映射关系中本对象类及本对象类与其他对象类之间的关系进行查找;The second searching unit 2022 is configured to: if the attribute of the object class is not an attribute of the object class, search according to the relationship between the object class and the object class and other object classes in the mapping relationship;
第二转换单元2023,设置为:根据所述映射条件将查找到的对象类的属性转换为所述数据库表中的数据。The second converting unit 2023 is configured to: convert the attributes of the found object class into data in the database table according to the mapping condition.
本实施例可以将对象类的属性转换为数据库表中的数据,首先判断所要转换的对象类的属性是否为本对象类自身的属性,如果是本对象类的属性,则在满足映射条件时直接将本对象类的属性转换为数据库表中的数据;如果不是本对象类的属性,则需要根据本对象类及本对象类与其他对象类之间的关系进行查找,本实施例可以根据本对象类及本对象类与其他对象类之间的父子关系、关联关系或组合关系进行查找。当查找到对象类的属性时,在满足映射条件的前提下,将查找到的对象类的属性转换为数据库表中的数据。In this embodiment, the attribute of the object class can be converted into the data in the database table. First, it is determined whether the attribute of the object class to be converted is the attribute of the object class itself. If the attribute of the object class is the attribute of the object class, the mapping condition is directly met. Convert the attributes of this object class to the data in the database table; if it is not the attribute of the object class, you need to search according to the relationship between the object class and the object class and other object classes. This embodiment can be based on this object. The class and the parent-child relationship, association relationship, or combination relationship between the object class and other object classes are searched. When the attribute of the object class is found, the attributes of the found object class are converted into data in the database table on the premise that the mapping condition is satisfied.
在再一实施例中,如图9所示,上述转换模块102还可以包括:In another embodiment, as shown in FIG. 9, the conversion module 102 may further include:
第三判断单元3021,设置为:获取所述对象类之间的关系,判断所述对象类之间的关系是否为所述映射关系中对应的本对象类与其他对象的关系;The third determining unit 3021 is configured to: acquire a relationship between the object classes, and determine whether the relationship between the object classes is a relationship between the corresponding object class and other objects in the mapping relationship;
第三查找单元3022,设置为:若所述对象类之间的关系不是本对象类与其他对象的关系,则根据所述映射关系中本对象类及本对象类与其他对象类之间的关系进行查找;The third searching unit 3022 is configured to: if the relationship between the object classes is not the relationship between the object class and other objects, according to the mapping relationship between the object class and the object class and other object classes Make a search;
第三转换单元3023,设置为:根据所述映射条件将查找到的对象类之间 的关系转换为所述数据库表中的数据。The third converting unit 3023 is configured to: between the found object classes according to the mapping condition The relationship is converted to data in the database table.
本实施例可以将对象类之间的关系转换为数据库表中的数据,首先判断所要转换的对象类之间的关系是否为本对象类自身与其他对象的关系,如果是本对象类与其他对象的关系,则在满足映射条件时直接将其转换为数据库表中的数据;如果不是,则需要根据本对象类及本对象类与其他对象类之间的关系进行查找,本实施例可以根据本对象类及本对象类与其他对象类之间的父子关系、关联关系或组合关系进行查找。当查找到该对象类之间的关系时,在满足映射条件的前提下,将查找到的对象类之间的关系转换为数据库表中的数据。In this embodiment, the relationship between the object classes can be converted into data in the database table. First, it is determined whether the relationship between the object classes to be converted is the relationship between the object class itself and other objects, and if the object class and other objects are The relationship is directly converted to the data in the database table when the mapping condition is satisfied; if not, the relationship between the object class and the object class and other object classes needs to be searched according to the relationship between the object class and the other object class. The object class and the parent-child relationship, association relationship, or combination relationship between the object class and other object classes are searched. When the relationship between the object classes is found, the relationship between the found object classes is converted into data in the database table under the condition that the mapping condition is satisfied.
本领域普通技术人员可以理解上述实施例的全部或部分步骤可以使用计算机程序流程来实现,所述计算机程序可以存储于一计算机可读存储介质中,所述计算机程序在相应的硬件平台上(如系统、设备、装置、器件等)执行,在执行时,包括方法实施例的步骤之一或其组合。One of ordinary skill in the art will appreciate that all or a portion of the steps of the above-described embodiments can be implemented using a computer program flow, which can be stored in a computer readable storage medium, such as on a corresponding hardware platform (eg, The system, device, device, device, etc. are executed, and when executed, include one or a combination of the steps of the method embodiments.
可选地,上述实施例的全部或部分步骤也可以使用集成电路来实现,这些步骤可以被分别制作成一个个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。Alternatively, all or part of the steps of the above embodiments may also be implemented by using an integrated circuit. These steps may be separately fabricated into individual integrated circuit modules, or multiple modules or steps may be fabricated into a single integrated circuit module. achieve.
上述实施例中的装置/功能模块/功能单元可以采用通用的计算装置来实现,它们可以集中在单个的计算装置上,也可以分布在多个计算装置所组成的网络上。The devices/function modules/functional units in the above embodiments may be implemented by a general-purpose computing device, which may be centralized on a single computing device or distributed over a network of multiple computing devices.
上述实施例中的装置/功能模块/功能单元以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。上述提到的计算机可读取存储介质可以是只读存储器,磁盘或光盘等。When the device/function module/functional unit in the above embodiment is implemented in the form of a software function module and sold or used as a stand-alone product, it can be stored in a computer readable storage medium. The above mentioned computer readable storage medium may be a read only memory, a magnetic disk or an optical disk or the like.
工业实用性Industrial applicability
本发明实施例由于预先配置对象类与数据库表的映射关系,并确定在满足映射条件时进行转换,因此能够实现面向对象模型数据到关系数据库数据的有条理、有效的转换,实现流程较简单。 In the embodiment of the present invention, the mapping relationship between the object class and the database table is pre-configured, and the conversion is performed when the mapping condition is satisfied, so that the object-oriented model data to the relational database data can be realized in a structured and effective manner, and the implementation process is simple.

Claims (10)

  1. 一种面向对象模型数据的转换方法,包括:A method for transforming object-oriented model data, comprising:
    获取数据库表及预先配置的映射关系,根据所述映射关系获取所述数据库表对应的面向对象模型的对象类及映射条件;Obtaining a database table and a pre-configured mapping relationship, and acquiring an object class and a mapping condition of the object-oriented model corresponding to the database table according to the mapping relationship;
    根据所述映射条件将所述对象类转换为所述数据库表中的数据。Converting the object class to data in the database table according to the mapping condition.
  2. 如权利要求1所述的面向对象模型数据的转换方法,其中,所述根据所述映射条件将所述对象类转换为所述数据库表中的数据的步骤包括:The method of converting object-oriented model data according to claim 1, wherein said converting said object class into data in said database table according to said mapping condition comprises:
    获取所述对象类的值,判断所述对象类的值是否为所述映射关系中对应的本对象类的值;Obtaining a value of the object class, and determining whether the value of the object class is a value of a corresponding object class in the mapping relationship;
    若否,则根据所述映射关系中本对象类及本对象类与其他对象类之间的关系进行查找;If not, searching according to the relationship between the object class and the object class and other object classes in the mapping relationship;
    根据所述映射条件将查找到的对象类的值转换为所述数据库表中的数据。Converting the value of the found object class to the data in the database table according to the mapping condition.
  3. 如权利要求1所述的面向对象模型数据的转换方法,其中,所述根据所述映射条件将所述对象类转换为所述数据库表中的数据的步骤包括:The method of converting object-oriented model data according to claim 1, wherein said converting said object class into data in said database table according to said mapping condition comprises:
    获取所述对象类的属性,判断所述对象类的属性是否为所述映射关系中对应的本对象类的属性;Obtaining an attribute of the object class, and determining whether the attribute of the object class is an attribute of the corresponding object class in the mapping relationship;
    若否,则根据所述映射关系中本对象类及本对象类与其他对象类之间的关系进行查找;If not, searching according to the relationship between the object class and the object class and other object classes in the mapping relationship;
    根据所述映射条件将查找到的对象类的属性转换为所述数据库表中的数据。Converting the attributes of the found object class to the data in the database table according to the mapping condition.
  4. 如权利要求1所述的面向对象模型数据的转换方法,其中,所述根据所述映射条件将所述对象类转换为所述数据库表中的数据的步骤包括:The method of converting object-oriented model data according to claim 1, wherein said converting said object class into data in said database table according to said mapping condition comprises:
    获取所述对象类之间的关系,判断所述对象类之间的关系是否为所述映射关系中对应的本对象类与其他对象的关系;Obtaining a relationship between the object classes, and determining whether the relationship between the object classes is a relationship between the corresponding object class and other objects in the mapping relationship;
    若否,则根据所述映射关系中本对象类及本对象类与其他对象类之间的关系进行查找; If not, searching according to the relationship between the object class and the object class and other object classes in the mapping relationship;
    根据所述映射条件将查找到的对象类之间的关系转换为所述数据库表中的数据。Converting the relationship between the found object classes into data in the database table according to the mapping condition.
  5. 如权利要求2、3或4所述的面向对象模型数据的转换方法,其中,所述根据本对象类及本对象类与其他对象类之间的关系进行查找的步骤包括:The method for converting object-oriented model data according to claim 2, 3 or 4, wherein the step of searching according to the relationship between the object class and the object class and other object classes comprises:
    根据所述映射关系中本对象类及本对象类与其他对象类之间的父子关系、关联关系或组合关系进行查找。According to the mapping relationship, the object class and the parent-child relationship, the association relationship, or the combination relationship between the object class and other object classes are searched.
  6. 一种面向对象模型数据的转换装置,包括:A device for transforming object-oriented model data, comprising:
    获取模块,设置为:获取数据库表及预先配置的映射关系,根据所述映射关系获取所述数据库表对应的面向对象模型的对象类及映射条件;The obtaining module is configured to: obtain a database table and a pre-configured mapping relationship, and acquire an object class and a mapping condition of the object-oriented model corresponding to the database table according to the mapping relationship;
    转换模块,设置为:根据所述映射条件将所述对象类转换为所述数据库表中的数据。The conversion module is configured to: convert the object class into data in the database table according to the mapping condition.
  7. 如权利要求6所述的面向对象模型数据的转换装置,其中,所述转换模块包括:The apparatus for converting object-oriented model data according to claim 6, wherein the conversion module comprises:
    第一判断单元,设置为:获取所述对象类的值,判断所述对象类的值是否为所述映射关系中对应的本对象类的值;The first determining unit is configured to: obtain a value of the object class, and determine whether the value of the object class is a value of the corresponding object class in the mapping relationship;
    第一查找单元,设置为:若所述对象类的值不是本对象类的值,则根据所述映射关系中本对象类及本对象类与其他对象类之间的关系进行查找;The first searching unit is configured to: if the value of the object class is not the value of the object class, search according to the relationship between the object class and the object class and other object classes in the mapping relationship;
    第一转换单元,设置为:根据所述映射条件将查找到的对象类的值转换为所述数据库表中的数据。The first conversion unit is configured to: convert the value of the found object class into data in the database table according to the mapping condition.
  8. 如权利要求6所述的面向对象模型数据的转换装置,其中,所述转换模块包括:The apparatus for converting object-oriented model data according to claim 6, wherein the conversion module comprises:
    第二判断单元,设置为:获取所述对象类的属性,判断所述对象类的属性是否为所述映射关系中对应的本对象类的属性;The second determining unit is configured to: obtain an attribute of the object class, and determine whether the attribute of the object class is an attribute of the corresponding object class in the mapping relationship;
    第二查找单元,设置为:若所述对象类的属性不是本对象类的属性,则根据所述映射关系中本对象类及本对象类与其他对象类之间的关系进行查找; The second search unit is configured to: if the attribute of the object class is not an attribute of the object class, perform a search according to the relationship between the object class and the object class and other object classes in the mapping relationship;
    第二转换单元,设置为:根据所述映射条件将查找到的对象类的属性转换为所述数据库表中的数据。The second conversion unit is configured to: convert the attributes of the found object class into data in the database table according to the mapping condition.
  9. 如权利要求6所述的面向对象模型数据的转换装置,其中,所述转换模块包括:The apparatus for converting object-oriented model data according to claim 6, wherein the conversion module comprises:
    第三判断单元,设置为:获取所述对象类之间的关系,判断所述对象类之间的关系是否为所述映射关系中对应的本对象类与其他对象的关系;The third determining unit is configured to: acquire a relationship between the object classes, and determine whether the relationship between the object classes is a relationship between the corresponding object class and other objects in the mapping relationship;
    第三查找单元,设置为:若所述对象类之间的关系不是本对象类与其他对象的关系,则根据所述映射关系中本对象类及本对象类与其他对象类之间的关系进行查找;The third search unit is configured to: if the relationship between the object classes is not the relationship between the object class and other objects, according to the relationship between the object class and the object class and other object classes in the mapping relationship Find
    第三转换单元,设置为:根据所述映射条件将查找到的对象类之间的关系转换为所述数据库表中的数据。The third conversion unit is configured to: convert the relationship between the found object classes into data in the database table according to the mapping condition.
  10. 一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令用于执行权利要求1-5任一项的方法。 A computer readable storage medium storing computer executable instructions for performing the method of any of claims 1-5.
PCT/CN2015/083982 2014-12-15 2015-07-14 Conversion method and conversion apparatus for object-oriented model data WO2016095509A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410776177.0 2014-12-15
CN201410776177.0A CN105760372A (en) 2014-12-15 2014-12-15 Conversion method and conversion device for object-oriented model data

Publications (1)

Publication Number Publication Date
WO2016095509A1 true WO2016095509A1 (en) 2016-06-23

Family

ID=56125813

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/083982 WO2016095509A1 (en) 2014-12-15 2015-07-14 Conversion method and conversion apparatus for object-oriented model data

Country Status (2)

Country Link
CN (1) CN105760372A (en)
WO (1) WO2016095509A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110750597A (en) * 2018-07-23 2020-02-04 北京国双科技有限公司 Data processing method and device, storage medium and processor

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108054720B (en) * 2017-12-12 2020-02-21 南京国电南自电网自动化有限公司 Modeling method of intelligent substation relay protection device for physical equipment object
CN108427671B (en) * 2018-01-25 2021-06-25 腾讯科技(深圳)有限公司 Information conversion method and apparatus, storage medium, and electronic apparatus

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6754670B1 (en) * 1999-12-17 2004-06-22 International Business Machines Corporation Mapping relational tables to object oriented classes
CN1604082A (en) * 2003-08-29 2005-04-06 微软公司 Mapping architecture for arbitrary data models
CN103714129A (en) * 2013-12-12 2014-04-09 用友软件股份有限公司 Device and method for buildingg dynamic data structures and relationships based on condition rules
CN103793435A (en) * 2012-11-02 2014-05-14 镇江华扬信息科技有限公司 Method for converting object model to database structure

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7043490B2 (en) * 2002-03-05 2006-05-09 International Business Machines Corporation Method, system, and program product to support multiple content-management data models
CN1996281A (en) * 2005-12-26 2007-07-11 北大方正集团有限公司 Method for building content management system
CN101593103B (en) * 2008-05-29 2013-04-17 国际商业机器公司 System and method for simultaneously realizing relation perdurability and semantic network style access
CN103761077A (en) * 2013-10-17 2014-04-30 国家电网公司 Method for mapping and modeling from CIM (Common Information Model) to relational database

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6754670B1 (en) * 1999-12-17 2004-06-22 International Business Machines Corporation Mapping relational tables to object oriented classes
CN1604082A (en) * 2003-08-29 2005-04-06 微软公司 Mapping architecture for arbitrary data models
CN103793435A (en) * 2012-11-02 2014-05-14 镇江华扬信息科技有限公司 Method for converting object model to database structure
CN103714129A (en) * 2013-12-12 2014-04-09 用友软件股份有限公司 Device and method for buildingg dynamic data structures and relationships based on condition rules

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110750597A (en) * 2018-07-23 2020-02-04 北京国双科技有限公司 Data processing method and device, storage medium and processor

Also Published As

Publication number Publication date
CN105760372A (en) 2016-07-13

Similar Documents

Publication Publication Date Title
CN105407024B (en) A kind of isomeric data interoperability methods and device based on distribution subscription communication mechanism
US20220006684A1 (en) Coap-based opc ua message transmission method, and server
JP6663060B2 (en) Semantic gateway modeling method and semantic gateway
US20200097487A1 (en) Novel olap pre-calculation model and modeling method
WO2016019772A1 (en) Method and apparatus for shielding heterogeneous data source
CN105701122A (en) Log collection method, apparatus and system
WO2020062959A1 (en) Data configuration method and apparatus
CN103530724B (en) Manufacturing capacity servitization method based on workflow model
US20140012988A1 (en) Provisioning computer resources on a network
WO2016095509A1 (en) Conversion method and conversion apparatus for object-oriented model data
WO2015154474A1 (en) Query interface generation method and device
JP2009523289A5 (en)
CN105049256A (en) Method and system for realizing universal custom interface message
CN108345691B (en) Data source general processing framework construction method, data source processing method and device
CN105824944B (en) A kind of XML configuration data maintaining method and system based on scripting language
Petrolo et al. Integrating wireless sensor networks within a city cloud
CN103488696A (en) Business query method, device and system of CPE (customer premises equipment), ACS (auto-configuration server) and CPE
CN110888672B (en) Expression engine implementation method and system based on metadata architecture
US20170032052A1 (en) Graph data processing system that supports automatic data model conversion from resource description framework to property graph
WO2019007403A1 (en) Service configuration-driven flow table method and device
WO2020038337A1 (en) Network configuration method, apparatus and system
CN105930410A (en) Data service bus architecture used for data transmission of Internet of Things
Al-Hazmi et al. Towards semantic monitoring data collection and representation in federated infrastructures
CN103139806B (en) Method and base station of the webmaster with base station configuration data decoupling
WO2016058462A1 (en) Method and system for configuring extensible cross-network element service

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15869020

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15869020

Country of ref document: EP

Kind code of ref document: A1