System interaction method and device, equipment and storage medium

By parsing and transforming SQL statements to generate command statements for interaction with the operating system, the problem of users needing to spend a lot of time learning command languages ​​is solved, and efficient system interaction is achieved.

CN115981791BActive Publication Date: 2026-08-04ADVANCED NEW TECHNOLOGIES CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ADVANCED NEW TECHNOLOGIES CO LTD
Filing Date
2019-05-23
Publication Date
2026-08-04

AI Technical Summary

Technical Problem

When users interact with the operating system through command language, they need to spend a lot of time and effort learning, resulting in low work efficiency.

Method used

The target SQL statement is parsed to generate an abstract syntax tree, the nodes to be converted are determined, and the statement is converted into operation commands of the target command language based on a preset mapping relationship, generating command statements that interact with the operating system.

Benefits of technology

It lowers the barrier to entry for interacting with the operating system through command language, improves work efficiency, and reduces the time and effort required for learning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115981791B_ABST
    Figure CN115981791B_ABST
Patent Text Reader

Abstract

This application provides a system interaction method, apparatus, device, and storage medium, relating to the field of computer technology. The method includes: parsing a target SQL statement to determine elements to be converted within the target SQL statement; converting the elements to be converted into operation commands corresponding to a target command language of a target operating system based on a preset mapping relationship, wherein the preset mapping relationship includes a mapping relationship between language elements in the target SQL statement and operation commands in the target command language; and generating a command statement corresponding to the target command language based on the converted target SQL statement, so as to interact with the target operating system based on the command statement. The technical solution of this application enables interaction with the operating system through SQL language, eliminating the need for significant time and effort to learn command languages, thus lowering the barrier to entry for interacting with the operating system through command languages.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This invention patent application is a divisional application of Chinese invention patent application filed on May 23, 2019, with application number 201910435910.5 and title "System Interaction Method, Apparatus, Device and Storage Medium". Technical Field

[0002] This application relates to the field of computer technology, and in particular to a system interaction method, system interaction device, system interaction equipment, and computer-readable storage medium. Background Technology

[0003] With the rapid development of computer technology, users are interacting more and more with the operating system, and how to better interact with the operating system has become a focus of attention.

[0004] Currently, users primarily interact with the operating system through command languages. Command languages ​​are languages ​​used by the operating system to parse and execute user-input commands. However, because command languages ​​such as PowerShell are not commonly used programming languages, many users are unfamiliar with their commands. Interacting directly with the operating system through command languages ​​requires a significant investment of time and effort to learn, resulting in low work efficiency for these users. Summary of the Invention

[0005] The purpose of this application is to provide a system interaction method, system interaction device, system interaction equipment, and computer-readable storage medium to improve the efficiency of users interacting with the operating system through command language.

[0006] To solve the above-mentioned technical problems, the embodiments of this application are implemented as follows:

[0007] According to a first aspect of the embodiments of this application, a system interaction method is provided, including:

[0008] The target Structured Query Language (SQL) statement is parsed, and an abstract syntax tree (AST) corresponding to the target SQL statement is generated based on the parsing results. The AST is traversed, and the nodes to be converted in the AST are determined based on the type of the language elements corresponding to the traversed nodes. The language elements corresponding to the nodes to be converted are used as the elements to be converted in the target SQL statement.

[0009] Based on a preset mapping relationship, the elements to be converted in the target SQL statement are converted into operation commands corresponding to the target command language of the target operating system to obtain the converted target SQL statement; wherein, the preset mapping relationship includes the mapping relationship between the language elements in the target SQL statement and the operation commands of the target command language;

[0010] Based on the converted target SQL statement, a command statement corresponding to the target command language is generated.

[0011] In an example embodiment of this application, based on the above scheme, the target SQL statement is parsed, and an abstract syntax tree corresponding to the target SQL statement is generated based on the parsing result. This includes: performing lexical analysis on the target SQL statement to generate multiple language elements corresponding to the target SQL statement; and performing syntactic analysis on the target SQL statement to generate the abstract syntax tree corresponding to the target SQL statement based on the multiple language elements.

[0012] In an example embodiment of this application, based on the above scheme, traversing the abstract syntax tree includes: traversing the abstract syntax tree based on visitor pattern and breadth-first traversal.

[0013] In the example embodiments of this application, based on the above scheme, the target operating system is a Windows operating system, and the target command language is PowerShell.

