JPH0738196B2 - Structure search method - Google Patents
Structure search methodInfo
- Publication number
- JPH0738196B2 JPH0738196B2 JP3258670A JP25867091A JPH0738196B2 JP H0738196 B2 JPH0738196 B2 JP H0738196B2 JP 3258670 A JP3258670 A JP 3258670A JP 25867091 A JP25867091 A JP 25867091A JP H0738196 B2 JPH0738196 B2 JP H0738196B2
- Authority
- JP
- Japan
- Prior art keywords
- term
- codeword
- search
- code word
- code
- 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.)
- Expired - Lifetime
Links
- 238000000034 method Methods 0.000 title claims description 44
- 230000006870 function Effects 0.000 description 19
- 238000010586 diagram Methods 0.000 description 9
- 238000013473 artificial intelligence Methods 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000007796 conventional method Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Description
【0001】[0001]
【産業上の利用分野】本発明は、構造を持ったデータを
対象とした情報検索を行う構造体の検索方法に関する。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a structure search method for performing information search for data having a structure.
【0002】[0002]
【従来の技術】人工知能等、知識を利用した計算機処理
などでは、構造を持ったデータがその知識やデータの表
現の基本要素として多く用いられている。大量の知識や
データを必要とする、より高度で大規模な知識処理の応
用を考えた場合、構造を持ったデータの高速な検索方法
が重要である。2. Description of the Related Art In computer processing using knowledge such as artificial intelligence, structured data is often used as a basic element for expressing the knowledge and data. Considering the application of more advanced and large-scale knowledge processing that requires a large amount of knowledge and data, a high-speed search method for structured data is important.
【0003】演繹データベース、知識データベース等の
システムでは、通常、変数を含む項が知識表現の基本要
素として用いられることが多く、それらの演算として単
一化演算が基本演算として必須である。知識の規模が大
きくなるにつれ、大量の項に対する単一化可能な項の高
速演算(検索機構)が必須である。そこで、何等かの高
速化手法が必要であるが、項は定数と異なり、構造を持
ち、しかもその構造が可変であるため、B−treeやハッ
シュ法等の従来の高速技法を適用することができない。In a system such as a deductive database or a knowledge database, a term including a variable is usually used as a basic element of a knowledge expression, and a unification operation is indispensable as the basic operation. As the scale of knowledge grows, a fast operation (search mechanism) of unifiable terms for a large number of terms is essential. Therefore, some kind of speed-up method is required, but since the term has a structure different from a constant and the structure is variable, it is possible to apply a conventional high-speed method such as B-tree or hash method. Can not.
【0004】そこで、各項に対し符号語を割り当て、そ
の符号語に対して簡単な演算を施すことにより、予め単
一化可能な候補を選択する手法が提案されている。その
一つとして、例えば、Wise, M. J. & Poerts, D. M. W.
“Indexing Prolog via Superimposed Code Word and F
ield Encoded Words”.International Conference on L
ogic Programming, IEEE Computer Society Press, pp2
03-210, Feb, 1984 に記載されたFEW(フィールド・
エンコーデッド・ワード:Field Encorded Word )法が
知られている。Therefore, a method has been proposed in which a code word is assigned to each term and a simple operation is performed on the code word to select a candidate that can be unified in advance. As one of them, for example, Wise, MJ & Poerts, DMW
“Indexing Prolog via Superimposed Code Word and F
ield Encoded Words ”.International Conference on L
ogic Programming, IEEE Computer Society Press, pp2
03-210, Feb, 1984 FEW (field
Field Encorded Word) method is known.
【0005】以下、上記のFEW法について説明する。
先ず、最初に、項を定義する。項は、以下のように再帰
的に定義される。 (1) 変数及び0引数関数子は項である(0引数関数子は
定数)。 (2) n引数関数子(項1、項2、…、項n)は項であ
る。 そして、この項に対して、変数に適当な項を割り当てた
場合、同一の項となる(単一化可能な)項を検索する。
例えば、以下、大文字を変数として、f(X,b,g
(X))とf(a,Y,g(a))は、Xにaを、Yに
bを代入することにより、どちらもf(a,b,g
(a))となるため、単一化可能である。逆に、f
(X,b,g(X))とf(a,Y,g(b))は、単
一化不可能である。また、単一化はProlog等で用
いられ、論理型言語を中心とした知識表現で多く用いら
れる。The above-mentioned FEW method will be described below.
First, terms are defined. The terms are defined recursively as follows. (1) Variables and 0-argument function elements are terms (0-argument function elements are constants). (2) The n-argument function (term 1, term 2, ..., Term n) is a term. Then, when an appropriate term is assigned to a variable for this term, a term that becomes the same term (can be unified) is searched.
For example, in the following, f (X, b, g
(X)) and f (a, Y, g (a)) are both f (a, b, g) by substituting a for X and b for Y.
(A)), it is possible to unify. Conversely, f
(X, b, g (X)) and f (a, Y, g (b)) cannot be unified. In addition, unification is used in Prolog and the like, and is often used in knowledge representation centered on a logic language.
【0006】しかし、変数の代入操作が含まれるため、
例えば、想定される質問(項)に対して、該当するデー
タ(単一化可能な項)を全て連続したように予め並べる
連続可能性のような性質すらなく、大量のデータに対し
て、従来の索引付けの方法、即ち、非構造体に関する方
法の適用が困難である。However, since a variable assignment operation is included,
For example, with respect to an envisaged question (term), even if there is no property such as continuity in which all corresponding data (unification possible terms) are arranged in advance so as to be continuous, it is possible to It is difficult to apply the indexing method of i.e., that of non-structure.
【0007】FEW法の処理方法は以下のように行われ
る。検索対象となる項集合中の全ての項および問い合わ
せである項に対して符号語を生成する。即ち、n−ビッ
トの符号語に対して、項が、 (1) 0−引数関数子(定数)である場合、ハッシュ関数
を用いてnビットの符号を生成する。 (2) m−引数関数子である場合、符号語をm+1個の部
分に分割し、最初の部分語にm−引数関数子のハッシュ
値を、残りのm個に各引数の項の分割された符号語に対
する符号を生成する。 (3) 変数の場合、格納される項に対しては、全てのビッ
トが1である符号を、また、問い合わせの項に対して
は、全てのビットが0である符号を生成する。The processing method of the FEW method is performed as follows. Codewords are generated for all terms in the term set to be searched and for terms that are queries. That is, for an n-bit codeword, when the term is (1) 0-argument function (constant), an n-bit code is generated using a hash function. (2) If it is an m-argument functor, the codeword is divided into m + 1 parts, the hash value of the m-argument functor is divided into the first subword, and the remaining m are divided into terms of each argument. Generate a code for the codeword. (3) In the case of a variable, a code with all bits set to 1 is generated for the stored term, and a code with all bits set to 0 is generated for the query term.
【0008】そして、検索対象となる項集合中の全ての
項の符号語と問い合わせである項の符号語を比較するこ
とで、単一化可能な候補項を抽出する。即ち、検索対象
となる項の符号語をS、問い合わせの項の符号語をQと
すると、Q∧S=Qを満足する項が候補項である。但し
∧はビット毎の論理積を表す。次いで、候補項に関して
問い合わせの項と単一化可能かどうかを調べる。Then, by comparing the codewords of all the terms in the term set to be searched with the codewords of the term that is the inquiry, unification candidate items are extracted. That is, if the codeword of the term to be searched is S and the codeword of the query term is Q, the term satisfying Q∧S = Q is a candidate term. However, ∧ represents the logical product of each bit. Then, it is examined whether the candidate term can be unified with the term of the query.
【0009】図2に項集合の例を、図3に符号化の例を
示す。例えば、検索対象となる項を図2の(1) 〜(5) 、
問い合わせの項を図2の(a)として与えた場合の検索
処理は以下のようになる。先ず、検索対象の項集合の各
項に対して、図3の例のように符号語を割り当てる。符
号語は、上述した規則に従い、定数や変数の場合は、そ
の符号をハッシュ関数ψによって求める。m−引数関数
の場合は、適当な関数を用いて符号語をm+1個の符号
語に分割し、最初の符号語に関数子のハッシュ値を、残
りのm個には各引数の符号を同様に与える。引数がまた
m−引数であった場合には、更に分割が行われる。これ
以上分割ができない(割り当てられた符号語が短過ぎ
る)場合分割を行わず、例えば関数子のハッシュ値をそ
の符号とする。但し、検索対象となる項に存在する変数
については、全ビット1を与える。また、問い合わせで
ある項についても、同様に符号語を作成する。但し、問
い合わせの項に存在する変数については、全ビット0を
与える。FIG. 2 shows an example of the term set, and FIG. 3 shows an example of encoding. For example, the terms to be searched are (1) to (5) in FIG.
The search process when the inquiry term is given as (a) in FIG. 2 is as follows. First, a codeword is assigned to each term in the term set to be searched, as in the example of FIG. In the case of a constant or a variable, the code word is obtained by the hash function ψ according to the above rule. In the case of the m-argument function, the codeword is divided into m + 1 codewords using an appropriate function, the hash value of the functor is assigned to the first codeword, and the code of each argument is assigned to the remaining m. Give to. If the argument is also the m-argument, further division is performed. When it cannot be further divided (the assigned codeword is too short), the division is not performed and, for example, the hash value of the functor is used as the code. However, all the bits 1 are given to the variables existing in the term to be searched. In addition, a code word is similarly created for an item that is an inquiry. However, all the bits 0 are given to the variables existing in the term of the inquiry.
【0010】図4に、検索候補の選定処理の説明図を示
す。ここで、図4(a)は、質問項とその符号語を示
し、図4(b)は検索処理を示している。図4(a)に
示すように、問い合わせである項(質問項)にも符号語
Qが与えられる。そして、検索対象の符号語をS、問い
合わせの符号語Qにおいて、Q∧S=Qを満足する項が
検索候補であり、この場合は検索候補として項(1) およ
び(4) が挙げられ(図4(b)参照)、そのうち項(4)
が単一化可能な項である。しかしながら、Q∧S=Qを
満足しても、単一化可能でない場合がある。これをfail
s drop(フェイルス・ドロップ)と呼び、図4(b)に
おける(1) がこれに相当する。また、この場合、Q∧S
=Qを満たさない項については単一化できないことが知
られているので、単一化を試みる必要がなくその分の検
索時間の短縮が図れる。FIG. 4 shows an explanatory diagram of the search candidate selection processing. Here, FIG. 4A shows a question term and its codeword, and FIG. 4B shows a search process. As shown in FIG. 4A, the code word Q is also given to the term (question term) that is an inquiry. Then, in the code word to be searched, S, and in the query code word Q, terms satisfying Q∧S = Q are search candidates. In this case, the search candidates include the terms (1) and (4) ( Figure 4 (b)), of which item (4)
Is a term that can be unified. However, even if Q∧S = Q is satisfied, unification may not be possible. Fail this
This is called s drop (fails drop), and (1) in FIG. 4B corresponds to this. In this case, Q ∧ S
Since it is known that a term that does not satisfy = Q cannot be unified, it is not necessary to try to unify, and the search time can be shortened accordingly.
【0011】一方、上記のFEW法と同種の方法として
知られるCCW(Concatinated Code Word)法では、予
め定められた構造に従って、項の内部の各関数子および
変数の符号化したもの(要素符号語)を結合したものを
符号語として用いる。この場合、ハッシュ値の比較に
は、各(要素)符号語が等しいかどちらかが変数である
かを調べ、全てそうであれば、候補とする方式をとる。On the other hand, in the CCW (Concatinated Code Word) method, which is known as a method similar to the FEW method described above, a coded version of each function and variable inside the term (element code word) is used in accordance with a predetermined structure. ) Is used as a code word. In this case, for comparison of hash values, it is checked whether or not each (element) codeword is a variable, and if either is the case, a method of selecting a candidate is adopted.
【0012】[0012]
【発明が解決しようとする課題】しかしながら、上記の
FEW法では、比較演算として、いわゆる重ね合わせ符
号(SCW)の方式を踏襲しているため、nビットの符
号語で高々Com(n,n/2)種類の関数子しか識別
できず、分解能(符号語により識別可能なデータの種
類)が低下するという問題点を有していた。尚、ここ
で、Com(n,n/2)とは、n個の中からn/2個
取出す組合せの数を示す。一方、上記のCCW法は、各
nビットの要素符号語に対して2n−1種類の識別が行
えるが、構造を予め定める必要があり、構造に合わない
場合は、その符号語が無駄になるといる問題点を有して
いた。本発明は、上記従来の問題点を解決するためにな
されたもので、符号化の分解能(精度)を向上させるこ
とのできる構造体の検索方法を提供することを目的とす
る。However, in the above-mentioned FEW method, since the so-called superposition code (SCW) method is followed as the comparison operation, at most Com (n, n / 2) Only the type of functor can be identified, and the resolution (the type of data that can be identified by the code word) is reduced. Here, Com (n, n / 2) indicates the number of combinations for extracting n / 2 out of n. On the other hand, although the above CCW method can identify 2n-1 types of element codewords of n bits each, it is necessary to determine the structure in advance, and if the structure does not match, the codeword becomes useless. I had a problem. The present invention has been made to solve the above conventional problems, and an object of the present invention is to provide a structure search method capable of improving the encoding resolution (accuracy).
【0013】[0013]
【課題を解決するための手段】本発明の構造体の検索方
法は、項を用いたデータ表現を行う計算機システムにお
いて、検索項の集合から、少なくとも一つの質問項に対
し、該質問項と単一化する検索項を検索する構造体の検
索方法において、前記検索項および質問項に対して、該
項内の各関数子および変数に対し該項の符号語を生成す
る符号語生成手段と、前記符号語生成手段で生成された
質問項の符号語と、前記検索項の符号語との論理演算結
果により、単一化の可能性のある項を判定する判定手段
とを備え、前記符号語生成手段は、符号語に2ビット以
上からなる最小要素を設定し、前記符号語の生成の際に
項の構造に従い分割を再帰的に行い、このとき前記最小
要素以下には分割せず、かつ分割された各符号語の符号
を定め、前記判定手段は、前記検索項および質問項の最
小要素同士の符号語の論理演算に基づき単一化の候補を
選択することを特徴とするものである。According to a method of searching a structure of the present invention, in a computer system that performs data representation using terms, at least one question term from a set of search terms and the question term are simply combined with each other. In a structure search method for searching a search term to be unified, for the search term and the query term, a codeword generating unit that generates a codeword of the term for each function and variable in the term, The codeword includes a codeword of the query term generated by the codeword generation means and a determination means for determining a term having a possibility of unification based on a logical operation result of the codeword of the search term. The generating means sets a minimum element consisting of 2 bits or more in the codeword, recursively divides the codeword according to the structure of the term when generating the codeword, and at this time, does not divide into the minimum element or less, and Determine the code of each divided codeword, and determine Stage, is characterized in that selects candidates for unification based on the logical operation of the code word of the smallest element between the search term and the question section.
【0014】[0014]
【作用】本発明の構造体の検索方法においては、検索項
の集合から、少なくとも一つの質問項に対して単一化す
る検索項を検索する場合、先ず、検索項および質問項に
対して生成した符号語に2ビット以上からなる最小要素
を設定し、かつ符号語の生成の際に項の構造に従い分割
を再帰的に行い、このとき最小要素以下には分割せず、
また、分割された各符号語の符号を定める。次に、検索
項および質問項の最小要素同士の符号の論理演算で、単
一化の候補を選択する。このように、本発明において
は、2ビット以上からなる最小要素を設定しているた
め、その最小要素内で変数を表わす特定の符号を定める
ことが可能となる。それにより、最小要素毎に質問項と
検索項のどちらかが変数の特定の符号である場合は単一
化の候補とし、それ以外は符号語が全く等しい時を候補
とし、全ての最小要素で、単一化の候補となるとき全体
を単一化の候補とすることが可能である。この場合、変
数以外の符号は、変数の特定の符号と重ならなければ良
く、最小要素ビット幅をmビットとし、割り当てられた
符号語の幅をnビットとすると、図5(c)の式(1)
に示す数((2m−1)(n/m))の符号を与えることが可
能となる。一般に、これは前述のn個の中からn/2個
取り出す組み合わせの数、Com(n,n/2)よりも
大きいため、識別できる関数子の種類が従来の方法より
多くなり、分解能を向上させることができる。従って、
前記課題を解決できるのである。In the structure search method of the present invention, when a search term that unifies with at least one question term is searched from a set of search terms, first, the search term and the question term are generated. The minimum element consisting of 2 bits or more is set in the generated codeword, and when the codeword is generated, the division is recursively performed according to the structure of the term, and at this time, the division is not performed below the minimum element,
Further, the code of each divided code word is determined. Next, a candidate for unification is selected by a logical operation of codes between the minimum elements of the search term and the query term. As described above, in the present invention, since the minimum element having 2 bits or more is set, it is possible to determine the specific code representing the variable within the minimum element. As a result, if either the query term or the search term is the specific code of the variable for each minimum element, it is considered as a candidate for unification, and otherwise, when the codewords are exactly the same, it is considered as a candidate. , When it becomes a candidate for unification, it is possible to make the whole as a candidate for unification. In this case, the codes other than the variables do not have to overlap with the specific codes of the variables, and assuming that the minimum element bit width is m bits and the width of the assigned codeword is n bits, the formula of FIG. (1)
It is possible to give the codes of the number ((2 m −1) (n / m) ) shown in. In general, since this is larger than the number of combinations to take n / 2 out of the above n, Com (n, n / 2), the number of types of functors that can be identified is larger than in the conventional method, and the resolution is improved. Can be made. Therefore,
The above problems can be solved.
【0015】[0015]
【実施例】以下、本発明の実施例を図面を用いて詳細に
説明する。先ず、本発明では、検索対象となる項の集合
(データベース)から、各項の特徴を抽出した符号語を
予め用意する。また、検索の問い合わせに対しても、そ
の質問項もしくは、質問項の集合に対して符号語を同様
に作成し、符号語の比較により検索対象の絞り込みを行
い、絞り込まれた検索対象の項とだけ質問項との単一化
処理を行う。単一化の処理に比べ、符号語の比較演算は
極めて高速に行えるため、全ての検索対象に対して単一
化処理を行った場合と比較して高速な処理が期待でき
る。Embodiments of the present invention will now be described in detail with reference to the drawings. First, in the present invention, a codeword in which the features of each term are extracted is prepared in advance from a set (database) of terms to be searched. In addition, for search inquiries, codewords are similarly created for the question term or a set of question terms, and the search target is narrowed down by comparing the codewords. Only perform unification processing with the question item. Compared to the unifying process, the comparison operation of the codewords can be performed at an extremely high speed, so that a high-speed process can be expected as compared with the case where the unifying process is performed on all the search targets.
【0016】即ち、本発明の単一化検索の処理概要は、
以下のように構成されている。 (1) 検索対象となる項の集合の各項に対して、符号語を
作成する(尚、この符号語は通常索引ファイルと呼ばれ
るファイルに格納される)。 (2) 検索対象に対する検索指示が与えられたら、その検
索条件を表現する項である質問項もしくは、その項集合
に対しても、各項に対する符号語を作成する。 (3) 検索対象の符号語と質問項の符号語により、単一化
の可能性のある組合せを抽出する。 (4) 上記(3) で絞り込まれた組合せに対して単一化処理
を行う。 更に、検索対象に対する問い合わせがある場合は、(2)
から(4) を繰り返す。これにより、前処理として、(1)
のオーバヘッドを削減することができる。That is, the processing outline of the unified search according to the present invention is as follows.
It is configured as follows. (1) A codeword is created for each term in the set of terms to be searched (this codeword is usually stored in a file called an index file). (2) When a search instruction for a search target is given, a codeword for each term is created for a question term that is a term expressing the search condition or a term set thereof. (3) Extract combinations that have the possibility of unification by using the codeword to be searched and the codeword of the query term. (4) Perform unification processing on the combinations narrowed down in (3) above. Furthermore, if there is an inquiry for the search target, (2)
Repeat (4) to. As a result, (1)
Overhead can be reduced.
【0017】本発明の特徴は、上記(1) および(2) にお
ける索引化の方法にある。このような索引方法では、短
い符号語を用いていかに検索対象の語の情報を表現する
かが問題となり、その結果が(3) における絞り込みの率
となり、全体の処理時間に影響を与える。単一化検索の
ための索引法であるFEWでは、符号語の対する符号化
の方式として重ね合わせ符号による符号化を用いてい
る。これは、オア演算を行うために符号語を2進語で表
現した時の1の現れるビット数と0の現れるビット数が
等しくなるように符号化した時に最も選択効率が良くな
ることが知られている。The feature of the present invention resides in the indexing method in the above (1) and (2). In such an indexing method, how to express the information of the word to be searched using a short code word becomes a problem, and the result becomes the rate of narrowing down in (3), which affects the entire processing time. FEW, which is an indexing method for unifying search, uses coding by a superposition code as a coding method for codewords. It is known that the selection efficiency is highest when the code word is encoded so that the number of bits in which 1 appears and the number of bits in which 0 appears when the code word is expressed in binary to perform the OR operation are equal. ing.
【0018】本発明では、符号語は、2ビット以上の分
割単位を持っていると考える。符号語の分割では、分割
単位を単位として行い、分割単位を更に分割することは
できない。本発明では、符号語の与え方として以下の方
法を用いる。 (1) 与えられた項が定数のとき、その符号語に対するハ
ッシュ値を演算し、その符号語の符号とする。 (2) 与えられた項が変数であるとき、その符号語に対す
る値は0とする。 (3) 与えられた項が、m−引数関数で表現されていると
きは、符号語をm+1個に分割して、各分割された符号
語に対して、 最初の分割された符号語には、関数名のハッシュ値を
符号とし、 残りの符号語には各引数の項に対する符号語を本アル
ゴリズムを再帰的に適用することにより計算する。 この時、分割できなければ、関数名のハッシュ値を符号
語全体の符号語とする。In the present invention, the codeword is considered to have a division unit of 2 bits or more. The code word is divided into units, and the unit cannot be further divided. In the present invention, the following method is used to give the codeword. (1) When the given term is a constant, the hash value for that codeword is calculated and used as the code of that codeword. (2) When the given term is a variable, the value for that codeword shall be 0. (3) When the given term is expressed by the m-argument function, the codeword is divided into m + 1 pieces, and for each divided codeword, the first divided codeword is , The hash value of the function name is used as a code, and the remaining codewords are calculated by recursively applying this codeword for each argument term. At this time, if it cannot be divided, the hash value of the function name is used as the codeword of the entire codeword.
【0019】図1に、従来技術の項で説明したFEW法
の例と同様の項に対する符号語の構成を示す。この実施
例では、最小分割単位を4ビットにとっており、一つの
符号語は8個の分割要素からなっている。尚、符号化を
行う項は、f(a,h(X,c))である。FIG. 1 shows the construction of code words for terms similar to the example of the FEW method described in the section of the prior art. In this embodiment, the minimum division unit is 4 bits, and one codeword consists of 8 division elements. The term to be encoded is f (a, h (X, c)).
【0020】ここで、この項のトップレベルは、2引数
fであるので、この符号語を3つに分割する。この場
合、最初の2要素を関数記号fに割り当て、残りの3要
素ずつを2つの引数に割り当てる。即ち、最初の2要素
は、fの8ビットへのハッシュ関数値を用いて、「01
010101」となる。その後の3要素については、第
1引数であるaによって決定されるが、これは定数であ
るため、その12ビットへのハッシュ値を計算して、
「100110100101」となる。最後の3要素に
ついては、第2引数のh(X,c)の符号語を計算する
が、これは2引数関数hであるので、更に分割し、最初
の要素がhの4ビットへのハッシュ値で「0010」、
2番目は変数のため「000」、最後がcで「100
0」となる。この場合、最小要素より細かくなるような
分割は行わない。例えば、fの第2引数が3引数関数で
あった場合には、分割をせずにその関数記号のハッシュ
値とするか、最初の2引数と関数記号を用いたハッシュ
値を用いるかなどの方法を取る。これらは、対象となる
項の集合や質問の特性から決定することができる。Here, since the top level of this term has two arguments f, this codeword is divided into three. In this case, the first two elements are assigned to the function symbol f, and the remaining three elements are assigned to the two arguments. That is, the first two elements are "01" using the hash function value of f into 8 bits.
010101 ". The subsequent three elements are determined by the first argument a, but since this is a constant, the hash value to 12 bits is calculated,
It becomes "100110100101". For the last three elements, the codeword of the second argument h (X, c) is calculated. Since this is a two-argument function h, it is further divided, and the first element is a hash of h to 4 bits. The value is "0010",
The second variable is "000", and the last is "100".
It becomes "0". In this case, the division that is finer than the minimum element is not performed. For example, when the second argument of f is a three-argument function, whether the hash value of the function symbol is used without division, or the hash value using the first two arguments and the function symbol is used. Take the way. These can be determined from the set of target terms and the characteristics of the question.
【0021】一方、上記の符号語に対する検索は、以下
のようになる。全ての最小要素に対して、「その最小要
素に対して符号語が全く同じであるか、どちらかが0で
ある」という条件が成立すれば候補である。即ち、各符
号語の最小要素毎に、その値が0であれば、それを変数
として扱う。変数が現れる場所には、どのような値がき
ても候補となる。図5に、符号語の比較を示す。例え
ば、図5(a)に示す場合は、比較する符号語の2要素
目がどちらも0でなく、かつ等しくないため、候補には
ならない。反対に、図5(b)に示す場合では、全ての
要素が等しいか、どちらかが0になっているため、候補
として残ることになる。On the other hand, the search for the above codeword is as follows. It is a candidate if all the minimum elements satisfy the condition "the codeword is the same for the minimum element or one of them is 0". That is, if the value of each minimum element of each codeword is 0, it is treated as a variable. No matter what value comes to the place where the variable appears, it becomes a candidate. FIG. 5 shows a comparison of code words. For example, in the case shown in FIG. 5A, since the second elements of the codewords to be compared are neither 0 nor equal, they are not candidates. On the other hand, in the case shown in FIG. 5B, all the elements are equal or one of them is 0, so that they remain as candidates.
【0022】この際、従来のFEW法のように、S∧Q
=Qのような判定ではなく、比較は通常の比較であるた
め、最小要素のビット幅をmビットとすると、nビット
の符号語に対して変数の符号を除いた図5(c)中の式
(1) の種類の記号を識別することができる。例えば、最
小要素が4ビットの場合、8ビットの符号語に対して、
従来のFEW法では、Com(8,4)=70通りの符
号が用いられるが、本実施例では式(2) に示すように、
225通りの符号を用いることができる。At this time, as in the conventional FEW method, S∧Q
Since the comparison is not a judgment such as = Q but a normal comparison, assuming that the bit width of the minimum element is m bits, the code of the variable is removed from the code word of n bits in FIG. formula
You can identify symbols of type (1). For example, when the minimum element is 4 bits, for an 8-bit codeword,
In the conventional FEW method, Com (8,4) = 70 different codes are used, but in the present embodiment, as shown in equation (2),
225 different codes can be used.
【0023】尚、上記実施例では、符号語による候補の
選定をプログラムで構成するようにしたが、これは、ハ
ードウェアで構成することも可能である。図6に、ハー
ドウェアで構成した判定手段の例を示す。ここで、図6
(a)は判定手段の全体回路図、図6(b)は各判定回
路A、Bの内部回路図である。このように、判定回路A
と判定回路Bには、それぞれ符号語の各1ビットずつが
入力されるよう構成されており、また、各判定回路A、
B、…、の出力がアンド回路に入力され、その論理積を
演算するようになっている。また、各判定回路A、B
は、符号語同士の各ビットをそれぞれ入力するエクスク
ルーシブ−ノア(EX −NOR)回路1、2、3、4
と、それぞれの符号語の各ビットを入力するノア回路
5、6と、各エクスクルーシブ−ノア回路1、2、3、
4の出力を入力するアンド回路7と、アンド回路7の出
力とノア回路5、6の出力を入力するオア回路8とから
構成されている。In the above embodiment, the selection of the candidate by the code word is configured by the program, but this can also be configured by hardware. FIG. 6 shows an example of the determination means composed of hardware. Here, FIG.
6A is an overall circuit diagram of the determination means, and FIG. 6B is an internal circuit diagram of the determination circuits A and B. In this way, the determination circuit A
And the decision circuit B are configured so that each 1 bit of the code word is inputted, and each decision circuit A,
The outputs of B, ... Are input to the AND circuit, and the logical product of them is calculated. In addition, each determination circuit A, B
Is an exclusive-NOR (EX-NOR) circuit 1, 2, 3, 4 for inputting each bit of codewords.
And NOR circuits 5 and 6 for inputting the respective bits of the respective codewords, and the exclusive-NOR circuits 1, 2, 3 and
The AND circuit 7 inputs the output of No. 4 and the OR circuit 8 inputs the output of the AND circuit 7 and the outputs of the NOR circuits 5 and 6.
【0024】また、上記実施例では、構造体として項の
場合を例にとって説明したが、一般の、プログラム言語
等で用いられる構造体は、通常、その構造定義とデータ
が分離されているが、このような構造体を項の形で表現
することも可能であり、従って、そのような構造体にお
いても項表現に変換することで、本発明を適用すること
が可能である。更に、上記実施例では、最小分割単位を
4ビットで構成したが、これに限定されるものではな
く、2ビット以上であれば、上記実施例と同様の効果を
奏する。Further, in the above embodiment, the case of the term as the structure has been described as an example, but a structure generally used in a programming language or the like has its structure definition and data separated, It is also possible to represent such a structure in the form of a term, and therefore, the present invention can be applied by converting such a structure into a term expression. Further, in the above-mentioned embodiment, the minimum division unit is composed of 4 bits, but the present invention is not limited to this, and if it is 2 bits or more, the same effect as that of the above-mentioned embodiment is obtained.
【0025】[0025]
【発明の効果】以上詳細に説明したように、本発明の構
造体の検索方法によれば、検索による候補項の選定を、
検索項及び質問項の2ビット以上からなる最小要素同士
の論理演算により行うようにしたので、例えばmビット
の最小要素を有するnビットの符号語に対して識別でき
る関数子の種類が、Com(n,n/2)から図5
(c)の式(1)で表される数にまで広がり、符号化の
分解能を向上させることが出来る。この分解能の向上に
より従来、異なる関数子が同一符号に符号化されること
により誤って単一化の候補と判定されていたものが、本
発明の方法によれば異なる符号に符号化される可能性が
高くなり、誤った候補の選択、即ちフェイルス・ドロッ
プの確率を減少させることができる。その結果、大量な
項に対する単一化処理において、無駄な処理が削減さ
れ、高速な検索が可能となる。As described in detail above, according to the method for searching a structure of the present invention, the selection of candidate items by searching is
Since it is performed by the logical operation of the minimum elements of 2 bits or more of the search term and the query term, for example, the type of the functor that can be identified with respect to the n-bit codeword having the m-bit minimum element is Com ( n, n / 2) to FIG.
The number can be expanded to the number represented by the equation (1) in (c), and the encoding resolution can be improved. Due to this improvement in resolution, different functional elements have been erroneously determined to be candidates for unification by being encoded into the same code, but according to the method of the present invention, they can be encoded into different codes. Therefore, the probability of wrong candidate selection, that is, the failure drop can be reduced. As a result, unnecessary processing is reduced in the unification processing for a large number of terms, and high-speed search is possible.
【図1】本発明の構造体の検索方法の説明図である。FIG. 1 is an explanatory diagram of a method for searching a structure according to the present invention.
【図2】項集合の説明図である。FIG. 2 is an explanatory diagram of a term set.
【図3】従来の構造体の検索方法における符号化の一例
を示す説明図である。FIG. 3 is an explanatory diagram showing an example of encoding in a conventional structure search method.
【図4】従来の構造体の検索方法における検索候補の選
定処理の説明図である。FIG. 4 is an explanatory diagram of search candidate selection processing in a conventional structure search method.
【図5】本発明の構造体の検索方法における符号語の比
較処理の説明図である。FIG. 5 is an explanatory diagram of codeword comparison processing in the structure search method of the present invention.
【図6】本発明の構造体の検索方法における判定手段の
他の実施例を示す構成図である。FIG. 6 is a configuration diagram showing another embodiment of the determination means in the structure search method of the present invention.
フロントページの続き (56)参考文献 特開 平1−276237(JP,A) 特開 平1−232436(JP,A) 特開 平1−232426(JP,A) WISE,M.J.&POERTS, D.M.W.“INDEXING PRO LOG VIA SUPERIMPOSE D CODE WORD AND FIE LD ENCODED WORDS”.I NTERNATIONAL CONFER ENCE ON LOGIC PROGR AMMING,IEEE COMPUTE R SOCIETY PRESS,PP 203−210,FEB,1984Continuation of the front page (56) Reference JP-A-1-276237 (JP, A) JP-A-1-232436 (JP, A) JP-A-1-232426 (JP, A) WISE, M. J. & POERTS, D.E. M. W. "INDEXING PRO LOG VIA SUPERIMPOSE D CODE WORD AND FIE LD ENCODED WARDS". INTERNATIONAL CONFER ENCE ON LOGIC PROGR AMMING, IEEE COMPUTER SOCIETY PRESS, PP 203-210, FEB, 1984
Claims (1)
テムにおいて、検索項の集合から、少なくとも一つの質
問項に対し、該質問項と単一化する検索項を検索する構
造体の検索方法において、前記検索項および質問項に対
して、該項内の各関数子および変数に対し該項の符号語
を生成する符号語生成手段と、前記符号語生成手段で生
成された質問項の符号語と、前記検索項の符号語との論
理演算結果により、単一化の可能性のある項を判定する
判定手段とを備え、前記符号語生成手段は、符号語に2
ビット以上からなる最小要素を設定し、前記符号語の生
成の際に項の構造に従い分割を再帰的に行い、このとき
前記最小要素以下には分割せず、かつ分割された各符号
語の符号を定め、前記判定手段は、前記検索項および質
問項の最小要素同士の符号語の論理演算に基づき単一化
の候補を選択することを特徴とする構造体の検索方法。1. A method for retrieving a structure for retrieving a search term unifying with at least one question term from a set of search terms in a computer system for performing data representation using terms , For the search term and the query term, for each functor and variable in the term, the codeword of the term
A code word generating means for generating a query word, a code word of the query term generated by the code word generating means, and a logical operation result of the code word of the search term to determine a term having a possibility of unification. Determination means, and the code word generation means includes 2 for the code word.
Set the minimum element consisting of more than bits, and recursively divide according to the structure of the term when generating the codeword.
The code is not divided below the minimum element, and the code of each divided code word is determined, and the determination means is a candidate for unification based on the logical operation of the code words of the minimum elements of the search term and the question term. A method for searching a structure, characterized by selecting.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP3258670A JPH0738196B2 (en) | 1991-09-11 | 1991-09-11 | Structure search method |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP3258670A JPH0738196B2 (en) | 1991-09-11 | 1991-09-11 | Structure search method |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPH0573618A JPH0573618A (en) | 1993-03-26 |
| JPH0738196B2 true JPH0738196B2 (en) | 1995-04-26 |
Family
ID=17323471
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP3258670A Expired - Lifetime JPH0738196B2 (en) | 1991-09-11 | 1991-09-11 | Structure search method |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH0738196B2 (en) |
Family Cites Families (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPH01232436A (en) * | 1988-03-14 | 1989-09-18 | Agency Of Ind Science & Technol | Selecting device for unifying candidate term |
| JPH01232426A (en) * | 1988-03-14 | 1989-09-18 | Agency Of Ind Science & Technol | Index generating device for unifying candidate selection |
| JPH0664534B2 (en) * | 1988-04-27 | 1994-08-22 | 工業技術院長 | Device for selecting unification candidate terms |
-
1991
- 1991-09-11 JP JP3258670A patent/JPH0738196B2/en not_active Expired - Lifetime
Non-Patent Citations (1)
| Title |
|---|
| WISE,M.J.&POERTS,D.M.W."INDEXINGPROLOGVIASUPERIMPOSEDCODEWORDANDFIELDENCODEDWORDS".INTERNATIONALCONFERENCEONLOGICPROGRAMMING,IEEECOMPUTERSOCIETYPRESS,PP203−210,FEB,1984 |
Also Published As
| Publication number | Publication date |
|---|---|
| JPH0573618A (en) | 1993-03-26 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| Stephen | String searching algorithms | |
| Falkoff | Algorithms for parallel-search memories | |
| US5151950A (en) | Method for recognizing handwritten characters using shape and context analysis | |
| JP4805315B2 (en) | Computer representation by data structure and related encoding / decoding method | |
| US5488719A (en) | System for categorizing character strings using acceptability and category information contained in ending substrings | |
| US8095526B2 (en) | Efficient retrieval of variable-length character string data | |
| US20030088577A1 (en) | Database and method of generating same | |
| KR20100116595A (en) | Managing an archive for approximate string matching | |
| JPH02109167A (en) | Character string search method and device | |
| Atig et al. | Emptiness of ordered multi-pushdown automata is 2etime-complete | |
| Dewar | The SETL programming language | |
| JPH0738196B2 (en) | Structure search method | |
| US8661061B2 (en) | Data structure, data structure generation method, information processing apparatus, information processing system, and computer-readable storage medium having stored therein information processing program | |
| Wolff | 'Computing'as Information Compression by Multiple Alignment, Unification and Search | |
| Bertossi et al. | Parallel String Matching with Variable Length Don′ t Cares | |
| EP0638187B1 (en) | Categorizing strings in character recognition | |
| Parberry | A computer assisted optimal depth lower bound for sorting networks with nine inputs | |
| Kurniawan et al. | A new string matching algorithm based on logical indexing | |
| CN109299260B (en) | Data classification method, device and computer readable storage medium | |
| KR102271489B1 (en) | Apparatus and method of constructing Aho-Corasick automata for detecting regular expression pattern | |
| Kirkpatrick et al. | Parallel construction of binary trees with near optimal weighted path length | |
| JP3018579B2 (en) | Name search processor | |
| JP2590698B2 (en) | Character string data retrieval device | |
| olivier | Streamlined QM Method | |
| Nevill-Manning et al. | Modeling sequences using grammars and automata |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| EXPY | Cancellation because of completion of term |