CN109684485B - Method for designing arbitrary rule inference engine based on SWRL - Google Patents

Method for designing arbitrary rule inference engine based on SWRL Download PDF

Info

Publication number
CN109684485B
CN109684485B CN201811594867.9A CN201811594867A CN109684485B CN 109684485 B CN109684485 B CN 109684485B CN 201811594867 A CN201811594867 A CN 201811594867A CN 109684485 B CN109684485 B CN 109684485B
Authority
CN
China
Prior art keywords
rule
connection
inference
atoms
iterative
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.)
Active
Application number
CN201811594867.9A
Other languages
Chinese (zh)
Other versions
CN109684485A (en
Inventor
汪璟玢
李娟�
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fuzhou University
Original Assignee
Fuzhou University
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Fuzhou University filed Critical Fuzhou University
Priority to CN201811594867.9A priority Critical patent/CN109684485B/en
Publication of CN109684485A publication Critical patent/CN109684485A/en
Application granted granted Critical
Publication of CN109684485B publication Critical patent/CN109684485B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention relates to a design method of an arbitrary rule inference engine based on SWRL, which is based on a primary priority principle and a parallel principle, and determines the priority of inference connection by analyzing the occurrence times of elements of an arbitrary rule body precursor in the rule analysis process; in iterative connection, analyzing connection variables and rule atoms required by each iteration through an iterative connector, and activating an inference connector; in inference joining, inference joining is performed until the triples required for rule back-parts are generated. The invention reduces the iteration times under the condition of connecting rule atoms as many as possible in each iteration process. And realizing parallelization and automatic reasoning of the user-defined rules.

Description

Method for designing arbitrary rule inference engine based on SWRL
Technical Field
The invention relates to the technical field of flow type RDF data automatic reasoning under knowledge maps, in particular to a design method of an arbitrary rule reasoning engine based on SWRL.
Background
The OWL Horst rule set is decidable and has strong expression capability, can realize some valuable reasoning in OWL and has moderate computational complexity, so that the OWL Horst rule set is widely used in a reasoning system. But the OWL Horst rule set still cannot meet the situation that complex semantic reasoning exists. For example, based on city safety data, it is impossible to infer traffic congestion in recent years by using an ontology language. Custom rules are needed to associate city safety data with traffic congestion and discover the relation between them. Therefore, under specific requirements, custom semantic rules are needed to mine information implicit between data. At present, inference research based on a custom rule is relatively few, but excellent scholars propose corresponding measures. There are open documents to construct the SWRL rule for the urban public transportation field, and use Jena to reason, and continuously mine the potential relation of the field. There is also a document that proposes a distributed reasoning capability based on arbitrary rules, which improves the reasoning efficiency by converting Datalog rules into RDD operations, using a dynamic data partitioning model and a copy-delete strategy. In addition, the document is a distributed inference engine which is improved on the basis of the above document and partially realizes a general rule.
Furthermore, although the techniques of knowledge fusion and extraction have become mature. However, due to the enormous amount of work, the current knowledge-graphs are still independent. While reasoning has not been limited solely to a single knowledge-graph. How to mine implicit relationships across the knowledge graph becomes a big hotspot in the current knowledge graph research community. At present, researches on a cross-knowledge-graph reasoning engine based on any rule are relatively few, wherein Chenxi et al propose cross-biological-medicine knowledge-graph reasoning and use semantic information to infer the association between traditional Chinese medicine and western medicine. The paper constructs an inference chain rule and provides an odd-even judgment rule to realize an efficient inference engine.
The prior art has the following disadvantages:
1. the inference rule is relatively simple and cannot be expanded to any rule; chenxi et al propose cross-biological knowledge map reasoning to construct a reasoning rule chain for mining and discovering the association between different medical and biological knowledge bases. The characteristics of the inference rule chain are shown in fig. 1: the inference rule chain is characterized in that the object of the previous triplet is the subject of the next triplet. The connection mode connects the object of the previous example triple and the subject of the next example triple, so as to discover the implicit relationship between the node A and the node F. The inference rule chain is relatively simple, firstly, the connection variables are all nodes, and the occurrence times of the connection variables are all 2. Second, the chain of inference rules does not take into account complex relationships between attributes. The requirements of medicinal biology can be met, but cannot be extended to more complex semantic reasoning.
2. The reasoning efficiency is limited by regular atoms, and is relatively low; motik et al propose a distributed reasoning capability based on arbitrary rules, the reasoning engine first marks the common variables and extracts them into a set commomVar, and connects the common variables with the matching instance triples during reasoning. But the inference engine does not consider that the linkage variables occur in more than 2 regular atoms. Secondly, the inference engine needs to connect each rule atom in an iterative manner, and if the number of connection variables is n and the number of rule atoms is m, the connection is needed for nm times.
3. Automated inference engines based on arbitrary rules are relatively less studied.
Disclosure of Invention
In view of this, the invention aims to provide a design method of any rule inference engine based on SWRL, which can reduce the number of iterations and realize parallelization and automatic inference of user-defined rules.
The invention is realized by adopting the following scheme: a design method of any rule inference engine based on SWRL specifically comprises the following steps:
step S1: the rule analyzer analyzes the inflowing SWRL rule according to a primary priority principle and a parallel principle and transmits an analyzed result to the iterative connector;
step S2: in iterative connection, analyzing connection variables and rule atoms required by each iteration through an iterative connector, and activating an inference connector;
step S3: in the inference connection, the inference connection machine carries out inference connection until a triple required by the rule back-piece is generated.
The invention is under the knowledge of complicated field, under the background that the ontology language can not express complicated semantic relation, in order to express more complicated semantic relation, the user will define the rule by oneself often. Traditional ontology language-based reasoning engines cannot be extended to custom rules. The invention therefore proposes an arbitrary rule inference engine, IEAR, based on SWRL, allowing the user to self-extend the SWRL rules. The IEAR reasoning engine firstly analyzes the user-defined SWRL rule, analyzes the connection variables of the user-defined SWRL rule, determines a reasoning connection sequence and automatically completes iterative reasoning. The invention reduces the iteration times under the condition of connecting rule atoms as many as possible in each iteration process. And realizing parallelization and automatic reasoning of the user-defined rules.
Further, the step S1 is specifically: firstly, numbering atoms and elements of the atoms in a user-defined rule body, and simultaneously extracting all attributes in the rule body; then, sorting according to the occurrence times of the elements, and putting the elements with the times more than or equal to 2 into a connection variable; and finally, transmitting the connection variables and the numbered atoms, elements and attributes to an iteration connector.
Further, the step S2 is specifically: the iterative connector firstly acquires connection variables, elements and attributes from the rule parser and parses iterative connection variables and rule atoms; the iterative connector filters and marks incoming triplets, activating the inference connector.
Further, step S3 is specifically: the inference connecting machine is used for connecting the inflowing triples after being activated and outputting corresponding structures to the RDD; if the regular atoms are not connected, activating the iterative connector, returning to the step S2, and entering the next round of iterative connection; if the regular atoms are not connected, the RDD is connected according to the connection variable of the iteration, and the result generated by inference is output.
Further, the first priority rule is as follows: atoms where elements with a large number of occurrences in the rule antecedent are located have a reasoning priority principle; if the connection variables appear as many times, the connection variables are sorted according to the number of the connection variables, and connection reasoning is carried out preferentially when the number is small.
Further, the parallel principle is: if the rule atom to which the linking variable is linked is not related to a rule atom that already has a precedence principle, the linking variable has the same priority as the linking variable that already has a precedence principle, and is linked in parallel in one iteration, subject to the precedence one rule principle.
Compared with the prior art, the invention has the following beneficial effects: the invention provides an automatic rule analysis method, which realizes automatic reasoning of any rule; according to the invention, a plurality of rule atoms are connected as many as possible each time according to a primary priority principle and a parallel principle, so that the iterative connection times are reduced.
Drawings
FIG. 1 is a prior art inference rule chain in the background of the invention.
Fig. 2 is a schematic diagram of the principle of the embodiment of the present invention.
FIG. 3 is a record of the OWL Horst rule set (Universal rule set) of the present invention.
Detailed Description
The invention is further explained below with reference to the drawings and the embodiments.
It should be noted that the following detailed description is exemplary and is intended to provide further explanation of the disclosure. Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs.
It is noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of example embodiments according to the present application. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, and it should be understood that when the terms "comprises" and/or "comprising" are used in this specification, they specify the presence of stated features, steps, operations, devices, components, and/or combinations thereof, unless the context clearly indicates otherwise.
As shown in fig. 2, the present embodiment provides a method for designing an arbitrary rule inference engine based on SWRL, which specifically includes the following steps:
step S1: the rule analyzer analyzes the inflowing SWRL rule according to a primary priority principle and a parallel principle, and transmits the analyzed result to the iterative connector;
step S2: in iterative connection, analyzing connection variables and rule atoms required by each iteration through an iterative connector, and activating an inference connector;
step S3: in the inference connection, the inference connection machine carries out inference connection until a triple required by the rule back-piece is generated.
The invention is under the knowledge of complicated field, under the background that the ontology language can not express complicated semantic relation, in order to express more complicated semantic relation, the user will define the rule by oneself often. Traditional ontology language-based reasoning engines cannot be extended to custom rules. The invention therefore proposes an arbitrary rule inference engine, IEAR, based on SWRL, allowing the user to self-extend the SWRL rules. The IEAR reasoning engine firstly analyzes the user-defined SWRL rule, analyzes the connection variables of the user-defined SWRL rule, determines a reasoning connection sequence and automatically completes iterative reasoning. The method reduces the iteration times by connecting rule atoms as many as possible in each iteration process. And realizing parallelization and automatic reasoning of the user-defined rules.
In this embodiment, the step S1 specifically includes: firstly, numbering atoms and elements of the atoms in a user-defined rule body, and simultaneously extracting all attributes in the rule body; then, sorting according to the occurrence times of the elements, and putting the elements with the times more than or equal to 2 into a connection variable; and finally, transmitting the connection variables and the numbered atoms, elements and attributes to an iteration connector.
In this embodiment, the step S2 specifically includes: the iterative connector firstly acquires connection variables, elements and attributes from the rule parser and parses iterative connection variables and rule atoms; the iterative connector filters and marks incoming triplets, activating the inference connector.
In this embodiment, step S3 specifically includes: the inference connecting machine is used for connecting the inflowing triples after being activated and outputting corresponding structures to the RDD; if the regular atoms are not connected, activating the iterative connector, returning to the step S2, and entering the next round of iterative connection; if the regular atoms are not connected, the RDD is connected according to the connection variable of the iteration, and the result generated by inference is output.
In this embodiment, the first priority rule is: atoms where elements with a large number of occurrences in the rule antecedent are located have a reasoning priority principle; if the connection variables appear as many times, the connection variables are sorted according to the number of the connection variables, and connection reasoning is carried out preferentially when the number is small.
In this embodiment, the parallel principle is: if the rule atom to which the linking variable is linked is not related to a rule atom that already has a precedence principle, the linking variable has the same priority as the linking variable that already has a precedence principle, and is linked in parallel in one iteration, subject to the precedence one rule principle.
The above-described embodiments are described next in more detail. The following definitions are first given:
definition 1.SWRL rule B1∧B2∧...∧Bn→ H. Let RR (reasoning rule) be the inference rule, B be the rule front piece, H be the rule back piece. Their relationship is RR ═ { B, H };
in B there are a plurality of regular atoms B1~BnRule antecedent B and rule atom BiThe relationship of (c) is expressed as: b ═ Bi|BiBelongs to B, belongs to RR and is more than or equal to 1 and less than or equal to n. The SWRL rule back-piece only has one rule atom, and the relationship between the rule back-piece H and the rule atom is represented as follows: h ═ Hi|Hi∈H,H∈RR,1≤i≤1}。
Wherein B isiAnd HiIs expressed as P (x, y), Q (x, y), C (x), sameAs (x, y), and differentfom (x, y). P is any attribute, Q is any data attribute, C is OWL any description, and x and y represent classes or instances.
The data representation of OWL is typically in the form of triples of RDF. The SWRL rule atoms have the same semantics as the triples. The mapping relationship between them is shown in table 1.
TABLE 1 mapping relationship of SWRL rule atoms and triples
Figure BDA0001921130460000071
Definition 2.Bij: is represented by BiIs located at the position of element j in (a). The body index is defined as the regular atom position i, and the varIndex represents the position j in the regular atom where the element is located. B isijFor numbering elements of regular atoms. B isijThe definition is as follows:
Bij={Bij|Bij∈Bi,Bi∈R,1≤i≤n,1≤j≤3};
regular atom BiThe elements j are ordered in the order of subject, predicate and object in the RDF triples according to the mapping of table 1. If the regular atom is P (x, y), then the position of x is Bi1And the position of P is Bi2Y is at position Bi3. If the regular atom is C (x), then x is in the position Bi1Type is B in rdfi2And the position of C is Bi3
By rule RR1For the purpose of example only,
RR1:
Figure BDA0001921130460000081
the element y in the regular atom hasBrother (y, z) is represented as B21The element x is represented by B23The attribute element hasBrother is represented as B22
Define 3. attribute queue (pQue): the queue stores attribute elements of all rule atoms in B and marks the body index of the rule atom where the attribute is located. The attribute queue is used to determine whether incoming data is associated with a rule.
pQue is defined as follows:
pQue={<Bi2,i>|Bi2∈Bi,1≤i≤n};
by rule RR1For example, then pQue of the ruleRR1={<hasParent,1>,<hasBrother,2>}。
Define 4. example triple pool (tTriple): the queue stores instance triples related to the rule, and after the instance triples flow into the system, the predicates of the instance triples are matched with the attribute values of the pQue. After successful matching, the pQue was labeled with the body index in pQue. If the match fails, the triplet is marked-1 and discarded. The instance triple pool is used to filter out instance data associated with the rule. the representation of tTriple is defined as follows:
tTriple={<<sipi oi>,bodyIndex>|1≤i≤n};
if there are instance triplets<Jane hasParent Jack>、<Jane hasFriend Rose>、<Jack hasBrotherMichael>Then tTripleRR1={<<Jane hasParent Jack>,1>,<<Jack hasBrother Michael>,2>}. Example triplet<Jane hasFriend Rose>Is not in pQueRR1In the default case, the flag is-1, that is<<Jane hasFriend Rose>,-1>And discarded.
Define 5. element queue (eQue): the queue stores all the elements of the regular atom in B and marks the body index of the regular atom where its element is located and the element position in the regular atom varIndex. eQue is defined as follows:
eQue={<Bij,i,j>|Bij∈Bi,1≤i≤n,1≤j≤3};
by rule RR1For example, then eQue for the ruleRR1={<x,1,1>,<hasParent,1,2>,<y,1,3>,<y,2,1>,<hasBrother,2,2>,<y,2,3>}。
Definition 6. middleware information (HInfo): the set stores and marks the position of the first occurrence of the element required by the rule back piece in the rule front piece. The attribute elements of the rule back part can be stored in the rule front part or can be a brand new relationship. Thus, the present embodiment recognizes that the attributes of the rule back piece are independent of the rule front piece. In the latter piece of information, the present embodiment records only its value. Hinfo is defined as follows:
HInfo={<Bij,i,j>|Bij (1)∈Bi,1≤i≤n,1≤j≤3,j≠2}∪{H2};
by rule RR1For example, then the HInfo of the ruleRR1={<x,1,1>,hasUncle,<y,2,3>}。
Definition 7. connection variable (connectVar): elements that occur 2 or more times in a regular atom and are not constant can be considered to be connected variables. The value of the connection variable and the number of times num are recorded.
Figure BDA0001921130460000091
By rule RR1For example, asThen the connectictVar of the ruleRR1={<y,2>}。
Define 8. constant pool (comVar): for storing predefined elements in the SWRL, the embodiment considers that one of the elements in the constant pool is used to determine whether the incoming data is related to the rule, and therefore, when the RR has an element in the comVar, the RR needs to be added to the attribute queue. And secondly, the method is used for filtering elements which are irrelevant to the reasoning process. The elements of the constant pool may appear 2 times and more, but they are not connected variables. Thus, if a rule body exists for an element in the constant pool, eQue may not record information about the element. The initial settings for the constant pool are as follows:
comVar={rdf:type、owl:sameAs、owl:differentFrom};
taking rule 7 and rule 11 of fig. 3 as an example, the attribute value owl: sameAs appears twice, but the attribute value is only suitable for reasoning to determine whether the triple is a related class, but is not related to reasoning connection, and is not a connection variable.
Definition 9. independent variables (nonVar): elements that appear only once in the rule body and not in the rule back-part are considered to be irrelevant to reasoning and can be discarded.
Figure BDA0001921130460000101
Define 10. join result (joinResult): and when the connection is inferred, the instance triples connect the corresponding position element information in the eQue by using the body index of connectVar and then put the connected position element information into the joinResult. The representation of the joinResult is defined as follows:
Figure BDA0001921130460000102
by rule RR1For example, if there are instance triplets<Jane hasParent Jack>、<Jack hasBrother Michael>. The rule's joinResult after connection with the connection variable JaneRR1={<Jane,1,1>,<Michael,2,3>}。
The results of the joinResult are exactly all rule backings HINfoRR1The required element value, then directly outputting the result<Jane hasUncle Michael>。
In this embodiment, the priority & first-time principle specifically includes: according to definition 7, a number of occurrences equal to or greater than two is a connection variable. The element p appears 3 times and u appears 2 times in rule 1 of fig. 3. In rule 16, element v occurs 3 times and elements p and w each occur 2 times. It can be concluded that there are unequal numbers of occurrences of the connection variables in the rules.
This embodiment considers that the number of times a variable is connected is equal to the number of regular atoms that the element can connect to. That is, rule 16 of FIG. 3 may connect rule atoms < v own: allValueFrom >, < v own: onProperty p >, and < w rdf: type v > simultaneously. The connection variable, which occurs as many times, has priority for inferred connections because it can connect as many rule atoms as possible in one iteration. That is, the join variable v in the OWL Horst rule set can be considered to have a precedence principle because it can join 3 rule atoms simultaneously in one iteration.
In the present embodiment, the priority rule is defined as follows: the atoms where the elements with the large occurrence number in the rule antecedents are located have a reasoning priority principle. If the connection variables appear as many times, the connection variables are sorted according to the number of the connection variables, and if the number is small, connection reasoning is preferentially carried out.
RR in SWRL rule2For example, the following steps are carried out:
RR2:AllvalueFrom(v,u),OnProperty(v,p),HasType(w,v),p(w,x)-->HasType(x,u)
first is RR2Each regular atom of (a) is numbered:
B1:AllvalueFrom(v,u)
B2:OnProperty(v,p)
B3:HasType(w,v)
B4:p(w,x)
H:HasType(x,u)
analysis revealed that v occurred 3 times and p and w each occurred 2 times. Element v may be the same asTime connection B1、B2And B3P may be linked to B2And B4W may be linked to B3And B4. According to the precedence principle, v has a priority greater than p and w. First connect B1、B2And B3. The result after the first concatenation is put into a joinResult.
Elements p and w both appear 2 times, they are both connected variables, both connected B4. In principle, the join result should be connected to p and w, respectively, at the same time in the order in which the variables are connected. There is inefficiency and failure to obtain correct results.
The present embodiment therefore proposes a principle that regular atoms can only be allowed to connect 1 time in one inference. Therefore, during reasoning, a connection attribute queue (jQue) is defined, the attribute of the rule atom for connection is put into the jQue, and the element is deleted in the pQue.
Define 11. join attribute queue (jQue): the queue stores the regular atomic properties of the join and their corresponding tags for use in joining each iteration. And the join variable is deleted from pQue for one-time principle following. The representation of jQue is defined as follows:
jQue={<Bi2,i>|Bi2belongs to pQue, i is more than or equal to 1 and less than or equal to n }; wherein the content of the first and second substances,
Figure BDA0001921130460000111
by rule RR2For example, then pQue of the ruleRR2={<AllvalueFrom,1>,<OnProperty,2>,<HasType,3>,<p,4>}. After the first iteration of the connection, then
pQueRR2={<p,4>};
jQueRR2={<AllvalueFrom,1>,<OnProperty,2>,<HasType,3>};
The parallel principle is as follows: if rule RR2Regular body of (A) exists in (B)5HasType (x, k), as shown in table 2.
TABLE 2 RR2Connecting variables with BijCorresponding to (2)Is a system
Figure BDA0001921130460000121
As can be seen from Table 2, at this time the linkage variable x appears 2 times, linking the regular atom B4And B5. Although the join variable occurs less frequently than join variable v, there is no crossover of the regular atoms to which they are joined. It is therefore considered herein that priority is given to compliance&On the basis of a primary principle, the connection variable has the same priority with v, and can be inferentially connected with v in parallel in one iteration.
In this embodiment, the parallelism is defined as follows:
if the rule atom to which the linking variable is linked is independent of the rule atom with the precedence principle, the linking variable has the same priority as the linking variable with the precedence principle and is linked in parallel in one iteration.
An intermediate connection element queue (conVar) is thus defined, and the element to be connected is placed in the conVar, while the information about the element is deleted in the connectVar.
Define 12. connection attribute queue (conVar): the queue stores the regular atomic attributes and their corresponding tags that are ready for connection at each iteration for use during iterative connections. And the connection variable is removed from connectVar, following a one-time principle. The representation of conVar is defined as follows:
conVar={<Bi2,num>|Bi2∈connectVar,1≤i≤n},
wherein the content of the first and second substances,
Figure BDA0001921130460000132
in the presence of B5Rule RR of2For example, the connectitvar of the ruleRR2={<v,3>,<p,2>,<w,2>,<x,2>}. After the first iteration of the connection, then
conVarRR2={<v,3><x,2>};
connectVarRR2={<p,2>,<w,2>};
In particular, in the present embodiment, the pseudo code of the algorithm of the rule parser is shown as algorithm 1.
Figure BDA0001921130460000131
The regular atoms are first labeled as body index. Let i be body index and j be varIndex. Extract all attributes in the rulebody and press<Bi2,i>The form is then placed in pQue. Extracting the elements in the regular body and pressing<Bij,i,j>The form of (2) is put into eQue. And numbering the position where the rule back-piece element appears for the first time. And are provided with<Bij,i,j>The form of (2) was put into HINfo.
Then, the element greater than 2 in eQue is put into connectVar, and the element equal to 1 is regarded as an independent variable and is directly removed. And outputs connectVar, eQue, and pQue to the iterative connector.
In this embodiment, the pseudo code of the algorithm of the iterative linker is shown as algorithm 2.
For instance triples flowing into the system, a decision is made based on the value in pQue. If the attribute of the triple exists in the pQue, the example triple is marked by the body index of the attribute and then is put into the tTriple for preparing the inference connector connection.
The connection variables required at the next inference connector are then analyzed. Searching the body index of the rule atom where the connection variable is located according to the precedence order of the connectVar, and putting the attribute with the body index into jQue for use in reasoning connection; at the same time, the join variable is placed in the conVar, which is used to reason about join usage.
The attribute with this body index is deleted from pQue when it is put into jQue. The function of deleting the attributes in the pQue is to follow the principle of priority & one time, and one regular atom can only be connected once in one iteration connection; meanwhile, the join variable is placed in the connvar and deleted from the connctvar. The mechanism has the functions of determining connection variables required for connection in each iteration; second, if connectVar is empty, the inference is over.
Figure BDA0001921130460000141
Figure BDA0001921130460000151
In this embodiment, the pseudo code of the algorithm of the inference connector is shown as algorithm 3.
In the inference connector, variables are connected in a loop conVar. And according to the times num of the connection variables, num attributes in the pQue are circulated. Matching the body index values of num attributes with the tTriple, connecting by taking the connection variable as a key after matching, putting the result value into a join result, and putting the new connection result into the join result when the new iteration is connected. And puts the joined join result into a join result list.
And when the connectVar is empty, judging whether the pQue is empty, if not, continuing to the iterative connector for further iterative connection. If the result is null, matching the remaining connection variables in the connectVar with the joinResult in the joinResultList until the connectVar is null, finally, matching the final joinResult with the information in the Hinfo, outputting the result, storing the result in Redis, and finishing the reasoning.
Figure BDA0001921130460000152
Figure BDA0001921130460000161
The above description is only a preferred embodiment of the present invention, and all equivalent changes and modifications made in accordance with the claims of the present invention should be covered by the present invention.