[0014] According to a second aspect of this application, a system interaction device is provided, comprising: a parsing module, configured to parse a target SQL statement and generate an abstract syntax tree corresponding to the target SQL statement based on the parsing result; traverse the abstract syntax tree and determine the nodes to be converted in the abstract syntax tree based on the type of the language elements corresponding to the traversed nodes; and use the language elements corresponding to the nodes to be converted as the elements to be converted in the target SQL statement; a conversion module, configured to convert the elements to be converted in the target SQL statement into operation commands corresponding to the target command language of the target operating system, thereby obtaining a converted target SQL statement; wherein the preset mapping relationship includes a mapping relationship between the language elements in the target SQL statement and the operation commands of the target command language; and a generation module, configured to generate a command statement corresponding to the target command language based on the converted target SQL statement.

[0015] In an example embodiment of this application, based on the above scheme, the parsing module includes: a lexical parsing unit, used to perform lexical parsing on the target SQL statement to generate multiple language elements corresponding to the target SQL statement; and a syntax parsing unit, used to perform syntax analysis on the target SQL statement to generate the abstract syntax tree corresponding to the target SQL statement based on the multiple language elements.

[0016] In the example embodiments of this application, based on the above scheme, the parsing module traverses the abstract syntax tree based on the visitor pattern and breadth-first traversal.

[0017] In the example embodiments of this application, based on the above scheme, the target operating system is a Windows operating system, and the target command language is PowerShell.

[0018] According to a third aspect of the embodiments of this application, a system interaction device is provided, including: a processor; and a memory configured to store computer-executable instructions, which, when executed, cause the processor to implement the steps of the system interaction method described in any one of the first aspects above.

[0019] According to a fourth aspect of the embodiments of this application, a storage medium is provided for storing computer-executable instructions, which, when executed, implement the steps of the system interaction method described in any one of the first aspects above.

[0020] Through the technical solutions in this application embodiment, on the one hand, the target SQL statement is parsed to determine the elements to be converted in the target SQL statement, which can accurately identify the language elements in the target SQL statement that need to be converted; on the other hand, based on the preset mapping relationship, the elements to be converted are converted into operation commands corresponding to the target command language, which can efficiently convert the elements to be converted in the target SQL statement into operation commands corresponding to the target command language, thus improving the conversion efficiency; furthermore, a command statement corresponding to the target command language is generated to interact with the target operating system based on the command statement, which enables interaction with the operating system through SQL language without spending a lot of time and effort to learn the command language, thus lowering the usage threshold for interacting with the operating system through the command language and improving the work efficiency of such users. Attached Figure Description

[0021] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0022] Figure 1 A flowchart illustrating a system interaction method provided according to some embodiments of this application is shown;

[0023] Figure 2 A flowchart illustrating the process of determining the element to be converted in a target SQL statement according to some embodiments of this application is shown;

[0024] Figure 3 A schematic diagram of an abstract syntax tree corresponding to a target SQL statement is shown, according to some embodiments of this application;

[0025] Figure 4 A flowchart illustrating a system interaction method provided according to some other embodiments of this application is shown;

[0026] Figure 5 A schematic block diagram of a system interaction device provided according to some embodiments of this application is shown;

[0027] Figure 6 A schematic block diagram of a parsing module provided according to some embodiments of this application is shown;

[0028] Figure 7 A schematic block diagram of a conversion module provided according to some embodiments of this application is shown;

[0029] Figure 8 A schematic block diagram of a system interaction device provided according to some embodiments of this application is shown. Detailed Implementation

[0030] To enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in 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 should fall within the scope of protection of this application.

[0031] SQL (Structured Query Language) is a widely used and accepted data query language. If SQL could be used to interact with the operating system—that is, to translate SQL statements into corresponding command-line statements—it would significantly lower the barrier to entry for users interacting with the operating system through command-line languages, and improve their work efficiency.

[0032] Based on the above, this application first proposes a system interaction method. Figure 1 A flowchart illustrating a system interaction method according to some embodiments of this application is shown. This system interaction method can be applied to and executed by a terminal device, which includes, but is not limited to, a desktop computer, a laptop computer, or a tablet computer. (Refer to...) Figure 1 As shown, the system interaction method includes steps S110 to S130, which will be discussed below. Figure 1 The system interaction methods in the example embodiments of this application are described in detail.

[0033] Reference Figure 1 As shown, in step S110, the target SQL statement is parsed to determine the elements to be converted in the target SQL statement.

