CN115526319A - Method for realizing expert system based on multi-source knowledge - Google Patents
Method for realizing expert system based on multi-source knowledge Download PDFInfo
- Publication number
- CN115526319A CN115526319A CN202211331513.1A CN202211331513A CN115526319A CN 115526319 A CN115526319 A CN 115526319A CN 202211331513 A CN202211331513 A CN 202211331513A CN 115526319 A CN115526319 A CN 115526319A
- Authority
- CN
- China
- Prior art keywords
- knowledge
- knowledge base
- reasoning
- function
- rule
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N5/00—Computing arrangements using knowledge-based models
- G06N5/02—Knowledge representation; Symbolic representation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/36—Creation of semantic tools, e.g. ontology or thesauri
- G06F16/367—Ontology
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/903—Querying
- G06F16/90335—Query processing
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N5/00—Computing arrangements using knowledge-based models
- G06N5/04—Inference or reasoning models
- G06N5/041—Abduction
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Evolutionary Computation (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Computing Systems (AREA)
- Artificial Intelligence (AREA)
- Life Sciences & Earth Sciences (AREA)
- Animal Behavior & Ethology (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
一种基于多源知识的专家系统的实现方法,通过构建知识库并对不同来源的知识分别进行解析并转换为知识库所能识别的格式,然后采集问题输入并对输入问题进行领域判定,并使用领域方法解决问题;再对输入的问题进行推理观察,并根据相似匹配,查询匹配的规则或函数,根据相似匹配得到的规则和函数,进一步地进行完整匹配、生成推理结果、并将推理结果加入知识库中,通过推理收缩删除冗余的、大概率无用的候选推理结果并输出推理机推理的最终结果。本发明使得知识库的通用性大大增强;使得知识来源大大拓宽;使得知识推理能力大大增强。
An implementation method of an expert system based on multi-source knowledge, by constructing a knowledge base, parsing the knowledge from different sources and converting it into a format that the knowledge base can recognize, then collecting question input and performing domain judgment on the input question, and Use the domain method to solve the problem; then conduct reasoning observation on the input problem, and according to the similar matching, query the matching rules or functions, according to the rules and functions obtained from the similar matching, further complete matching, generate reasoning results, and reasoning results Add to the knowledge base, delete redundant, high-probability useless candidate inference results through inference shrinkage, and output the final result of inference engine inference. The invention greatly enhances the versatility of the knowledge base; greatly broadens the source of knowledge; and greatly enhances the ability of knowledge reasoning.
Description
技术领域technical field
本发明涉及的是一种专家系统领域领域的技术,具体是一种基于多源知识的专家系统的实现方法。The present invention relates to a technology in the field of expert systems, in particular to a method for realizing an expert system based on multi-source knowledge.
背景技术Background technique
专家系统是一种智能计算机程序系统,其内部含有大量的某个领域专家水平的知识与经验,它能够应用人工智能技术和计算机技术,根据系统中的知识与经验,进行推理和判断,模拟人类专家的决策过程,以便解决那些需要人类专家处理的复杂问题,简而言之,专家系统是一种模拟人类专家解决领域问题的计算机程序系统。An expert system is an intelligent computer program system, which contains a large amount of expert knowledge and experience in a certain field. It can apply artificial intelligence technology and computer technology to reason and judge according to the knowledge and experience in the system, simulating human In short, an expert system is a computer program system that simulates human experts to solve domain problems.
专家系统通常由人机交互界面、知识库、推理机、解释器、综合数据库、知识获取等6个部分构成,其中尤以知识库与推理机相互分离而别具特色。专家系统的体系结构随专家系统的类型、功能和规模的不同,而有所差异。An expert system usually consists of six parts: human-computer interaction interface, knowledge base, inference engine, interpreter, comprehensive database, and knowledge acquisition. Among them, the separation of knowledge base and inference engine is unique. The architecture of an expert system varies with the type, function, and scale of the expert system.
自从1965年第一个专家系统DENDRAL在美国斯坦福大学问世以来,经过50年的开发,各种专家系统已遍布各个专业领域,涉及到工业、农业、军事以及国民经济的各个部门乃至社会生活的许多方面。Since the first expert system DENDRAL came out at Stanford University in the United States in 1965, after 50 years of development, various expert systems have spread across various professional fields, involving industry, agriculture, military and various departments of the national economy and many aspects of social life. aspect.
早期的专家系统诸如DENDRAL系统(1968年,斯坦福大学费根鲍姆等人)用于推断化学分子结构的专家系统,MYCSYMA系统(1971年,麻省理工学院)用于数学运算的数学专家系统。其特点是高度的专业化、专门问题求解能力强,但结构和功能不完整、移植性差,且缺乏解释功能。Early expert systems such as the DENDRAL system (1968, Feigenbaum et al., Stanford University) were used to infer chemical molecular structures, and the MYCSYMA system (1971, Massachusetts Institute of Technology) was used for mathematical operations. It is characterized by a high degree of specialization and a strong ability to solve special problems, but its structure and functions are incomplete, its portability is poor, and it lacks an explanation function.
后来专家系统进入了成熟期,出现了诸如MYCIN系统(斯坦福大学)用于血液感染病诊断,PROSPECTOR系统(斯坦福研究所)用于探矿,CASNET系统(拉特格尔大学)用于青光眼诊断与治疗,AM系统(1981年,斯坦福大学)用于模拟人类进行概括、抽象和归纳推理、发现某些数论的概念和定理,HEARSAY系统(卡内基-梅隆大学)用于语音识别专家系统。这些系统的特点是单学科专业型专家系统;系统结构完整,功能较全面,移植性好;具有推理解释功能,透明性好;采用启发式推理、不精确推理;用产生式规则、框架、语义网络表达知识;用限定性英语进行人-机交互。Later, the expert system entered a mature stage, such as the MYCIN system (Stanford University) for the diagnosis of blood infectious diseases, the PROSPECTOR system (Stanford Research Institute) for prospecting, and the CASNET system (Rutger University) for glaucoma diagnosis and treatment. , AM system (1981, Stanford University) is used to simulate human beings for generalization, abstraction and inductive reasoning, and discovers some concepts and theorems of number theory, and HEARSAY system (Carnegie Mellon University) is used for speech recognition expert systems. The characteristics of these systems are single-disciplinary professional expert systems; the system has complete structure, comprehensive functions, and good portability; it has reasoning and explanation functions and good transparency; it uses heuristic reasoning and imprecise reasoning; Network representation of knowledge; Human-Computer Interaction in Qualified English.
从80年代至今,专家系统进入了进一步的发展期,出现了XCON(DEC公司、卡内基-梅隆大学)用于为VAX计算机系统制订硬件配置方案,以及专家系统开发工具,诸如骨架系统(EMYCIN、KAS、EXPERT等)、通用型知识表达语言(OPS5等)、专家系统开发环境(AGE等)。From the 1980s to the present, the expert system has entered a further development period, and XCON (DEC Corporation, Carnegie-Mellon University) has appeared to formulate hardware configuration solutions for the VAX computer system, as well as expert system development tools, such as the skeleton system ( EMYCIN, KAS, EXPERT, etc.), general-purpose knowledge expression language (OPS5, etc.), expert system development environment (AGE, etc.).
目前,我国也研制开发出施肥专家系统(中国科学院合肥智能机械研究所)、新构造找水专家系统(南京大学)、勘探专家系统及油气资源评价专家系统(吉林大学)、服装剪裁专家系统及花布图案设计专家系统(浙江大学)、关幼波肝病诊断专家系统(北京中医学院)等专家系统。At present, my country has also developed an expert system for fertilization (Hefei Institute of Intelligent Machinery, Chinese Academy of Sciences), an expert system for finding water in new structures (Nanjing University), an expert system for exploration and oil and gas resource evaluation (Jilin University), an expert system for clothing tailoring and Expert systems for calico pattern design (Zhejiang University), Guan Youbo Liver Disease Diagnosis Expert System (Beijing College of Traditional Chinese Medicine) and other expert systems.
尽管专家系统已经在各个领域得到了广泛地应用,并收到良好的效果,但它们解决问题的范围常常受到限制,主要是因为:①知识不足;②解决问题的方法不妥。而且,大部分的专家系统均为针对某一特定领域建立的,一旦越出这一特定领域,系统就有可能无法再有效地运行。Although expert systems have been widely used in various fields and have received good results, their range of problem solving is often limited, mainly because of: ① lack of knowledge; ② inappropriate methods to solve problems. Moreover, most of the expert systems are established for a specific field, and once they go beyond this specific field, the system may no longer be able to operate effectively.
发明内容Contents of the invention
本发明针对现有技术存在的上述不足,提出一种基于多源知识的专家系统的实现方法,使得知识库的通用性大大增强;使得知识来源大大拓宽;使得知识推理能力大大增强。Aiming at the above-mentioned deficiencies in the prior art, the present invention proposes an implementation method of an expert system based on multi-source knowledge, which greatly enhances the versatility of the knowledge base, greatly broadens the knowledge sources, and greatly enhances the knowledge reasoning ability.
本发明是通过以下技术方案实现的:The present invention is achieved through the following technical solutions:
本发明涉及一种基于多源知识的专家系统的实现方法,通过构建知识库并对不同来源的知识分别进行解析并转换为知识库所能识别的格式,然后采集问题输入并对输入问题进行领域判定,并使用领域方法解决问题;再对输入的问题进行推理观察,并根据相似匹配,查询匹配的规则或函数,根据相似匹配得到的规则和函数,进一步地进行完整匹配、生成推理结果、并将推理结果加入知识库中,通过推理收缩删除冗余的、大概率无用的候选推理结果并输出推理机推理的最终结果。The invention relates to a realization method of an expert system based on multi-source knowledge, by constructing a knowledge base, analyzing and converting the knowledge from different sources into a format that can be recognized by the knowledge base, and then collecting and inputting questions and performing field analysis on the input questions Judgment, and use the domain method to solve the problem; then conduct reasoning and observation on the input problem, and query the matching rules or functions according to the similar matching, and further perform a complete matching, generate reasoning results, and Add the reasoning results to the knowledge base, delete redundant and useless candidate reasoning results through reasoning shrinkage, and output the final result of reasoning machine reasoning.
本发明涉及一种实现上述方法的系统,包括:知识解析器、知识库、推理引擎、用户界面、输出生成器,其中:知识解析器根据输入的不同种类的知识,分别进行相应的解析处理,并将解析结果转化进入知识库中;知识库利用一种具有通用型知识表达能力的知识模型以存储知识;推理引擎根据用户输入的问题,进行推理,得到推理结果(有可能是推理未能成功的失败结果);用户界面负责与用户交互,交互方式是命令行;输出生成器根据用户输入的指令,将用户指定的对象输出成用户指定的格式。The present invention relates to a system for implementing the above method, including: a knowledge parser, a knowledge base, a reasoning engine, a user interface, and an output generator, wherein: the knowledge parser performs corresponding parsing processing according to different types of input knowledge, And transform the analysis results into the knowledge base; the knowledge base uses a knowledge model with general-purpose knowledge expression ability to store knowledge; the reasoning engine performs reasoning according to the questions input by the user, and obtains the reasoning results (the reasoning may not be successful failure result); the user interface is responsible for interacting with the user, and the interactive mode is the command line; the output generator outputs the object specified by the user into the format specified by the user according to the instruction input by the user.
技术效果technical effect
本发明使用知识图谱+规则+函数作为基本元素实现通用型知识库,利用多种已有的知识提取和知识解析技术解析多种来源的知识,并将解析结果融合进通用型知识库中;将推理机的推理分为简单推理和复杂推理,简单推理使用知识图谱匹配技术查找问题的解,复杂推理使用推理观察-推理扩张-推理收缩的循环过程尝试查找问题的解。The present invention uses knowledge map + rules + functions as basic elements to realize a general-purpose knowledge base, uses various existing knowledge extraction and knowledge analysis technologies to analyze knowledge from various sources, and integrates the analysis results into the general-purpose knowledge base; The reasoning of the reasoning machine is divided into simple reasoning and complex reasoning. Simple reasoning uses knowledge map matching technology to find solutions to problems, and complex reasoning uses the cyclic process of reasoning observation-reasoning expansion-reasoning contraction to try to find solutions to problems.
与现有技术相比,本发明支持多种知识来源,解决了以往专家系统只能解析单一知识来源的问题,增强了专家系统的易用性和可扩展性;使用复杂推理一定程度上打破了以往专家系统的推理机受领域限制的局限性,使得一部分未被专家系统预先设计的算法覆盖到的问题也能得以被推理机自动解决。Compared with the prior art, the present invention supports multiple knowledge sources, solves the problem that the previous expert system can only resolve a single knowledge source, and enhances the ease of use and scalability of the expert system; the use of complex reasoning breaks the In the past, the reasoning machine of the expert system was limited by the domain, so that some problems that were not covered by the algorithm pre-designed by the expert system could be automatically solved by the reasoning machine.
附图说明Description of drawings
图1为多来源知识解析流程图;Figure 1 is a flowchart of multi-source knowledge analysis;
图2为推理机核心流程图;Fig. 2 is a flow chart of the core of the inference engine;
图3为专家系统架构图;Fig. 3 is an expert system architecture diagram;
图4为逻辑项结构图;Fig. 4 is a logical item structure diagram;
图5为专家系统使用流程图。Figure 5 is a flowchart of the use of the expert system.
具体实施方式detailed description
如图1所示,为本实施例涉及一种基于多源知识的专家系统的实现方法,包括以下步骤:As shown in Figure 1, this embodiment relates to an implementation method of an expert system based on multi-source knowledge, comprising the following steps:
步骤1)构建知识库Step 1) Build Knowledge Base
所述的知识库包括:主知识图谱、规则库、函数库,其中:主知识图谱是一个由节点和关系构成的图,用于描述大量的三元组关系(A,Relation,B);规则库由大量规则构成,每条规则均为一个命题,可以有参数,也可以没有。无参数的规则形如IFATHEN B,有参数的规则形如Foreach(x,y,z):IFATHEN B,其中,A和B各是一个逻辑与项(见图4)。每个逻辑与项由至少一个小知识图谱和零或若干个逻辑或项组成,每个逻辑或项由至少一个逻辑与项组成;函数库由大量函数构成。每个函数由输入参数、局部变量和一串指令构成。每个指令为控制指令(比如return、条件执行),为基本指令(比如加减乘除),为对其他函数的一个调用。函数的默认执行方式是无限循环执行函数体,由return指令跳出函数体的执行。此外,每个函数、每条指令都允许设置起始性质和终止性质,均为一个逻辑与项,用以说明对应函数或指令的起始状态和终止状态。The knowledge base includes: a main knowledge map, a rule library, and a function library, wherein: the main knowledge map is a graph composed of nodes and relationships, and is used to describe a large number of triplet relationships (A, Relation, B); the rules The library consists of a large number of rules, each of which is a proposition, which may or may not have parameters. A rule without parameters is in the form of IFATHEN B, and a rule with parameters is in the form of Foreach(x, y, z): IFATHEN B, where A and B are each a logical AND item (see Figure 4). Each logical AND item consists of at least one small knowledge graph and zero or several logical OR items, and each logical OR item consists of at least one logical AND item; the function library consists of a large number of functions. Each function consists of input parameters, local variables, and a sequence of instructions. Each instruction is a control instruction (such as return, conditional execution), a basic instruction (such as addition, subtraction, multiplication and division), and a call to other functions. The default execution mode of the function is to execute the function body in an infinite loop, and the return instruction jumps out of the execution of the function body. In addition, each function and each instruction is allowed to set the start property and end property, both of which are a logical AND item, used to describe the start state and end state of the corresponding function or instruction.
步骤2)对来自知识图谱、图数据库、关系型数据库的知识进行解析并转换为知识库所能识别的格式,便于专家系统进行分析处理,具体包括:Step 2) Analyzing the knowledge from the knowledge map, graph database, and relational database and converting it into a format that can be recognized by the knowledge base, which is convenient for the expert system to analyze and process, specifically including:
2.1)对知识图谱和图数据库的数据,直接进行数据解析,读取出其中所有的三元组关系(A,Relation,B),再将这些三元组关系加入知识库的知识图谱中。2.1) For the data of the knowledge map and the graph database, directly analyze the data, read out all the triple relations (A, Relation, B), and then add these triple relations to the knowledge map of the knowledge base.
2.2)对关系型数据库的数据,先进行数据解析,读取出其中所有的关系记录Ri(e1,e2,…,eN)。对于形如R(A)的记录,将其转换为形如(A,R,null)的三元组关系。对于形如R(A,B)的记录,将其转换为形如(A,R,B)的三元组关系。对于更长的记录R(e1,e2,…,eN),将其转换为一组形如(e1,R,e2)、(e1,R,e3)、……、(e1,R,eN)的三元组关系。再将所有以上转换成的三元组关系加入知识库的知识图谱中。2.2) For the data of the relational database, the data is analyzed first, and all the relational records Ri(e1, e2,...,eN) are read out. For a record of the form R(A), convert it to a triple relation of the form (A,R,null). For a record of the form R(A,B), convert it to a triplet relation of the form (A,R,B). For a longer record R(e1,e2,...,eN), convert it to a set of the form (e1,R,e2), (e1,R,e3),...,(e1,R,eN) triplet relationship. Then add all the above-converted triplet relationships to the knowledge map of the knowledge base.
步骤3)对来自XML、JSON的知识进行解析并转换为知识库所能识别的格式,便于专家系统进行分析处理,具体包括:Step 3) parse the knowledge from XML and JSON and convert it into a format that can be recognized by the knowledge base, which is convenient for the expert system to analyze and process, specifically including:
3.1)对XML格式,首先使用DOM(Document Object Model)技术将XML文件解析为DOM树,然后识别DOM树的节点:将DOM树中的知识图谱节点(<kg>)按步骤2.1中知识图谱的解析方法解析成三元组关系并加入知识库的知识图谱中,将DOM树中的规则节点(<rule>)按其子节点的标记解析成知识库中的规则,将DOM树中的函数节点(<func>)按其子节点的标记解析成知识库中的函数。3.1) For the XML format, first use DOM (Document Object Model) technology to parse the XML file into a DOM tree, and then identify the nodes of the DOM tree: the knowledge map node (<kg>) in the DOM tree according to the knowledge map in step 2.1 The parsing method parses into a triplet relationship and adds it to the knowledge map of the knowledge base. The rule node (<rule>) in the DOM tree is parsed into a rule in the knowledge base according to the mark of its child node, and the function node in the DOM tree is (<func>) resolves to functions in the knowledge base according to the tokens of its child nodes.
3.2)对JSON格式,首先使用有限状态机对JSON文件进行词法解析,然后对词法解析得到的结果进行自顶向下的语法分析得到JSON对象树。之后识别对象树的节点:将对象树中的知识图谱对象({kg:…})按步骤2.1中知识图谱的解析方法解析成三元组关系并加入知识库的知识图谱中,将对象树中的规则对象({rule:…})按其子对象的键值对解析成知识库中的规则,将对象树中的函数对象({func:…})按其子对象的键值对解析成知识库中的函数。3.2) For the JSON format, first use the finite state machine to perform lexical analysis on the JSON file, and then perform top-down grammatical analysis on the result obtained by the lexical analysis to obtain the JSON object tree. Then identify the nodes of the object tree: parse the knowledge map object ({kg:...}) in the object tree into a triplet relationship according to the analysis method of the knowledge map in step 2.1 and add it to the knowledge map of the knowledge base, and add the object tree The rule object ({rule:…}) is parsed into rules in the knowledge base according to the key-value pairs of its sub-objects, and the function object ({func:…}) in the object tree is parsed according to the key-value pairs of its sub-objects into Functions in the knowledge base.
步骤4)对来自Lisp、Prolog的知识进行解析并转换为知识库所能识别的格式,便于专家系统进行分析处理,具体包括:Step 4) parse the knowledge from Lisp and Prolog and convert it into a format that can be recognized by the knowledge base, which is convenient for the expert system to analyze and process, specifically including:
4.1)对Lisp格式,首先使用有限状态机对Lisp文件进行词法解析,然后对词法解析得到的结果进行自顶向下的语法分析得到Lisp抽象语法树。然后对Lisp抽象语法树进行解析,将Lisp函数转换成本发明的知识库的函数库中的函数。4.1) For the Lisp format, first use the finite state machine to perform lexical analysis on the Lisp file, and then perform top-down grammatical analysis on the result obtained from the lexical analysis to obtain the Lisp abstract syntax tree. Then the Lisp abstract syntax tree is parsed, and the Lisp functions are converted into functions in the function library of the knowledge base of the present invention.
4.2)对Prolog格式,首先使用有限状态机对Prolog文件进行词法解析,然后对词法解析得到的结果进行自顶向下的语法分析得到Prolog抽象语法树。然后对Prolog抽象语法树进行解析,将Prolog规则转换成本发明的知识库的规则库中的规则。4.2) For the Prolog format, first use the finite state machine to perform lexical analysis on the Prolog file, and then perform top-down grammatical analysis on the result obtained by the lexical analysis to obtain the Prolog abstract syntax tree. Then the Prolog abstract syntax tree is analyzed, and the Prolog rules are converted into rules in the rule base of the knowledge base of the present invention.
步骤5)采集问题输入:一个问题为证明一个命题(其形式和本发明的知识库的规则库中的规则一致),即是一个证明问题;为给定一组输入参数和一个逻辑与项,要求找到知识库中已有的若干实体(Entity)与参数一一匹配,且满足输入的逻辑与项进行参数替换后能被当前知识库所推理得到,即是一个查询问题。举例说明一个证明问题,问题为Foreach(x)IF x是整数THEN x是有理数,当知识库中有足够的知识(知识图谱、规则、函数),则应当能得出结论——该命题成立。举例说明一个查询问题,问题为Select(a,b):(a,capital_is,b),当知识库中有适当的知识,则应当能找出若干解。Step 5) collection problem input: a problem is to prove a proposition (its form is consistent with the rule in the rule base of the knowledge base of the present invention), that is, a proof problem; for a given group of input parameters and a logical AND item, It is a query problem to find a number of existing entities (Entities) in the knowledge base that match the parameters one by one, and satisfy the input logical AND items to be inferred by the current knowledge base after parameter replacement. Give an example to illustrate a proof problem. The problem is Foreach(x)IF x is an integer THEN x is a rational number. When there is enough knowledge (knowledge graph, rules, functions) in the knowledge base, it should be able to draw a conclusion—the proposition is established. To illustrate a query problem, the problem is Select(a,b):(a,capital_is,b), when there is appropriate knowledge in the knowledge base, several solutions should be found.
比如:(a,b)=(China,Beijing),即(China,capital_is,Beijing)。具体如何解出输入的问题,则需要以来下面的步骤。For example: (a, b) = (China, Beijing), namely (China, capital_is, Beijing). Specifically, how to solve the input problem requires the following steps.
步骤6)对输入问题进行领域判定:根据用户输入的问题,遍历知识库中的规则库和函数库,判定该问题是否是领域特定方法可解的。判定方法是根据规则的条件从句(IF-clause,是一个逻辑与项)或函数的起始性质(也是一个逻辑与项),对输入的问题进行完全匹配(即用已有实体替换逻辑与项中的参数实体,然后计算参数逻辑与项是否包含于已有逻辑与项中)。当匹配成功,说明知识库中已有某规则或某函数是问题的解法,即直接使用对应规则进行推导,或直接运行对应函数即可得出问题的解,这种情况称为简单推理。当找不出任何匹配,则进入推理机的循环推理流程,这种情况称为复杂推理。Step 6) Domain judgment on the input problem: According to the problem input by the user, traverse the rule base and function library in the knowledge base to determine whether the problem is solvable by a domain-specific method. The judgment method is to completely match the input question according to the conditional clause of the rule (IF-clause, which is a logical AND item) or the initial nature of the function (also a logical AND item) (that is, replace the logical AND item with an existing entity Parameter entity in , and then calculate whether the parameter logical AND item is included in the existing logical AND item). When the matching is successful, it means that a certain rule or a certain function in the knowledge base is the solution to the problem, that is, the solution to the problem can be obtained by directly using the corresponding rule or directly running the corresponding function. This situation is called simple inference. When no match can be found, it enters the circular reasoning process of the reasoning machine, which is called complex reasoning.
步骤7)使用领域方法解决问题:根据步骤6判定的结果,将用户输入的问题交由相应匹配的领域特定方法来解决,即使用对应规则进行推导或运行对应函数。Step 7) Use domain methods to solve the problem: According to the result of step 6, the problem input by the user is handed over to the corresponding matching domain-specific method to solve, that is, use the corresponding rules to deduce or run the corresponding functions.
比如:当用户要求求解一道一元二次方程QuadEq(3,4,5),则遍历匹配知识库的规则库和函数库,当发现存在解一元二次方程的函数SolveQuadEq(a,b,c)时,则调用该函数求解输入的一元二次方程,即调用SolveQuadEq(3,4,5)。For example: when the user requests to solve a quadratic equation of one variable QuadEq(3,4,5), the rule library and function library of the matching knowledge base are traversed, and when the function SolveQuadEq(a,b,c) for solving the quadratic equation of one variable is found , call this function to solve the input quadratic equation, that is, call SolveQuadEq(3,4,5).
步骤8)对输入的问题进行推理观察,并根据相似匹配,查询匹配的规则或函数。由于步骤2判定知识库中没有规则或方法可完全匹配输入的问题,那么推理机还可以不断尝试推理以期获得进展。Step 8) Perform reasoning observation on the input question, and query matching rules or functions according to similar matching. Since step 2 determines that there is no rule or method in the knowledge base that can completely match the input question, the reasoning machine can continue to try reasoning in order to make progress.
比如:当知识库中没有求解一元二次方程的规则或函数,那么还可以通过移项、配方的方法求解;当观察到二次项系数为0,那么还可以消去二次项,进而查找一元一次方程的解法。For example: if there is no rule or function for solving a quadratic equation in one variable in the knowledge base, then it can also be solved by transposition and formula; when the coefficient of the quadratic term is observed to be 0, then the quadratic term can be eliminated, and then the unary equation can be searched The solution of a linear equation.
步骤9)根据步骤4相似匹配得到的规则和函数,进一步地进行完整匹配、生成推理结果、并将推理结果加入知识库中。Step 9) According to the rules and functions obtained by similar matching in step 4, further perform complete matching, generate inference results, and add the inference results to the knowledge base.
比如:对于求解一元二次方程可以配方时,本步骤则对配方的对应规则或函数进行完全匹配,然后对方程实施相应的配方转换,并将配方后的新方程加入知识库中。由于每个参数均为独立的,所以完全匹配的规模可能非常巨大(为N1*N2*…Nm,Ni为第i个参数的备选实体数量),匹配时间、匹配结果数量均为组合级增长的,故需要人为设置阈值。本发明设置的阈值为单个规则/函数最大参数数量(6)、单个参数最大备选实体数量(100)、单次匹配成功匹配结果最大数量(100)。For example: when solving a quadratic equation with one variable can be formulated, this step is to completely match the corresponding rules or functions of the formula, and then implement the corresponding formula conversion for the formula, and add the new formula after the formula to the knowledge base. Since each parameter is independent, the scale of complete matching may be very large (N1*N2*...Nm, Ni is the number of candidate entities for the i-th parameter), and the matching time and the number of matching results are both combination-level growth Therefore, it is necessary to manually set the threshold. The thresholds set by the present invention are the maximum number of parameters for a single rule/function (6), the maximum number of candidate entities for a single parameter (100), and the maximum number of successful matching results for a single match (100).
步骤10)通过推理收缩删除冗余的、大概率无用的推理结果,避免推理机快速耗尽系统资源而推理进度止步不前。本步骤对生成的实体和关系进行相似匹配,当若干实体(本发明设置的阈值为10)所拥有的关系及其关系对象是相似的,那么这些实体很可能是冗余的,可以只保留其中一个。对于生成的规则,则两两对其IF从句和THEN从句进行完全匹配,当某一规则完全是另一规则的子集,则删除较弱的规则。对于生成的函数,则两两对其起始性质和终止性质进行完全匹配,当某一函数的性质完全被另一函数覆盖,则删除较弱的函数。Step 10) Delete redundant and highly probable useless inference results through inference shrinkage, so as to prevent the inference engine from quickly exhausting system resources and stagnant inference progress. This step performs similar matching on the generated entities and relationships. When the relationships and relationship objects owned by several entities (threshold value of the present invention is 10) are similar, then these entities are likely to be redundant, and only one of them can be retained. One. For the generated rules, the IF clauses and THEN clauses are completely matched in pairs. When a rule is completely a subset of another rule, the weaker rule is deleted. For the generated functions, the start and end properties are completely matched in pairs. When the properties of a function are completely covered by another function, the weaker function is deleted.
步骤11)输出推理机推理的最终结果,即输出步骤3使用规则或调用函数运算出的结果、步骤4观察发现问题已被解决从而输出的结果或步骤4观察发现系统时间资源或空间资源已被耗尽且无法再通过推理收缩腾出系统资源,从而输出的错误信息。最终结果的输出方式可以是任意一种知识来源的输入格式,比如知识图谱、XML、Lisp语言等等。Step 11) output the final result of the reasoning machine reasoning, that is, output the result calculated by using rules or calling functions in step 3, the result output by observing in step 4 that the problem has been solved, or the observation in step 4 that the system time resource or space resource has been blocked Exhausted and can no longer free up system resources through speculative shrinking, thus outputting error messages. The output mode of the final result can be any input format of knowledge source, such as knowledge map, XML, Lisp language, etc.
本实施例涉及上述方法的专家系统,包括:知识解析器、知识库、推理引擎、用户界面和输出生成器,其中:知识解析器根据输入的不同种类的知识,分别进行相应的解析处理,并将解析结果转化进入知识库中;知识库利用一种具有通用型知识表达能力的知识模型以存储知识;推理引擎根据用户输入的问题,进行推理,得到推理结果;用户界面负责与用户交互,交互方式是命令行;输出生成器根据用户输入的指令,将用户指定的对象输出成用户指定的格式。This embodiment relates to the expert system of the above method, including: a knowledge parser, a knowledge base, an inference engine, a user interface, and an output generator, wherein: the knowledge parser performs corresponding parsing processing according to different types of input knowledge, and Transform the analysis results into the knowledge base; the knowledge base uses a knowledge model with general knowledge expression ability to store knowledge; the reasoning engine performs reasoning according to the questions input by the user, and obtains the reasoning results; the user interface is responsible for interacting with users. The method is the command line; the output generator outputs the object specified by the user into the format specified by the user according to the instruction input by the user.
经过具体实际实验,在Windows平台下,运行上述专家系统,能够将知识图谱、关系型数据库、图数据库、XML、JSON、Lisp、Prolog等格式的知识成功读取解析并加入知识库,知识库输出的结果显示知识库的内容符合预期;用户的问题以JSON的格式输入,能发现简单的查询问题运行结果符合预期(查询成功或失败),而复杂的查询问题中的一部分也能运行成功。由于阈值设置得较小,所以问题规模变大后,复杂的查询问题运行失败的比率就非常高。After specific practical experiments, running the above-mentioned expert system under the Windows platform can successfully read and analyze knowledge in formats such as knowledge graphs, relational databases, graph databases, XML, JSON, Lisp, Prolog, etc., and add them to the knowledge base, and the knowledge base outputs The results show that the content of the knowledge base is in line with expectations; the user's questions are input in JSON format, and it can be found that the results of simple query problems are in line with expectations (query success or failure), and some of the complex query problems can also run successfully. Since the threshold is set small, complex query problems have a very high failure rate as the problem size increases.
与现有技术相比,本方法使得知识库的通用性大大增强;使得知识来源大大拓宽;使得知识推理能力大大增强。Compared with the prior art, the method greatly enhances the versatility of the knowledge base; greatly broadens the source of knowledge; greatly enhances the ability of knowledge reasoning.
上述具体实施可由本领域技术人员在不背离本发明原理和宗旨的前提下以不同的方式对其进行局部调整,本发明的保护范围以权利要求书为准且不由上述具体实施所限,在其范围内的各个实现方案均受本发明之约束。The above specific implementation can be partially adjusted in different ways by those skilled in the art without departing from the principle and purpose of the present invention. The scope of protection of the present invention is subject to the claims and is not limited by the above specific implementation. Each implementation within the scope is bound by the invention.
Claims (4)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211331513.1A CN115526319A (en) | 2022-10-28 | 2022-10-28 | Method for realizing expert system based on multi-source knowledge |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211331513.1A CN115526319A (en) | 2022-10-28 | 2022-10-28 | Method for realizing expert system based on multi-source knowledge |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN115526319A true CN115526319A (en) | 2022-12-27 |
Family
ID=84703057
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202211331513.1A Pending CN115526319A (en) | 2022-10-28 | 2022-10-28 | Method for realizing expert system based on multi-source knowledge |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN115526319A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117194678A (en) * | 2023-09-06 | 2023-12-08 | 中国银行股份有限公司 | A parameter file replacement method, device, equipment and readable storage medium |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPH06337790A (en) * | 1993-05-28 | 1994-12-06 | Toshiba Corp | Expert system |
| CN101329625A (en) * | 2007-06-22 | 2008-12-24 | 上海宝信软件股份有限公司 | Expert system developing platform |
| CN104506338A (en) * | 2014-11-21 | 2015-04-08 | 河南中烟工业有限责任公司 | Fault diagnosis expert system based on decision tree for industrial Ethernet network |
| US10311442B1 (en) * | 2007-01-22 | 2019-06-04 | Hydrojoule, LLC | Business methods and systems for offering and obtaining research services |
| CN112036571A (en) * | 2020-08-25 | 2020-12-04 | 深圳市酷开网络科技有限公司 | Multi-field expert system joint reasoning method and system |
| CA3153861A1 (en) * | 2021-03-31 | 2022-09-30 | 12407035 Canada Inc. | Controlling elements of furnishing units |
-
2022
- 2022-10-28 CN CN202211331513.1A patent/CN115526319A/en active Pending
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPH06337790A (en) * | 1993-05-28 | 1994-12-06 | Toshiba Corp | Expert system |
| US10311442B1 (en) * | 2007-01-22 | 2019-06-04 | Hydrojoule, LLC | Business methods and systems for offering and obtaining research services |
| CN101329625A (en) * | 2007-06-22 | 2008-12-24 | 上海宝信软件股份有限公司 | Expert system developing platform |
| CN104506338A (en) * | 2014-11-21 | 2015-04-08 | 河南中烟工业有限责任公司 | Fault diagnosis expert system based on decision tree for industrial Ethernet network |
| CN112036571A (en) * | 2020-08-25 | 2020-12-04 | 深圳市酷开网络科技有限公司 | Multi-field expert system joint reasoning method and system |
| CA3153861A1 (en) * | 2021-03-31 | 2022-09-30 | 12407035 Canada Inc. | Controlling elements of furnishing units |
Non-Patent Citations (1)
| Title |
|---|
| 尹文生;: "面向问题分析与决策的专家系统", 计算机应用研究, no. 12, 15 December 2008 (2008-12-15) * |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117194678A (en) * | 2023-09-06 | 2023-12-08 | 中国银行股份有限公司 | A parameter file replacement method, device, equipment and readable storage medium |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| Munir et al. | The use of ontologies for effective knowledge modelling and information retrieval | |
| Domingos et al. | 1 markov logic: A unifying framework for statistical relational learning | |
| CN107038262B (en) | A kind of Semantic Modeling Method based on data map, Information Atlas and knowledge mapping frame that association frequency calculates | |
| Zhang et al. | Learnedsqlgen: Constraint-aware sql generation using reinforcement learning | |
| CN102243649A (en) | Semi-automatic information extraction processing device of ontology | |
| CN118484465B (en) | A method and device for generating SQL statements from natural language statements | |
| Hazber et al. | A survey: Transformation for integrating relational database with semantic Web | |
| Bar El et al. | Atena: An autonomous system for data exploration based on deep reinforcement learning | |
| CN115526319A (en) | Method for realizing expert system based on multi-source knowledge | |
| Bonner et al. | Sequences, datalog, and transducers | |
| De Schreye et al. | On the existence of nonterminating queries for a restricted class of Prolog-clauses | |
| Horrocks | Optimisation techniques for expressive description logics | |
| Basu et al. | Using a relational database to support explanation in a knowledge-based system | |
| CN114418101B (en) | Bayesian network reasoning method and system | |
| Ellis et al. | Managing complex objects in Peirce | |
| CN115345153A (en) | Natural language generation method based on concept network | |
| Porter | Earley deduction | |
| Le et al. | Formal analysis of database trigger systems using event-B | |
| Dwivedi et al. | Query processing and interlinking of fuzzy object-oriented database | |
| TAMRAKAR | An Analysis of Fuzzy set of Query Processing for Fuzzification | |
| Han et al. | A LLM Enhanced Two-Stage Approach for Multi-hop Knowledge Graph Reasoning | |
| Frost et al. | An event based denotational semantics for natural language queries to data represented in triple stores | |
| Botoeva et al. | OBDA over non-relational databases | |
| Du et al. | Construction of visual knowledge graph of crop diseases and pests based on deep learning | |
| Stahl | Query Learning with Quantum Logic |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |
