Database logical entity dynamic construction method, entity relationship construction method and device
By constructing query statements containing placeholders and encapsulating them as logical entities, the problem of redundancy of entities and entity relationships between different domains is solved, and the reuse of entities and entity relationships and the saving of storage space are achieved.
Patent Information
- Application Number
- CN202310181865.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-27
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2043-02-27
AI Technical Summary
In the prior art, since the entities and entity relationship templates between different domains are independent of each other, the entities and entity relationships are redundant and have low utilization rates, which also brings huge storage pressure to the database.
By constructing a query statement containing placeholders and encapsulating it as a logical entity, and replacing the placeholders with user identification information, it is possible to obtain user data associated with the user identification information in the database table in a targeted manner and build the entity relationship between the logical entity and the database table.
It enables the reuse of a set of entities and entity relationships among different users, improves data utilization and saves database storage space.
Smart Images

Figure CN116483852B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to a database logical entity dynamic construction method, an entity relationship construction method and a device. Background Art
[0002] Every company faces a variety of customers, generating tens or even hundreds of millions of pieces of data that are used to gain insights into customer behavior and support business development. Data analysis is the process of discovering business value from data through analytical methods. This process can start with determining the analysis objective and end with discovering business value and providing data support.
[0003] In related technologies, data analysis systems pre-set different domains and multiple entity relationship templates within each domain based on user needs. Users can then call upon business objects (or entities) and their entity relationships within the domain to perform data analysis. However, to protect user privacy, entities and entity relationship templates between different domains are kept independent of each other, as otherwise they could lead to privacy leaks. This results in redundant entities and entity relationships, leading to low utilization rates. This also places significant storage pressure on the database. Summary of the Invention
[0004] In view of this, the present disclosure relates to the field of data processing technology, and more specifically, to a database logical entity dynamic construction method, entity relationship construction method and device.
[0005] In a first aspect, a method for dynamically constructing a database logical entity is provided, comprising: constructing a query statement for a database table, the query statement including a placeholder, the placeholder being replaced with user identification information when the query statement is called; encapsulating the query statement into a logical entity so that the logical entity can, based on the user identification information with which the placeholder is replaced, directionally obtain user data associated with the user identification information in the database table.
[0006] In some embodiments, the query statement further includes a selection instruction, and the fields included in the logical entity are the same as the fields selected by the selection instruction.
[0007] In a second aspect, a method for constructing a database entity relationship is provided, comprising: obtaining parameter information, the parameter information being used to indicate a specified field to be queried; determining a logical entity for querying the specified field based on the parameter information, the logical entity being encapsulated by the method of the first aspect; and constructing an entity relationship between the logical entity and a target entity in a database table.
[0008] In some embodiments, constructing an entity relationship between a logical entity and a target entity in a database table includes: selecting a first field contained in the logical entity; traversing at least one preset entity in the database table to determine a target entity that has an entity relationship with the logical entity, the target entity containing a second field, and the second field having an association relationship with the first field; and constructing an entity relationship between the logical entity and the target entity based on the association relationship between the first field and the second field.
[0009] In some embodiments, the placeholders in the logical entity are filled in according to the context information to obtain the entity relationship between the logical entity in the specified query scope and the target entity, including: parsing the context information to obtain variable information corresponding to the placeholders; replacing the placeholders in the logical entity with the variable information to obtain the entity relationship between the logical entity in the specified query scope and the target entity.
[0010] According to a third aspect, a device for dynamically constructing a database logical entity is provided, comprising: a construction module for constructing a query statement for a database table, the query statement comprising a placeholder, the placeholder being replaced with user identification information when the query statement is called; and an encapsulation module for encapsulating the query statement into a logical entity, so that the logical entity can, based on the user identification information with which the placeholder is replaced, directionally obtain user data associated with the user identification information in the database table.
[0011] In a fourth aspect, an entity relationship construction device is provided, including: an acquisition module for acquiring parameter information, the parameter information being used to indicate a specified field to be queried; a determination module for determining a logical entity for querying a specified field based on the parameter information, the logical entity being encapsulated by the method of the first aspect; and a construction module for constructing an entity relationship between the logical entity and a target entity in a database table.
[0012] In a fifth aspect, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the methods of the first and second aspects mentioned above by executing the executable instructions.
[0013] In a sixth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the methods of the first and second aspects mentioned above are implemented.
[0014] The disclosed embodiments provide a method for dynamically constructing database logical entities. This method constructs a query statement for a database table, including a placeholder that is replaced with user identification information when the query statement is called. The query statement is then encapsulated as a logical entity, enabling the logical entity to target user data associated with the user identification information in the database table based on the user identification information replaced with the placeholder. This allows a set of entities and entity relationships to be reused across different users, increasing data utilization and conserving database storage space. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 A schematic diagram of the system architecture of a database logical entity dynamic construction method and an entity relationship construction method in an embodiment of the present disclosure is shown.
[0016] Figure 2 A flowchart of a method for dynamically constructing a database logical entity in an embodiment of the present disclosure is shown.
[0017] Figure 3 A flowchart illustrating a method for constructing a database entity relationship in an embodiment of the present disclosure is shown.
[0018] Figure 4 A schematic diagram illustrating a process of constructing an entity relationship between a logical entity and a target entity in a database table in an embodiment of the present disclosure is shown.
[0019] Figure 5 A flowchart illustrating steps after constructing an entity relationship between a logical entity and a target entity in an embodiment of the present disclosure is shown.
[0020] Figure 6 A schematic structural diagram of a device for dynamically constructing database logical entities in an embodiment of the present disclosure is shown.
[0021] Figure 7 A schematic structural diagram of an entity relationship construction device in an embodiment of the present disclosure is shown.
[0022] Figure 8 A schematic structural diagram of an electronic device in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0023] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0024] In addition, the accompanying drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. Identical reference numerals in the figures denote identical or similar parts, and thus repetitive descriptions thereof will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities that do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0025] Following the computer and internet revolutions, big data technology has swept across nearly every industry. Every company faces a variety of customers, generating tens or even hundreds of millions of data points that are used to gain insights into customer behavior and support business development. Data analysis is the process of discovering business value from data through analytical methods. Extracting and processing information from databases is the foundation of data analysis.
[0026] In related technologies, data analysis systems preset different domains and multiple entity relationship templates under the domains based on user needs. Users can call business objects (or entities) and their entity relationships in the domains to perform data analysis based on their own needs. To protect user privacy, entities and entity relationship templates between different domains are independent of each other, otherwise privacy leaks may occur. However, as the number of users increases, more and more domains are required, which leads to redundant entities and entity relationships and low utilization rates. At the same time, it also brings huge storage pressure to the database.
[0027] In light of this, the present disclosure provides a method for dynamically constructing database logical entities. This method constructs a query statement for a database table, the query statement including a placeholder that is replaced with user identification information when the query statement is called. The query statement is then encapsulated as a logical entity, enabling the logical entity to target user data associated with the user identification information in the database table based on the user identification information replaced with the placeholder. This allows a set of entities and entity relationships to be reused across different users, increasing template utilization while conserving database storage space.
[0028] Figure 1 A schematic diagram of an exemplary system architecture of a database logical entity dynamic construction method or device and a database entity relationship construction method or device that can be applied to the embodiments of the present disclosure is shown.
[0029] like Figure 1 As shown, the system architecture 100 may include a logical entity and entity relationship construction device 101 , a storage device 102 and a terminal device 103 .
[0030] The logical entity and entity relationship construction apparatus 101 can communicate with a terminal device 103 via a network. The terminal device 103 can be a server providing various services. For example, a background execution server can construct an entity relationship to be constructed based on parameter information. Specifically, the background execution server can determine the logical entity to be used for querying a specified field based on the received parameter information and feedback the ultimately constructed entity relationship to the terminal device 103.
[0031] In some embodiments, the logical entity and entity relationship construction apparatus 101 may execute the database entity relationship construction method of the present disclosure according to the parameter information input by the user, and display the constructed entity relationship to be constructed to the user through the terminal device 103 .
[0032] The storage device 102 may be a server deployed with a database, on which original data used for database entity relationship construction and a plurality of entity relationship templates are stored.
[0033] In some embodiments, the storage device 102 and the logical entity and entity relationship construction device 101 may be the same server.
[0034] The terminal device 103 is equipped with a client capable of initiating the database logical entity dynamic construction method and the database entity relationship construction method provided by the present disclosure. The client can be, but is not limited to, an application, a web client, or a mini-program client. Furthermore, the specific form of the client can vary depending on the terminal platform. For example, the client can be a mobile client or a PC client.
[0035] In some embodiments, the parameter information may be input by the user through the terminal device 103 and sent to the logical entity and entity relationship construction apparatus 101 , or may be predefined parameter information directly imported by the user through the logical entity and entity relationship construction apparatus 101 .
[0036] Those skilled in the art will know that Figure 1 The number of entity relationship building devices, storage devices, and terminal devices shown in the figure is merely illustrative, and any number of entity relationship building devices, storage devices, and terminal devices may be provided according to actual needs. This disclosure does not limit this.
[0037] Those skilled in the art will know that Figure 1 The number of terminals and servers shown in the figure is merely illustrative. Any number of terminals and servers may be provided according to actual needs, and the present disclosure does not impose any limitation thereto.
[0038] This exemplary implementation will be described in detail below with reference to the accompanying drawings and examples.
[0039] First, an embodiment of the present disclosure provides a method for dynamically constructing a database logical entity, which can be executed by any electronic device with computing and processing capabilities.
[0040] Figure 2 A flowchart of a method for dynamically constructing a database logical entity according to an embodiment of the present disclosure is shown as follows: Figure 2 As shown, the method for dynamically constructing database logical entities provided in the embodiment of the present disclosure includes the following steps.
[0041] S201: Construct a query statement for a database table, where the query statement includes a placeholder.
[0042] Specifically, a query statement with placeholders can be constructed, where the placeholders can be replaced with user identification information. The user identification information is used to locate the field to be queried belonging to a specific user, for example, the user's identity ID.
[0043] For example, the query statement might be select c1, c2, c3 from t1 where c1 = $c_v$. $c_v$ is a placeholder, c1, c2, and c3 are the fields to be queried, and c1 is the field corresponding to the user identification information. t1 is a database table (or physical entity), and c1, c2, and c3 are stored in table t1.
[0044] S202: Encapsulate the query statement into a logical entity.
[0045] Specifically, a logical entity can be a virtual table. By using this virtual table as a logical entity, it can establish entity relationships with other entities. For example, a virtual table containing a table name and data type can be defined and used to store field information queried by a query statement. Virtual tables are based on database table definitions and are used to provide data services or perform specific data operations. Their data is used in the same way as database tables.
[0046] It's important to note that common virtual tables include derived tables, memory tables, and temporary tables. These tables share the common characteristic of not physically existing but logically existing. Virtual tables are defined based on physical tables to provide data services but do not actually store data. Their data usage is similar to that of physical tables.
[0047] For example, taking a temporary table as an example, the construction method of a virtual table can be:
[0048] create temporary table tmp_table(
[0049] name VARCHAR(10)NOT NULL,
[0050] value INTEGER NOT NULL );
[0052] tmp_table is the table name, name VARCHAR(10) NOT NULL, and value INTEGER NOT NULL are used to define the data types of the fields in the virtual table.
[0053] After the virtual table is built, the query statement can be encapsulated in the virtual table. When the virtual table is called, the query result of the query statement is used as the data in the virtual table.
[0054] In some embodiments, the logical entity can, based on the user identification information replaced by the placeholder, selectively retrieve user data associated with the user identification information in the database table. That is, when the placeholder in a query statement encapsulated in the logical entity is replaced with the user identification information, the query statement can retrieve the user data associated with the user identification information. In this case, the field data in the logical entity is the user data retrieved by the query statement.
[0055] In some embodiments, the query statement further includes a select instruction, and the fields included in the logical entity are the same as the fields selected by the select instruction. For example, the fields c1, c2, and c3 selected by the select instruction (select) in the above query statement are the fields included in the logical entity encapsulated by the query statement.
[0056] Secondly, an embodiment of the present disclosure provides a method for constructing database entity relationships, which can be executed by any electronic device with computing and processing capabilities.
[0057] Figure 3 A flow chart showing a method for constructing a database entity relationship according to an embodiment of the present disclosure is shown as follows: Figure 3 As shown, the database entity relationship construction method provided in the embodiment of the present disclosure includes the following steps.
[0058] S301, obtaining parameter information.
[0059] Specifically, the parameter information is used to indicate one or more specified fields to be queried, and these fields may be from one or more database tables.
[0060] S302: Determine a logical entity for querying a specified field according to the parameter information.
[0061] Specifically, a logical entity including all fields to be queried can be found according to the parameter information, and the logical entity is constructed by the method of the embodiment of the present disclosure.
[0062] S303: Build an entity relationship between the logical entity and the target entity in the database table.
[0063] In some embodiments, as Figure 4 As shown, building an entity relationship between a logical entity and a target entity in a database table includes the following steps.
[0064] S3031: Select the first field included in the logical entity.
[0065] Specifically, the first field may be any field in the logical entity, or any combination of any number of fields in the logical entity.
[0066] S3032: traverse at least one preset entity in the database table to determine a target entity having an entity relationship with the logical entity, where the target entity includes a second field, and the second field has an association relationship with the first field.
[0067] Specifically, a database table stores multiple preset entities, each of which includes at least one field. If the second field of the preset entity is associated with the first field of the logical entity (e.g., the first field and the second field are the same), then an entity relationship exists between the preset entity and the logical entity. The second field of the preset entity can be any field in the preset entity or any combination of any number of fields in the preset entity.
[0068] S3033: Construct an entity relationship between the logical entity and the target entity based on the association relationship between the first field and the second field.
[0069] In some embodiments, an entity relationship between a logical entity and a target entity may be constructed through an association relationship between a first field and a second field, wherein the association relationship includes a left join, a right join, and an inner join.
[0070] In some embodiments, as Figure 5 As shown, after constructing the entity relationship between the logical entity and the target entity, the following steps are also included.
[0071] S30331, obtain context information.
[0072] Specifically, the context information can be input by the user or obtained by parsing the query statement through a parsing tool. The context information includes user identification information and can indicate a specified query scope of a specified field.
[0073] S30332: Fill the placeholders in the logical entity according to the context information to obtain the entity relationship between the logical entity in the specified query scope and the target entity.
[0074] In some embodiments, the context information can be further parsed using a parsing tool to obtain variable information corresponding to the placeholder, and the placeholder in the logical entity can be replaced with the variable information. In this case, the variable information can be used to specify the query scope of the logical entity. During the period when the placeholder is occupied, the logical entity loses the ability to query other scopes. Thus, an entity relationship can be obtained between the logical entity with the specified query scope and the target entity.
[0075] Based on the same inventive concept, the present disclosure also provides a device for dynamically constructing database logical entities, as shown in the following embodiment. Since the principle of solving the problem in the device embodiment is similar to that in the above method embodiment, the implementation of the device embodiment can refer to the implementation of the above method embodiment, and the repeated parts will not be repeated.
[0076] Figure 6 A schematic diagram showing the structure of a device for dynamically constructing a database logical entity according to an embodiment of the present disclosure is shown. Figure 6 As shown, the database logical entity dynamic construction device 600 includes: a construction module 601 and a packaging module 602.
[0077] Specifically, construction module 601 is configured to construct a query statement for a database table, the query statement including placeholders that are replaced with user identification information when the query statement is invoked. Encapsulation module 602 is configured to encapsulate the query statement into a logical entity, so that the logical entity can, based on the user identification information replaced with the placeholders, target and retrieve user data associated with the user identification information in the database table.
[0078] In some embodiments, the query statement further includes a selection instruction, and the fields included in the logical entity are the same as the fields selected by the selection instruction.
[0079] It should be noted that the above-described embodiments of the apparatus for dynamically constructing database logical entities are merely illustrative of the division of the aforementioned functional modules when used for dynamically constructing database logical entities. In actual applications, the aforementioned functions can be assigned to different functional modules as needed, i.e., the internal structure of the apparatus can be divided into different functional modules to complete all or part of the functions described above. Furthermore, the apparatus for dynamically constructing database logical entities and the method for dynamically constructing database logical entities in the above-described embodiments are based on the same concept. The specific implementation process is detailed in the method embodiments and will not be further elaborated here.
[0080] Based on the same inventive concept, the present disclosure also provides a database entity relationship construction device, as described in the following embodiment. Since the principle of solving the problem in the device embodiment is similar to that in the above method embodiment, the implementation of the device embodiment can refer to the implementation of the above method embodiment, and the repeated parts will not be repeated.
[0081] Figure 7 A schematic diagram showing the structure of a database entity relationship construction device according to an embodiment of the present disclosure is shown. Figure 7 As shown, the database entity relationship construction device 700 includes: an acquisition module 701, a determination module 702 and a construction module 703.
[0082] Specifically, acquisition module 701 is used to obtain parameter information indicating the specified field to be queried. Determination module 702 is used to determine, based on the parameter information, a logical entity for querying the specified field. The logical entity is encapsulated by the method of the present disclosure. Construction module 703 is used to construct an entity relationship between the logical entity and a target entity in a database table.
[0083] In some embodiments, the construction module 703 is also used to select a first field contained in the logical entity; traverse at least one preset entity in the database table, determine a target entity that has an entity relationship with the logical entity, the target entity contains a second field, and the second field has an association relationship with the first field; based on the association relationship between the first field and the second field, construct an entity relationship between the logical entity and the target entity.
[0084] In some embodiments, the construction module 703 is further used to obtain context information, which is used to show the specified query scope of the specified field; fill the placeholders in the logical entity according to the context information, and obtain the entity relationship between the logical entity of the specified query scope and the target entity.
[0085] In some embodiments, the construction module 703 is further used to parse the context information to obtain variable information corresponding to the placeholder; replace the placeholder in the logical entity with the variable information to obtain the entity relationship between the logical entity in the specified query scope and the target entity.
[0086] It should be noted that the database entity relationship construction device provided in the above embodiment, when used for database entity relationship construction, is only illustrated by the division of the above functional modules. In actual application, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the database entity relationship construction device provided in the above embodiment and the database entity relationship construction method embodiment are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0087] Those skilled in the art will appreciate that various aspects of the present disclosure may be implemented as systems, methods, or program products. Therefore, various aspects of the present disclosure may be implemented in the following forms: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, which may be collectively referred to herein as "circuits," "modules," or "systems."
[0088] Refer to the following Figure 8 800 according to this embodiment of the present disclosure will be described. Figure 8 The electronic device 800 shown is merely an example and should not limit the functions and scope of application of the embodiments of the present disclosure.
[0089] like Figure 8 As shown, electronic device 800 is implemented as a general-purpose computing device. Components of electronic device 800 may include, but are not limited to, the aforementioned at least one processing unit 810, the aforementioned at least one storage unit 820, and a bus 830 connecting various system components (including storage unit 820 and processing unit 810).
[0090] The storage unit stores program codes, which can be executed by the processing unit 810, so that the processing unit 810 executes the steps according to various exemplary embodiments of the present disclosure described in the above “Exemplary Method” section of this specification.
[0091] In some embodiments, the processing unit 810 can perform the following steps of the above-mentioned method embodiment: construct a query statement for the database table, the query statement includes a placeholder, and the placeholder is used to be replaced with user identification information when the query statement is called; encapsulate the query statement into a logical entity so that the logical entity can obtain user data associated with the user identification information in the database table based on the user identification information replaced by the placeholder.
[0092] In some embodiments, the processing unit 810 can also perform the following steps of the above-mentioned method embodiment: obtaining parameter information, the parameter information is used to indicate the specified field to be queried; based on the parameter information, determining the logical entity used to query the specified field, the logical entity is encapsulated by the database logical entity dynamic construction method provided by the present disclosure; constructing the entity relationship between the logical entity and the target entity in the database table.
[0093] The storage unit 820 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 8201 and / or a cache memory unit 8202 , and may further include a read-only memory unit (ROM) 8203 .
[0094] The storage unit 820 may also include a program / utility 8204 having a set (at least one) of program modules 8205, such program modules 8205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0095] Bus 830 may represent one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0096] The electronic device 800 can also communicate with one or more external devices 840 (e.g., a keyboard, a pointing device, a Bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 800, and / or any device that enables the electronic device 800 to communicate with one or more other computing devices (e.g., a router, a modem, etc.). Such communication can occur via an input / output (I / O) interface 850. Furthermore, the electronic device 800 can also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network such as the Internet) via a network adapter 860. As shown, the network adapter 860 communicates with other modules of the electronic device 800 via a bus 830. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the electronic device 800, including but not limited to microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0097] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
[0098] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided. The computer-readable storage medium may be a readable signal medium or a readable storage medium. A program product capable of implementing the above-mentioned method of the present disclosure is stored thereon. In some possible implementations, various aspects of the present disclosure may also be implemented in the form of a program product, which includes program code. When the program product is executed on a terminal device, the program code is used to cause the terminal device to execute the steps according to various exemplary embodiments of the present disclosure described in the "Exemplary Methods" section above of this specification.
[0099] More specific examples of computer-readable storage media in the present disclosure may include, but are not limited to, an electrical connection having one or more conductors, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), optical fibers, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0100] In the present disclosure, a computer-readable storage medium may include a data signal propagated in baseband or as part of a carrier wave, which carries readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium that can transmit, propagate, or transfer a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0101] Alternatively, the program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination thereof.
[0102] In a specific implementation, the program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, and the like, as well as conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0103] It should be noted that although several modules or units of the device for action execution are mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be concretized in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be concretized.
[0104] Furthermore, although the steps of the method of the present disclosure are described in a particular order in the accompanying drawings, this does not require or imply that the steps must be performed in this particular order, or that all steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.
[0105] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
[0106] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the appended claims.
Claims
1. A method for constructing a database entity relationship, characterized in that: include: Obtain parameter information, where the parameter information is used to indicate a specified field to be queried; Determining a logical entity for querying the specified field according to the parameter information; Constructing an entity relationship between the logical entity and a target entity in a database table; Acquire context information, where the context information is used to indicate a specified query scope of the specified field; Filling the placeholders in the logical entity according to the context information to obtain the entity relationship between the logical entity in the specified query scope and the target entity; The logical entity is encapsulated by the following method: Constructing a query statement for a database table, wherein the query statement includes a placeholder, and the placeholder is used to be replaced by user identification information when the query statement is called; The query statement is encapsulated into a logical entity, so that the logical entity can directionally obtain the user data associated with the user identification information in the database table based on the user identification information with which the placeholder is replaced.
2. The method according to claim 1, characterized in that The query statement further includes a selection instruction, and the fields included in the logical entity are the same as the fields selected by the selection instruction.
3. The method according to claim 1, characterized in that The constructing of an entity relationship between the logical entity and a target entity in a database table includes: Selecting the first field included in the logical entity; Traversing at least one preset entity in the database table to determine a target entity having an entity relationship with the logical entity, the target entity including a second field, and the second field having an association relationship with the first field; An entity relationship between the logical entity and the target entity is constructed based on the association relationship between the first field and the second field.
4. The method according to claim 1, wherein Filling the placeholder in the logical entity according to the context information to obtain the entity relationship between the logical entity in the specified query scope and the target entity includes: Parsing the context information to obtain variable information corresponding to the placeholder; The placeholder in the logical entity is replaced with the variable information to obtain the entity relationship between the logical entity in the specified query scope and the target entity.
5. An entity relationship construction device, characterized in that: include: An acquisition module, used to acquire parameter information, wherein the parameter information is used to indicate a specified field to be queried; A determination module, configured to determine a logical entity for querying the specified field based on the parameter information; A construction module, configured to construct an entity relationship between the logical entity and a target entity in a database table; Acquire context information, where the context information is used to indicate a specified query scope of the specified field; Filling the placeholders in the logical entity according to the context information to obtain the entity relationship between the logical entity in the specified query scope and the target entity; The logical entity is encapsulated by the following method: Constructing a query statement for a database table, wherein the query statement includes a placeholder, and the placeholder is used to be replaced by user identification information when the query statement is called; The query statement is encapsulated into a logical entity, so that the logical entity can directionally obtain the user data associated with the user identification information in the database table based on the user identification information with which the placeholder is replaced.
6. An electronic device, characterized in that: include: processor; as well as a memory for storing executable instructions of the processor; The processor is configured to perform the method according to any one of claims 1 to 4 by executing the executable instructions.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Method and system of creating a logical table from multiple differently formatted physical tables
CN1790322A
Generating logical fields for a data abstraction model
US20080189289A1