[0034] In the example embodiment, the elements to be converted in the target SQL statement represent the language elements of the operation commands in the target SQL statement that need to be converted into the target command language. The language elements in the SQL statement represent lexical units in the SQL language. The types of language elements in the SQL language can include: keywords, identifiers, literals, operators, and delimiters. The elements to be converted in the SQL statement can include keywords and / or identifiers in the SQL statement. For example, keywords in the SQL statement can include: insert, delete, update, select, from, where, and, or, not, etc.; identifiers in the SQL statement can include: database name, table name, file name, path name, etc.; literals in the SQL statement can include: numbers, strings, percentages, etc.; operators can include: +, -, *, >, etc.; delimiters in the SQL statement can include: commas, semicolons, quotation marks, etc.

[0035] In the example embodiment, the target SQL statement is parsed to determine the keywords and / or identifiers within it, and these determined keywords and / or identifiers are used as elements to be converted within the target SQL statement. For example, suppose the target SQL statement is "select files from mycomputer where path = 'E:\music'", which is used to view the file list under the directory E:\music of the computer named mycomputer. After parsing the target SQL statement, multiple language elements corresponding to the target SQL statement are generated. Among these, the language elements "select", "from", and "where" are of type keywords; the language elements "files", "mycomputer", and "path" are of type identifiers; the language elements "=" and "single quote ''" are of type delimiters; and the language element "E:\music" is of type literal, i.e., a string literal.

[0036] In this example embodiment, it is necessary to convert the keywords select, from, where, and the identifiers files, mycomputer, and path in the target SQL statement. Therefore, the language elements select, from, where, files, mycomputer, and path are taken as the elements to be converted in the target SQL statement.

[0037] Furthermore, in the example embodiment, lexical analysis and syntax analysis are performed on the target SQL statement, and the elements to be converted in the target SQL statement are determined based on the analysis results. For example, keywords and / or identifiers in the target SQL statement are determined based on the analysis results, and the determined keywords and / or identifiers are used as the elements to be converted in the target SQL statement.

[0038] In step S120, based on a preset mapping relationship, the elements to be converted in the target SQL statement are converted into operation commands corresponding to the target command language of the target operating system to obtain the converted target SQL statement; wherein, the preset mapping relationship includes the mapping relationship between the language elements in the target SQL statement and the operation commands of the target command language.

[0039] In the example embodiment, the target operating system is Windows, and the target command language is PowerShell. A command language is a language used by the operating system to enable interaction between the user and the operating system. The preset mapping relationship includes the mapping relationship between language elements in the target SQL statement and operation commands in the target command language. This mapping relationship can be one-to-one or many-to-one, meaning one language element maps to one operation command or multiple language elements map to one operation command. In the example embodiment, this preset mapping relationship can be implemented using a MAP or other suitable methods such as key-value pairs; this application does not impose any special limitations on this. Further, based on this preset mapping relationship, the elements to be converted in the target SQL statement are converted into the corresponding operation commands in the preset mapping relationship.

[0040] For example, assuming the target command language is PowerShell, the one-to-one mapping between SQL language elements and PowerShell operation commands can include: insert mapping to write, update mapping to set, select mapping to get, etc. The many-to-one mapping between SQL and PowerShell can include: select content from mapping to get-content; select files from mapping to get-childitem; select files from…where..path mapping to get-childitem-path, etc. Therefore, in the example embodiment, select content from in the target SQL statement is converted to get-content in PowerShell; select files from in the target SQL statement is mapped to get-childitem in PowerShell; and select files from…where..path in the target SQL statement is converted to get-childitem-path in PowerShell.

[0041] It should be noted that, in the example embodiments of this application, the target operating system may also be a Linux operating system or a MacOS operating system, and the corresponding target command language may be a shell language or other appropriate command language. This application does not impose any special limitations on this.

[0042] In step S130, based on the converted target SQL statement, a command statement corresponding to the target command language is generated to interact with the target operating system based on the command statement.

[0043] In the example embodiment, after converting the elements to be converted in the target SQL statement into operation commands corresponding to the target command language, the converted target SQL statement is processed to generate a command statement corresponding to the target command language, and the command statement is executed to interact with the target operating system. Processing the converted target SQL statement may include: deleting redundant language elements, such as redundant identifiers, or replacing language elements in the target SQL statement with language elements of the target command language, or may include other appropriate processing, which is also within the scope of protection of this application.

