Logical reasoning engine use method, terminal, system, medium and equipment
By converting the logic programming language into the target logic programming language through an intermediate representation, the compatibility problem between the logic programming language and the engine in the logic reasoning service is solved, realizing the flexible use of the logic programming language and the integration of the engine, and improving the response speed and applicability of smart devices.
Patent Information
- Application Number
- CN202410550878.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-06
- Publication Date
- 2025-11-07
AI Technical Summary
In existing technologies, logic reasoning services require fixed logic reasoning languages and engines, which makes it difficult to flexibly use incompatible logic reasoning engines, hinders the integration of logic reasoning engines, and results in low efficiency.
The logic programming language is converted into the target logic programming language through an intermediate representation, and the target logic programming language is used to call the target logic inference engine, thereby decoupling the logic programming language and the logic inference engine. The intermediate representation is constructed using a probabilistic quadruple form and a control flow graph.
It enables the logic programming language to easily use various logic reasoning engines, including incompatible ones, improving the reaction speed and sensitivity of virtual avatars and intelligent robots, and making it suitable for various scenarios.
Smart Images

Figure CN120911626A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of artificial intelligence, in particular to a method for using different logical reasoning engines based on an intermediate representation form, and more particularly to a method for using a logical reasoning engine, a terminal, a system, a medium and equipment. BACKGROUND
[0002] Online Inference Service is an important part of machine learning engineering. Through the Online Inference Service, the trained model can realize its value in the production link. Many enterprises with online business usually deploy several or even dozens of online inference services on servers or clouds. Users send input content that needs to be inferred to the server or cloud through the client or browser. The server or cloud returns the inference result to the user through the response message.
[0003] In the process of implementing the present application concept, the inventors found that at least the following problems exist in the related art: implementing an inference service or an online inference service requires running an inference program. There is a fixed correspondence between the logical reasoning language used by the inference program and the logical reasoning engine, that is, one logical reasoning language corresponds to one or more logical reasoning engines. The logical reasoning language can only use the logical reasoning engine that is adapted to it and cannot use the logical reasoning engine that is not adapted to it. The advantages of different logical reasoning engines are different. To make the logical reasoning language suitable for various application scenarios, it is necessary to integrate the advantages of different logical reasoning engines. Therefore, it is necessary to solve the technical problem of integrating logical reasoning engines from the architecture level, which is difficult to implement in practice, very complex, and inefficient.
[0004] Therefore, there is an urgent need in the art for a method for simply and quickly using a logical reasoning engine in an inference service. SUMMARY
[0005] Therefore, the present application aims to solve the technical problem of the related art that a logical programming language cannot use a logical reasoning engine that is not adapted to it.
[0006] To solve the above technical problems, the specific embodiment of the present application provides a method for using a logical reasoning engine, comprising: determining a logical reasoning engine used by an inference program; determining a target logical programming language corresponding to the logical reasoning engine; converting a logical programming language into the target logical programming language using an intermediate representation form, wherein the logical programming language used by the inference program is different from the target logical programming language; and calling the target logical reasoning engine using the target logical programming language.
[0007] Optionally, before determining the logical inference engine used by the inference procedure, the method for using the logical inference engine further comprises: constructing an intermediate representation form.
[0008] Optionally, the data storage content of the intermediate representation form comprises a quadruple form with probability.
[0009] Optionally, the data structure of the intermediate representation form adopts a statement execution order control flow graph form.
[0010] Optionally, the step of constructing the intermediate representation form comprises: collecting rules, facts and query statements of all languages; and constructing the data storage content and the data structure of the intermediate representation form by using the collected rules, facts and query statements.
[0011] Optionally, the step of converting the logical programming language into the target logical programming language by using the intermediate representation form comprises: searching for target data storage content in the intermediate representation form by using rules, facts and query statements of the logical programming language; and generating the target logical programming language according to the target data storage content and the data structure.
[0012] Optionally, after calling the target logical inference engine by using the target logical programming language, the method for using the logical inference engine further comprises: receiving and updating the data storage content of the intermediate representation form iteratively by using inference results of the target logical inference engine.
[0013] Optionally, after receiving and updating the data storage content of the intermediate representation form iteratively by using inference results of the target logical inference engine, the method for using the logical inference engine further comprises: updating a user query result by using the inference results of the target logical inference engine.
[0014] Another specific embodiment of the present application provides an inference engine client, comprising: a first determining module configured to determine a logical inference engine used by an inference procedure; a second determining module configured to determine a target logical programming language corresponding to the logical inference engine; a converting module configured to convert a logical programming language into the target logical programming language by using an intermediate representation form, wherein the logical programming language used by the inference procedure is different from the target logical programming language; and a calling module configured to call the target logical inference engine by using the target logical programming language.
[0015] Yet another specific embodiment of the present application provides a method for using a logic reasoning engine, comprising: determining a target logic reasoning engine specified by a user; determining a target logic programming language corresponding to the target logic reasoning engine; converting a logic programming language into the target logic programming language using an intermediate representation, wherein the logic programming language is different from the target logic programming language; and invoking the target logic reasoning engine using the target logic programming language.
[0016] Yet another specific embodiment of the present application provides a method for using a logic reasoning engine, comprising: receiving an invocation request from one or more logic reasoning engine clients; performing reasoning using a target logic reasoning engine according to the invocation request to obtain a reasoning result, wherein a target logic programming language corresponding to the target logic reasoning engine is different from a logic programming language used by a reasoning program; and feeding back the reasoning result to the corresponding logic reasoning engine client.
[0017] Yet another specific embodiment of the present application provides a logic reasoning service server, comprising: a receiving module configured to receive an invocation request from one or more logic reasoning engine clients; a logic reasoning service module configured to perform reasoning using a target logic reasoning engine according to the invocation request to obtain a reasoning result, wherein a target logic programming language corresponding to the target logic reasoning engine is different from a logic programming language used by a reasoning program; and a sending module configured to feed back the reasoning result to the corresponding logic reasoning engine client.
[0018] Yet another specific embodiment of the present application provides a logic reasoning service system, comprising: a logic reasoning engine client and a logic reasoning service server.
[0019] Another aspect of the present application provides an electronic device, comprising one or more processors and a storage device, wherein the storage device is configured to store executable instructions, and the executable instructions, when executed by the processor, implement the method of the present application.
[0020] Another aspect of the present application provides a computer readable storage medium storing computer executable instructions, and the instructions, when executed by a processor, implement the method of the present application.
[0021] Another aspect of the present application provides a computer program, and the computer program comprises computer executable instructions, and the instructions, when executed, implement the method of the present application.
[0022] According to the above embodiments of the present application, the logic programming language input by the user is converted into an intermediate representation, and then the intermediate representation is converted into a target logic programming language corresponding to a target logic reasoning engine to be used, and then the target logic reasoning engine is invoked using the target logic programming language to perform reasoning, which can at least partially solve the problem in the related art that a logic programming language cannot use a non-compatible logic reasoning engine, and thus can achieve the technical effect that the logic programming language can easily use various logic reasoning engines (including non-compatible logic reasoning engines).
[0023] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the scope of the present application. BRIEF DESCRIPTION OF DRAWINGS
[0024] The following drawings that form a part of this specification are included to depict example embodiments of the present application and are a part of the specification. The drawings, together with the description, serve to explain the principles of the application.
[0025] Figure 1 A first schematic flowchart of a method for using a logic reasoning engine according to an embodiment of the present application.
[0026] Figure 2 A second schematic flowchart of a method for using a logic reasoning engine according to an embodiment of the present application.
[0027] Figure 3 A third schematic flowchart of a method for using a logic reasoning engine according to an embodiment of the present application.
[0028] Figure 4 A fourth schematic flowchart of a method for using a logic reasoning engine according to an embodiment of the present application.
[0029] Figure 5 A fifth schematic flowchart of a method for using a logic reasoning engine according to an embodiment of the present application.
[0030] Figure 6 A schematic block diagram of a reasoning engine client according to an embodiment of the present application.
[0031] Figure 7 A sixth schematic flowchart of a method for using a logic reasoning engine according to an embodiment of the present application.
[0032] Figure 8 A seventh schematic flowchart of a method for using a logic reasoning engine according to an embodiment of the present application.
[0033] Figure 9 A schematic block diagram of a reasoning service end according to an embodiment of the present application.
[0034] Figure 10 A structure schematic diagram of a reasoning service system provided for a specific embodiment of the present application.
[0035] Figure 11 A working flow schematic diagram of a reasoning service system provided for a specific embodiment of the present application.
[0036] Legend of reference signs:
[0037] 1 reasoning engine client 2 reasoning service server
[0038] 11 first determination module 12 second determination module
[0039] 13 conversion module 14 calling module
[0040] 21 receiving module 22 reasoning service module
[0041] 23 sending module S100-S106 steps DETAILED DESCRIPTION
[0042] In order to make the purpose, technical scheme and advantages of the embodiments of the present application more clear, the drawings and detailed description will be used to clearly explain the spirit of the present application. Any person skilled in the art can make changes and modifications to the technology taught by the present application without departing from the spirit and scope of the present application.
[0043] The schematic embodiments of the present application and their descriptions are used to explain the present application, but are not as a limitation of the present application. In addition, the same or similar reference signs of elements / components used in the drawings and embodiments are used to represent the same or similar parts.
[0044] As for the "first", "second", and the like used herein, it is not particularly intended to refer to the order or sequence, nor to limit the present application. It is only for distinguishing elements or operations described by using the same technical terms.
[0045] As for the directional terms used herein, such as: up, down, left, right, front or back, etc., they are only the direction of the drawings. Therefore, the directional terms used are used to explain, not to limit the present creation.
[0046] As for the "include", "comprise", "have", "contain" and the like used herein, they are all open terms, that is, they mean to include but not limited to.
[0047] As for the "and / or" used herein, it includes any or all combinations of the described things.
[0048] As used herein, the singular forms "a", "an", and "the" include plural referents unless the context clearly dictates otherwise.
[0049] As used herein, the terms "substantially", "approximately", and the like are used to describe any measurable quantity which can vary slightly from a true value due to measurement uncertainty, inherent lack of perfection, and other factors. In general, these terms are used in connection with quantities that can vary by up to 20% in some embodiments, up to 10% in some embodiments, up to 5% in some embodiments, or other amounts in other embodiments. Those skilled in the art will recognize the inherent lack of perfection in many if not most measurements, and will recognize the applicability of these terms to such measurements.
[0050] All terms used herein, including technical and scientific terms, have the meanings commonly understood by one of ordinary skill in the art unless otherwise defined. It should be noted that the use of any terms herein should not be interpreted to limit the scope of the disclosure, unless otherwise indicated. Rather, the terms should be interpreted in the context as they are typically used in the art.
[0051] In the event a usage similar to "at least one of A, B, and C, etc." is used in the context of a patent application, it will generally be interpreted that such a phrase means A alone, B alone, C alone, anyone of the items A, B, and C, combinations thereof, including A and B together, A and C together, B and C together, and / or A, B, and C together, etc. In the event a usage similar to "at least one of A, B, or C" is used in the context of a patent application, it will generally be interpreted that such a phrase means A alone, B alone, C alone, anyone of the items A, B, and C, combinations thereof, including A and B together, A and C together, B and C together, and / or A, B, and C together, etc. Those skilled in the art will further appreciate that virtually any disjunctive word or phrase presenting two or more alternative items shall be understood to be implementing a possible conjunction of those items, unless otherwise indicated. For example, the phrase "A or B" should be understood as meaning "A" or "B" or "A and B".
[0052] In the related art, when using an existing logic reasoning engine, the facts (FACT) and rules (RULE) are basically fixed and cannot be updated and iterated according to different scenarios. How to make the rules automatically updated and iterated also needs to be solved from the architecture level. The knowledge (common base) and the expression of the rules are various, such as OWL2, Prolog, Problog with probability, and the like. Different expressions of knowledge correspond to different types of logic reasoning engines.
[0053] The inference service system can include an inference engine client and an inference service end. The inference engine client and the inference service end are connected in communication through wired or wireless ways, and the wired connection includes fiber cable connection, twisted pair connection, etc. The inference engine client can include various intelligent bodies, intelligent robots, mobile terminals, smart phones, tablet computers, desktop computers, portable computers, etc. The inference service end can include various file or program servers, cloud virtual servers, remote servers, etc. The inference engine client can interact with the inference service end through various communication links, for example, the inference engine client sends data to the inference service end or receives data from the inference service end through various communication links. Various logical inference engines can be stored on the inference service end for the inference engine client to access.
[0054] It should be noted that the inference service provided by the embodiments of the present application can generally be executed by the inference service end. Accordingly, the various logical inference engines provided by the embodiments of the present application can generally be set in the inference service end. The inference service provided by the embodiments of the present application can also be executed by a server or a server cluster different from the inference service end and capable of communicating with the inference engine client. Accordingly, the various logical inference engines provided by the embodiments of the present application can also be set in the inference engine client, and the inference engine client executes the inference service. It should be understood that according to the implementation needs, there can be any number of inference engine clients and inference service ends.
[0055] Figure 1 A first schematic flowchart of a use method of a logical inference engine provided by the embodiments of the present application.
[0056] In the embodiments of the present application, as shown in Figure 1 The use method of the logical inference engine can include the following operations S101-S104:
[0057] In operation S101, the logical inference engine used by the inference program is determined.
[0058] In the embodiment of the present application, if the user does not specify to use a logical reasoning engine, a default reasoning engine is used for reasoning. Generally, reasoning is performed by a reasoning program, which is a source program code written in a logical programming language, such as a source program code written in Prolog. The reasoning program needs to call a logical reasoning engine to perform reasoning. The reasoning engine is a program solver, such as a solver of Prolog. The logical reasoning engine is strongly language-dependent and cannot be called by a solver of a different logical programming language. If the user does not specify to use a logical reasoning engine, the reasoning program uses one or several logical reasoning engines by default. Of course, the user can also specify to use a logical reasoning engine. For example, OWL2, Prolog, and Problog with probability use different logical reasoning engines by default. Since the logical reasoning engine is strongly language-dependent, the logical programming language used by the reasoning program cannot directly call the logical reasoning engine used by default.
[0059] Next, in operation S102, a target logical programming language corresponding to the logical reasoning engine is determined.
[0060] In the embodiment of the present application, the logical reasoning engine is strongly language-dependent, and one logical programming language corresponds to one or more logical reasoning engines. Each default logical reasoning engine corresponds to a logical programming language, which is referred to as a target logical programming language.
[0061] Secondly, in operation S103, a logical programming language is converted into the target logical programming language by using an intermediate representation form, wherein the logical programming language used by the reasoning program is different from the target logical programming language.
[0062] In the embodiment of the present application, the intermediate representation form can uniformly represent different logical programming languages, and can convert the logical programming language into the target logical programming language.
[0063] Then, in operation S104, the target logical reasoning engine is called by using the target logical programming language.
[0064] In the embodiment of the present application, the target logical programming language and the target logical reasoning engine have a corresponding relationship, and the target logical programming language can call the target logical reasoning engine.
[0065] In the embodiment of the present application, the intermediate representation form can uniformly represent the features of various logical programming languages, the logical programming language used by the reasoning program can be converted into the target logical programming language corresponding to the logic reasoning engine to be called, therefore, any kind of logical programming language can easily use various logic reasoning engines (including non-compatible logic reasoning engines), so that the reasoning program can integrate the advantages of various logic reasoning engines, without solving the technical problems of multi-engine integration from the architecture level, improving the reaction speed of intelligent devices such as virtual embodiment and intelligent robots, so that intelligent devices such as virtual embodiment and intelligent robots can be applied to various scenes.
[0066] Figure 2 The second schematic flowchart of the use method of the logic reasoning engine provided in the embodiment of the present application.
[0067] In the embodiment of the present application, as shown in Figure 2 Before determining the logic reasoning engine used by the reasoning program in operation S101, the use method of the logic reasoning engine further includes:
[0068] In operation S100, the intermediate representation form is constructed.
[0069] In the embodiment of the present application, the data storage content of the intermediate representation form includes a four-tuple form with probability. The four-tuple can include subject (instantiated object, for example, a child), predicate (reasoning), object (uninstantiated object, for example, a boy), and probability.
[0070] In the embodiment of the present application, the data structure of the intermediate representation form adopts a control flow graph (CFG) form. The control flow graph is also called a control flow diagram, which is an abstract representation of a process or program, an abstract data structure used in a compiler, representing all paths that will be traversed in the execution process of a program, and representing the possible flow direction of all basic modules in a process in the form of a graph, and reflecting the real-time execution process of a process.
[0071] In the embodiment of the present application, the data of the intermediate representation form is stored in the form of four-tuple with probability, and the data structure of the intermediate representation form is constructed by using the control flow graph, so that the intermediate representation form can uniformly represent different logical programming languages, no matter what logical programming language is used to write the reasoning program, the corresponding logic reasoning engine can be called according to the application scene, the advantages of various logic reasoning engines are integrated, the reaction speed of intelligent devices such as virtual embodiment and intelligent robots is improved, and intelligent devices such as virtual embodiment and intelligent robots can be applied to various scenes.
[0072] Figure 3 A third schematic flowchart of a method for using a logical reasoning engine according to an embodiment of the present application.
[0073] As shown in FIG. 10, operation S100 includes constructing an intermediate representation form, which can include the following operations S1001-S1002. Figure 3
[0074] In operation S1001, rules, facts and query statements of all languages are collected.
[0075] In an embodiment of the present application, each logical programming language has rules, facts and query statements. Rules (Rule), facts (Fact) and query statements of all logical programming languages can be collected. For example, "B is the parent of A, and C is the parent of B, so C is the grandparent of A", which is a rule. "Xiaoli's father is Lao Li" is a fact, and "an umbrella can be represented as umbrella" is a fact.
[0076] Next, in operation S1002, the collected rules, facts and query statements are used to construct the data storage content and data structure of the intermediate representation form.
[0077] In an embodiment of the present application, all logical programming languages are stored in the form of four-tuple with probability, and the data structure of the intermediate representation form is constructed by using the control flow graph, so that the intermediate representation form can uniformly represent different logical programming languages. No matter what logical programming language the reasoning program is written in, the corresponding logical reasoning engine can be called according to the application scenario, the advantages of various logical reasoning engines are integrated, the collaborative use between different logical programming languages is made possible, the reaction speed of intelligent devices such as virtual embodiment and intelligent robots is improved, and the intelligent devices such as virtual embodiment and intelligent robots can be applied to various scenarios.
[0078] Figure 4 A fourth schematic flowchart of a method for using a logical reasoning engine according to an embodiment of the present application.
[0079] As shown in FIG. 10, operation S100 includes constructing an intermediate representation form, which can include the following operations S1001-S1002. Figure 4
[0080] In operation S1031, the rules, facts and query statements of the logical programming language are used to find target data storage content in the intermediate representation form.
[0081] In the embodiment of the present application, the target data storage content is searched in the intermediate representation form by using rules, facts and query statements of the logic programming language, which can include searching rules, facts and query statements of the target logic programming language in the intermediate representation form by using rules, facts and query statements of the logic programming language.
[0082] Next, in operation S1032, the target logic programming language is generated according to the target data storage content and the data structure.
[0083] In the embodiment of the present application, the target logic programming language is generated according to the target data storage content and the data structure, which can include generating the target logic programming language according to rules, facts and query statements of the target logic programming language and the data structure.
[0084] In the embodiment of the present application, the logic programming language used by the reasoning program is converted into the logic programming language corresponding to the target logic reasoning engine to be called, regardless of the logic programming language used by the reasoning program, the corresponding logic reasoning engine can be called according to the application scene, the advantages of various logic reasoning engines are integrated, the reaction speed of intelligent devices such as virtual embodiment and intelligent robots is improved, and the intelligent devices such as virtual embodiment and intelligent robots can be applied to various scenes.
[0085] Figure 5 The fifth schematic flowchart of the use method of the logic reasoning engine is provided for the embodiment of the present application.
[0086] In the embodiment of the present application, as shown in Figure 5 After operation S104 of calling the target logic reasoning engine by using the target logic programming language, the use method of the logic reasoning engine can further include operations S105-S106 as follows:
[0087] In operation S105, the data storage content of the intermediate representation form is iteratively updated by receiving and using the reasoning result of the target logic reasoning engine.
[0088] In the embodiment of the present application, the reasoning result of the target logic reasoning engine is received by the reasoning engine client from the reasoning server, and the data storage content of the intermediate representation form is iteratively updated by using the reasoning result, which can perform real-time reasoning.
[0089] Next, in operation S106, the user query result is updated by using the reasoning result of the target logic reasoning engine.
[0090] In the embodiment of the present application, the inference result of the target logic reasoning engine is used to update the user query result, and the data storage content and data structure of the intermediate representation form are also updated when the query result is in the intermediate representation form, the original rule can be automatically updated according to the inference result, and real-time reasoning can be performed.
[0091] In the embodiment of the present application, the inference result is used to update the data storage content of the intermediate representation form and the user query result, the original rule can be automatically updated according to the inference result, and real-time reasoning can be performed. The reaction speed and sensitivity of the intelligent device such as virtual embodiment and intelligent robot are improved, invalid interaction is reduced, interaction efficiency is improved, and the intelligent device such as virtual embodiment and intelligent robot can be applied to various scenes.
[0092] In the embodiment of the present application, the original rule is automatically updated in real time after each round of inference result occurs, the reasoning process is iterated in real time, self-driven, and the reaction speed of the intelligent device such as virtual embodiment and intelligent robot is improved.
[0093] Figure 6 A schematic block diagram of a reasoning engine client is provided in the embodiment of the present application.
[0094] As shown in the embodiment of the present application, Figure 6 the reasoning engine client 1 can include a first determination module 11, a second determination module 12, a conversion module 13 and a calling module 14.
[0095] Specifically, the first determination module 11 is configured to determine a logic reasoning engine used by a reasoning program; the second determination module 12 is configured to determine a target logic programming language corresponding to the logic reasoning engine; the conversion module 13 is configured to convert a logic programming language into the target logic programming language by using an intermediate representation form, wherein the logic programming language used by the reasoning program is different from the target logic programming language; and the calling module 14 is configured to call the target logic reasoning engine by using the target logic programming language.
[0096] In specific embodiments of the present application, the intermediate representation form can be used to uniformly represent the features of various logic programming languages, and the logic programming language used by the reasoning program can be converted into the target logic programming language corresponding to the logic reasoning engine to be called (if the user does not specify the use of the logic reasoning engine, the default logic reasoning engine is used). Therefore, any logic programming language can easily use various logic reasoning engines (including non-compatible logic reasoning engines), so that the reasoning program can integrate the advantages of various logic reasoning engines, making it possible to use different logic programming languages cooperatively, without needing to solve the technical problems of multi-engine integration from the architecture level, improving the reaction speed and sensitivity of intelligent devices such as virtual embodiment and intelligent robots, reducing invalid interactions and improving interaction efficiency, so that virtual embodiment and intelligent robots can be applied to various scenarios.
[0097] Figure 7 The sixth schematic flowchart of the use method of the logic reasoning engine provided in specific embodiments of the present application.
[0098] In specific embodiments of the present application, as shown in Figure 7 The use method of the logic reasoning engine can include the following operations S101' to S104':
[0099] In operation S101', the target logic reasoning engine specified by the user is determined.
[0100] In specific embodiments of the present application, the user can specify the target logic reasoning engine to be used in the reasoning engine client. Generally, reasoning is performed by a reasoning program, which is a source program code written in a logic programming language, for example, a source program code written in Prolog. The reasoning program needs to call a logic reasoning engine to implement reasoning. The reasoning engine refers to a program solver, for example, a solver of Prolog, which is composed of functions. The logic reasoning engine has strong language correlation and cannot use the same logic programming language to use (call) different logic reasoning engines, that is, different logic programming languages use different solvers. The user can specify the target logic reasoning engine to be used in the reasoning engine client. For example, if the logic programming language used by the reasoning program is OWL2, the user can specify the logic reasoning engine that can be called by the logic programming language Prolog.
[0101] Next, in operation S102', the target logic programming language corresponding to the target logic reasoning engine is determined.
[0102] In specific embodiments of the present application, the logic reasoning engine has strong language correlation, and one logic programming language corresponds to one or more logic reasoning engines. Each target logic reasoning engine corresponds to a logic programming language, which is called a target logic programming language.
[0103] Secondly, in operation S103', the logic programming language is converted into the target logic programming language by using the intermediate representation.
[0104] In the embodiments of the present application, the intermediate representation can uniformly represent different logic programming languages, and can convert the logic programming language into the target logic programming language.
[0105] Then, in operation S104', the target logic reasoning engine is called by using the target logic programming language.
[0106] In the embodiments of the present application, the target logic programming language has a corresponding relationship with the target logic reasoning engine, and the target logic programming language can call the target logic reasoning engine.
[0107] In the embodiments of the present application, the intermediate representation can uniformly represent the characteristics of various logic programming languages, and can convert the logic programming language used by the reasoning program into the target logic programming language corresponding to the logic reasoning engine to be called. Therefore, any logic programming language can easily use various logic reasoning engines (including non-compatible logic reasoning engines), so that the reasoning program can integrate the advantages of various logic reasoning engines, and the collaborative use between different logic programming languages becomes possible, without needing to solve the technical problem of multi-engine integration from the architecture level, improving the reaction speed of intelligent devices such as virtual embodiment and intelligent robots, so that the virtual embodiment and intelligent robots can be applied to various scenes.
[0108] Figure 8 A seventh schematic flowchart of a use method of a logic reasoning engine according to an embodiment of the present application is provided.
[0109] As shown in FIG. 7, the use method of the logic reasoning engine can include the following operations S201-S203: Figure 8
[0110] In operation S201, a calling request of one or more reasoning engine clients is received.
[0111] In the embodiments of the present application, the request of calling the logic reasoning engine is received from the one or more reasoning engine clients by wired or wireless mode. One reasoning server can be in communication connection with one or more reasoning engine clients, and one reasoning engine client can also be in communication connection with one or more reasoning servers.
[0112] Then, in operation S202, reasoning is performed by using the target logic reasoning engine according to the calling request, and a reasoning result is obtained, wherein the target logic programming language corresponding to the target logic reasoning engine is different from the logic programming language used by the reasoning program.
[0113] In specific embodiments of the present application, the logical programming language used by the reasoning program is different from the target logical programming language corresponding to the target logical reasoning engine. The language used by the calling request is the target logical programming language, and the target logical reasoning engine can be called.
[0114] Next, in operation S203, the reasoning result is fed back to the corresponding reasoning engine client.
[0115] In specific embodiments of the present application, the reasoning server runs the target logical reasoning engine to generate the reasoning result, and feeds back the reasoning result to the corresponding reasoning engine client.
[0116] In specific embodiments of the present application, the reasoning engine client can update the intermediate representation form of the data storage content and the user query result by using the reasoning result, can automatically update the original rule according to the reasoning result, and can perform real-time reasoning. The reaction speed of the intelligent device such as virtual embodiment and intelligent robot is improved, so that the intelligent device such as virtual embodiment and intelligent robot can be applied to various scenes.
[0117] Figure 9 A schematic block diagram of a reasoning server according to specific embodiments of the present application is provided.
[0118] In the embodiments of the present application, as shown in Figure 9 The reasoning server 2 can include a receiving module 21, a reasoning service module 22, and a sending module 23.
[0119] Specifically, the receiving module 21 is configured to receive a calling request of one or more reasoning engine clients; the reasoning service module 22 is configured to perform reasoning by using a target logical reasoning engine according to the calling request to obtain a reasoning result, wherein the target logical programming language corresponding to the target logical reasoning engine is different from the logical programming language used by the reasoning program; and the sending module 23 is configured to feed back the reasoning result to the corresponding reasoning engine client.
[0120] In specific embodiments of the present application, the reasoning engine client can update the intermediate representation form of the data storage content and the user query result by using the reasoning result, can automatically update the original rule according to the reasoning result, and can perform real-time reasoning. The reaction speed of the intelligent device such as virtual embodiment and intelligent robot is improved, so that the intelligent device such as virtual embodiment and intelligent robot can be applied to various scenes.
[0121] Figure 10 A structural schematic diagram of a reasoning service system according to specific embodiments of the present application is provided.
[0122] In the embodiments of the present application, as shown in Figure 10As shown, the reasoning service system can include a reasoning engine client 1 and a reasoning service end 2. The reasoning engine client 1 is in wireless communication connection with the reasoning service end 2, and the reasoning service end 2 is in wireless communication connection with a plurality of reasoning engine clients 1. The reasoning engine client 1 can include various intelligent bodies, intelligent robots, mobile terminals, smart phones, tablet computers, desktop computers, portable computers, etc. The reasoning service end 2 can include various file or program servers, cloud virtual servers, remote servers, etc.
[0123] Specifically, the reasoning engine client 1 can include a first determination module 11, a second determination module 12, a conversion module 13, and a calling module 14. The reasoning service end 2 can include a receiving module 21, a reasoning service module 22, and a sending module 23.
[0124] In specific embodiments of the present application, the intermediate representation form can uniformly represent the characteristics of various logical programming languages, and can convert the logical programming language used by the reasoning program into the target logical programming language corresponding to the logic reasoning engine to be called. Any kind of logical programming language can easily use various logical reasoning engines (including non-adapted logical reasoning engines), so that the reasoning program can integrate the advantages of various logical reasoning engines, without needing to solve the technical problems of multi-engine fusion from the architecture level, improving the reaction speed of intelligent devices such as virtual bodies and intelligent robots, so that intelligent devices such as virtual bodies and intelligent robots can be applied to various scenarios.
[0125] Figure 11 A working flow diagram of a reasoning service system provided in specific embodiments of the present application is shown.
[0126] In specific embodiments of the present application, as shown Figure 11 The user inputs a query statement through the reasoning program of the reasoning engine client, the reasoning program uses a logical programming language, and the query statement includes rules and knowledge. The query statement input by the user is converted by code to obtain rules, facts, and query statements. The rules, facts, and query statements obtained by conversion are used to search for rules, facts, and query statements of a target logical programming language in the intermediate representation form, and the target logical programming language can call a target logic reasoning engine. The reasoning engine client forms a target logic reasoning engine calling request code from the rules, facts, and query statements found in the intermediate representation form, and sends the code to the reasoning service end. After receiving the calling request code sent by the reasoning engine client, the reasoning service end runs the target logic reasoning engine called by the reasoning engine client, and feeds back the reasoning result to the reasoning engine client. The reasoning engine client updates the data storage content of the intermediate representation form and the user query result using the reasoning result, and updates the original rules, which can realize real-time reasoning. The reaction speed of intelligent devices such as virtual bodies and intelligent robots is improved, so that intelligent devices such as virtual bodies and intelligent robots can be applied to various scenarios.
[0127] According to an embodiment of the present application, the method flow according to the embodiments of the present application can be implemented as a computer software program. For example, the embodiments of the present application include a computer program product comprising a computer program carried on a computer readable storage medium, the computer program comprising program code for implementing the methods shown in the flowcharts. According to an embodiment of the present application, the electronic device, device, apparatus, module, unit, etc. described above can be implemented by computer program modules.
[0128] The present application also provides a computer readable storage medium, which can be included in the device / apparatus / system described in the above embodiments, or can exist separately without being assembled into the device / apparatus / system. The above computer readable storage medium carries one or more programs, which, when executed, implement the method according to the embodiments of the present application.
[0129] According to an embodiment of the present application, the computer readable storage medium can be a non-volatile computer readable storage medium, which can include, but is not limited to, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any appropriate combination thereof. In the present application, the computer readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus or device.
[0130] The flowcharts and block diagrams in the drawings illustrate the possible architectures, functionality, and operations of systems, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flowcharts or block diagrams can represent a module, a segment, or a portion of code, which comprises one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or in the reverse order, depending on the functionality involved. It will also be noted that each block in the block diagrams or flowcharts, and combinations of blocks in the block diagrams or flowcharts, can be implemented by special-purpose hardware-based systems that perform the specified functions or operations, or combinations of special-purpose hardware and computer instructions.
[0131] It will be appreciated by those skilled in the art that features of the various embodiments and / or claims of the present application can be combined or / and integrated, even if such combinations or integrations are not expressly disclosed in the present application. In particular, features of the various embodiments and / or claims of the present application can be combined and / or integrated in any number of ways, without departing from the scope of the present application. All such combinations and / or integrations are within the scope of the present application.
[0132] The above describes embodiments of the present application. However, these embodiments are merely for illustrative purposes, and are not intended to limit the scope of the present application. Although each embodiment is described above separately, this does not mean that measures in each embodiment cannot be used advantageously in combination. The scope of the present application is defined by the appended claims and their equivalents. Without departing from the scope of the present application, those skilled in the art can make various substitutions and modifications, which should all fall within the scope of the present application.
Claims
1. A method of using a logical inference engine, characterized by, The use method comprises: determining a logical reasoning engine used by a reasoning program; determining a target logic programming language corresponding to the logical reasoning engine; converting a logic programming language into the target logic programming language by using an intermediate representation form, wherein the logic programming language used by the reasoning program is different from the target logic programming language; and calling the target logic reasoning engine by using the target logic programming language. 2.The method of using a logical inference engine according to claim 1, wherein, Before determining the logical reasoning engine used by the reasoning program, the use method further comprises: building the intermediate representation form. 3.The method of using a logic reasoning engine according to claim 2, wherein, The data storage content of the intermediate representation form comprises a four-tuple form with probability.
4. The method of using a logical inference engine according to claim 3, wherein, The data structure of the intermediate representation form adopts a statement execution order control flow graph form.
5. The method of using a logical inference engine according to claim 4, wherein, The step of building the intermediate representation form comprises: collecting rules, facts and query statements of all languages; and building the data storage content and the data structure of the intermediate representation form by using the collected rules, facts and query statements.
6. The method of using a logical inference engine according to claim 5, wherein, The step of converting the logic programming language into the target logic programming language by using the intermediate representation form comprises: finding target data storage content in the intermediate representation form by using rules, facts and query statements of the logic programming language; and generating the target logic programming language according to the target data storage content and the data structure.
7. The method of using a logical inference engine according to claim 6, wherein, After calling the target logic reasoning engine by using the target logic programming language, the use method further comprises: receiving and updating the data storage content of the intermediate representation form iteratively by using inference results of the target logic reasoning engine. 8.The method of using a logic reasoning engine according to claim 7, characterized in that, After receiving and updating the data storage content of the intermediate representation form iteratively by using inference results of the target logic reasoning engine, the use method further comprises: updating a user query result by using the inference results of the target logic reasoning engine.
9. An inference engine client, comprising: Comprise: a first determination module for determining a logical reasoning engine used by a reasoning program; a second determination module for determining a target logic programming language corresponding to the logical reasoning engine; a conversion module for converting a logic programming language into the target logic programming language by using an intermediate representation form, wherein the logic programming language used by the reasoning program is different from the target logic programming language; and a calling module for calling the target logic reasoning engine by using the target logic programming language.
10. A method of using a logic inference engine, the method comprising: The use method comprises: determining a target logic reasoning engine specified by a user; determining a target logic programming language corresponding to the target logic reasoning engine; converting a logic programming language into the target logic programming language by using an intermediate representation form, wherein the logic programming language is different from the target logic programming language; and calling the target logic reasoning engine by using the target logic programming language.
11. A method of using a logic inference engine, the method comprising: The use method comprises: receiving a calling request of one or more reasoning engine clients; performing inference by using a target logic reasoning engine according to the calling request to obtain inference results, wherein a target logic programming language corresponding to the target logic reasoning engine is different from a logic programming language used by a reasoning program; and feeding back the inference results to corresponding reasoning engine clients.
12. An inference service end, characterized by, The reasoning server comprises: receive a calling request of one or more inference engine clients; perform inference using a target logic inference engine according to the calling request to obtain an inference result, wherein the target logic inference engine corresponds to a target logic programming language different from a logic programming language used by the inference program; and feed back the inference result to the corresponding inference engine client.
13. An inference service system, characterized by The system comprises the inference engine client according to claim 9 and the inference server according to claim 12. 14.A computer readable storage medium having stored thereon executable instructions that, when executed by a processor, perform a method according to any one of claims 1-8, 10, 11. 15.An electronic device, comprising: one or more processors; a storage device storing executable instructions that, when executed by the processor, perform a method according to any one of claims 1-8, 10, 11.
