Apparatus for creating query using relational definition model and method therefor
By using a relationship definition model to generate a codebook for query generation, the method simplifies the process of creating queries, addressing the complexity of existing methods and enhancing user experience through automated query execution.
Patent Information
- Application Number
- JP2024089907
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-12-11
- Filing Date
- 2024-06-03
- Publication Date
- 2025-06-23
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing query generation methods require complex scripting and manual input, making them cumbersome and user-unfriendly, especially when dealing with multiple tables and relationships.
The method employs a relationship definition model to generate a codebook containing table and column codes, which are used to create a code-form query. This query is then converted into an executable form using a query conversion unit, allowing for automatic extraction of data from a database.
This approach simplifies the query generation process, making it more user-friendly by allowing queries to be generated through code selection only, thereby improving user convenience and providing a new user experience.
Smart Images

Figure 2025093276000001_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a technique for generating a query, and more particularly, to an apparatus and a method for generating a query using a relationship definition model.
Background Art
[0002] A query is a script requested to search for desired information from a database or the like. A programming language with a specific structure for such a query may be used, and typically, there is SQL (Structured Query Language). On the web, when transferring data in the GET request method, a query is included in the URL and transferred.
Prior Art Documents
Patent Documents
[0003]
Patent Document 1
Summary of the Invention
Problems to be Solved by the Invention
[0004] An object of the present invention is to provide an apparatus and a method for generating a query using a relationship definition model.
Means for Solving the Problems
[0005] The method for generating a query of the server device of the present invention includes: a codebook generation unit providing a codebook including a table code corresponding to each of a plurality of tables in which relationships between tables are defined and a column code corresponding to a column to be exposed among the columns of the plurality of tables to a terminal device via a server communication unit; when receiving a code-form query including the table code and the column code selected from the codebook from the terminal device via the server communication unit, a query conversion unit converting the code-form query into an executable query using the table code and the column code; and a query execution unit extracting data corresponding to the converted query from a database, generating a response message, and then transferring the generated response message to the terminal device via the server communication unit.
[0006] The step of converting into an executable query includes: the query conversion unit deriving the relationship between the tables selected by the table code with reference to a relationship information model in which the relationships between the tables are defined; and the query conversion unit converting the code-form query into an executable query based on the derived relationship between the tables and the column code.
[0007] The step of converting into an executable query is characterized in that the query conversion unit derives a subquery that can be executed independently and arranges the derived subquery within the FROM clause.
[0008] Before the step of providing the codebook, the method further includes: a codebook generation unit generating a relationship information model that defines the relationships between a plurality of tables included in a database; the codebook generation unit generating a table code corresponding to each of the plurality of tables; the codebook generation unit generating a column code corresponding to a column to be exposed among the plurality of columns of the table; and the codebook generation unit generating a codebook including the table code and the column code.
[0009] A method for generating a query of a terminal device according to the present invention includes: a step in which a terminal communication unit receives a codebook including a table code corresponding to each of a plurality of tables in which relationships between tables are defined from a server device and a column code corresponding to a column to be exposed among columns of the plurality of tables; a step in which a query generation unit selects the table code and the column code from the codebook according to a user input, and generates a code-form query including the selected table code and column code; and a step in which the query generation unit transfers the code-form query generated via the terminal communication unit to the server device.
[0010] A server device for generating a query according to the present invention includes: a codebook generation unit that provides, via a server communication unit, a codebook including a table code corresponding to each of a plurality of tables in which relationships between tables are defined to a terminal device and a column code corresponding to a column to be exposed among columns of the plurality of tables; a query conversion unit that, when receiving a code-form query including a table code and a column code selected from the codebook from the terminal device via the server communication unit, converts the code-form query into an executable query according to the table code and the column code; and a query execution unit that extracts data corresponding to the converted query from a database to generate a response message, and then transfers the generated response message to the terminal device via the server communication unit.
[0011] The query conversion unit is characterized in that it derives the relationship between tables selected by the table code with reference to a relationship information model in which the relationships between tables are defined, and converts the code-form query into an executable query based on the derived relationship between tables and the column code.
[0012] The query conversion unit is characterized in that it derives a subquery executable alone and arranges the derived subquery within a FROM clause.
[0013] The server device further includes a codebook generation unit that generates a relationship information model defining relationships between a plurality of tables included in a database, generates a table code corresponding to each of the plurality of tables, generates a column code corresponding to a column to be exposed among a plurality of columns of the table, and generates a codebook including the table code and the column code.
[0014] The terminal device for generating a query according to the present invention includes a terminal communication unit that receives a codebook including a table code corresponding to each of a plurality of tables in which relationships between tables are defined and a column code corresponding to a column to be exposed among columns of the plurality of tables from a server device, selects the table code and the column code from the codebook based on a user input, generates a code-form query including the selected table code and column code, and transfers the code-form query generated via the terminal communication unit to the server device.
Advantages of the Invention
[0015] According to the present invention, a query can be automatically generated only by selecting codes, and the convenience of the user can be improved. Thereby, a new user experience is provided.
Brief Description of the Drawings
[0016]
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Figure 6
Figure 7
Embodiments for Carrying Out the Invention
[0017] Prior to the detailed description of the present invention, it should be noted that in the following description, only parts necessary for understanding the embodiments of the present invention are described, and descriptions of other parts are omitted as long as they do not deviate from the gist of the present invention.
[0018] The terms and words used in the present specification and claims described below should not be construed as being limited to their ordinary or dictionary meanings. Based on the principle that the inventor can appropriately define the concept of the terms in order to explain his invention in the best way, they should be construed as meanings and concepts that conform to the technical idea of the present invention. Therefore, the embodiments described in the present specification and the configurations shown in the drawings are merely preferred embodiments of the present invention and do not fully describe the technical idea of the present invention. It should be understood that there can be various equivalents and modifications that can replace them at the time of this application.
[0019] Hereinafter, embodiments of the present invention will be described in more detail with reference to the accompanying drawings. First, a system for generating a query using a relationship definition model according to an embodiment of the present invention will be described. FIG. 1 is a diagram for explaining a system for generating a query using a relationship definition model according to an embodiment of the present invention. FIG. 2 is a diagram for explaining the configuration of a server device for generating a query using a relationship definition model according to an embodiment of the present invention. FIG. 3 is a diagram for explaining the configuration of a terminal device for generating a query using a relationship definition model according to an embodiment of the present invention.
[0020] Referring to FIG. 1, a system for generating a query using a relationship definition model according to an embodiment of the present invention includes a server device 100 and a terminal device 200.
[0021] The server device 100 is basically one entity existing on the network, stores data having information necessary for the terminal device 200, and provides data corresponding to a query of the terminal device 200.
[0022] The terminal device 200 is basically a device used by a user. Representative examples of the terminal device 200 include a personal computer and a notebook computer. The terminal device 200 is connected to the server device 100 via a network, generates a query based on a user input, and transfers this to the server device 100 to request data corresponding to the query from the server device 100.
[0023] According to an embodiment of the present invention, after the server device 100 generates a codebook including table codes corresponding to a plurality of tables in which relationships between tables are defined and column codes corresponding to columns to be exposed among the columns of the plurality of tables, the server device 100 provides the codebook to the terminal device 200.
[0024] The terminal device 200 can generate a code-form query based on the codebook provided by the server device 100. Further, the terminal device 200 transfers the code-form query to the server device 100.
[0025] Thereby, after the server device 100 converts the code-form query into an executable query, it causes the converted query to be executed, generates a response message including data corresponding to the executed query, and provides it to the terminal device 200.
[0026] Referring to FIG. 2, the server device 100 includes a server communication unit 110, a codebook generation unit 120, a query conversion unit 130, a query execution unit 140, and a database 150.
[0027] The server communication unit 110 is for communication with the terminal device 200. The server communication unit 110 can communicate with the terminal device 200 connected via a wired or wireless network.
[0028] The codebook generation unit 120 is for generating a codebook. Specifically, the codebook generation unit 120 generates a relationship information model that defines the relationships between the tables included in the database 150. Next, the codebook generation unit 120 generates a codebook including table codes and column codes. At this time, the codebook generation unit 120 generates a table code corresponding to each of the plurality of tables for which relationships are defined. Next, the codebook generation unit 120 generates a column code corresponding to the column to be exposed among the plurality of columns of the table. Thereby, a codebook including table codes and column codes can be generated. When the codebook is generated, the codebook generation unit 120 can provide the codebook including table codes and column codes to the terminal device 200 via the server communication unit 110.
[0029] The query conversion unit 130 can receive a code-form query including a table code and a column code from the terminal device 200 via the server communication unit 110. Thereby, the query conversion unit 130 converts the code-form query into an executable query by the table code K and the column code L. Here, an executable query means a query in a form that can analyze the query and provide a response by the analysis. In particular, the query conversion unit 130 derives the relationship between the tables selected by the table code with reference to the relationship information model in which the relationship between the tables is defined, and can convert the code-form query into an executable query based on the derived relationship between the tables and the column code. In other words, after generating a query using the derived relationship between the tables, the query conversion unit 130 further maps the items corresponding to the column code and converts it into an executable query. In particular, the query conversion unit 130 can derive a subquery that can be executed alone, and generate a query in the form of an inline view by arranging the derived subquery in the FROM clause.
[0030] The query execution unit 140 generates a response message with reference to the database 150 corresponding to the executable query, and provides the generated response message to the terminal device 200. That is, data corresponding to the executable query is extracted from the database 150 of the server device 100, a response message including the extracted data is generated, and then the generated response message can be transferred to the terminal device 200.
[0031] Referring to FIG. 3, the terminal device 200 includes a terminal communication unit 210 and a query generation unit 220.
[0032] The terminal communication unit 210 is for communication with the server device 100. The terminal communication unit 210 can communicate with the server device 100 connected via a wired or wireless network. As a result, the terminal communication unit 210 can receive a codebook including table codes corresponding to each of a plurality of tables in which the relationships between the tables are defined and column codes corresponding to the columns to be exposed among the columns of the plurality of tables from the server device 100.
[0033] The query generation unit 220 can select a table code K and a column code L from the codebook according to the user input, and generate a code-form query using the selected table code K and column code L. Also, the query generation unit 220 can transfer the code-form query generated via the terminal communication unit 210 to the server device 100.
[0034] Next, a method for generating a query using the relationship definition model according to the embodiment of the present invention will be described. FIG. 4 is a flowchart for explaining a method for generating a query using the relationship definition model according to the embodiment of the present invention. FIGS. 5 to 7 are exemplary diagrams for explaining a method for generating a query using the relationship definition model according to the embodiment of the present invention.
[0035] Referring to FIG. 4, the codebook generation unit 120 of the server device 100 generates a relationship information model that defines the relationships between the tables included in the database 150 in step S110.
[0036] Next, as shown in FIG. 5, the codebook generation unit 120 generates a codebook including the table code K and the column code L at step S120. At this time, the codebook generation unit 120 generates a table code K corresponding to each of a plurality of tables for which relationships are defined (for example, "REP4A927854D97A44968B6232C342683701"). Next, the codebook generation unit 120 generates a column code corresponding to the column to be exposed among the plurality of columns of the table. Thereby, a codebook including the table code and the column code can be generated.
[0037] When the codebook is generated, the codebook generation unit 120 provides the terminal device 200 with a codebook including the table code and the column code via the server communication unit 110 at step S130.
[0038] Thereby, the terminal communication unit 210 of the terminal device 200 can receive a codebook including a table code corresponding to each of a plurality of tables for which relationships between tables are defined and a column code corresponding to the column to be exposed among the columns of the plurality of tables.
[0039] Thereby, the query generation unit 220 of the terminal device 200 selects the table code K and the column code L from the codebook based on the user input at step S140, and can generate a code-form query using the selected table code K and column code L as shown in FIG. 6.
[0040] Next, the query generation unit 220 transfers the generated code-form query to the server device 100 via the terminal communication unit 210 at step S150. Thereby, the server communication unit 110 of the server device 100 can receive a code-form query including the table code and the column code.
[0041] As a result, at step S160, the query conversion unit 130 of the server device 100 converts the code-form query into an executable query using the table code K and the column code L. Here, an executable query means a query that can analyze the query and provide a response through the analysis.
[0042] At this time, the query conversion unit 130 can derive the relationship between the tables selected by the table code with reference to the relationship information model in which the relationship between the tables is defined, and convert the code-form query into an executable query based on the derived relationship between the tables and the column code. More specifically, as shown in FIG. 7, a query is generated using the derived relationship between the tables (P1), items corresponding to the column code are mapped (P2), and it is converted into an executable query.
[0043] In particular, the query conversion unit 130 can derive a subquery Q that can be executed independently, and generate a query in the form of an inline view by placing the derived subquery Q within the FROM clause R.
[0044] Next, at step S170, the query execution unit 140 of the server device 100 generates a response message with reference to the database 150 corresponding to the executable query, and at step S180, provides the generated response message to the terminal device 200. For example, after extracting data corresponding to the executable query from the database 150 of the server device 100 and generating a response message including the extracted data, the generated response message can be transferred to the terminal device 200.
[0045] The method according to the embodiment of the present invention described above can be embodied in a program form readable through various computer means and can be recorded on a computer-readable recording medium. Here, the recording medium may include program instructions, data files, data structures, etc. alone or in combination. The program instructions recorded on the recording medium may be those specially designed and configured for the present invention, or those known and usable by those skilled in the computer software field. For example, the recording medium includes magnetic media such as hard disks, floppy disks, and magnetic tapes, optical media such as CD-ROMs and DVDs, magneto-optical media such as floptical disks, and hardware devices specially configured to store and execute program instructions such as ROMs, RAMs, and flash memories. Examples of program instructions may include not only machine language codes created by compilers but also high-level language codes that can be executed by a computer using an interpreter or the like. Such a hardware device may be configured to operate as one or more software modules for performing the operations of the present invention, and vice versa.
[0046] As described above, the present invention has been described using several preferred embodiments. However, these embodiments are exemplary and not limiting. Thus, those having ordinary knowledge in the technical field to which the present invention pertains can understand that various changes and modifications can be made by the doctrine of equivalents without departing from the spirit of the present invention and the scope of the rights presented in the appended claims.
Explanation of Reference Numerals
[0047] 100: Server device 110: Server communication unit 120: Codebook generation unit 130: Query conversion unit 140: Query execution unit 150: Database 200: Terminal device 210: Terminal communication section 220: Query generation section
Claims
1. 1. A method for generating a query of a server device, comprising: a codebook generating unit providing a codebook including table codes corresponding to a plurality of tables in which relationships between tables are defined, and column codes corresponding to columns to be exposed among the columns of the plurality of tables, to the terminal device via a server communication unit; receiving a code-type query including a table code and a column code selected from the codebook from a terminal device via the server communication unit, the query conversion unit converting the code-type query into an executable query according to the table code and the column code; a query execution unit extracting data corresponding to the converted query from a database to generate a response message, and then transmitting the generated response message to a terminal device via a server communication unit; 16. A method for generating a query, comprising:
2. The stage of converting the query into an executable query is the query conversion unit deriving a relationship between selected tables according to table codes by referring to a relationship information model in which relationships between tables are defined; converting the coded query into an executable query based on the table relationships and column codes derived by the query conversion unit; 2. The method for generating a query of claim 1, comprising:
3. The stage of converting the query into an executable query is 2. The method for generating a query according to claim 1, wherein the query transformation unit derives an independently executable sub-query and places the derived sub-query in a FROM clause.
4. Prior to the step of providing the codebook, generating a relational information model defining relations between a plurality of tables included in the database by the codebook generating unit; generating table codes corresponding to the plurality of tables by the codebook generating unit; generating a column code corresponding to a column to be exposed among a plurality of columns of the table; generating a codebook including the table code and the column code by the codebook generating unit; 2. The method for generating a query of claim 1, further comprising:
5. 1. A method for generating a query for a terminal device, comprising: receiving, from a server device, a codebook including table codes corresponding to a plurality of tables in which relationships between tables are defined, and column codes corresponding to columns to be exposed among the columns of the plurality of tables; a query generating unit selecting the table code and the column code from the codebook according to a user's input, and generating a code-type query including the selected table code and column code; The query generating unit transmits the generated code-type query to a server device via the device communication unit; 16. A method for generating a query, comprising:
6. A server device for generating a query, comprising: a codebook generating unit for providing a codebook including table codes corresponding to a plurality of tables, each of which has a relationship between tables defined, and column codes corresponding to columns to be exposed among the columns of the plurality of tables, to the terminal device via the server communication unit; a query conversion unit that converts a code-type query including a table code and a column code selected from the codebook from a terminal device via the server communication unit into an executable query based on the table code and the column code; a query execution unit that extracts data corresponding to the converted query from the database, generates a response message, and then transfers the generated response message to the terminal device via the server communication unit; 13. A server device for generating a query, comprising:
7. The query conversion unit is Derive the relationship between the tables selected by the table code by referring to the relationship information model in which the relationships between the tables are defined; 7. The server device for generating queries according to claim 6, further comprising: converting the coded query into an executable query based on the derived table relationships and column codes.
8. The query conversion unit is 7. The server apparatus for generating queries of claim 6, further comprising: deriving an independently executable sub-query; and placing the derived sub-query in a FROM clause.
9. generating a relational information model defining relationships between multiple tables included in the database; generating a table code corresponding to each of the plurality of tables; generating a column code corresponding to a column to be exposed among the plurality of columns of the table; The server apparatus for generating a query according to claim 6, further comprising a codebook generating unit for generating a codebook including the table code and the column code.
10. A terminal device for generating a query, comprising: a terminal communication unit that receives from a server device a codebook including table codes corresponding to a plurality of tables in which relationships between tables are defined, and column codes corresponding to columns to be exposed among the columns of the plurality of tables; a query generating unit that selects the table code and the column code from the codebook in response to a user's input, generates a code-type query including the selected table code and column code, and transfers the generated code-type query to a server device via the terminal communication unit; 16. A terminal device for generating a query, comprising:
Citation Information
Patent Citations
Apparatus for generating automatically SQL statements using random expression and method thereof
KR102586375B1