[0044] For example, suppose the target command language is PowerShell, and the target SQL statement is `select files from mycomputer where path = 'E:\music'`. The default mapping includes `select files from…where..path` mapped to `get-childitem-path`. After converting the elements of the target SQL statement into corresponding PowerShell commands, the target SQL statement becomes: `get-childitem-path mycomputer 'E:\music'`. The converted SQL statement is then processed by removing the redundant identifier `mycomputer` (the operating system defaults to the currently logged-in computer), generating the PowerShell command `get-childitem-path E:\music`. This command interacts with the target operating system, returning a list of files in the `music` folder on drive E of the currently logged-in computer.

[0045] according to Figure 1The system interaction method in the example embodiment, on the one hand, parses the target SQL statement to determine the elements to be converted in the target SQL statement, which can accurately determine the language elements in the target SQL statement that need to be converted; on the other hand, based on the preset mapping relationship, it converts the elements to be converted into operation commands corresponding to the target command language, which can efficiently convert the elements to be converted in the target SQL statement into operation commands corresponding to the target command language, thus improving the conversion efficiency; furthermore, it generates a command statement corresponding to the target command language to interact with the target operating system, which can interact with the operating system through SQL language without spending a lot of time and effort to learn the command language, thus lowering the usage threshold for interacting with the operating system through the command language.

[0046] Figure 2 A flowchart illustrating the process of determining the element to be converted in a target SQL statement according to some embodiments of this application is shown.

[0047] Reference Figure 2 As shown, in step S210, the target SQL statement is parsed, and an abstract syntax tree corresponding to the target SQL statement is generated based on the parsing result.

[0048] In the example embodiment, lexical parsing is performed on the target SQL statement to generate multiple language elements corresponding to the target SQL statement. For example, suppose the target SQL statement is "select myfile from mycomputer where path = 'E:\music'". After parsing the target SQL statement, the following language elements are generated: select, myfile, from, mycomputer, where, path, =, E:\music.

[0049] Furthermore, in the example embodiment, the type of each language element in the target SQL statement is determined. For example, the language elements "select", "from", and "where" are of the type of keywords; the language elements "myfile", "mycomuputer", and "path" are of the type of identifiers; the language element "=" is of the type of delimiter; and the language element "E:\music" is of the type of string literal.

[0050] Furthermore, the target SQL statement is subjected to syntax analysis to generate an abstract syntax tree corresponding to the target SQL statement. For example, a syntax parser sequentially obtains the syntax elements in the target SQL statement, and generates the corresponding abstract syntax tree based on the obtained syntax elements. In the example embodiment, the target SQL statement can be parsed using SqlParser to generate the corresponding abstract syntax tree. It should be noted that other suitable syntax parsers, such as ANTLR or JsqlParser, can also be used to parse the target SQL statement, and this application does not impose any special limitations on this.

[0051] Figure 3 A schematic diagram of an abstract syntax tree corresponding to a target SQL statement, provided according to some embodiments of this application, is shown. (Refer to...) Figure 3 As shown, the target SQL statement is `select content from mycomputer where path = 'E:\myfile'`. This target SQL statement is used to retrieve the file content of the file `myfile` under the directory `E:\myfile`. Under the root node `root`, there are multiple syntax elements of the target SQL statement. These syntax elements are arranged in the order of the syntax rules. Among them, the keywords `select`, `from`, and `where` are child nodes of the root node. The identifier `content` in the SQL statement is an identifier defined in the syntax rules, `mycomputer` is a child node of the identifier `computername` defined in the syntax rules, the identifier `path` is an identifier defined in the syntax rules, and the literal `E:\myfile` is a child node of the identifier `path`.

[0052] In step S220, the abstract syntax tree is traversed, and the nodes to be converted in the abstract syntax tree are determined based on the type of the language element corresponding to the traversed node.

[0053] In the example embodiment, the abstract syntax tree is traversed using a breadth-first search method to determine whether the type of the language element corresponding to the traversed node is a keyword or an identifier. Nodes whose language element type is a keyword or identifier are identified as nodes in the abstract syntax tree to be converted. For example, the language elements "select", "from", and "where" are keywords; the language elements "content", "mycomuputer", and "path" are identifiers; the language element "=" is a delimiter; and the language element "E:\music" is a literal. It should be noted that the abstract syntax tree can also be traversed using a depth-first search method or other suitable traversal methods, and this application does not impose any special limitations on this.

[0054] In step S230, the language element corresponding to the node to be converted in the abstract syntax tree is taken as the element to be converted in the target SQL statement.

[0055] In the example embodiment, the language elements corresponding to the nodes to be converted in the abstract syntax tree are used as the elements to be converted in the target SQL statement. For example, in the above embodiment, "select", "content", "from", "where", "mycomuputer", and "path" corresponding to the nodes to be converted are determined as the elements to be converted in the SQL statement.

