WO2011091708A1 - 多维数据库存储及查询的方法 - Google Patents

多维数据库存储及查询的方法 Download PDF

Info

Publication number
WO2011091708A1
WO2011091708A1 PCT/CN2011/000026 CN2011000026W WO2011091708A1 WO 2011091708 A1 WO2011091708 A1 WO 2011091708A1 CN 2011000026 W CN2011000026 W CN 2011000026W WO 2011091708 A1 WO2011091708 A1 WO 2011091708A1
Authority
WO
WIPO (PCT)
Prior art keywords
entity
state
module
database
identification
Prior art date
Application number
PCT/CN2011/000026
Other languages
English (en)
French (fr)
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 广州市西美信息科技有限公司
Priority to US13/575,597 priority Critical patent/US20120317137A1/en
Publication of WO2011091708A1 publication Critical patent/WO2011091708A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/283Multi-dimensional databases or data warehouses, e.g. MOLAP or ROLAP

Definitions

  • the present invention relates to database technology, and in particular, to a method of multidimensional database storage and query. Background technique
  • the traditional two-dimensional database technology records the same information in the database in the way of event process.
  • the way of storage is "someone does something at a certain time", and the information record table between them is passed through a certain A key column is associated, such as someone, something, and so on.
  • this management method encounters some very multi-dimensional data, it will have many disadvantages, such as causing the data volume and table to be too large, the relationship between data dimension and dimension is difficult to achieve, and it is not conducive to data secondary mining. .
  • the information includes the dimensions of the individual species, the various attributes and characteristics of each individual, the things that individuals do, time and location.
  • the traditional two-dimensional database management method is as follows:
  • the traditional two-dimensional database technology sets the individual category table, and stores all the individuals into the table, for example, into micro-individuals (such as products) and macro-individuals (such as companies), and then Divide the types of microscopic individuals and macroscopic individuals.
  • the traditional two-dimensional database technology establishes a micro-individual information attribute table for each individual, and adds relevant micro-individual attributes to the table, and Make some important attributes that can distinguish different microscopic individuals as non-repeatable items.
  • the 4 bar microscopic individual is then associated with the microscopic individual matter table (Table 3) as a primary association term.
  • Micro-individual such as property attribute 1 attribute 2 attribute 3 attribute 4 ... attribute ⁇ ⁇
  • the subdivision elements are internal components of the macro entity, such as employees in the company. If the company elements can also be subdivided, the subdivision table can be set.
  • the traditional two-dimensional database technology is as shown in Figure 1.
  • the X dimension represents an attribute dimension with an individual association as a hierarchy, wherein the individual category table is associated with each individual's attribute table, and each attribute table is associated with a corresponding individual item table; the Y dimension represents a side by side of the individual category.
  • Individual dimensions such as individual eight, B, C, etc.
  • This traditional two-dimensional database has the following disadvantages when storing and querying multi-dimensional data information.
  • the traditional two-dimensional database recording method is also likely to cause some recording errors in the data table. Because the traditional recording method does not and can not regulate and identify all the fields in the event, the recording error is easy to occur, such as the system will consider apple It is a different product from Apple. In fact, these two are just input errors and express the same product. This method of recording causes a large amount of repetitive and useless content in the database records, resulting in large data redundancy.
  • Embodiments of the present invention are also capable of solving the above and other problems.
  • a multi-dimensional cross database is established, and a three-dimensional, multi-dimensional data storage method is realized with time as the axis, which can overcome the technical defect that the traditional database is difficult to completely store the multi-dimensional information into the database.
  • the present invention can save ever-changing multi-dimensional information (such as market information, etc.) in an optimized manner, thereby saving storage resources.
  • the invention also avoids the complicated update and maintenance workload when the traditional method saves the multi-dimensional information data, and only needs to modify the state of the related entity at a certain time cross-section to realize the update and maintenance of the database, that is, only the entity An event change has occurred before the database needs to be updated.
  • the present invention also provides a query method in a multi-dimensional database, which realizes multi-dimensional information stored in a database and presents it to a user in a traditional two-dimensional manner through time, state, and cross-comparison of entities.
  • FIG. 1 is a schematic diagram of two-dimensional association of a conventional two-dimensional database technology.
  • FIG. 2 is a schematic diagram of the association between individual and elements of a source database in accordance with an embodiment of the present invention.
  • FIG. 3 illustrates an association model between entity tables in accordance with an embodiment of the present invention.
  • FIG. 4 illustrates an association model between state tables in accordance with an embodiment of the present invention.
  • Figure 5 is a process diagram illustrating the process of adding an entity and identifying and storing it with other related entities, states, and to a database, in accordance with an embodiment of the present invention.
  • Figure 6 is a flow diagram illustrating the addition and storage of an entity to other related entities, states, and storage to a database, in accordance with an embodiment of the present invention.
  • Figure 7 is a flow diagram showing a specific implementation of identification and reverse identification in accordance with an embodiment of the present invention.
  • Figure 8 is a flow diagram of specific implementation steps of a query database in accordance with an embodiment of the present invention.
  • FIG. 9 is a flow chart of a data storage method in accordance with an embodiment of the present invention. detailed description
  • the present invention is to implement a multi-dimensional data storage and query method with a time axis as the core, and the specific implementation includes the following aspects.
  • the present invention sets cross-associated data identification for all data relative to the simple identification method of data in the conventional two-dimensional database technology. As shown in Fig. 2, the present invention divides entities into microscopic individuals, macroscopic individuals, and elements, which are defined as follows:
  • Micro-individual refers to entities that cannot be subdivided, such as products and people in the market research industry;
  • Macro individual An entity that can be subdivided, but can also be treated as a whole, such as a country, a legal person, or an industry;
  • Element refers to the component of this macroscopic entity that is formed in a macroscopic individual, such as a province in a country, a product in an industry, or a certain machine in a company.
  • the present invention cross-correlates these entities by identifying individual entities associated with the respective entities in a table of entities.
  • the database will find other entities associated with the entity through the associated identity, such as the name or ID of the associated entity.
  • these cross-correlations can link various physical and state tables.
  • the present invention also sets a reverse identifier, when adding or modifying an entity (also referred to as a subject) of an entity table (the present body) Also referred to herein as receptors, and/or receptors associated with the state of a subject in the state table, the user is also required to perform a reverse identification in the entity table and/or state table of the recipient to ensure The symmetry of the information in the database.
  • the entity table association technique of the present invention will be described in detail below with reference to Tables 7-9.
  • the present invention will set up different two-dimensional data tables 7-9 and define them as entity tables.
  • the entities corresponding to these physical forms can be macroscopic individuals, microscopic individuals, and even elements in macroscopic individuals.
  • the micro-individual entity table of the present invention includes three modules, namely, an entity identification module, an associated entity module, and an attribute module.
  • entity identification module is configured to store an identifier of the micro-entity, such as a name or an ID
  • the associated entity module includes one or more association items to store an identifier of an entity associated with the micro-individual entity in the other entity table
  • attribute module is used to
  • the micro-individual entity table of the present invention also stores various basic attributes of the entity. But the difference is that the associated entity module is added, the associated entity stored in the entity table, the associated entity in another entity table, and the associated entity in other entity table, thereby the entity table and other entity tables Linked together.
  • the macro individual entity table of the present invention includes three modules, namely, an entity identification module, an associated entity module, and an attribute module.
  • the entity tag module is configured to store an identifier of the macro entity, such as a name or an ID
  • the associated entity module includes one or more association items to store an entity name associated with the macro individual entity in the other entity table
  • the attribute module is used to Stores the attributes of the corresponding macro individual entities.
  • Entity ID Entity table with the element entity
  • Identity 7 attribute module of the associated entity The entity name is in this entity table in another entity in the other entity field A field field C field X or ID in the associated table in the associated table in the associated table B
  • a element E element U individual Attribute 1 Attribute 2 Attribute 3 Attribute N
  • the element entity table of the present invention also includes three modules, namely, an entity identification module, an associated entity module, and a property module.
  • entity identification module is configured to store an identifier of the element entity, such as a name or an ID
  • the associated entity module includes one or more associated items to store an entity name associated with the element entity in the other entity table
  • the attribute module is configured to store the corresponding element.
  • the attributes of the entity are configured to store the corresponding element.
  • entity table associations can be set according to different types of entities, such as micro-individuals, macro-individuals, or elements.
  • associations with entities in this table can be set, and associations with entities in other entity tables can also be set for different associations between entities.
  • the associated items are stored in their respective tables.
  • FIG. 3 illustrates an association model between entity tables in accordance with an embodiment of the present invention.
  • the X dimension is a dimension based on the attributes of the entity
  • the Y dimension is a dimension based on the type of the entity.
  • the present invention associates entities in respective entity tables by introducing associated entity modules, and according to these associations, these entity tables can be linked to form a new dimension: entity association dimension (Z dimension).
  • entity association dimension is a new dimension derived from the cross-identification of entities in the present invention.
  • the entity tables After being associated by the association modules defined between the entities, the entity tables become a three-dimensional entity array module as shown in FIG.
  • the present invention In addition to defining an entity table, the present invention also sets the state of recording a multidimensional information entity.
  • the data table the status table.
  • the state table the time dimension is set as the basic dimension of the state table, and the real-time state of various entities associated with it is used as the storage object.
  • the macro individual status table shown in Table 10 and the individual status table shown in Table 11, including the time dimension module are used for a predetermined time granularity (eg, year, month, day, hour, minute, second, etc.)
  • a predetermined time granularity eg, year, month, day, hour, minute, second, etc.
  • the main entity identity module is configured to store the identity of the master entity, such as the name or ID of the master entity; and the state in the state through data identification technology
  • the associated status module set in the table used to store the associated status of the primary entity (such as U) of the status table, including the activities of the primary entity (such as U) and associated entities (such as C, A, Z, etc.) and/or The activities, changes, etc.
  • the main entity such as U
  • the main entity and the associated entity are relative concepts. From a macro perspective, the interacting entities do not have to distinguish between primary and secondary, but if the entity and other entities occur from the perspective of an entity
  • An activity can treat the entity as the primary entity and other entities that are associated with the entity as associated entities. Since the main entity and the same associated entity will have different states, it may be necessary to subdivide the associated state into different categories. For example, suppose U individuals are macroscopic individuals, such as a company. In January 2008, C individuals (a product) X and Y tons were purchased and sold. Tables 10 and Tables are shown in the U and C individual status tables, respectively. Store as shown in 11.
  • Tables 10 and 11 show only the states of the respective associated entities, those skilled in the art will understand that the main entity can not only have various states with other entities, but the main entity itself also undergoes various changes, According to the spirit and principle of the present invention, the change of the main entity itself also belongs to the storage object of the associated state module.
  • the state table is the same as the entity table in the present invention, and the state table can be linked by the cross-identification between the entities and become a state array module.
  • Cross-identification between entities is preceded by reference to Tables 7-9 and 3
  • association module has been set in the entity table to store the identity of the entity associated with the entity in the other entity table, in the state table, in order to save storage space, other entities associated with the primary entity may not be stored.
  • the identity is changed by the identity of the primary entity to find the identity of the associated entity and related attributes in the entity table, thereby potentially incorporating the contents of the entity table into the state table.
  • it is also available
  • the association between the state tables will be one more time dimension than the entity table.
  • information stored by X-dimensional (dimension based on entity association state) and Y-dimensional (dimension-based dimension) forms, for example, a state table 1-36.
  • state tables construct state matrix modules (represented by the various cubes in the figure) by Z-dimensional (entity identification dimension, a new dimension derived from the cross-identification of entities in the present invention).
  • state array modules are related by W dimension (time dimension, the most critical dimension in the state table, actually the dimension that all state tables are associated with). In this way, a four-dimensional association technical solution of the state table module is implemented.
  • the entity table module in the present invention mainly defines various attributes of the entity and related identifiers (including the identifier of the entity and the identifier of the associated entity), and the state table module mainly defines the cross-correlation of the entities with various entities at different times. status. Those related entities in the entity table are associated with the entity, and this activity is stored in the state table of the i main entity.
  • the association module in the entity table also stores the identity of the entity that has a static association with the primary entity.
  • the static association includes, for example, an included relationship, etc.
  • the associated state module in the state table includes activities performed by the primary entity and other associated entities, and includes states in which the primary entity itself occurs, and the like.
  • the entity table module and the state table module can be associated together by the entity identification module to comprehensively reflect the entity's static information and dynamic change information.
  • the appropriate dimension can be selected as a reference to optimize the organization and management of the data to facilitate data storage, query and maintenance operations. For example, when reflecting multidimensional market information, the time dimension can be used as a reference for data storage, query, and maintenance operations, so that multidimensional market information can be effectively processed.
  • the data storage scheme of the present invention constructs interrelated data storage modules by defining several different dimensions, and mainly using time dimension as a reference and using data identification technology, and then multidimensional information according to a storage model composed of data storage modules. Save to the database.
  • Figure 5 is a process diagram illustrating the process of adding an entity and identifying and storing it with other related entities, states, and to a database, in accordance with an embodiment of the present invention.
  • the specific storage steps are as follows (take entity A as an example, entities B and C are stored entities in the database): Step 501, define entity A in the entity table;
  • Step 502 Add a related attribute of the entity A to the attribute module in the entity table.
  • Step 503 Add an identifier of the entity B associated with the entity A.
  • Step 504 Perform reverse identification in the entity table of the corresponding entity B, and perform reverse labeling in the entity table of the entity B to establish an entity matrix module (including the entity A).
  • entity table and the entity table of the entity B) the reverse identifier can be automatically performed;
  • Step 505 Add a state that occurs with the entity B in the state table of the entity A.
  • Step 506 Add a force to the state table of the entity A at a predetermined time granularity. The time when the state with entity B occurred;
  • Step 507 performing reverse identification in the state table of the entity B (including adding a state that occurs with the entity A and a time when the state occurs), thereby establishing a state array module (including an entity A table and an entity B table), where the The identification can be made automatically;
  • Step 508 The database system associates the state tables of entity A and entity B with the time table according to the time attributes of the state table modules of entity A and entity B. ;
  • FIG. 1 One implementation of the specific implementation flow of the identification and reverse identification in the above steps is shown in FIG.
  • the step of adding another associated entity C of entity A is repeated with 503-508.
  • the database system adds the entity table and the state table of the associated entity C to the established entity array module and the state array module, the entity array module and the state array module already contain the entity A, the entity B, and the entity C.
  • the entity table and the state table, and in the state matrix module, the state tables of the entity A, the entity B, and the entity C are associated by the time axis;
  • Figure 6 is a flow diagram illustrating the addition and storage of an entity to other related entities, states, and storage to a database, in accordance with an embodiment of the present invention.
  • Step 600 The process begins.
  • Step 601 Define an entity A in the entity table.
  • Step 602 Add the attribute of entity A.
  • Step 603 Determine whether there is an entity associated with A. If yes, the process proceeds to 604. If not, the process proceeds to 608.
  • Step 604 Add an identifier of the entity associated with the entity A in the entity table, and perform reverse identification in the entity table of the entity associated with the entity A.
  • Step 605 Add the state of the entity A and the associated entity to the associated state module in the state table of the entity A.
  • Step 606 Add the time of the state of the entity A and the associated entity in the state table of the entity A at a predetermined time granularity.
  • Step 607 Perform reverse identification in the state table of the entity associated with the entity A, including the state of the entity A and the time when the state occurs.
  • Step 608 The process ends.
  • the management method is very simple.
  • the entity identifier in the other table will also automatically follow the change.
  • the implementation process of the specific identification and reverse identification is as shown in FIG. 7, for example.
  • the database will determine whether the user is operating the entity table or the state table (step 702), which will be divided into the following two cases:
  • the manager operates to modify the associated entity B (Recipient B) in the table of entity A (Principal A).
  • the system searches the database for a list of entities and implements the association modification in a manner that requires the user to select the recipient (step 703). After the selection, after modifying the user's operation to the database, the system will automatically find the associated information of the associated recipient of the step operation (the entity B in the above example) in the entity table, and automatically in the entity table.
  • the recipient of the table is added and submitted to the manager to confirm the reverse identification work (step 705). If the search does not find the presence of the recipient in the database, the user is required to add the corresponding information to the recipient in the entity table (step 704) to ensure that the reverse identification operation is completed smoothly.
  • the recipients in the state table of adding or modifying subject A are similar to the reverse identification step of the entity table, and are also identified and reversed in the entity table. .
  • the reverse flag of the state table automatically associates the time of the state table of the recipient (step 708).
  • the administrator also needs to confirm the occurrence status of the subject and the recipient in steps 707 and 709.
  • FIG. 7 only exemplifies the identification and reverse identification at the time of adding and modifying operations, the present invention is not limited thereto. Moreover, those skilled in the art will appreciate that the delete operation can also implement identification or reverse identification based on the above scheme.
  • the step of identifying the entity table may include: storing, modifying, or deleting the identity of the associated entity associated with the entity in the entity table in the associated entity module of the entity table.
  • the step of performing the reverse identification on the entity table may include: the step of: the reverse identifier is: searching, in the database, the entity table corresponding to the associated entity by using the identifier of the associated entity, if the corresponding entity table is searched, And storing, modifying, or deleting the identifier of the entity in the associated entity module of the corresponding entity table of the associated entity, if the corresponding entity table is not found, and the related entity module in the entity table is
  • the storage or modification operation creates an entity table for the associated entity and stores or modifies the identity of the entity in an associated entity module in the entity table created for the associated entity.
  • the step of identifying the status table may include: storing in an associated status module of the status table
  • the time dimension module of the state table stores, modifies or deletes the time when the state occurs.
  • the step of performing the reverse identification on the status table may include: the step of: the reverse identifier is: searching, in the database, the status table corresponding to the associated entity by using the identifier of the associated entity, if the corresponding status table is searched, And storing, modifying, or deleting the state of the associated entity and the primary entity in the associated state module of the corresponding state table of the associated entity, and in the time dimension module of the corresponding state table of the associated entity.
  • the present invention can completely store the multi-dimensional information into a multi-dimensional database.
  • the present invention also provides a modular versatility for cross-querying a wide variety of multi-dimensional information and returning query results in a two-dimensional form.
  • multidimensional information can be queried by various dimensions such as entity, state, time, etc., and the query result in the form of a two-dimensional table can be returned.
  • the specific implementation steps of the query are as follows: (Taking the query entity A as an example): The user makes a query request, and queries the activity that the entity A occurs between time 1 and time 2;
  • Step 801 Enter a query request of the user, and issue a query command in the database system.
  • Step 802 Determine whether the entity is recorded in the database. If not, return a query null value in step 803. If yes, in step 804, query An entity table associated with the entity; Step 805, determining whether there are other entity tables associated with the entity, and if not, returning the query result in step 806, displaying the attributes of the entities in the entity table, and if so, in the step 807, reading a record in an entity table associated with the entity, and saving the record to a buffer of the server;
  • Step 808 intercepting the time point in the database, determining whether there is a status table associated with the entity at the intercepted time point, and if so, the step proceeds to 809, and if not, the step proceeds to 810;
  • Step 809 reading a record related to the entity in the state table associated with the entity; Step 810, determining whether there are other state tables associated with the entity, and if not, in step 812, reading the server a buffer, returning a query result, and if so, in step 811, reading a record associated with the entity in other state tables associated with the entity, and saving the record to a buffer of the server; Step 812, reading the buffer of the server, and returning the query result.
  • this table is an example of practical application of the present invention, wherein the F1 column is queried by the entity array module, and the F2 column is the result of querying from the state array module of the entity A, and the F3 column is The timeline intercepts the result, and the F4 column is the result of the source data cross-identification technique.
  • 9 is a flowchart of a data storage method according to an embodiment of the present invention, the method comprising the steps of: 900 a process start; 901 establishing an entity table for storing entity information in a database; 902 storing entity information to the In the entity table; 903 establishes a state table for storing state information of the entity in the database; 904 stores state information of the entity into the state table; 905 associates the entity table with the state table; The time dimension associates the state table; 907 the process ends.
  • the step 901 further includes: setting an entity identifier module, an association entity module, and an attribute module in the entity table, where the entity identifier module is configured to store an identifier of the entity, where the association attribute module is configured to store an attribute of the corresponding entity;
  • the entity module associates multiple entity tables into a three-dimensional entity array module.
  • Step 903 further includes: setting a time dimension module, a main entity identity module, and an association state module in the state table,
  • the primary entity identifier module is configured to store an identifier of the primary entity, where the association state module is configured to store an association state of the primary entity, and use an associated entity module or the state table in an entity table of the primary entity.
  • the associated state module is configured to associate the plurality of state tables into a three-dimensional state matrix module.
  • the step 905 further includes: using the entity identification module in the entity table and the primary entity identity module in the state table to An entity table is associated with the state table; and wherein the data is multidimensional market data.
  • Step 906 further includes: using the time dimension to associate the three-dimensional state matrix module to form a four-dimensional state table association module.
  • the associated entity module is set in the entity table by identification and reverse identification.
  • the step of identifying includes: storing, modifying, or deleting an identifier of an associated entity associated with an entity in the entity table in an associated entity module of the entity table;
  • the identifier of the associated entity searches the database for the entity table corresponding to the associated entity. If the corresponding entity table is searched, the entity is stored, modified, or deleted in the associated entity module of the corresponding entity table of the associated entity.
  • the identity of the entity is stored or modified in an associated entity module in the entity table.
  • the associated status module is set in the status table by identification and reverse identification.
  • the step of identifying includes: storing, modifying, or deleting a state of occurrence of a primary entity and an associated entity in the state table in an associated state module of a state table, and storing in a time dimension module of the state table, Modifying or deleting the time when the state occurs;
  • the step of the reverse identifier includes: searching, in the database, a state table corresponding to the associated entity by using an identifier of the associated entity, and if searching for a corresponding state table, Storing, modifying, or deleting the state of the associated entity and the primary entity in the associated state module of the corresponding state table of the associated entity, and storing in the time dimension module of the corresponding state table of the associated entity, Modifying or deleting the time when the state occurs, if a corresponding state table is not found, and a storage or modification operation is performed in the associated state module of the state table of the main entity, a state table is created for the associated entity.
  • the present invention also provides a data storage structure, comprising: an entity table established in a database for storing entity information; a state table established in the database for storing state information of the entity; the entity table and the A status table is associated, wherein the status table is Use the time dimension to associate.
  • the entity table further includes an entity identifier module, an associated entity module, and an attribute module, where the entity identifier module is configured to store an identifier of the entity, and the attribute module is configured to store an attribute of the corresponding entity; Forming, by the association of the associated entity module, a three-dimensional entity array module; wherein the table further includes a time dimension module, a main day entity identification module, and an associated state module, and the time, the main entity identification module And the associated state module is configured to store an association state of the primary entity, and the associated entity module in the entity table of the primary entity or the state table is adopted between the state table
  • the associated state modules are associated to form a three-dimensional state matrix module that is time-dimensionally associated to form a four-dimensional state table association module.
  • the entity table and the state table are associated by the entity identity module in the entity table and the master entity identity module in the state table.
  • the present invention also provides a method for storing data in the above data storage structure, comprising the steps of: defining an entity in an entity table; adding an attribute of the entity; determining whether there is an entity associated with the entity; Adding an identifier of the associated entity associated with the entity to the entity table, and performing reverse identification in the entity table of the associated entity; adding in the associated state module in the entity's state table a state in which the entity and the associated entity occur; a time at which the state of the entity and the associated entity occurs in the state table of the entity at a predetermined time granularity; reversed in a state table of the associated entity And identifying a time at which the associated entity and the state of the entity occur in a state table of the associated entity at a predetermined time granularity.
  • the present invention also provides a method for querying data stored in the data storage method according to the present invention, comprising the steps of: inputting a query request of a user, issuing a query command in the database system; determining whether the entity is recorded in the database, if not Returning the query null value, if yes, querying the entity table associated with the entity; determining whether there are other entity tables associated with the entity, and if not, returning the query result, displaying the attributes of the entity in the entity table, If yes, read the record in the entity table associated with the entity, and save the record to the buffer of the server; intercept the time point in the database to determine whether there is a state table associated with the entity at the intercepted time point And if yes, reading a record related to the entity in the state table associated with the entity, and if not, determining whether there are other state tables associated with the entity, and if not, reading the buffer of the server Area, returning the result of the query, and if so, reading the other state table associated with the entity with the entity

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Description

多维数据库存储及查询的方法 技术领域
一般而言, 本发明涉及数据库技术, 具体而言, 本发明涉及多维 数据库存储及查询的方法。 背景技术
传统的二维数据库技术, 是以事件过程的方式把不同样的信息记 录到数据库中, 存储的方式是 "某人在某时做了某件事情", 并把彼此 间的信息记录表通过某一关键列进行关联, 如某人、 某事物等。 但这 种管理方式如果在碰到一些非常多维的数据的时候会出现比较多的 缺点, 如造成数据量和表格过大、 数据维与维之间的关系难以实现、 不利于数据二次挖掘等。
对于一些多维的信息如市场研究、 国家动态等, 信息所包含维度 个体种类、 每个个体的各种属性和特征、 个体所做的事情、 时间和地 点等。 在这种多维和繁复的信息存储中, 传统的二维数据库的管理方 法如下:
1、 首先, 如表 1所示, 传统的二维数据库技术设置个体种类表, 把所有的个体分门别类的存储进这个表,例如分为微观个体(如产品) 和宏观个体(如公司) , 然后分出微观个体和宏观个体的种类。
Figure imgf000003_0001
表 1 个体种类表
2、 在建立好个体种类表后, 如表 2 所示, 传统的二维数据库技 术对每一种个体都会建立一个微观个体信息属性表, 把相关的微观个 体属性都添加到这个表中 , 并把一些重要的可以区分不同微观个体的 属性作为不可重复项。 然后 4巴微观个体作为一个主关联项来与微观个 体事项表(表 3 )进行关联。 微观个体 (如产 属性 1 属性 2 属性 3 属性 4 … 属性 Ν σ
α、 )
Α个体 特征 1 特征 2 特征 3 特征 4 • , · 特征 Ν
B个体 特征 Γ 特征 2, 特征 3' 特征 4, • · · 特征 Ν,
C个体 特征 1 " 特征 2" 特征 3" 特征 4" , · · 特征 Ν"
, . , . . , . , . . , , •■ ·
表 2微观个体属性表
Figure imgf000004_0001
表 3微观个体事项表
3、 同样, 如表 4-6所示, 传统的数据库在记录宏观个体的多维信 息的时候, 是在数据库中建立行业的基本的宏观个体信息主表, 然后 再把相关的属性等存储到这个表中。 然后再利用宏观个体来对表 4和 表 5进行关联, 利用元素来对表 5和表 6进行关联。
Figure imgf000004_0002
表 4宏观个体属性表
Figure imgf000004_0003
Bl个体 元素 2 特征 Γ 特征 2, 特征 3, 特征 4' • · · 特征 N'
CI个体 元素 3 特 征 特 征 特 征 特 征 - · - 特 征
1" 2" 3" 4" N"
■■ ·
表 5宏观个体元素属性表
其中, 细分元素是属于宏观个体内部的组成部分, 如公司里面的员工, 如果公司元素中还可以细分, 可再设置细分表。
Figure imgf000005_0001
表 6宏观个体状态表
由此可见, 传统的二维数据库技术的关联方式如图 1所示。 在图 1 中, X维表示以个体关联为层级的属性维, 其中, 个体种类表关联 各个个体的属性表, 而各个属性表关联相应的个体事项表; Y维表示 以个体种类区分的并列的个体维, 例如个体八、 B、 C等。
这种传统的二维数据库在存储和查询多维的数据信息时存在以 下不足。
1 ) 虽然传统的二维数据库可以保证个体信息的独立性与不可重 复性, 但在一个个体表中, 在一定时间段内该个体发生的事项将会非 常多, 导致对于事项表的设置将会非常的复杂, 例如在事项对象中会 出现非常多而且无法预见最终数量的表格栏, 致使无法将事项表设置 成能够记录该个体的全部的多维信息。 如果每一个个体表都存储如此 大量的信息, 最终将会导致整数据库的数据量非常大, 数据表的设置 也会一直无限扩大, 从而浪费大量的存储空间, 并且添加、 删除、 修 改等维护操作会变得非常复杂, ,
2 )传统的二维数据库管理方式一般只是以个体作为表之间的关 联,这仅仅是一维关联, 而其它的属性都统统作为另外一维列于表中。
但如果其它维度如个体的各属性、 发生的各事项之间存在关联, 这种 传统的二维数据库将无法满足这种维与维之间的数据关联。 3 )在传统的二维数据库中, 多维信息的查询也是一件困难的事 情,如图 4的结构,这种数据库仅仅能够查询出的结果是—— "某个体 在某时间发生了某件事"、 "备注"。 但如果这个个体同时发生几件事, 并且这些事件存在交叉的时候(其它维度有关联) , 这些信息就不能 查询出来。 因此,用传统的二维数据库技术存储和查询多维的信息时, 存储的数据并不能充分的利用起来, 很多数据都只能使用一次, 对于 多维数据中潜在的一些价值并不能充分的发挥, 不利于数据的二次挖 掘。
4 )传统的二维数据库的记录方法也容易造成数据表中出现一些 记录误差, 由于传统记录方法没有也无法对事项中的所有字段进行规 范和标识, 导致容易出现记录误差, 如系统将认为 apple与 Apple是 不同的产品, 事实上这两个只是输入的误差, 表达的是同一个产品。 这种记录方法会造成数据库的记录存在大量重复的无用内容, 从而产 生很大的数据冗余度。
综上所述, 现代社会正呈现出多元化的趋势, 所有的数据、 指标 也向着多维的方向去发展, 例如, 要记录一个产品的市场信息, 就包 括生产、 消费、 厂商、 进出口、 时间、 地点等众多的维度。 传统的二 维记录方式在这些数据繁复的多维信息中将会显得捉襟见肘, 无法把 这些多维的信息完全地在数据库里面存储并关联起来, 也就无法进行 有效的查询。 发明内容
本发明的目的在于有效地存储多维数据以便节省存储空间。 本发 明的实施例还能够解决上述和其它问题。
采用本发明的技术方案, 通过建立多维的交叉数据库, 以时间为 轴, 实现立体的, 多维的数据存储方法, 能够克服传统数据库难以把 多维的信息完整地存储到数据库的技术缺陷。
本发明能够把千变万化的多维信息(例如市场信息等) 以优化的 方式保存起来, 从而节省存储资源。 本发明还避免了传统的方法保存 多维信息数据时的繁复的更新、 维护工作量, 只需要在某个时间横截 面, 修改相关实体的状态即可实现数据库的更新和维护, 也就是说只 有实体发生了事件变化才需要更新数据库。 此外, 本发明还提供了多 维的数据库中的查询方法, 通过时间、 状态、 实体的交叉对比, 实现 将数据库中存储的多维信息以传统的二维方式查询出来并呈现给用 户。 附图说明 图 1为传统的二维数据库技术的二维关联示意图。
图 2为根据本发明的实施例的源数据库个体和元素之间相互关联 的示意图。
图 3示出根据本发明的实施例的实体表之间的关联模型。
图 4示出根据本发明的实施例的状态表之间的关联模型。
图 5是说明根据本发明的实施例的添加一个实体并将其与相关的 其它实体、 状态进行标识并存储到数据库的过程示意图。
图 6是说明根据本发明的实施例的添加一个实体并将其与相关的 其它实体、 状态进行标识并存储到数据库的流程图。
图 7是根据本发明的实施例的标识及反向标识的具体实施流程 图。
图 8为根据本发明的实施例的查询数据库的具体实现步骤的流程 图。
图 9是根据本发明的实施例的数据存储方法的流程图。 具体实施方式
本发明要实现一种以时间轴为核心的多维数据存储及查询的方 法, 具体的实施包括以下几个方面。
1. 标识技术
(1)数据的标识方法:
相对于传统的二维数据库技术中对数据的简单标识方法, 本发明 对所有数据设置了交叉关联的数据标识。 如图 2所示, 本发明将实体 分为微观个体、 宏观个体和元素, 这三者的定义如下:
微观个体: 指不能再细分的实体, 如市场研究行业中的产品、 人 等;
宏观个体:指可以再细分,但也可以作为一个整体来对待的实体, 如一个国家、 一个法人或一个行业等;
元素: 指宏观个体中所构成这个宏观个体的组成部分, 如国家中 的省、 行业中的某产品、 企业中的某人某机器等。
本发明通过在各个实体的表中标识出与相应实体相关联的各个 实体, 来把这各个实体交叉关联起来。 当一个实体在数据库中存储或 查询后, 数据库将会通过相关的标识, 例如关联实体的名称或 ID, 来 找到与该实体相关联的其它实体。 另外, 这些交叉的关联能把各种实 体表和状态表联系起来。
(2)反向标识:
为了方便多维数据库的管理, 本发明还设置了反向标识, 当在添 加或修改某个实体表中某实体(本文中也称为主体) 的关联实体(本 文中也称为受体) , 和 /或状态表中与某主体的状态相关的受体时候, 同时也会要求用户在受体的实体表和 /或状态表中进行反向的标识,以 确保数据库中信息的对称性。
本发明的标识与反向标识的具体实施流程参照图 7。
2、 实体表的定义与关联模块:
下面结合表 7-9对本发明的实体表关联技术进行详细的描述。 本 发明将设定不同的二维数据表 7-9, 并将它们定义为实体表。 这些实 体表对应的实体可以是宏观个体、 微观个体, 甚至是宏观个体中的元 素。
10 关联实体模块: 存储其它
实体表中的与该微观实体
^体标识模块 属性模块
Figure imgf000008_0001
Figure imgf000008_0002
15 表 7微观个体实体表
如表 7所示, 本发明的微观个体实体表包括三个模块, 即实体标 识模块、 关联实体模块和属性模块。 实体标识模块用于存储微观实体 的标识, 如名称或 ID, 关联实体模块包括一个或多个关联项来存储其 它实体表中的与该微观个体实体相关联的实体的标识, 属性模块用于
20 存储相应微观个体实体的属性。 与二维数据库一样, 本发明的微观个 体实体表同样存储实体的各种基本属性。 但不同的是增加了关联实体 模块, 用于存储在本实体表中的关联实体, 在另一实体表中的关联实 体以及在其它实体表中的关联实体, 从而将该实体表与其它实体表关 联在一起。
25 关联买体模块: 存储其它
实体表中的与该宏观个体
识模块 属性模块
实体相关联的实体的标识
Figure imgf000009_0001
在本实体表 在另一实体表 在又一实体 芋 芋 芋 芋段 X 中的关联实 中的关联实体 表中的关联 段 A 段 B 段 C
体 实体 联在实中
体其的实
X个体 Ε个体 Α 元素、 B 属性 属性 属性 属性 N 表体它关
元素、 C 元 1 2
素 ......
N/A N/A C元素 属性 属性 属性 属性 K
1 2 3
N/A B个体、 D个体 属性 属性 属性 属性 N
1 2 3
U个体 B个体 属性 属性 属性 属性 N
1 2 3 表 8宏观个体实体表 如表 8所示, 与微观个体实体表相似, 本发明的宏观个体实体表 包括三个模块, 即实体标识模块、 关联实体模块和属性模块。 实体标 10 识模块用于存储宏观实体的标识, 如名称或 ID, 关联实体模块包括一 个或多个关联项来存储其它实体表中的与该宏观个体实体相关联的 实体名称, 属性模块用于存储相应宏观个体实体的属性。
15 关联实体模块: 存储其它
实体标识模块 实体表中的与该元素实体
相关联的实体的标识 7 属性模块
Figure imgf000010_0001
实体名称 在本实体表 在另一实体 在其它实体 字段 A 字 段 字段 C 字段 X 或 ID 中的关联实 表中的关联 表中的关联 B
体 . 实体 实体
A元素 E元素 U个体 属性 1 属性 2 属性 3 属性 N
B元素 H元素 U个体 属性 1 属性 2 属性 3 属性 N
C元素 K元素 U个体、 V个 属性 1 属性 2 属性 3 属性 N 体 表 9元素实体表
如表 9所示, 与微观个体实体表和宏观个体实体表相似, 本发明 的元素实体表也包括三个模块, 即实体标识模块、 关联实体模块和属 性模块。 实体标识模块用于存储元素实体的标识, 如名称或 ID, 关联 实体模块包括一个或多个关联项来存储其它实体表中的与该元素实 体相关联的实体名称, 属性模块用于存储相应元素实体的属性。
如表 7-9所示, 在实体表的关联实体模块中, 可根据该实体种类 的不同, 如微观个体、 宏观个体或元素等, 设置不同种类和数量的实 体表关联项。 首先可设置与在本表中的实体的关联项, 还可 居实体 间的不同的关联情况设置与在其它实体表中的实体的关联项。 对于两 个相互关联的实体, 将分别在它们各自对应的表中存储关联项。
图 3示出根据本发明的实施例的实体表之间的关联模型。 如图所 示, X维是以实体的属性为基准的维度, Y维是以实体的种类为基准 的维度。 本发明通过引入关联实体模块来在各个实体表中对实体进行 了关联, 根据这些关联可以把这些实体表联系起来, 形成一个新的维 度: 实体关联维度(Z维) 。 实体关联维度是根据本发明中对实体进 行的交叉标识所得出的新的维度。 通过在实体间定义的所述关联模块 进行关联后, 这些实体表就成为如图 3所示的三维的实体表阵模块。
3、 状态表的定义及关联模块
除了定义实体表, 本发明中还设定了记录多维信息实体的状态的 数据表, 即状态表。 在状态表中, 设定以时间维度作为状态表的基本 维度, 以与之关联的各种实体的实时状态等作为存储的对象。
例如表 10 所示的宏观个体状态表和表 11 所示的 ^鼓观个体状态 表, 包括时间维度模块, 用于以预定的时间粒度(例如年、 月、 日、 时、 分、 秒等)来存储活动发生的时间, 以便在时间维度上关联各个 状态表中各个实体的活动;主实体标识模块,用于存储主实体的标识, 如主实体的名称或 ID; 以及通过数据标识技术在状态表中设置的关联 状态模块, 用于存储状态表的主实体(如 U ) 的关联状态, 包括主实 体(如 U ) 与关联实体(如 C、 A、 Z等)所发生的活动和 /或主实体 (如 U )本身发生的活动、 变化, 等等。 其中, 主实体和关联实体是 相对的概念, 从宏观上看, 相互关联的各个实体相互作用, 是不必区 分主次的, 而如果从某个实体的角度来看该实体与其它实体的发生的 活动, 则可将该实体视为主实体, 而将与该实体发生关联活动的其它 实体视为关联实体。 由于主实体与同一个关联实体之间都会出现不同 的状态, 所以可能需要将关联状态细分为不同的种类。 例如假设 U个 体是宏观个体, 例如一个公司, 在 2008年 1月份购进和售出了 C个 体(某产品) X和 Y吨, 在 U个体和 C个体的状态表中分别如表 10 和表 11所示进行存储。 虽然表 10和表 11仅示出与各个关联实体的 状态, 但是本领域的技术人员会理解到, 主实体不仅能与其它实体发 生各种状态, 该主实体本身也会发生各种变化, 因此, ^^据本发明的 精神和原理, 主实体本身的变化也属于关联状态模块的存储对象。
关联状态
时间维度 主实体标
模块
Figure imgf000011_0001
态 3 u个体
表 10宏观个体状态表
时间维度 主实体标 关联状态模块
模块 识模块
Figure imgf000012_0001
Figure imgf000012_0002
表 11 微观个体状态表
在状态表之间的关联方面, 如图 4所示, 状态表与本发明中的实 体表一样, 也可以通过实体之间的交叉标识来把状态表联系起来并幵 成状态表阵模块。 实体之间的交叉标识通过前面参照表 7-9和图 3所
10 描述的方案来实现。 因为在实体表中已经设置了关联模块来存储其它 实体表中的与该实体相关联的实体的标识, 所以在状态表中, 为了节 省存储空间, 可以不存储与主实体相关联的其它实体的标识, 而改为 通过主实体的标识来在实体表中查找到关联实体的标识及相关属性, 从而将实体表的内容潜在地结合到状态表中。 作为可选的方案, 也可
15 以在状态表的关联状态模块中找到与主实体相关联的其它实体的标 识。
而且, 由于状态是跟时间有非常大的关系, 所以状态表比起实体 表多出来的一个重要维度就是时间维度, 如表 10和表 11中的时间维 度模块。 因此, 状态表之间的关联将比实体表要多出一个时间维度,
20 是四维的关联。 如图 4所示, 通过 X维(以实体关联状态为基准的维度)和 Y维 (以实体为基准的维度)存储的信息形成例如状态表 1-36。 这些状态 表通过 Z维(实体标识维, 根据本发明中对实体的交叉标识所得出的 新的维度)构建出状态表阵模块(如图中的各个立方体所表示出的)。 这些状态表阵模块通过 W维(时间维, 状态表中最关键的维度, 实际 上把所有的状态表关联起来的维度) 关联起来。 这样, 实现了状态表 模块的四维关联技术方案。
4、 实体表模块与状态表模块之间的关联
本发明中的实体表模块主要是定义实体的各种属性及相关标识 (包括本实体的标识和关联实体的标识) , 状态表模块主要是定义实 体在不同时间上的与各种实体交叉关联的状态。 实体表中的关联模块 联) 的那些关 实体, 而这 活动存储在 i 主实体的状态表中。 除此 之外, 实体表中的关联模块还存储与主实体具有静态关联的实体的标 识。 所述静态关联例如包含与被包含关系等, 状态表中的关联状态模 块包括主实体与其它关联实体发生的活动, 还包括主实体本身发生的 状态, 等等。 实体表模块和状态表模块可通过实体标识模块来关联在 一起, 从而全面地反映实体的静态信息和动态变化信息。 在将实体表 与状态表关联在一起之后, 可以根据需要来选择适当的维度来作为基 准以便对数据进行优化的组织、 管理, 以方便数据的存储、 查询和维 护等操作。 例如, 在反映多维市场信息时, 可以把时间维度作为基准 来进行数据的存储、 查询和维护等操作, 这样, 能够对多维市场信息 进行有效的处理。
5、 处理多维信息的流程:
(1)添加多维信息:
本发明的数据存储方案是通过定义出几个不同的维度, 并主要以 时间维度作为基准并利用数据标识技术来构建相互关联的数据存储 模块, 然后按照数据存储模块构成的存储模型, 把多维信息保存到数 据库中去。
图 5是说明根据本发明的实施例的添加一个实体并将其与相关的 其它实体、 状态进行标识并存储到数据库的过程示意图。 具体存储步 骤如下(以添加实体 A为例,实体 B和 C为数据库中已存储的实体): 步骤 501 , 在实体表中定义实体 A;
步骤 502, 在实体表中的属性模块中添加实体 A的相关属性; 步骤 503 , 添加与实体 A关联的实体 B的标识;
步骤 504, 在对应的实体 B 的实体表中进行反向标识, 通过在实 体 B的实体表中进行反向标识,来建立实体表阵模块(包含实体 A的 实体表和实体 B的实体表) , 所述反向标识可自动进行;
步骤 505, 在实体 A的状态表中添加与实体 B发生的状态; 步骤 506, 以预定的时间粒度在实体 A的状态表中添力。与实体 B 发生状态的时间;
步骤 507,在实体 B的状态表中进行反向标识(包括添加与实体 A 发生的状态以及状态发生的时间) , 从而建立状态表阵模块(包含实 体 A表和实体 B表) , 所述反向标识可自动进行;
步骤 508,数据库系统根据实体 A和实体 B的状态表模块的时间 属性来把实体 A和实体 B的状态表关联到时间轴上。 ;
上述步骤中的标识与反向标识的具体实施流程的一种实现方式 参见图 7。
添加实体 A的另一个关联实体 C的步骤与 503-508重复。当数据 库系统把关联实体 C的实体表和状态表添加到已建立的实体表阵模块 和状态表阵模块中之后, 实体表阵模块和状态表阵模块已经包含实体 A、实体 B和实体 C三者的实体表和状态表,并且在状态表阵模块中, 实体 A、 实体 B和实体 C三者的状态表通过时间轴关联起来;
随着数据库中数据的不断增加, 实体表阵模块与状态表阵模块中 成员的数量将不断增加。
图 6是说明根据本发明的实施例的添加一个实体并将其与相关的 其它实体、 状态进行标识并存储到数据库的流程图。
步骤 600: 过程开始。
步骤 601 : 在实体表中定义一个实体 A。
步骤 602: 添加实体 A的属性。
步骤 603: 判断是否存在与 A发生关联的实体, 若是则过程进行到 604, 若否, 则过程进行到 608。
步骤 604: 在所述实体表中添加与实体 A相关联的实体的标识, 并 在与实体 A关联的实体的实体表中进行反向标识。
步骤 605: 在实体 A的状态表中的关联状态模块中添加实体 A与关 联实体发生的状态。
步骤 606: 以预定的时间粒度在实体 A的状态表中添加实体 A与关 联实体发生的状态的时间。
步骤 607: 在与实体 A关联的实体的状态表中进行反向标识, 包括 实体 A发生的状态以及状态发生的时间。
步骤 608: 过程结束。
(2)管理多维信息
由于本发明中的源数据标识技术是自动反向生成的, 所以相对于 传统的二维数据技术来说, 管理方法非常简单。 当系统中对实体模块 的其中一个标识进行修改的时候, 根据自动反向标识的生成, 在另一 个表的实体标识也会自动跟随着更改。
具体的标识与反向标识的实施流程例如如图 7所示。
首先数据库会判定用户操作的是实体表还是状态表 (步骤 702 ), 将会分以下两种情况:
管理者操作在实体 A (主体 A )的表中修改关联实体 B (受体 B ) , 系统从数据库中搜索实体列表并以要求用户选定受体的方式去实现 这一关联修改(步骤 703 ) , 选定后, 在把用户的操作修改到数据库 的同时, 系统将另外自动在实体表中寻找该步操作的关联受体(上述 例子中的实体 B ) 的关联信息, 并自动在实体表中添加该表的受体, 同时提交给管理者对该反向标识工作进行确认(步骤 705 ) 。 如果该 步搜索并没有找到数据库中存在该受体, 则要求用户必须在实体表中 添加该受体相对应的信息 (步骤 704 ) , 以保证该反向标识操作能顺 利完成。
由于状态表的本身也与实体表相关联, 所以在添加或修改主体 A 的状态表中的受体则与实体表的反向标识步骤较为类似, 也要在实体 表中进行标识和反向标识。 不同点在于, 由于状态表比实体表多出了 一个时间维, 所以状态表的反向标识中除了标识实体, 还会对受体的 状态表的时间进行自动关联(步骤 708 ) 。 另外, 由于状态反向标识 的不可预测性, 管理者还需在步骤 707和 709中对主体和受体的发生 状态进行确认。
虽然图 7仅举例说明了在添加和修改操作时的标识和反向标识 , 但是本发明不限于此。 而且, 本领域的技术人员会理解, 删除操作也 可以基于上述方案来实现标识或反向标识。
综上所述, 对实体表进行标识的步骤可包括: 在实体表的关联实 体模块中存储、 修改或删除与所述实体表中的实体相关联的关联实体 的标识。
对实体表进行反向标识的步骤可包括: 所述反向标识的步骤包 括: 通过所述关联实体的标识在数据库中搜索与所述关联实体对应的 实体表, 如果搜索到对应的实体表, 则在所述关联实体的对应的实体 表的关联实体模块中存储、 修改或删除所述实体的标识, 如果未搜索 到对应的实体表, 并且在所述实体表的关联实体模块中进行的是存储 或修改操作, 则为所述关联实体创建实体表, 并在为所述关联实体而 创建的实体表中的关联实体模块中存储或修改所述实体的标识。
对状态表进行标识的步骤可包括: 在状态表的关联状态模块中存 所述状态表的时间维度模块中存储、 修改或删除所述状态发生的时 间。
对状态表进行反向标识的步骤可包括: 所述反向标识的步骤包 括: 通过所述关联实体的标识在数据库中搜索与所述关联实体对应的 状态表, 如果搜索到对应的状态表, 则在所述关联实体的对应的状态 表的关联状态模块中存储、 修改或删除所述关联实体与所述主实体发 生的状态, 并在所述关联实体的对应的状态表的时间维度模块中存 储、 修改或删除所述状态发生的时间, 如果未搜索到对应的状态表, 并且在所述主实体的状态表的关联状态模块中进行的是存储或修改 操作, 则为所述关联实体创建状态表, 并在为所述关联实体而创建的 状态表中的关联状态模块中存储或修改所述关联实体与所述主实体 发生的状态, 并在所述关联实体的对应的状态表的时间维度模块中存 储或修改所述状态发生的时间。
6、 数据库查询模块
在数据存储结构设置好后, 本发明能够非常完整地把多维信息分 门别类保存到多维数据库中。 另外, 本发明还提供了一种模块化通用 性交叉查询各种各样的多维信息的情况,并返回二维表格形式的查询 结果。 具体地说, 在本发明中, 可以通过实体、 状态、 时间等各个维 度进行对多维信息进行查询并返回二维表格形式的查询结果。
如图 8所示,查询的具体实现步骤如下: (以查询实体 A为例): 用户提出查询请求,查询实体 A在时间点 1到时间点 2之间发生 的活动;
步骤 801, 输入用户的查询要求,在数据库系统中发出查询命令; 步骤 802, 判断数据库中是否记录了该实体, 若否, 则在步骤 803返回 查询空值, 若是, 则在步骤 804, 查询出与该实体相关联的实体表; 步骤 805 , 判断是否还存在与该实体关联的其它实体表, 若否, 则在步骤 806, 返回查询结果, 显示实体表中实体的属性, 若是, 则 在步骤 807, 读取与该实体关联的实体表中的记录, 并将记录保存至 服务器的緩沖区;
步骤 808 , 在数据库中截取时间点, 判断在所截取的时间点上是 否存在与该实体关联的状态表, 若是, 则步骤进行到 809, 若否, 则 步骤进行到 810;
步骤 809, 读取与该实体相关联的状态表中与该实体相关的记录; 步骤 810, 判断是否还存在与该实体相关联的其它状态表, 若否, 则在步骤 812, 读取服务器的緩沖区, 返回查询结果, 若是, 则在步 骤 811 , 读取与该实体相关联的其它状态表中与该实体相关的记录, 并将记录保存至服务器的緩冲区; 步骤 812, 读取服务器的缓冲区, 返回查询结果。
如表 12所示, 此表是本发明实际应用的例子, 其中 F1栏由实体 表阵模块中查询出来的结果, F2栏为从实体 A的状态表阵模块中查 询出来的结果, F3栏为时间轴截取结果, F4栏为源数据交叉标识技 术呈现的结果。
Figure imgf000017_0001
F1 F3
表 12 多维数据库查询模块查询结果
图 9是根据本发明的实施例的数据存储方法的流程图, 所述方法 包括以下步骤: 900 过程开始; 901 在数据库中建立用于存储实体信 息的实体表; 902 将实体信息存储到所述实体表中; 903 在数据库中 建立用于存储实体的状态信息的状态表; 904将实体的状态信息存储 到所述状态表中; 905 将所述实体表与所述状态表相关联; 906 采用 时间维度来关联所述状态表; 907 过程结束。
步骤 901进一步包括: 在实体表中设置实体标识模块、 关联实体 模块和属性模块, 所述实体标识模块用于存储实体的标识, 所述关联 所述属性模块用于存储相应实体的属性; 采用关联实体模块将多个实 体表关联起来, 构造成三维实体表阵模块。 步骤 903进一步包括: 在 状态表中设置时间维度模块、 主实体标识模块和关联状态模块, 所述 间, 所述主实体标识模块用于存储主实体的标识, 所述关联状态模块 用于存储所述主实体的关联状态; 采用所述主实体的实体表中的关联 实体模块或所述状态表中的关联状态模块来把多个状态表关联起来, 构造成三维状态表阵模块; 其中, 步骤 905进一步包括: 通过实体表 中的实体标识模块与状态表中的主实体标识模块来将所述实体表与 所述状态表相关联; 以及其中, 所述数据是多维市场数据。 步骤 906 进一步包括: 釆用时间维度来关联所述三维状态表阵模块以构成四维 状态表关联模块。
通过标识和反向标识来在实体表中设置所述关联实体模块。 其 中, 所述标识的步骤包括: 在实体表的关联实体模块中存储、 修改或 删除与所述实体表中的实体相关联的关联实体的标识; 所述反向标识 的步骤包括: 通过所述关联实体的标识在数据库中搜索与所述关联实 体对应的实体表, 如果搜索到对应的实体表, 则在所述关联实体的对 应的实体表的关联实体模块中存储、 修改或删除所述实体的标识, 如 果未搜索到对应的实体表, 并且在所述实体表的关联实体模块中进行 的是存储或修改操作, 则为所述关联实体创建实体表, 并在为所述关 联实体而创建的实体表中的关联实体模块中存储或修改所述实体的 标识。
通过标识和反向标识来在状态表中设置所述关联状态模块。 其 中, 所述标识的步骤包括: 在状态表的关联状态模块中存储、 修改或 删除所述状态表中的主实体与关联实体发生的状态, 并在所述状态表 的时间维度模块中存储、 修改或删除所述状态发生的时间; 所述反向 标识的步骤包括: 通过所述关联实体的标识在数据库中搜索与所述关 联实体对应的状态表, 如果搜索到对应的状态表, 则在所述关联实体 的对应的状态表的关联状态模块中存储、 修改或删除所述关联实体与 所述主实体发生的状态, 并在所述关联实体的对应的状态表的时间维 度模块中存储、 修改或删除所述状态发生的时间, 如果未搜索到对应 的状态表, 并且在所述主实体的状态表的关联状态模块中进行的是存 储或修改操作, 则为所述关联实体创建状态表, 并在为所述关联实体 而创建的状态表中的关联状态模块中存储或修改所述关联实体与所 述主实体发生的状态, 并在所述关联实体的对应的状态表的时间维度 模块中存储或修改所述状态发生的时间。
上述反向标识的步骤可自动进行。
本发明还提供了一种数据存储结构, 包括: 在数据库中建立的用 于存储实体信息的实体表; 在数据库中建立的用于存储实体的状态信 息的状态表; 所述实体表与所述状态表相关联, 其中, 所述状态表釆 用时间维度来关联。 其中, 所述实体表进一步包括实体标识模块、 关 联实体模块和属性模块, 所述实体标识模块用于存储实体的标识, 所 的标识, 所述属性模块用于存储相应实体的属性; 所述实体表之间通 过所述关联实体模块的关联而形成三维实体表阵模块; 其中, 所述状 表进一步包括时间维度模块、 主日实体标识模块和关联状态模块, 所 时间, 所述主实体标识模块用于存储所述主实体的标识, 所述关联状 态模块用于存储所述主实体的关联状态; 所述状态表之间采用所述主 实体的实体表中的关联实体模块或所述状态表中的关联状态模块来 关联以形成三维状态表阵模块, 所述三维状态表阵模块采用时间维度 来关联以形成四维状态表关联模块。 其中, 所述实体表与所述状态表 之间通过实体表中的实体标识模块与状态表中的主实体标识模块来 关联。
本发明还提供了一种在上述数据存储结构中存储数据的方法, 包 括以下步骤: 在实体表中定义实体; 添加所述实体的属性; 判断是否 存在与所述实体发生关联的实体; 若是, 则在所述实体表中添加与所 述实体相关联的关联实体的标识, 并在与所述关联实体的实体表中进 行反向标识; 在所述实体的状态表中的关联状态模块中添加所述实体 与关联实体发生的状态; 以预定的时间粒度在所述实体的状态表中添 加所述实体与所述关联实体发生的状态的时间; 在所述关联实体的状 态表中进行反向标识, 并且以预定的时间粒度在所述关联实体的状态 表中添加所述关联实体与所述实体发生的状态的时间。
本发明还提供了一种查询按照本发明的数据存储方法存储的数 据的方法, 包括以下步骤: 输入用户的查询要求, 在数据库系统中发 出查询命令; 判断数据库中是否记录了该实体, 若否, 则返回查询空 值, 若是, 则查询出与该实体相关联的实体表; 判断是否还存在与该 实体关联的其它实体表, 若否, 则返回查询结果, 显示实体表中实体 的属性, 若是, 则读取与该实体关联的实体表中的记录, 并将记录保 存至服务器的緩沖区; 在数据库中截取时间点, 判断在所截取的时间 点上是否存在与该实体关联的状态表, 若是, 则读取与该实体相关联 的状态表中与该实体相关的记录, 若否, 则判断是否还存在与该实体 相关联的其它状态表, 若否, 则读取服务器的緩冲区,返回查询结果, 若是, 则读取与该实体相关联的其它状态表中与该实体相关的记录, 并将记录保存至服务器的緩冲区; 读取服务器的緩冲区, 返回查询结 果。
本说明中提到 "一个实施例,,或 "实施例"等表示结合该实施例描述 的特定特征、 结构或特性包含在本发明所涵盖的至少一个实现方式 中。 因此, 词语"一个实施例"或"实施例"等的出现不一定表示相同的 实施例。 此外, 特定特征、 结构或特性可通过与所述的特定实施例不 同的其它适当形式来创立, 并且所有这类形式均可为本发明所覆盖。
虽然以上结合的具体实施例对本发明进行了详细描述, 但是本领 域的技术人员会理解, 可在不背离本发明精神和范围的前提下, 对本 发明进行各种修改和改变(例如, 可在不背离本发明的精神和范围的 前提下, 对各个技术方案及其技术特征进行各种修改和组合) , 而这 些修改和改变都被认为落入本发明的范围内。

