A data processing method and device based on data dependency
By creating a dependency subject table, information entry table, and dependency relationship table for data packets to record the dependencies between metadata, the code development problem of adding new data access requirements in the database is solved, and the flexibility and automation of data access are realized.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI SHUHUI SYST TECH CO LTD
- Filing Date
- 2023-02-08
- Publication Date
- 2026-04-24
AI Technical Summary
In existing technologies, adding new data access requirements to a database requires technical personnel to develop code or update programs, resulting in high development costs.
By creating a dependency subject table, information entry table, and dependency relationship table for data packets, the data packet name, metadata, and the dependencies between metadata are recorded, realizing a chain structure of data packets. Data is accessed and stored using the dependency relationship table without the need for code development or program updates.
Without modifying the code, it meets the new data access requirements, reduces development difficulty and technical threshold, and achieves flexibility and automation in data access.
Smart Images

Figure CN116010422B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a data processing method and apparatus based on data dependency. Background Technology
[0002] When using databases to store data, the data is often split into different tables for clearer data organization. For example, when a school builds a database, it stores teacher information, class information, and student information in separate tables. However, database tables often have complex relationships. For instance, a teacher can teach multiple classes, so one teacher's information in the teacher information table may correspond to multiple classes in the class information table; similarly, a class can include multiple students, so one class's information in the class information table may correspond to multiple students in the student information table.
[0003] In existing technologies, data retrieval from databases is handled by technicians who write program code according to predetermined data rules. Corresponding access methods or trigger buttons are then provided for data storage and retrieval. This workflow requires technicians to develop code or update programs to meet new data access needs, thus increasing development costs. Therefore, how to meet new data access needs without requiring code development or program updates is a pressing issue that needs to be addressed. Summary of the Invention
[0004] In view of this, the main objective of this application is to provide a data processing method and apparatus based on data dependency, so as to meet the new data access requirements without code development or program updates.
[0005] The first aspect of this application provides a data processing method based on data dependency, the method comprising:
[0006] Create a dependency body table for the data packet, which includes the data packet name;
[0007] Create an information entry table for the data packet. The information entry table includes multiple metadata in the data packet. The metadata includes metadata names, and each metadata corresponds to a database table.
[0008] Create a dependency table for the data package. The dependency table includes data fields of multiple metadata and the dependencies between data fields in the metadata and data fields in other metadata.
[0009] Obtain the dependency subject table by pre-entering the data packet name;
[0010] Retrieve the data packets belonging to the dependency body table based on the dependency body table;
[0011] Retrieve the information entry table and dependency table from the data packet.
[0012] In some implementations of the first aspect of this application, the data fields include primary key fields and foreign key fields, and the dependencies are established by setting the data fields as primary key fields or foreign key fields.
[0013] In some implementations of the first aspect of this application, the method further includes:
[0014] Retrieve the entry metadata name and entry fields;
[0015] The entry metadata is retrieved from the information entry table based on the entry metadata name. The entry metadata is one of multiple metadata.
[0016] In some implementations of the first aspect of this application, the method further includes:
[0017] Based on the entry field, perform a data query on the database table corresponding to the entry metadata to obtain the query result data;
[0018] Store the query results in the results pool.
[0019] In some implementations of the first aspect of this application, the query result data carries an identifier value of the entry field, and the method further includes:
[0020] Mark the data field to which the entry field belongs in the entry metadata as the current data field, and perform data query in at least one query stage;
[0021] Each query stage includes: determining whether the current data field has dependent metadata based on the dependency table, where the data field in the dependent metadata has a dependency relationship with the current data field, and the dependent metadata is one of multiple metadata; if the current data field has dependent metadata, then the query result data of the current stage is obtained from the database table corresponding to the dependent metadata based on the identifier value and stored in the result pool, and the data field in the dependent metadata that has a dependency relationship with the current data field is marked as the current data field of the next query stage; if the current data field does not have dependent metadata, then the data query ends.
[0022] In some implementations of the first aspect of this application, the method further includes:
[0023] Assemble the query result data in the result pool according to a preset data format to obtain the query results;
[0024] Output the query results.
[0025] In some implementations of the first aspect of this application, the method further includes:
[0026] Store the field values of the entry field in the database table corresponding to the entry metadata.
[0027] In some implementations of the first aspect of this application, the method further includes:
[0028] Retrieve the identifier value of the entry field from the database table corresponding to the entry metadata;
[0029] Mark the data field to which the entry field belongs in the entry metadata as the current data field, and store it in at least one storage stage;
[0030] Each storage stage includes: determining whether the current data field has dependent metadata based on the dependency table; if the data field in the dependent metadata has a dependency relationship with the current data field, and the dependent metadata is one of multiple metadata; if the current data field has dependent metadata, then setting an identifier value for the entry field, storing the field value and the identifier value of the entry field in the database table corresponding to the dependent metadata, and marking the data field in the dependent metadata that has a dependency relationship with the current data field as the current data field of the next storage stage; if the current data field does not have dependent metadata, then ending the data storage.
[0031] In some implementations of the first aspect of this application, the default data format is JSON.
[0032] A second aspect of this application provides a data processing apparatus based on data dependency, the apparatus comprising:
[0033] The first creation unit is used to create a dependency body table for the data packet, which includes the data packet name;
[0034] The second creation unit is used to create an information entry table for the data packet. The information entry table includes multiple metadata in the data packet. The metadata includes metadata names, and each metadata corresponds to a database table.
[0035] The third creation unit is used to create a dependency table for the data package. The dependency table includes data fields of multiple metadata and the dependency relationships between data fields in the metadata and data fields in other metadata.
[0036] The first acquisition unit is used to acquire the dependency subject table by pre-inputting data packet name;
[0037] The second acquisition unit is used to acquire the data packets belonging to the dependency subject table based on the dependency subject table;
[0038] The third acquisition unit is used to obtain the information entry table and dependency table from the data packet.
[0039] Compared with the prior art, the technical solution provided in this application has the following beneficial effects:
[0040] This application creates a first data table as a dependency subject table for the data packet, which includes the data packet name; a second data table as an information entry table for the data packet, which includes multiple metadata, each metadata name, and each metadata corresponding to a pre-stored database table; and a third data table as a dependency relationship table for the data packet, which includes the data fields of each metadata and the dependencies between the data fields of the metadata and the data fields of other metadata. This enables the processing of data tables in the data packet through data dependency configuration, forming a chain structure for the data packet with clear dependencies between the database tables. When data access is based on this chain structure, no technical personnel need to develop or update the program when new data access requirements are added. Attached Figure Description
[0041] Figure 1 A flowchart illustrating a data processing method based on data dependency provided in an embodiment of this application;
[0042] Figure 2 A flowchart illustrating yet another data processing method based on data dependency provided in this application embodiment;
[0043] Figure 3 A flowchart illustrating yet another data processing method based on data dependency provided in this application embodiment;
[0044] Figure 4 A schematic diagram of teacher information metadata provided in an embodiment of this application;
[0045] Figure 5 A schematic diagram illustrating the subject information metadata provided in the embodiments of this application;
[0046] Figure 6 A schematic diagram of class information metadata provided in an embodiment of this application;
[0047] Figure 7 A schematic diagram illustrating student information metadata provided in an embodiment of this application;
[0048] Figure 8 A schematic diagram illustrating the student grade information metadata provided in an embodiment of this application;
[0049] Figure 9 A flowchart illustrating the data packet provided in an embodiment of this application;
[0050] Figure 10 A schematic diagram of a dependency relationship provided for an embodiment of this application;
[0051] Figure 11 A schematic diagram illustrating yet another dependency relationship provided in an embodiment of this application;
[0052] Figure 12 A schematic diagram illustrating yet another dependency relationship provided in an embodiment of this application;
[0053] Figure 13 A schematic diagram illustrating yet another dependency relationship provided in an embodiment of this application;
[0054] Figure 14 A schematic diagram illustrating yet another dependency relationship provided in an embodiment of this application;
[0055] Figure 15 A schematic diagram of a data access system provided in an embodiment of this application;
[0056] Figure 16 This is a schematic diagram of a data processing device based on data dependency provided in an embodiment of this application. Detailed Implementation
[0057] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0058] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0059] In existing technologies, data retrieval is achieved by writing program code based on established data rules. Under this working mode, technical personnel need to carry out code development or program updates to meet the new data access requirements. Therefore, how to meet the new data access requirements without code development and program updates is an urgent problem to be solved.
[0060] See Figure 1 As shown, this application provides a data processing method based on data dependency, which specifically includes the following steps:
[0061] S101: Create a dependency body table for the data packet. The dependency body table includes the data packet name.
[0062] The dependency body table is used to identify data packets. It records the names of the data packets and can be retrieved by the data packet name. It should be noted that the dependency body table can also record other descriptive information of the data packets, such as their creation time.
[0063] S102: Create an information entry table for the data packet. The information entry table includes multiple metadata, each metadata including a metadata name. Each metadata corresponds to a database table.
[0064] In the embodiments of this application, the information entry table records multiple database tables contained in the data package in the form of metadata. Metadata refers to data that describes the database tables, and a database table refers to a data table stored in a database. Each database table corresponds to a metadata record, which can record the metadata name. It should be noted that, in order to facilitate the retrieval of the metadata corresponding to the database table based on the metadata name, the metadata name can be the same as the database table name. For example, if a school information data package includes five database tables: teacher information table, subject information table, class information table, student information table, and grade information table, then the information entry table includes five metadata records: teacher information metadata, subject metadata, class information metadata, student information metadata, and grade information metadata.
[0065] It should be noted that the information entry table can also record database table-related information such as the address or name of the database where the database table is located, the name of the database table, and the description of the database table. The purpose of recording database table-related information is to enable the retrieval of database tables from different databases, so that the metadata in the data packet is no longer limited to coming from the same database. For example, the database table can be retrieved from the corresponding database through the address information of the database where the database table is located, thereby realizing cross-database query of database tables.
[0066] S103: Create a dependency table for the data package. The dependency table includes data fields of multiple metadata and the dependencies between data fields in the metadata and data fields in other metadata.
[0067] In the embodiments of this application, the data fields may include field information such as field name, description information, and field value type. For example, the field name of data field A is TEACHERCODE, the description information is faculty / staff ID, and the data type is String; the field name of data field B is ENTRYTIME, the description information is start date, and the data type is Date.
[0068] The dependency table records the specific fields of the database table corresponding to each metadata in the data package. For example, the basic information metadata of teachers recorded in the dependency table includes fields such as teacher name, staff number, teacher's employment date, and teacher's contact information.
[0069] The dependency table also records the dependencies between data fields in the metadata and data fields in other metadata. For example, teacher information metadata includes a staff ID field, and subject information metadata includes a teaching staff ID field. If the requirement is to find the subject information taught by a teacher in the subject information table based on the staff ID of a teacher in the teacher information metadata, a dependency can be established between the staff ID field in the teacher information metadata and the teaching staff ID field in the subject information metadata. Data fields can include primary key fields and foreign key fields. Dependencies can be established by setting data fields in the metadata as primary key fields or foreign key fields. For example, the staff ID field in the teacher information metadata can be set as the primary key, and the teaching staff ID field in the subject information metadata can be set as a foreign key to establish a dependency between the staff ID field and the teaching staff ID field. It should be noted that the primary key must be unique and non-repeating. This can be achieved by the database itself controlling an auto-incrementing variable, or by the program developer generating a unique string of information using a custom algorithm. Using other methods to generate unique and non-repeating primary keys does not affect the implementation of this application's embodiments. Furthermore, when establishing dependencies using primary key fields or foreign key fields, only the primary key field of one database table needs to be specified to retrieve data from all related database tables.
[0070] In some implementations of this application, four dependency types—equal to, not equal to, begin with, and end with—can be used to describe dependencies. "Equal to" indicates a dependency relationship between a data field and another data field in other metadata. For example, the staff ID field in teacher information metadata is dependent on the teaching staff ID field in subject information metadata; this dependency relationship can be set to "equal to." "Not equal to" indicates no dependency relationship between a data field and another data field in other metadata. "Begin with" indicates that a data field, based on a dependency relationship with another data field in other metadata, begins with a specified field. For example, in designing a financial reimbursement system, administrators reset the prefix of the reimbursement forms for the following year at the end of each year, setting the prefix for 2022 as "2022-" and for 2023 as "2023-". Based on this, all information starting with a specific field value can be retrieved from the database table. "End with" indicates that a data field, based on a dependency relationship with another data field in other metadata, ends with a specified field.
[0071] S104: Obtain the dependency subject table by pre-entering the data package name.
[0072] In the embodiments of this application, the dependency subject table serves as an identifier for data packets. It is necessary to obtain the dependency subject table based on the given data packet name. In some implementations of this application, identification information such as data packet number, which can identify data packets, can also be used to obtain the dependency subject table, provided that this identification information is unique and is stored in the dependency subject table in advance.
[0073] S105: Retrieve the data packet to which the dependency subject table belongs based on the dependency subject table.
[0074] In this step, a dependency subject table, an information entry table, and a dependency relationship table are created in the data packet. The dependency subject table records the data packet name. The dependency subject table can be obtained through the data packet name, and then the data packet to which the dependency subject table belongs can be obtained.
[0075] This step can be understood as first determining which data packet's dependency body table the dependency body table belongs to, and then obtaining the corresponding data packet.
[0076] S106: Obtain the information entry table and dependency table from the data packet.
[0077] Obtaining the information entry table and dependency table is to understand the dependencies between data fields and data fields in other metadata, so as to facilitate subsequent data storage and retrieval.
[0078] exist Figure 1In the illustrated process, a dependency subject table, an information entry table, and a dependency relationship table are created for the data packet. The dependency subject table serves as a marker for the data packet. The information entry table uses metadata to record basic information about the database tables contained in the data packet, with each metadata entry corresponding to a separate database table. The dependency relationship table records the dependencies between data fields in the metadata and data fields in other metadata, thus determining the relationships between database tables. This forms a chain-like structure for the data packet that clearly defines the dependencies between database tables, effectively organizing these dependencies. Compared to existing technologies that require writing program code based on predetermined data rules, the method provided in this application, while meeting new data access needs, eliminates the need for technical personnel to develop code. Instead, it establishes dependencies between database tables by predefining the dependencies between data fields stored in the dependency relationship table. This allows for flexible predefinition of dependencies between database tables based on the dependency relationship table, thereby meeting new data access needs without requiring technical personnel to provide code such as SQL statement scripts. Furthermore, the method provided in this application reduces the difficulty of data access and lowers the technical threshold for system administrators in data storage.
[0079] See Figure 2 As shown, this application embodiment further provides a data processing method based on data dependency, in Figure 1 Based on the previous steps, an application information entry table and a data query step relying on the main table have been added. Specifically, the steps include:
[0080] S201: Get the entry metadata name and entry fields.
[0081] The entry metadata name is one of the metadata names contained in the information entry table. In some implementations, the obtained entry metadata name and entry field are in the form of a JSON string. For example, if the entry metadata name is teacher basic information metadata and the entry field specifies the teacher's staff number as scl-20180910, then the obtained JSON string is {"ts_teacher":{"teachercode":"scl-20180910"}}.
[0082] S202: Retrieve entry metadata from the information entry table based on the entry metadata name.
[0083] This entry metadata is one of several metadata sets.
[0084] In the embodiments of this application, the information entry table records the names of various metadata, and the corresponding metadata can be obtained from the information entry table according to the metadata name.
[0085] S203: Perform a data query on the database table corresponding to the entry metadata based on the entry field to obtain the query result data.
[0086] The query result data refers to the collection of at least one piece of data obtained from this step. For example, querying the data of the teacher with the basic information metadata table for the teacher with the employee number 20180910 will yield the teacher's name, date of employment, contact information, etc.
[0087] The query results include an identifier value for the entry field. It should be noted that this identifier value is used for subsequent iterative data queries before any actual data query is performed.
[0088] S204: Store the query results data in the result pool.
[0089] The result pool is used to store the retrieved query result data. When storing query result data, the result pool uses the table name of the database table as an index to store the query result data, so that the query result data can be retrieved from the result pool according to the table name of the database table later.
[0090] S205: Mark the data field to which the entry field belongs in the entry metadata as the current data field, and perform data query in at least one query stage based on the identifier value.
[0091] For example, the basic information metadata of teachers includes fields such as staff number and teacher name. If the entry field specifies staff number as 20180910, then the entry field belongs to the staff number field. This step marks the staff number field as the current data field.
[0092] S206: Determine whether the current data field has dependent metadata based on the dependency table.
[0093] Among them, the data fields in the dependency metadata have a dependency relationship with the current data fields, and the dependency metadata is one of multiple metadata.
[0094] In this embodiment of the application, this step is performed by determining the dependency relationship between the data fields in the metadata recorded in the dependency relationship table and the data fields of other metadata. In some implementations, the dependency relationship between metadata can also be determined through the dependency relationship table.
[0095] Dependency metadata refers to one of several metadata sets belonging to a data field that has a dependency relationship with the current data field. For example, if a data field in metadata A has a dependency relationship with the current data field, then metadata A can be called the dependency metadata of the current data field. This step uses a dependency table to determine whether there are any other metadata sets that have a dependency relationship with the current data field, and then uses the other metadata sets belonging to the data fields that have a dependency relationship with the current data field as the dependency metadata of the current field.
[0096] In some implementations of this application, the concept of preceding metadata can be used to describe dependent metadata. In this case, the entry metadata can be further marked as the current metadata, while the dependent metadata is one of multiple metadata that uses the current metadata as preceding metadata. Preceding metadata can refer to metadata B being called preceding metadata of metadata A if a field of metadata A has a dependency relationship with a data field of other metadata B. For example, if a data field in metadata A has a dependency relationship with a data field in metadata B, and A is the active party and B is the passive party, then for the active party, the passive party is its preceding metadata, even if the dependency relationship itself is mutual. Another example is that the dependency relationship between data fields is established by setting primary keys and foreign keys for the data fields. If data field D2 of metadata D is a foreign key of data field C1 of metadata C, then metadata C uses metadata D as preceding metadata.
[0097] S207: If the current data field has dependent metadata, then retrieve the query result data of the current stage from the database table corresponding to the dependent metadata according to the identifier value and store it in the result pool, and mark the data field in the dependent metadata that has a dependency relationship with the current data field as the current data field of the next query stage.
[0098] Combining the above steps, the implementation of this step is as follows: Class information metadata and student information metadata exist separately; a query is performed using the name of the class information metadata as the entry field, where the entry field specifies the class name as Class 1, Grade 1; the first query result data for Class 1, Grade 1 is retrieved from the database table corresponding to the class information metadata and stored in the result pool. During this process, it can be determined that the ID of Class 1, Grade 1 is 1; it is checked whether there is dependent metadata for the field to which Class 1, Grade 1 belongs, i.e., whether the class name field in the class information metadata has dependent metadata; assuming that the dependent metadata exists as student information metadata, the student information with class ID 1 is retrieved from the database table corresponding to the student information metadata as the second query result data, and the second query result data is stored in the result pool.
[0099] S208: If the current data field does not have dependent metadata, then end the data query.
[0100] It should be noted that steps S208 and S209 are parallel steps. That is, after step S207, if the current field has dependent metadata, step S208 is executed; if the current field does not have dependent metadata, step S209 is executed.
[0101] S209: Assemble the query result data in the result pool according to the preset data format to obtain the query result.
[0102] In some implementations, the query results data in the result pool are assembled into JSON data format for output. The JSON key value is the table name corresponding to the metadata, and the VALUE value is an array structure, where each value in the array corresponds to a JSON object.
[0103] exist Figure 2 The illustrated process further includes a step of data querying using an information entry table and a dependency table. The information entry table records metadata names. Entry metadata can be retrieved from the information entry table using the entry metadata name. Data is then queried from the database table corresponding to the entry metadata based on the entry field, yielding query results. These results carry an identifier value corresponding to the entry field. Subsequently, the data field to which the entry field belongs in the entry metadata is marked as the current data field to perform at least one stage of data querying. In each stage, the dependency table is used to determine if the current data field of the current stage has dependent metadata. If it does, the query results for the current stage are retrieved from the database table corresponding to the dependent metadata based on the identifier value and stored in the result pool. Data fields in the dependent metadata that have a dependency relationship with the current data field are marked as the current data field for the next stage, enabling data querying in the next stage. Compared to existing technologies that require code modification when there are new data query needs, the method provided in this embodiment does not require code modification in the above situation. Instead, it satisfies new data acquisition needs and achieves automated data querying by setting the dependency relationships between data fields in the metadata and data fields in other metadata in the dependency table.
[0104] See Figure 3 As shown, this application embodiment further provides a data processing method based on data dependency, in Figure 1 Based on the previous steps, an application information entry table and a dependency subject table for data storage have been added, specifically including the following steps:
[0105] S301: Get the entry metadata name and entry fields.
[0106] The entry field consists of at least one field. For example, when storing student information in a student information table, the entry field may specifically include address, class number, student age, and student name.
[0107] It should be noted that there is a correspondence between the entry metadata name and the entry field, and one entry metadata name can correspond to multiple entry fields. Each entry field has a corresponding data field in the database table of the metadata to which the entry metadata name belongs. Furthermore, this step can obtain multiple metadata names and at least one entry field corresponding to each metadata name. In this case, steps S302 to S308 are performed based on each metadata name and its corresponding entry field.
[0108] S302: Retrieve entry metadata from the information entry table based on the entry metadata name.
[0109] The entry metadata is one of several metadata items.
[0110] It should be noted that the entry metadata is one of multiple metadata. This can be understood as a subset of the set of multiple metadata contained in the data packet.
[0111] S303: Store the field value of the entry field in the database table corresponding to the entry metadata.
[0112] Based on the example in step S301, the specific implementation of this step is, for example, storing the field values of the address field, the class number field, the student age field, and the student name field in the student information table.
[0113] S304: Retrieve the identifier value of the entry field from the database table corresponding to the entry metadata.
[0114] It should be noted that when there are multiple entry fields, in order to ensure the accuracy of data storage, the identifier value of each entry field must be the same.
[0115] S305: Mark the data field to which the entry field belongs in the entry metadata as the current field, and perform data storage for at least one stage.
[0116] It should be noted that when there is more than one entry field, steps S305 to S308 provided in this embodiment of the application can be executed periodically, that is, multiple entry fields are stored sequentially.
[0117] S306: Determine whether the current data field has dependent metadata based on the dependency table.
[0118] Among them, the data fields in the dependency metadata have a dependency relationship with the current data fields, and the dependency metadata is one of multiple metadata.
[0119] It should be noted that, in this step, when the current data field may have multiple dependent metadata, the subsequent steps in this embodiment of the application are executed for each dependent metadata determined in this step.
[0120] S307: If the current data field has dependent metadata, set an identifier value for the entry field, store the field value and identifier value of the entry field in the database table corresponding to the dependent metadata, and mark the data field in the dependent metadata that has a dependency relationship with the current data field as the current data field in the next storage stage.
[0121] The purpose of setting an identifier value for the entry field and storing the field value and identifier value of the entry field is to facilitate data access operations based on the identifier value later.
[0122] S308: If the current data field does not have dependent metadata, then end data storage.
[0123] It should be noted that steps S307 and S308 are parallel steps. That is, after step S306, if the current data field has dependent metadata, step S307 is executed; if the current data field does not have dependent metadata, step S308 is executed.
[0124] exist Figure 3 The illustrated process further includes a step of data storage using an information entry table and a dependency table. Entry metadata is retrieved from the information entry table by the entry metadata name, and the entry field is stored in the database table corresponding to the entry metadata. Then, the dependency table is used to further determine whether the data field to which the entry field belongs in the entry metadata has dependent metadata, and the field value of the entry field and the identifier value set for the entry field are stored in the database table corresponding to the dependent metadata. Compared to existing technologies, the method provided in this embodiment only needs to modify the dependency relationship between data fields in the metadata and data fields in other metadata in the dependency table to meet the newly added data storage requirements, thereby achieving automated data storage.
[0125] The following describes a data processing method based on data dependency provided in this application, using a practical application scenario as an example. The practical application scenario may include the following:
[0126] The campus system needs to record complete information on teachers, subjects, classes, students, and student grades. The specific information entries table includes, for example: Figure 4 The teacher's basic information metadata shown, such as Figure 5 The subject information metadata shown, such as Figure 6 The class information metadata shown, such as Figure 7 The student information metadata shown, and such as Figure 8 The student grade information metadata is shown.
[0127] Will as Figures 4 to 8 The metadata shown is combined and defined as follows: Figure 9 The data packet shown.
[0128] The dependencies between data fields in the metadata are further configured in the dependency table based on the relationships between data in the database tables. For example, the relationships between data in the database tables might be: a subject information database table records teacher employee IDs, a class information database table records staff IDs, a student information database table records the class number, and a student information database table records student grades. The specific dependencies recorded in the dependency table could include: Figure 10 The data fields in the teacher's basic information metadata shown here have dependencies on other metadata data fields, such as... Figure 11 The data fields in the subject information metadata shown have dependencies on other metadata data fields, such as... Figure 12 The data fields in the class information metadata shown have dependencies on data fields in other metadata, such as... Figure 13 The student information metadata shown includes data fields and their dependencies on other metadata data fields, as well as... Figure 14 The data fields in the student grade information metadata shown here have dependencies on the data fields in other metadata.
[0129] Recorded through the dependency table, such as Figures 10 to 14The dependencies shown indicate that: Data fields in the teacher's basic information metadata do not have dependencies on other metadata; the responsible staff ID field in the subject information metadata has a dependency on the staff ID field in the teacher's basic information metadata; the homeroom teacher's staff ID field in the class information metadata has a dependency on the staff ID field in the teacher's basic information metadata, thus indicating that the teacher's basic information metadata is dependent on the staff ID field; the student ID field in the student grade information metadata has a dependency on the student ID field in the student information metadata, thus indicating that the student information metadata is dependent on the student ID field; the class ID field in the student information metadata has a dependency on the class ID field in the class information metadata, thus indicating that the class information metadata is dependent on the class ID field. Furthermore,
[0130] See Figure 15 As shown, in the data access system built using the method provided in the embodiments of this application, the technical architecture of the system may include a presentation layer, a business logic layer, a data dependency layer, and a data layer; the presentation layer is used to provide an operable interface to the user through a mobile application, a web application, or a client application; the business logic layer is used to provide data access services; the data dependency layer is used to store storage packages; the data layer is connected to multiple databases, and the metadata in the data packets in the business dependency layer corresponds to a database table in a database.
[0131] In the data dependency layer, the parameters of the data packet can include the data packet name and creation time, and these parameters can be stored in the dependency subject table. The data packet can include multiple metadata, and the parameters of the metadata can include basic information of the data table, basic information of the database, and metadata name. These metadata parameters can be stored in the information entry table. In addition, the metadata also records detailed metadata information, including primary key fields, foreign key fields, and relationships. This detailed metadata information can be stored in the dependency relationship table.
[0132] See Figure 16 As shown, Figure 16 A data processing device based on data dependency provided in this application includes a first creation unit 1601, a second creation unit 1602, a third creation unit 1603, a first acquisition unit 1604, a second acquisition unit 1605, and a third acquisition unit 1606.
[0133] The first creation unit 1601 is used to create a dependency body table for the data packet, the dependency body table including the data packet name;
[0134] The second creation unit 1602 is used to create an information entry table for the data packet. The information entry table includes multiple metadata in the data packet. The metadata includes metadata names, and each metadata corresponds to a database table.
[0135] The third creation unit 1603 is used to create a dependency table for the data packet. The dependency table includes data fields of multiple metadata and the dependency relationships between data fields in the metadata and data fields in other metadata.
[0136] The first acquisition unit 1604 is used to acquire the dependency subject table by pre-inputting data packet name;
[0137] The second acquisition unit 1605 is used to acquire the data packet to which the dependency subject table belongs based on the dependency subject table;
[0138] The third acquisition unit 1606 is used to acquire the information entry table and the dependency table from the data packet.
[0139] In some implementations of the embodiments of this application, the data field includes a primary key field and a foreign key field, and the dependency relationship is established by setting the data field as a primary key field or a foreign key field.
[0140] In some implementations of the embodiments of this application, the data processing apparatus is further configured to perform the following steps:
[0141] Retrieve the entry metadata name and entry fields;
[0142] The entry metadata is retrieved from the information entry table based on the entry metadata name. The entry metadata is one of multiple metadata.
[0143] In some implementations of the embodiments of this application, the data processing apparatus is further configured to perform the following steps:
[0144] Based on the entry field, perform a data query on the database table corresponding to the entry metadata to obtain the query result data;
[0145] Store the query results in the results pool.
[0146] In some implementations of this application, the query result data carries an identifier value of the entry field, and the data processing device is further configured to perform the following steps:
[0147] Mark the data field to which the entry field belongs in the entry metadata as the current data field, and perform data query in at least one query stage;
[0148] Each query stage includes: determining whether the current data field has dependent metadata based on the dependency table, where the data field in the dependent metadata has a dependency relationship with the current data field, and the dependent metadata is one of multiple metadata; if the current data field has dependent metadata, then the query result data of the current stage is obtained from the database table corresponding to the dependent metadata based on the identifier value and stored in the result pool, and the data field in the dependent metadata that has a dependency relationship with the current data field is marked as the current data field of the next query stage; if the current data field does not have dependent metadata, then the data query ends.
[0149] In some implementations of the embodiments of this application, the data processing apparatus is further configured to perform the following steps:
[0150] Assemble the query result data in the result pool according to a preset data format to obtain the query results;
[0151] Output the query results.
[0152] In some implementations of the embodiments of this application, the data processing apparatus is further configured to perform the following steps:
[0153] Store the field values of the entry field in the database table corresponding to the entry metadata.
[0154] In some implementations of the embodiments of this application, the data processing apparatus is further configured to perform the following steps:
[0155] Retrieve the identifier value of the entry field from the database table corresponding to the entry metadata;
[0156] Mark the data field to which the entry field belongs in the entry metadata as the current data field, and store it in at least one storage stage;
[0157] Each storage stage includes: determining whether the current data field has dependent metadata based on the dependency table; if the data field in the dependent metadata has a dependency relationship with the current data field, and the dependent metadata is one of multiple metadata; if the current data field has dependent metadata, then setting an identifier value for the entry field, storing the field value and the identifier value of the entry field in the database table corresponding to the dependent metadata, and marking the data field in the dependent metadata that has a dependency relationship with the current data field as the current data field of the next storage stage; if the current data field does not have dependent metadata, then ending the data storage.
[0158] In some implementations of this application, the preset data format is JSON.
[0159] Finally, it should be noted that in the embodiments of this application, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0160] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A data processing method based on data dependency, characterized in that, The method includes: Create a dependency body table for the data packet, the dependency body table including the data packet name; An information entry table is created for the data packet. The information entry table includes multiple metadata in the data packet. The metadata includes metadata names, and each metadata corresponds to a database table. A dependency table is created for the data package. The dependency table includes data fields of the plurality of metadata and the dependencies between the data fields in the metadata and the data fields in other metadata. In response to receiving a data packet name input by the user, the dependency subject table corresponding to the data packet name is obtained; The data packet to which the dependency subject table belongs is obtained based on the dependency subject table; The information entry table and the dependency table are obtained from the data packet.
2. The method according to claim 1, characterized in that, The data fields include primary key fields and foreign key fields, and the dependency relationship is established by setting the data fields as the primary key fields or the foreign key fields.
3. The method according to claim 1, characterized in that, The method further includes: Retrieve the entry metadata name and entry fields; The entry metadata is obtained from the information entry table based on the entry metadata name, where the entry metadata is one of the plurality of metadata.
4. The method according to claim 3, characterized in that, The method further includes: The database table corresponding to the entry metadata is queried according to the entry field to obtain the query result data; The query results are stored in the result pool.
5. The method according to claim 4, characterized in that, The query result data carries the identifier value of the entry field, and the method further includes: Mark the data field to which the entry field belongs in the entry metadata as the current data field, and perform the data query in at least one query phase; Each query stage includes: determining whether the current data field has dependent metadata based on the dependency relationship table, wherein the data field in the dependent metadata has the dependency relationship with the current data field, and the dependent metadata is one of the plurality of metadata; if the current data field has the dependent metadata, then obtaining the query result data of the current stage from the database table corresponding to the dependent metadata according to the identifier value and storing it in the result pool, and marking the data field in the dependent metadata that has the dependency relationship with the current data field as the current data field of the next query stage; if the current data field does not have the dependent metadata, then ending the data query.
6. The method according to claim 4, characterized in that, The method further includes: The query result data in the result pool is assembled according to a preset data format to obtain the query result; Output the query results.
7. The method according to claim 3, characterized in that, The method further includes: The field value of the entry field is stored in the database table corresponding to the entry metadata.
8. The method according to claim 7, characterized in that, The method further includes: Obtain the identifier value of the entry field from the database table corresponding to the entry metadata; The data field to which the entry field belongs in the entry metadata is marked as the current data field, and the data is stored in at least one storage stage; Each storage stage includes: determining whether the current data field has dependent metadata based on the dependency table, wherein the data field in the dependent metadata has a dependency relationship with the current data field, and the dependent metadata is one of a plurality of metadata; if the current data field has the dependent metadata, then setting the identifier value for the entry field, storing the field value of the entry field and the identifier value of the entry field in the database table corresponding to the dependent metadata, and marking the data field in the dependent metadata that has the dependency relationship with the current data field as the current data field of the next storage stage; if the current data field does not have the dependent metadata, then ending the data storage.
9. The method according to claim 6, characterized in that, The preset data format is JSON.
10. A data processing device based on data dependency, characterized in that, The device includes: The first creation unit is used to create a dependency subject table for the data packet, the dependency subject table including the data packet name; The second creation unit is used to create an information entry table for the data packet. The information entry table includes multiple metadata in the data packet. The metadata includes metadata names, and each metadata corresponds to a database table. The third creation unit is used to create a dependency table for the data packet. The dependency table includes data fields of the plurality of metadata and the dependency relationships between the data fields in the metadata and the data fields in other metadata. The first acquisition unit is configured to acquire the dependency subject table corresponding to the data packet name in response to receiving the data packet name input by the user; The second acquisition unit is used to acquire the data packet to which the dependency subject table belongs based on the dependency subject table; The third acquisition unit is used to acquire the information entry table and the dependency table from the data packet.
Citation Information
Patent Citations
Medical streaming data blood relationship analysis and storage methods and devices
CN111627552A
Entity relationship generation method and data query method based on knowledge graph
CN115203435A