[0056] Furthermore, in the example embodiment, based on a preset mapping relationship, the elements to be converted in the target SQL statement are transformed into operation commands corresponding to the target command language of the target operating system. For example, the keyword "select content from" is converted into the "get-content" command in PowerShell, and the converted target SQL statement becomes "get-content-path mycomputer E:\myfile".

[0057] Next, a command statement corresponding to the target command language is generated based on the converted target SQL statement to interact with the target operating system. In an example embodiment, the converted target SQL statement is processed to generate a command corresponding to the target command language. For example, suppose the converted target SQL statement becomes get-content-pathmycomputer E:\myfile. Redundant language elements such as mycomputer (which defaults to the currently logged-in computer) are removed from the target SQL statement, generating the corresponding command statement get-content-path E:\myfile. Executing the generated command statement returns the file content of the myfile file to the operating system.

[0058] Figure 4 A flowchart illustrating a system interaction method provided according to some other embodiments of this application is shown.

[0059] Reference Figure 4 As shown, in step S410, the target SQL statement is parsed to generate an abstract syntax tree corresponding to the target SQL statement.

[0060] In the example embodiment, lexical parsing is performed on the target SQL statement to generate multiple language elements corresponding to the target SQL statement. For example, suppose the target SQL statement is select * from mycomputer where path = 'C:\'. After parsing the target SQL statement, the following language elements are generated: select, *, from, mycomputer, where, path, =, C:\.

[0061] Furthermore, in the example embodiment, the type of each language element in the target SQL statement is determined. For example, the language elements "select", "from", and "where" are of type keywords; the language elements "*", "mycomuputer", and "path" are of type identifiers; the language element "=" is of type delimiter; and the language element "C:\" is of type literal.

[0062] Furthermore, the target SQL statement is subjected to syntax analysis to generate an abstract syntax tree corresponding to the target SQL statement. For example, a syntax parser sequentially obtains the syntax elements in the target SQL statement, and generates the corresponding abstract syntax tree based on the obtained syntax elements. In the example embodiment, the target SQL statement can be parsed using SqlParser to generate the corresponding abstract syntax tree. It should be noted that other suitable syntax parsers, such as ANTLR or JsqlParser, can also be used to parse the target SQL statement, and this application does not impose any special limitations on this.

[0063] In step S420, based on the visitor pattern, the generated abstract syntax tree is traversed using breadth-first search to determine the nodes to be converted.

[0064] In the example embodiment, nodes in the generated abstract syntax tree are accessed using the visitor pattern, and each node in the abstract syntax tree is traversed using breadth-first search to determine the type of the syntax element corresponding to the traversed node. Nodes whose syntax element type is a keyword and / or identifier are identified as nodes to be converted. For example, nodes corresponding to the keywords "select", "from", and "where", as well as the identifiers "*", "mycomuputer", and "path" are identified as nodes to be converted.

[0065] In step S430, the operation node to be converted is converted into the operation command corresponding to the target command language.

[0066] In the example embodiment, based on a preset mapping relationship, the language elements corresponding to the operation nodes to be converted are transformed into operation commands corresponding to the target command language. For example, the nodes to be converted corresponding to select, *, from, and path are transformed into get-childitem-path, and the target SQL statement after conversion is get-childitem-path mycomputer C:\.

[0067] In step S440, a corresponding command statement is generated based on the transformed target SQL statement, the command statement is executed, and the interactive result is returned.