Claims

权 利 要 求
1. 一种数据存储方法, 包括以下步骤:
a)在数据库中建立用于存储实体信息的实体表;
b)将实体信息存储到所述实体表中;
c)在数据库中建立用于存储实体的状态信息的状态表; d)将实体的状态信息存储到所述状态表中;
e)将所述实体表与所述状态表相关联;
f) 采用时间维度来关联所述状态表。
2. 如权利要求 1所述的方法, 其中, 步骤 a)进一步包括: 在实体表中设置实体标识模块、 关联实体模块和属性模块, 所述 实体标识模块用于存储实体的标识, 所述关联实体模块用于存储其它 实体表中的与所述实体相关联的实体的标识, 所述属性模块用于存储 相应实体的属性;
采用关联实体模块将多个实体表关联起来, 构造成三维实体表阵 模块;
其中, 步骤 c)进一步包括:
在状态表中设置时间维度模块、 主实体标识模块和关联状态模 块, 所述时间维度模块用于以预定的时间粒度来存储主实体的状态发 生的时间, 所述主实体标识模块用于存储主实体的标识, 所述关联状 态模块用于存储所述主实体的关联状态;
釆用所述主实体的实体表中的关联实体模块或所述状态表中的 关联状态模块来把多个状态表关联起来, 构造成三维状态表阵模块; 其中, 步骤 e)进一步包括: 通过实体表中的实体标识模块与状态 表中的主实体标识模块来将所述实体表与所述状态表相关联; 以及 其中, 所述数据是多维市场数据。
3. 如权利要求 2所述的方法, 其中, 步骤 f)进一步包括: 采用时间维度来关联所述三维状态表阵模块以构成四维状态表 关联模块。
4. 如权利要求 2所述的方法, 其中, 通过标识和反向标识来在实 体表中设置所述关联实体模块。
5. 如权利要求 4所述的方法, 其中,
所述标识的步骤包括: 在实体表的关联实体模块中存储、 修改或 删除与所述实体 中的实体相关联的关联实体的标识;
所述反向标识的步驟包括: 通过所述关联实体的标识在数据库中 搜索与所述关联实体对应的实体表, 如果搜索到对应的实体表, 则在 所述关联实体的对应的实体表的关联实体模块中存储、 修改或删除所 述实体的标识, 如果未搜索到对应的实体表, 并且在所述实体表的关 联实体模块中进行的是存储或修改操作, 则为所述关联实体创建实体 表, 并在为所述关联实体而创建的实体表中的关联实体模块中存储或 修改所述实体的标识。
6. 如权利要求 2所述的方法, 其中, 通过标识和反向标识来在状 态表中设置所述关联状态模块。
7. 如权利要求 6所述的方法, 其中,
所述标识的步骤包括: 在状态表的关联状态模块中存储、 修改或 删除所述状态表中的主实体与关联实体发生的状态, 并在所述状态表 的时间维度模块中存储、 修改或删除所述状态发生的时间;
所述反向标识的步骤包括: 通过所述关联实体的标识在数据库中 搜索与所述关联实体对应的状态表, 如果搜索到对应的状态表, 则在 所述关联实体的对应的状态表的关联状态模块中存储、 修改或删除所 述关联实体与所述主实体发生的状态, 并在所述关联实体的对应的状 态表的时间维度模块中存储、 修改或删除所述状态发生的时间, 如果 未搜索到对应的状态表, 并且在所述主实体的状态表的关联状态模块 中进行的是存储或修改操作, 则为所述关联实体创建状态表, 并在为 所述关联实体而创建的状态表中的关联状态模块中存储或修改所述 关联实体与所述主实体发生的状态, 并在所述关联实体的对应的状态 表的时间维度模块中存储或修改所述状态发生的时间。
8. 如权利要求 5或 7所述的方法, 其中, 自动进行所述反向标识 的步骤。
9. 一种数据存储结构, 包括:
在数据库中建立的用于存储实体信息的实体表;
在数据库中建立的用于存储实体的状态信息的状态表; 所述实体表与所述状态表相关联,
其中, 所述状态表采用时间维度来关联。
10. 如权利要求 9所述的数据存储结构, 其中, 所述实体表进一 步包括实体标识模块、 关联实体模块和属性模块, 所述实体标识模块 用于存储实体的标识, 所述关联实体模块用于存储其它实体表中的与 所述实体相关联的实体的标识, 所述属性模块用于存储相应实体的属 性;
所述实体表之间通过所述关联实体模块的关联而形成三维实体 表阵模块;
其中, 所述状态表进一步包括时间维度模块、 主实体标识模块和 关联状态模块, 所述时间维度模块用于以预定的时间粒度来存储主实 体的状态发生的时间, 所述主实体标识模块用于存储所述主实体的标 识, 所述关联状态模块用于存储所述主实体的关联状态; 所述状态表 的关联状态模块来关 ^以形 λ三维状态表阵 块, 所^! 三维状态表阵模块采用时间维度来关联以形成四维状态表关联模块。 块与状态表中的主实体标识模块来关联。
11. 一种在如权利要求 9-10所述的数据存储结构中存储数据的方 法, 包括以下步骤:
在实体表中定义实体;
添加所述实体的属性;
判断是否存在与所述实体发生关联的实体;
若是, 则在所述实体表中添加与所述实体相关联的关联实体的标 识, 并在与所述关联实体的实体表中进行反向标识;
在所述实体的状态表中的关联状态模块中添加所述实体与关联 实体发生的状态;
以预定的时间粒度在所述实体的状态表中添加所述实体与所述 关联实体发生的状态的时间;
在所述关联实体的状态表中进行反向标识, 并且以预定的时间粒 度在所述关联实体的状态表中添加所述关联实体与所述实体发生的 状态的时间。
12. 一种查询按照权利要求 1-8所述的方法存储的数据的方法, 包 括以下步骤:
输入用户的查询要求, 在数据库系统中发出查询命令;
判断数据库中是否记录了该实体,
若否, 则返回查询空值,
若是, 则查询出与该实体相关联的实体表;
判断是否还存在与该实体关联的其它实体表,
若否, 则返回查询结果, 显示实体表中实体的属性,
若是, 则读取与该实体关联的实体表中的记录, 并将记录保存至 服务器的緩沖区;
在数据库中截取时间点, 判断在所截取的时间点上是否存在与该 实体关联的状态表, 若是, 则读取与该实体相关联的状态表中与该实 体相关的记录, 若否, 则判断是否还存在与该实体相关联的其它状态 表, 若否, 则读取服务器的緩沖区, 返回查询结果, 若是, 则读取与 该实体相关联的其它状态表中与该实体相关的记录, 并将记录保存至 服务器的缓冲区; fi
读取服务器的緩冲区, 返回查询结果。
PCT/CN2011/000026 2010-01-28 2011-01-06 多维数据库存储及查询的方法 WO2011091708A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US13/575,597 US20120317137A1 (en) 2010-01-28 2011-01-06 Method for multi-dimensional database storage and inquiry

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201010104308.2 2010-01-28
CN201010104308.2A CN102141992B (zh) 2010-01-28 2010-01-28 多维数据库存储及查询的方法