Claims (3)

1. A design method of any rule inference engine based on SWRL is characterized in that: the method comprises the following steps:
step S1: the rule analyzer analyzes the inflowing SWRL rule according to a primary priority principle and a parallel principle and transmits an analyzed result to the iterative connector;
step S2: in iterative connection, analyzing connection variables and rule atoms required by each iteration through an iterative connector, and activating an inference connector;
step S3: in the inference connection, the inference connecting machine carries out inference connection until a triplet required by a rule back part is generated;
the step S1 specifically includes: firstly, numbering atoms and elements of the atoms in a user-defined rule body, and simultaneously extracting all attributes in the rule body; then, sorting according to the occurrence times of the elements, and putting the elements with the times more than or equal to 2 into a connection variable; finally, the connection variables and the numbered atoms, elements and attributes are transmitted to an iteration connector;
the primary priority principle is as follows: atoms where elements with a large number of occurrences in the rule antecedent are located have a reasoning priority principle; if the connection variables appear as many times, sorting the connection variables according to the serial numbers of the connection variables, and performing connection reasoning preferentially when the serial numbers are small; the parallel principle is as follows: if the rule atom to which the linking variable is linked is not related to a rule atom that already has a precedence principle, the linking variable has the same priority as the linking variable that already has a precedence principle, and is linked in parallel in one iteration, subject to the precedence one rule principle.
2. The method of claim 1 for designing an arbitrary rule inference engine based on SWRL, wherein: the step S2 specifically includes: the iterative connector firstly acquires connection variables, elements and attributes from the rule parser and parses iterative connection variables and rule atoms; the iterative connector filters and marks incoming triplets, activating the inference connector.
3. The method of claim 1 for designing an arbitrary rule inference engine based on SWRL, wherein: step S3 specifically includes: the inference connecting machine is used for connecting the inflowing triples after being activated and outputting corresponding structures to the RDD; if the regular atoms are not connected, activating the iterative connector, returning to the step S2, and entering the next round of iterative connection; if the regular atoms are not connected, the RDD is connected according to the connection variable of the iteration, and the result generated by inference is output.
CN201811594867.9A 2018-12-25 2018-12-25 Method for designing arbitrary rule inference engine based on SWRL Active CN109684485B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811594867.9A CN109684485B (en) 2018-12-25 2018-12-25 Method for designing arbitrary rule inference engine based on SWRL

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811594867.9A CN109684485B (en) 2018-12-25 2018-12-25 Method for designing arbitrary rule inference engine based on SWRL