[0068] In the example embodiment, the converted target SQL statement is processed to generate a command corresponding to the target command language. This command is then executed, and an interactive result is returned. For example, suppose the converted target SQL statement becomes `get-childitem-path mycomputer C:\`. Redundant language elements such as `mycomputer` (which defaults to the currently logged-in computer) are removed from the target SQL statement, generating the corresponding command statement `get-childitem-path C:\`. Executing this command statement returns a list of files on the C drive of the currently logged-in computer.

[0069] Furthermore, in the example implementation, the first abstract syntax tree containing the operation commands is transformed into a second abstract syntax tree corresponding to the target command language; command statements corresponding to the target command language are then generated based on the second abstract syntax tree. The second abstract syntax tree is an abstract syntax tree that conforms to the syntax rules of the target command language. By introducing the second abstract syntax tree to generate corresponding command statements, the conversion efficiency of SQL can be improved in many cases, thereby enhancing the user experience.

[0070] In an example embodiment of this application, a system interaction device is also provided. (Refer to...) Figure 5 As shown, the system interaction device 500 includes: a parsing module 510, a conversion module 520, and a generation module 530. The parsing module 510 parses the target SQL statement to determine the elements to be converted in the target SQL statement. The conversion module 520 converts the elements to be converted in the target SQL statement into operation commands corresponding to the target command language of the target operating system based on a preset mapping relationship, thereby obtaining a converted target SQL statement. The preset mapping relationship includes the mapping relationship between language elements in the target SQL statement and operation commands of the target command language. The generation module 530 generates a command statement corresponding to the target command language based on the converted target SQL statement, enabling interaction with the target operating system based on the command statement.

[0071] In some example embodiments of this application, based on the above scheme, the parsing module 510 includes: a syntax tree generation unit 610, used to parse the target SQL statement and generate an abstract syntax tree corresponding to the target SQL statement based on the parsing result; a traversal unit 620, used to traverse the abstract syntax tree and determine the node to be converted in the abstract syntax tree based on the type of the language element corresponding to the traversed node; and a determination unit 630, used to take the language element corresponding to the node to be converted as the element to be converted in the target SQL statement.

[0072] In some example embodiments of this application, based on the above scheme, the conversion module 520 includes: a lookup unit 710, used to look up the corresponding operation command from the preset mapping relationship based on the language element corresponding to the node to be converted in the abstract syntax tree; and an element conversion unit 720, used to convert the language element corresponding to the node to be converted into an operation command corresponding to the target command language if the corresponding operation command is found.

[0073] In some example embodiments of this application, based on the above scheme, the syntax tree generation unit includes: a lexical analysis unit, used to perform lexical analysis on the target SQL statement to generate multiple language elements corresponding to the target SQL statement; and a syntax analysis unit, used to perform syntactic analysis on the target SQL statement to generate the abstract syntax tree corresponding to the target SQL statement based on the multiple language elements.

[0074] In some example embodiments of this application, based on the above scheme, the traversal unit is configured to traverse the abstract syntax tree based on visitor pattern and breadth-first traversal.

[0075] In some example embodiments of this application, based on the above scheme, the target operating system is a Windows operating system, and the target command language is PowerShell.

[0076] according to Figure 5The system interaction device in the example embodiment, on the one hand, parses the target SQL statement to determine the elements to be converted in the target SQL statement, accurately identifying the language elements in the target SQL statement that need to be converted; on the other hand, based on a preset mapping relationship, it converts the elements to be converted into operation commands corresponding to the target command language, efficiently converting the elements to be converted in the target SQL statement into operation commands corresponding to the target command language, thus improving conversion efficiency; furthermore, it generates a command statement corresponding to the target command language to interact with the target operating system, enabling interaction with the operating system through SQL language without spending a lot of time and effort learning the command language, lowering the usage threshold for interacting with the operating system through the command language, and improving the user's work efficiency in interacting with the operating system through the command language.

[0077] The system interaction device provided in this application embodiment can implement the various processes in the foregoing method embodiments and achieve the same functions and effects, which will not be repeated here.

[0078] Furthermore, embodiments of this application also provide a system interaction device, such as... Figure 8 As shown.

[0079] The system interaction device can vary significantly due to differences in configuration or performance. It may include one or more processors 801 and memory 802, and the memory 802 may store one or more application programs or data. The memory 802 may be temporary or persistent storage. The application programs stored in the memory 802 may include one or more modules (not shown in the figure), and each module may include a series of computer-executable instructions for the system interaction device. Furthermore, the processor 801 may be configured to communicate with the memory 802 and execute the series of computer-executable instructions stored in the memory 802 on the system interaction device. The system interaction device may also include one or more power supplies 803, one or more wired or wireless network interfaces 804, one or more input / output interfaces 805, one or more keyboards 806, etc.

[0080] In one specific embodiment, the system interaction device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer-executable instructions for the system interaction device, and is configured to be executed by one or more processors. The one or more programs include computer-executable instructions for performing the following: parsing a target SQL statement to determine the elements to be converted in the target SQL statement; converting the elements to be converted into operation commands corresponding to the target command language of the target operating system based on a preset mapping relationship, wherein the preset mapping relationship includes the mapping relationship between language elements in the target SQL statement and operation commands of the target command language; generating a command statement corresponding to the target command language based on the converted target SQL statement, so as to interact with the target operating system based on the command statement.

[0081] Optionally, when the computer-executable instruction is executed, it parses the target SQL statement to determine the elements to be converted in the target SQL statement, including: parsing the target SQL statement and generating an abstract syntax tree corresponding to the target SQL statement based on the parsing result; traversing the abstract syntax tree and determining the nodes to be converted in the abstract syntax tree based on the type of the language elements corresponding to the traversed nodes; and using the language elements corresponding to the nodes to be converted as the elements to be converted in the target SQL statement.

[0082] Optionally, when the computer-executable instruction is executed, the element to be converted is converted into an operation command corresponding to the target command language of the target operating system based on a preset mapping relationship. This includes: searching for the corresponding operation command from the preset mapping relationship based on the language element corresponding to the node to be converted in the abstract syntax tree; if the corresponding operation command is found, then the language element corresponding to the node to be converted is converted into an operation command corresponding to the target command language.

[0083] Optionally, when the computer-executable instructions are executed, they parse the target SQL statement and generate an abstract syntax tree corresponding to the target SQL statement based on the parsing results, including: performing lexical analysis on the target SQL statement to generate multiple language elements corresponding to the target SQL statement; and performing syntactic analysis on the target SQL statement to generate the abstract syntax tree corresponding to the target SQL statement based on the multiple language elements.

[0084] Optionally, when the computer-executable instructions are executed, they traverse the abstract syntax tree, including traversing the abstract syntax tree based on visitor patterns and breadth-first traversal.

[0085] Optionally, when the computer-executable instructions are executed, the target operating system is a Windows operating system, and the target command language is PowerShell.

[0086] The system interaction device provided in this application embodiment can implement the various processes in the foregoing method embodiments and achieve the same functions and effects, which will not be repeated here.

[0087] Furthermore, this application also provides a storage medium for storing computer-executable instructions. In one specific embodiment, the storage medium can be a USB flash drive, optical disc, hard disk, etc. When the computer-executable instructions stored in the storage medium are executed by a processor, they can perform the following process: parsing a target SQL statement to determine the elements to be converted in the target SQL statement; converting the elements to be converted into operation commands corresponding to the target command language of the target operating system based on a preset mapping relationship, wherein the preset mapping relationship includes the mapping relationship between language elements in the target SQL statement and operation commands of the target command language; generating a command statement corresponding to the target command language based on the converted target SQL statement, so as to interact with the target operating system based on the command statement.

[0088] Optionally, when the computer-executable instructions stored in the storage medium are executed by a processor, they parse the target SQL statement to determine the elements to be converted in the target SQL statement, including: parsing the target SQL statement and generating an abstract syntax tree corresponding to the target SQL statement based on the parsing result; traversing the abstract syntax tree and determining the nodes to be converted in the abstract syntax tree based on the type of the language elements corresponding to the traversed nodes; and using the language elements corresponding to the nodes to be converted as the elements to be converted in the target SQL statement.

[0089] Optionally, when the computer-executable instructions stored in the storage medium are executed by the processor, the elements to be converted are converted into operation commands corresponding to the target command language of the target operating system based on a preset mapping relationship. This includes: searching for the corresponding operation command from the preset mapping relationship based on the language element corresponding to the node to be converted in the abstract syntax tree; if the corresponding operation command is found, then converting the language element corresponding to the node to be converted into the operation command corresponding to the target command language.

[0090] Optionally, when the computer-executable instructions stored in the storage medium are executed by a processor, they parse the target SQL statement and generate an abstract syntax tree corresponding to the target SQL statement based on the parsing results. This includes: performing lexical analysis on the target SQL statement to generate multiple language elements corresponding to the target SQL statement; and performing syntactic analysis on the target SQL statement to generate the abstract syntax tree corresponding to the target SQL statement based on the multiple language elements.

[0091] Optionally, when the computer-executable instructions stored in the storage medium are executed by the processor, the abstract syntax tree is traversed, including traversing the abstract syntax tree based on visitor patterns and breadth-first search.

[0092] Optionally, when the computer-executable instructions stored in the storage medium are executed by a processor, the target operating system is a Windows operating system and the target command language is PowerShell.

[0093] The computer-readable storage medium provided in this application embodiment can implement the various processes in the foregoing method embodiments and achieve the same functions and effects, which will not be repeated here.

[0094] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the methodology). However, with technological advancements, many methodological improvements today can be considered direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved methodology into the hardware circuit. Therefore, it cannot be said that a methodological improvement cannot be implemented using a hardware physical module. For example, a Programmable Logic Device (PLD) (e.g., a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. Designers can program a digital system themselves to "integrate" it onto a PLD, without needing chip manufacturers to design and manufacture dedicated integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software. Similar to the software compiler used in program development, the original code before compilation must be written in a specific programming language, called a Hardware Description Language (HDL). There are many HDLs, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, and RHDL (Ruby Hardware Description Language). Currently, the most commonly used are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should understand that by simply performing some logic programming on the method flow using one of these hardware description languages ​​and programming it into an integrated circuit, the hardware circuit implementing the logical method flow can be easily obtained.

[0095] The controller can be implemented in any suitable manner. For example, it can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. A memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code form, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.

[0096] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.

[0097] For ease of description, the above devices are described separately by function as various units. Of course, in implementing this application, the functions of each unit can be implemented in one or more software and / or hardware.

[0098] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0099] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0100] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0101] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0102] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0103] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0104] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0105] It should also be noted that 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 limitation, 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.

[0106] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0107] This application can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a specific task or implement a specific abstract data type. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.

[0108] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.

[0109] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A system interaction method, characterized by, include: The target Structured Query Language (SQL) statement is parsed, and an abstract syntax tree corresponding to the target SQL statement is generated based on the parsing results. The abstract syntax tree is traversed to determine the type of language element corresponding to the traversed node, and the node whose language element type is keyword and / or identifier is determined as the node to be converted in the abstract syntax tree; the language element corresponding to the node to be converted is taken as the element to be converted in the target SQL statement, where the language element represents the lexical unit in the SQL statement; Based on a preset mapping relationship, the elements to be converted in the target SQL statement are converted into operation commands corresponding to the target command language of the target operating system to obtain the converted target SQL statement; wherein, the preset mapping relationship includes the mapping relationship between the language elements in the target SQL statement and the operation commands of the target command language; Based on the converted target SQL statement, a command statement corresponding to the target command language is generated to interact with the target operating system.

2. The system interaction method of claim 1, wherein, The target SQL statement is parsed, and an abstract syntax tree corresponding to the target SQL statement is generated based on the parsing results, including: Lexical analysis is performed on the target SQL statement to generate multiple language elements corresponding to the target SQL statement; The target SQL statement is subjected to syntax analysis to generate the abstract syntax tree corresponding to the target SQL statement based on the multiple language elements.

3. The system interaction method of claim 1, wherein, Traversing the abstract syntax tree includes: The abstract syntax tree is traversed based on the visitor pattern and breadth-first search.

4. The system interaction method of any one of claims 1 to 3, wherein, The target operating system is Windows, and the target command language is PowerShell.

5. A system interaction device, characterized by include: The parsing module is used to parse the target SQL statement and generate an abstract syntax tree corresponding to the target SQL statement based on the parsing results; The abstract syntax tree is traversed to determine the type of language element corresponding to the traversed node, and the node whose language element type is keyword and / or identifier is determined as the node to be converted in the abstract syntax tree; the language element corresponding to the node to be converted is taken as the element to be converted in the target SQL statement, where the language element represents the lexical unit in the SQL statement; A conversion module is used to convert the elements to be converted in the target SQL statement into operation commands corresponding to the target command language of the target operating system based on a preset mapping relationship, so as to obtain the converted target SQL statement; wherein, the preset mapping relationship includes the mapping relationship between the language elements in the target SQL statement and the operation commands of the target command language; The generation module is used to generate a command statement corresponding to the target command language based on the converted target SQL statement, so as to interact with the target operating system based on the command statement.

6. The system interaction apparatus according to claim 5, wherein, The parsing module includes: The lexical analysis unit is used to perform lexical analysis on the target SQL statement and generate multiple language elements corresponding to the target SQL statement. The syntax parsing unit is used to perform syntax analysis on the target SQL statement to generate the abstract syntax tree corresponding to the target SQL statement based on the multiple language elements.

7. The system interaction apparatus according to claim 5, wherein The parsing module traverses the abstract syntax tree based on the visitor pattern and breadth-first search.

8. The system interaction apparatus according to any one of claims 5 to 7, characterized by, The target operating system is Windows, and the target command language is PowerShell.

9. A system interaction device, characterized by include: processor; And a memory configured to store computer-executable instructions, which, when executed, cause the processor to implement the steps of the system interaction method according to any one of claims 1 to 4.

10. A storage medium storing computer-executable instructions, wherein the computer-executable instructions comprise instructions for: When the computer-executable instructions are executed, they implement the steps of the system interaction method according to any one of claims 1 to 4. ​