Publications (1)

Publication Number Publication Date
WO2011091708A1 true WO2011091708A1 (zh) 2011-08-04

Family

ID=44318656

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/000026 WO2011091708A1 (zh) 2010-01-28 2011-01-06 多维数据库存储及查询的方法

Country Status (3)

Country Link
US (1) US20120317137A1 (zh)
CN (1) CN102141992B (zh)
WO (1) WO2011091708A1 (zh)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102236662B (zh) * 2010-04-23 2013-09-25 广州市西美信息科技有限公司 数据库查询和控制方法
CN103544157B (zh) * 2012-07-11 2017-08-15 阿里巴巴集团控股有限公司 一种数据的存储方法和设备
CN103425772B (zh) * 2013-08-13 2016-08-10 东北大学 一种具有多维信息的海量数据查询方法
CN104657370B (zh) * 2013-11-19 2018-09-04 中国移动通信集团天津有限公司 一种实现多维立方体关联的方法和装置
CN104573133A (zh) * 2015-02-13 2015-04-29 广州神马移动信息科技有限公司 存储数据的方法和设备
CN105353994B (zh) * 2015-12-11 2019-10-22 上海斐讯数据通信技术有限公司 三维结构的数据存储方法及装置、查询方法及装置
CN108573010B (zh) * 2017-08-25 2020-06-19 北京金山云网络技术有限公司 关联异构系统同义数据的方法、装置、电子设备及介质
CN107844600A (zh) * 2017-11-23 2018-03-27 浪潮软件集团有限公司 一种数据存储方法和装置
CN111382990A (zh) * 2018-12-29 2020-07-07 达丰(上海)电脑有限公司 信息关联管理方法及其装置、设备和存储介质
CN110175173B (zh) * 2019-05-24 2021-03-26 全知科技(杭州)有限责任公司 一种基于数据特征分析的业务系统主数据识别与区分方法
CN110704548B (zh) * 2019-09-30 2021-12-10 北京元年科技股份有限公司 用于多维数据库的筛选有效计算数据的系统和方法
CN113934705A (zh) * 2021-09-17 2022-01-14 华润置地控股有限公司 数据中台、数据资产建设方法和相关装置
CN114356972B (zh) * 2021-12-03 2022-08-23 四川科瑞软件有限责任公司 一种数据处理方法、基于事件时间的检索方法和装置
CN114780654B (zh) * 2022-05-27 2022-11-15 河北省科学技术情报研究院(河北省科技创新战略研究院) 一种多源主附实体结构模块化构建的处理方法

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1999023585A1 (en) * 1997-11-05 1999-05-14 Amazon.Com, Inc. System and method for selecting rows from dimensional databases
CN1414495A (zh) * 2001-08-22 2003-04-30 株式会社小松制作所 数据库管理系统及数据库
CN1564160A (zh) * 2004-04-22 2005-01-12 重庆市弘越科技有限公司 建立及查询多维数据立方体的方法

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5999924A (en) * 1997-07-25 1999-12-07 Amazon.Com, Inc. Method and apparatus for producing sequenced queries
US7194465B1 (en) * 2002-03-28 2007-03-20 Business Objects, S.A. Apparatus and method for identifying patterns in a multi-dimensional database
US8239248B2 (en) * 2007-03-07 2012-08-07 Microsoft Corporation Techniques to manage information for dynamic reports using time periods for a business model

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1999023585A1 (en) * 1997-11-05 1999-05-14 Amazon.Com, Inc. System and method for selecting rows from dimensional databases
CN1414495A (zh) * 2001-08-22 2003-04-30 株式会社小松制作所 数据库管理系统及数据库
CN1564160A (zh) * 2004-04-22 2005-01-12 重庆市弘越科技有限公司 建立及查询多维数据立方体的方法