Publications (2)

Publication Number Publication Date
CN109684485A CN109684485A (en) 2019-04-26
CN109684485B true CN109684485B (en) 2021-09-28

Family

ID=66189389

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811594867.9A Active CN109684485B (en) 2018-12-25 2018-12-25 Method for designing arbitrary rule inference engine based on SWRL

Country Status (1)

Country Link
CN (1) CN109684485B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111986799B (en) * 2020-07-06 2024-06-04 北京欧应信息技术有限公司 Orthopedics knowledge graph construction system taking joint movement function as core
CN112380353B (en) * 2020-11-13 2021-06-08 哈尔滨工业大学 Knowledge engineering-based spacecraft overall design method, system and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8145627B2 (en) * 2005-06-10 2012-03-27 Hewlett-Packard Development Company, L.P. Use of connectivity analysis to assist rule-based optimizers
CN105718591A (en) * 2016-01-27 2016-06-29 武汉大学 Qualitative spatial relation reasoning method based on rules and constraint satisfaction
CN105808568A (en) * 2014-12-30 2016-07-27 华为技术有限公司 Context distributed reasoning method and device
CN105976031A (en) * 2015-03-13 2016-09-28 思科技术公司 Parallel processing of data by multiple semantic reasoning engines
CN106411923A (en) * 2016-10-25 2017-02-15 公安部第三研究所 Ontology modeling based network risk assessment method
CN107785074A (en) * 2017-10-27 2018-03-09 上海利连信息科技有限公司 A kind of disease subsidiary discriminant method and system of Process Based engine

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8145627B2 (en) * 2005-06-10 2012-03-27 Hewlett-Packard Development Company, L.P. Use of connectivity analysis to assist rule-based optimizers
CN105808568A (en) * 2014-12-30 2016-07-27 华为技术有限公司 Context distributed reasoning method and device
CN105976031A (en) * 2015-03-13 2016-09-28 思科技术公司 Parallel processing of data by multiple semantic reasoning engines
CN105718591A (en) * 2016-01-27 2016-06-29 武汉大学 Qualitative spatial relation reasoning method based on rules and constraint satisfaction
CN106411923A (en) * 2016-10-25 2017-02-15 公安部第三研究所 Ontology modeling based network risk assessment method
CN107785074A (en) * 2017-10-27 2018-03-09 上海利连信息科技有限公司 A kind of disease subsidiary discriminant method and system of Process Based engine

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Using SWRL and ontological reasoning for the personalization of context-aware assistive services;Kerry-Louise Skillen等;《PETRA"13:Proceedings of the 6th International Conference on PErvasive Technologies Related to Assistive Environments》;20130530;第1-8页 *
基于SWRL规则推理的隐含关系挖掘;丁晟春;《基于SWRL规则推理的隐含关系挖掘》;20110325;第68-72页 *