Also Published As

Publication number Publication date
CN102141992B (zh) 2015-04-29
US20120317137A1 (en) 2012-12-13
CN102141992A (zh) 2011-08-03

Similar Documents

Publication Publication Date Title
WO2011091708A1 (zh) 多维数据库存储及查询的方法
CA2858680C (en) Systems and methods for improving database performance
JP4385387B1 (ja) 属性付きキー・バリュー・ストアによるデータベース・システム
US6502088B1 (en) Method and system for improved access to non-relational databases
US20240078229A1 (en) Generating, accessing, and displaying lineage metadata
US9508048B2 (en) System and method for integrated real time reporting and analytics across networked applications
CN102918530B (zh) 数据集市自动化
US20040015486A1 (en) System and method for storing and retrieving data
US9223847B2 (en) Using dimension substitutions in OLAP cubes
US9633095B2 (en) Extract, transform and load (ETL) system and method
US6823334B2 (en) Metadata system for managing data mining environments
Agarwal et al. Approximate incremental big-data harmonization
CN109947741B (zh) 一种物项属性参数的建模和存储方法
US20070288425A1 (en) Complex data assembly identifier thesaurus
JP2004030221A (ja) 変更対象テーブル自動検出方法
WO2011132076A1 (zh) 数据库查询和控制方法
Suri et al. A comparative study between the performance of relational & object oriented database in Data Warehousing
WO2010150750A1 (ja) 属性付きキーバリューストアによるデータベース管理装置及び、そのキーバリューストア構造キャッシュ装置
US8527552B2 (en) Database consistent sample data extraction
US11372943B2 (en) Custom types controller for search engine support
CN102193979A (zh) 图形数据库非联机事务中查询数据的控制方法
CN102193975B (zh) 图形数据库联机事务中事务提交机制的实现方法
Ramesh et al. Implementation of atomicity and snapshot isolation for multi-row transactions on column oriented distributed databases using rdbms
US12093289B2 (en) Relationship-based display of computer-implemented documents
Ilkhomjon et al. About Database (Db)

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: 11736590

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 13575597

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 11736590

Country of ref document: EP

Kind code of ref document: A1