Also Published As

Publication number Publication date
CN109684485A (en) 2019-04-26

Similar Documents

Publication Publication Date Title
CN107967261A (en) Interactive question semanteme understanding method in intelligent customer service
CN101853257B (en) System and method for transformation of SPARQL query
US11556578B2 (en) Putative ontology generating method and apparatus
Fahrner et al. A survey of database design transformations based on the Entity-Relationship model
CN104199831B (en) Information processing method and device
US8037008B2 (en) DBMS-based knowledge extension and inference service method recorded on computer-readable medium
CN104391881B (en) A kind of daily record analytic method and system based on segmentation methods
CN109684485B (en) Method for designing arbitrary rule inference engine based on SWRL
AU2015258752A1 (en) Putative ontology generating method and apparatus
JPH06290102A (en) Equipment and method for accessing information
CN103870506B (en) Webpage information extraction method and system
CN104750795A (en) Intelligent semantic searching system and method
CN106372177A (en) Query expansion method supporting correlated query and fuzzy grouping of mixed data type
WO2020074023A1 (en) Deep learning-based method and device for screening for key sentences in medical document
CN103186633B (en) A kind of structured message abstracting method, searching method and device
CN106446162A (en) Orient field self body intelligence library article search method
Gherabi et al. Mapping relational database into OWL Structure with data semantic preservation
CN109522405A (en) File information processing method, electronic equipment and computer-readable deposit medium
Pfeiffer Constructing comparable conceptual models with domain specific languages
CN104424399B (en) A kind of method, apparatus of the knowledge navigation based on virus protein body
KR20130064160A (en) System of entity-relationship model reformulation of sparql query results on rdf data and the method
CN103020189B (en) Data processing equipment and data processing method
Colloc et al. Automatic Knowledge Acquisition for Object-Oriented Expert Systems
JP4103905B2 (en) Integrated search system
KR101225333B1 (en) System and method using tree pattern expression for extraction information from syntactically parsed text corpora

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
GR01 Patent grant
GR01 Patent grant