JP3555542B2 - Group number setting device and group number setting method - Google Patents

Group number setting device and group number setting method Download PDF

Info

Publication number
JP3555542B2
JP3555542B2 JP2000064030A JP2000064030A JP3555542B2 JP 3555542 B2 JP3555542 B2 JP 3555542B2 JP 2000064030 A JP2000064030 A JP 2000064030A JP 2000064030 A JP2000064030 A JP 2000064030A JP 3555542 B2 JP3555542 B2 JP 3555542B2
Authority
JP
Japan
Prior art keywords
group number
record
records
group
data record
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 - Fee Related
Application number
JP2000064030A
Other languages
Japanese (ja)
Other versions
JP2001256249A (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.)
NEC Corp
Original Assignee
NEC Corp
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 NEC Corp filed Critical NEC Corp
Priority to JP2000064030A priority Critical patent/JP3555542B2/en
Publication of JP2001256249A publication Critical patent/JP2001256249A/en
Application granted granted Critical
Publication of JP3555542B2 publication Critical patent/JP3555542B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Description

【0001】
【発明の属する技術分野】
本発明は、グループ番号設定装置およびグループ番号設定方法に関し、特に、データレコードおよび関連レコードを備え、新規に追加された関連レコードの内容に基づいて、データレコードにグループ番号を設定するグループ番号設定装置およびグループ番号設定方法に関する。
【0002】
【従来の技術】
従来、この種のグループ番号設定装置として、特開平2−234269号公報に開示された技術がある。
本技術は、1レコード毎にデータを入力するデータ入力手段と、入力したレコードが1つ前に入力したレコードと同一のグループに属するか否かをグルーピング項目の項目値をもとに判定するグループ識別手段と、連続した2レコードが同一のグループに属すると判定されたときに連続した2レコードの項目値をペアにして出力する2項関係生成手段と、生成された項目値のペアをもとに全てのグループについて矛盾のない項目値の出現順序を表現する統合出現順序情報を随時に作成・実行する統合出現順序更新手段と、全てのデータの入力終了後に前記統合出現順序情報をもとに項目名順序情報を出力する項目名順序出力手段とを備えている。かかる構成において、概略、項目名について全グループ内の項目値の出現順に矛盾しない一貫した順序の並びを実現している。
また、同様のグループ番号設定装置としては、特開平8−241228号公報に開示された技術が知られている。
【0003】
【発明が解決しようとする課題】
上述した従来のグループ番号設定装置においては、大量のデータレコード、および、関連レコードがある場合に、処理速度が低速になってしまうといった課題があった。さらに、このようなグループ番号設定装置においては、所定のデータレコードを削除する際に、当該データレコードが削除対象外であると判断された場合、このデータレコードに関連づいている全データレコードを削除対象外とする処理が必要である。
【0004】
本発明は、上記課題にかんがみてなされたもので、上記必要とされる所定のデータレコードを削除する際の処理を実現可能とするとともに、データベースに付与されたインデックスを利用することにより処理速度の高速化を実現することが可能なグループ番号設定装置およびグループ番号設定方法の提供を目的とする。
【0005】
【課題を解決するための手段】
上記目的を達成するため、請求項1にかかる発明は、各レコードをグループ番号にて管理するデータレコードテーブルとこのデータレコードテーブルと二項関係を有するレコードを有する関連レコードテーブルとをデータベース上に備え、上記データレコードテーブルのグループ番号を設定するグループ番号設定装置であって、少なくとも1つ以上の関連レコードを有する関連レコードテーブルから順次関連レコードに格納された関連名を読み出す関連名読出手段と、上記データレコードテーブルにて読み出された関連名を含む二つのレコードを特定する特定手段と、上記特定されたデータレコードのグループ番号を上記関連レコードの読み出し順に従って新しく生成したグループ番号によって設定する設定手段とを具備する構成としてある。
【0006】
上記のように構成した請求項1にかかる発明においては、データレコード、および、その関連レコード(二項関係)からなるシステムにおいて、新規に追加された関連レコードの内容に基づき、データレコードにグループ番号を設定する方法を実現するものである。本発明にかかるグループ番号設定装置は、各レコードをグループ番号にて管理するデータレコードテーブルと、このデータレコードテーブルと二項関係を有するレコードを有する関連レコードテーブルとを備え、このデータレコードテーブルのグループ番号を設定する。
【0007】
かかる設定において、関連名読出手段は、少なくとも1つ以上の関連レコードを有する関連レコードテーブルから順次関連レコードに格納された関連名を読み出すとともに、特定手段にて、データレコードテーブルから読み出された関連名を含む二つのレコードを特定する。そして、設定手段が、特定されたデータレコードのグループ番号を関連レコードの読み出し順に従って新しく生成したグループ番号に設定する。
【0008】
また、請求項2にかかる発明は、請求項1に記載のグループ番号設定装置において、上記設定手段は、上記特定手段にて特定された二つのレコードのグループ番号が未設定の場合、この二つのグループ番号に、上記設定手段にて生成した同一のグループ番号を設定する構成としてある。
上記のように構成した請求項2にかかる発明においては、特定手段にて特定された二つのレコードのグループ番号が未設定の場合、設定手段は、この二つのグループ番号に、設定手段にて生成した同一のグループ番号を設定する。
【0009】
さらに、請求項3にかかる発明は、請求項1または請求項2のいずれかに記載のグループ番号設定装置において、上記設定手段は、上記特定手段にて特定された二つのレコードのグループ番号について、一方のレコードのグループ番号のみが設定されている場合、当該レコードのグループ番号を設定されていない他方のグループ番号に設定する構成としてある。
【0010】
上記のように構成した請求項3にかかる発明においては、特定手段にて特定された二つのレコードのグループ番号について、一方のレコードのグループ番号のみが設定されている場合、設定手段は、このレコードのグループ番号を設定されていない他方のグループ番号に設定する。
【0011】
さらに、請求項4にかかる発明は、請求項1〜請求項3のいずれかに記載のグループ番号設定装置において、上記設定手段は、上記特定手段にて特定された二つのレコードのグループ番号について、既に両方のレコードのグループ番号が設定されている場合、これらの既に設定されているグループ番号どうしを比較し、小さい値のグループ番号を大きい値のグループ番号を有するレコードのグループ番号として設定する構成としてある。
【0012】
上記のように構成した請求項4にかかる発明においては、特定手段にて特定された二つのレコードのグループ番号について、既に両方のレコードのグループ番号が設定されている場合、設定手段は、これらの既に設定されているグループ番号どうしを比較し、小さい値のグループ番号を決定する。そして、比較にて大きい値とされたグループ番号と一致するレコード番号を有するレコードの当該レコード番号を上述した小さいレコード番号に更新し設定する。
【0013】
さらに、請求項5にかかる発明は、請求項1〜請求項4のいずれかに記載のグループ番号設定装置において、上記関連レコードテーブルは、上記データレコードテーブルと所定の整数Nにて形成されるN項関係を有する構成としてある。
上記のように構成した請求項5にかかる発明においては、関連レコードテーブルとデータレコードテーブルとを所定の整数NにてN項関係を有するように形成する。
【0014】
このように、各レコードをグループ番号にて管理するデータレコードテーブルとこのデータレコードテーブルと二項関係を有するレコードを有する関連レコードテーブルとを備え、上記データレコードテーブルのグループ番号を設定する手法は必ずしも実体のある装置に限られる必要はなく、その方法としても機能することは容易に理解できる。
【0015】
このため、請求項6にかかる発明は、各レコードをグループ番号にて管理するデータレコードテーブルとこのデータレコードテーブルと二項関係を有するレコードを有する関連レコードテーブルとをデータベース上に備え、上記データレコードテーブルのグループ番号を設定するグループ番号設定方法であって、少なくとも1つ以上の関連レコードを有する関連レコードテーブルから順次関連レコードに格納された関連名を読み出す関連名読出工程と、上記データレコードテーブルにて読み出された関連名を含む二つのレコードを特定する特定工程と、上記特定されたデータレコードのグループ番号を上記関連レコードの読み出し順に従って新しく生成したグループ番号によって設定する設定工程とを具備する構成としてある。
すなわち、必ずしも実体のある装置に限らず、その方法としても有効であることに相違はない。
【0016】
【発明の実施の形態】
以下、図面にもとづいて本発明の実施形態を説明する。
図1は、本発明の一実施形態にかかるグループ番号設定装置をブロック図により示している。
ここで、本実施形態にかかるグループ番号設定装置はデータレコードテーブルおよびその関連レコードテーブル(二項関係)からなるシステムにおいて、新規に追加された関連レコードの内容に基づき、データレコードテーブルにグループ番号を設定する方法を実現するものである。
【0017】
図1に示すように、本実施形態のグループ番号設定装置は、記憶装置(データベース)10とデータ処理装置20を有しており、また、記憶装置10はデータレコードテーブル11と関連レコードテーブル12を有し、データ処理装置20はグループ番号生成処理部22とグループ更新処理部23とを有している。
【0018】
ここで、グループ設定処理部21は関連レコードテーブル12の内容に基づいて、対応するデータレコードテーブル11にグループ番号を設定する。但し、関連レコードテーブル内で直接関連づけられているデータレコード同士でない場合でも、他の関連レコードを通して間接的に関連づけられていることがあり、その場合には間接的に関連づけられているデータレコードも含めて同じグループ番号を設定する必要がある。
【0019】
また、既に異なるグループ番号が設定されている場合に、グループ番号のマージが必要になる。ここでは、これらの関連付け処理を(1)直接関連づけられている場合の処理、および(2)既に関連づけられており、グループ番号のマージを行う場合の処理に分解し、間接的に関連づけられている場合でも、(1)および(2)の組み合わせで処理を実行する。
【0020】
グループ番号のマージ処理では、二つの異なるグループ番号を一つのグループ番号にマージすることになるが、この場合、一方のグループ番号をもつ全データレコードのグループ番号を他方のグループ番号に変更することになる。データレコード内のグループ番号列にはデータベース・インデックスを置いているため、指定されたグループ番号を持つデータレコードを高速に検索する。
【0021】
例えば、データレコード1〜4について、関連レコード1でデータレコード1とデータレコード2が、関連レコード2でデータレコード3とデータレコード4が、関連レコード3でデータレコード2とデータレコード3が関連づいているとする。この場合、データレコード1〜4のすべてに同じグループ番号を設定する必要がある。関連レコード1、および、関連レコード2では、(1)直接関連づけられている場合の処理、を行い、関連レコード3では、グループ番号のマージを行う場合の処理、を行うことで、すべてのデータレコードに同じグループ番号を設定することができる。
【0022】
このようにして、たとえ直接関連づけられていない場合でも、関連づいているすべてのデータレコードに同じグループ番号を設定することが可能になる。
ここでは、以下の前提に基づいている。
(1)全く関連づいていないデータレコードはグループ番号を保持する必要はない。
(2)関連レコードが削除されることはない。
【0023】
図1において、グループ設定処理部21は関連レコードテーブル12から新規に追加された関連レコードを取り出し、対応するデータレコードをデータレコードテーブル11から取り出す。関連レコードはデータレコードに関する二項関係を保持しているため、対応するデータレコードは二件取り出される。
【0024】
取り出された二件のデータレコードにグループ番号が設定されているかどうかで、この後の処理は以下の三通りに別れる。
(1)どちらのデータレコードにもグループ番号が設定されていない場合には、グループ番号生成処理部22から新しい番号を取り出し、両方のデータレコードにこのグループ番号を設定し、データレコードテーブル11に保存する。グループ番号生成処理部22では、次のグループ番号を保持し、一つ返す毎にインクリメントする。
【0025】
(2)片方のデータレコードにグループ番号が設定されている場合には、設定されていないデータレコードにこの番号を設定し、データレコードテーブル11に保存する。
【0026】
(3)どちらのデータレコードにもグループ番号が設定されている場合には、二つのグループ番号を、大きい方、小さい方に分類し、グループ更新処理部23に移る。グループ更新処理部23では、まず、データレコードテーブル11から大きい方の番号をグループ番号として持つ全データレコードを取り出し、小さい方の番号を新しいグループ番号として設定する。
ここで、上述したように、本実施形態においては、グループ設定処理部21が本発明にかかる関連名読出手段および特定手段を構成し、グループ更新処理部23、グループ番号生成処理部22およびグループ設定処理部21が設定手段を構成する。
【0027】
次に、図1のブロック図および図2のフローチャートを参照して本実施例の全体の動作について詳細に説明する。
まず最初に、未処理の関連レコードを取り出す。次に、関連レコードで関連づけられている二個のデータレコード1,2を取り出す(ステップA2)。ここで、データレコード1,2のグループ番号が設定されていない場合には(ステップA3,A4)、新しい番号を取り出し(ステップA6)、その番号をデータレコード1,2のグループ番号として設定する(ステップA7)。
【0028】
また、データレコード1はグループ番号が設定されていないが(ステップA3)、データレコード2はグループ番号が設定されている場合には(ステップA4)、データレコード1にデータレコード2のグループ番号を設定する(ステップA8)。
【0029】
一方、データレコード1はグループ番号が設定されているが(ステップA3)、データレコード2がグループ番号が設定されていない場合には(ステップA5)、データレコード2にデータレコード1のグループ番号を設定する(ステップA9)。最後に、データレコード1,2ともにグループ番号が設定されている場合には(ステップA3,A5)、小さい方のグループ番号を決定し(ステップA10)、二個のグループ番号のうち大きい方のグループ番号を持つ全データレコードを取り出し(ステップA11)、小さい方のグループ番号に基づいて、これらのデータレコードのグループ番号を更新する(ステップA12)。
【0030】
次に、ステップA11にて取り出した全データレコードについて、番号の更新が完了したか否かを判定し(ステップA13)、完了していなければ、ステップS12に戻り番号を更新する処理を繰り返す。このように、ステップA7,A8,A9,A12の設定および更新が完了した場合は、関連レコードデータベースを検索し、上記各グループ番号の設定および更新の処理について未処理の関連レコードが残っているか否かを判定する、すなわち、全関連レコードについての処理が終了したか否かを判定する(ステップA14)。そして、残っている場合はステップA1に戻り上述した処理を繰り返す。
【0031】
次に、具体例を用いて説明する。
図3、4、5に示す例では、図3において処理前のデータレコード、および、関連レコードの内容を示している。最初の関連レコードでは、どちらのデータレコードもグループ番号を持たないため、新しいグループ番号1を生成し、このグループ番号をデータレコード1,2に設定している。2番目、および、3番目の関連レコードも、最初の関連レコード同様、どちらのデータレコードもグループ番号を持たないため、新しいグループ番号2,3を生成し、これらのグループ番号をそれぞれ、データレコード3,4、および、データレコード6,8に設定している。
【0032】
4番目の関連レコードでは、片方のデータレコード4のみがグループ番号2を持っているため、他方のデータレコード10にも同じグループ番号2を設定している。5番目の関連レコードでは、1〜3番目の関連レコードと同様、どちらのデータレコードもグループ番号を持たないため、新しいグループ番号4を生成し、このグループ番号をデータレコード5,9に設定している。ここまでの結果は図4に示されている。最後に、6番目の関連レコードでは、どちらのデータレコードもグループ番号を持つため、大きい方の番号2を持つデータレコード3,4,10に、小さい方のグループ番号1を設定している。最終結果は図5に示されている。
【0033】
次に、本発明の他の実施例について図面を参照して詳細に説明する。
本実施例は、関連レコードが、N個のデータレコード間の関連を保持している点で異なる。実施例の構成は図1と変わらないため、図1をそのまま利用して説明する。
ここでは、以下の前提に基づいている。
(1)全く関連づいていないデータレコードはグループ番号を保持する必要はない。
(2)関連レコードが削除されることはない。
(3)各関連レコードでは、常に同じ数の関連を保持する必要はなく、例えば、あるものが三個のデータレコード間の関連を、他のものが五個のデータレコード間の関連を保持することが可能である。
【0034】
図1において、グループ設定処理部21は関連レコードテーブル12から新規に追加された関連レコードを取り出し、対応するデータレコードをデータレコードテーブル11から取り出す。ここで、関連レコードはデータレコードに関するN項関係を保持しているため、対応するデータレコードはN件取り出される。取り出されたN件のデータレコードにグループ番号が設定されているかどうかで、この後の処理は以下の3通りに別れる。
【0035】
(1)どのデータレコードにもグループ番号が設定されていない場合には、グループ番号生成処理部22から新しい番号を取り出し、N件のデータレコード全てにこのグループ番号を設定し、データレコードテーブル11に保存する。グループ番号生成処理部22では、次のグループ番号を保持し、一つ返す毎にインクリメントする。
【0036】
(2)グループ番号が設定されている全データレコードに同じグループ番号が設定されている場合には、設定されていないデータレコードにこの番号を設定し、データレコードテーブル11に保存する。
【0037】
(3)上記以外の場合には、小さい方の番号を決定後、グループ更新処理部23に移る。グループ更新処理部23では、まず、データレコードテーブル11から決定した小さい方の番号以外の番号をグループ番号としてもつ全データレコードを取り出し、決定した小さい方の番号を新しいグループ番号として設定する。
【0038】
次に、図1および図6のフローチャートを参照して本実施例の全体の動作について詳細に説明する。
まず最初に、未処理の関連レコードを取り出す。次に、関連レコードで関連づけられているN個のデータレコード1〜Nを取り出す(ステップA2)。ここで、全てのデータレコード1〜Nのグループ番号が設定されていない場合には(ステップA3)、新しい番号を取り出し(ステップA5)、その番号をデータレコード1〜Nのグループ番号として設定する(ステップA6)。グループ番号が設定されているデータレコードに全て同じグループ番号が設定されている場合には(ステップA4)、グループ番号が設定されていないデータレコードにこのグループ番号を設定する(ステップA7)。
【0039】
最後に、グループ番号が設定されているデータレコードに異なるグループ番号が設定されている場合には(ステップA4)、もっとも小さいグループ番号を決定し(ステップA8)、グループ番号が設定されていないデータレコードにこのグループ番号を設定する(ステップA9)。
次に、このもっとも小さいグループ番号以外のグループ番号を持つ全データレコードを取り出し(ステップA10)、このもっとも小さいグループ番号に基づいて、これらのデータレコードのグループ番号を更新する(ステップ11)。
【0040】
次に、ステップA10にて取り出した全データレコードについて、番号の更新が完了したか否かを判定し(ステップA12)、完了していなければ、ステップA11に戻り番号を更新する処理を繰り返す。このように、ステップA6,A7,A11の設定および更新が完了した場合は、関連レコードデータベースを検索し上記各グループ番号の設定および更新の処理について未処理の関連レコードが残っているか否かを判定する。すなわち、全関連レコードについての処理が終了したか否かを判定する(ステップA13)。そして、残っている場合はステップA1に戻り上述した処理を繰り返す。
【0041】
次に、具体例について説明する。
図7、8、9に示す例では、図7において処理前のデータレコード、および、関連レコードの内容を示している。最初の関連レコードでは、どちらのデータレコードもグループ番号を持たないため、新しいグループ番号1を生成し、このグループ番号をデータレコード1,2に設定している。2番目、および、3番目の関連レコードも、最初の関連レコード同様、どちらのデータレコードもグループ番号を持たないため、新しいグループ番号2,3を生成し、これらのグループ番号をそれぞれ、データレコード3,4および、データレコード6,8に設定している。
【0042】
4番目の関連レコードでは、一つのデータレコード4のみがグループ番号2を持っているため、その他のデータレコード9,10にも同じグループ番号2を設定している。ここまでの結果は図8に示されている。最後に、5番目の関連レコードでは、三つのデータレコードともグループ番号を持つため、もっとも小さいグループ番号1以外のグループ番号2,3を持つデータレコード3,4,6,8,9,10に、もっとも小さいグループ番号1を設定している。最終結果は図9に示されている。
【0043】
【発明の効果】
第1の効果は、無限に続く可能性がある関連レコードによる関連パスを走査することなしに、また、これらを効率的に行うために、主記憶装置内に関連する全データレコードを取り出すことなしに、処理できることにある。その理由は、データレコード上のグループ番号を直接更新しているためであり、また、(1)直接関連づけられている場合の処理、および(2)既に関連づけられており、グループ番号のマージを行う場合の処理、に分解し、間接的に関連づけられている場合でも、(1)および(2)の組み合わせで処理しているためである。
【0044】
第2の効果は、大量のデータレコード、および、関連レコードがある場合でも、高速にグループ番号の設定ができることになる。その理由は、グループ番号をデータレコードの一部として格納しているため、データベース・インデックスを置くことで、指定されたグループ番号を持つデータレコードを高速に検索できるためである。
【図面の簡単な説明】
【図1】本発明の一実施形態にかかるグループ番号設定装置のブロック図である。
【図2】第一の実施例の全体の動作を処理内容を示したフローチャートである。
【図3】第一の実施例における処理前のデータレコードテーブルおよび関連レコードテーブルの内容を示した図である。
【図4】第一の実施例における処理中のデータレコードテーブルおよび関連レコードテーブルの内容を示した図である。
【図5】第一の実施例における処理後のデータレコードテーブルおよび関連レコードテーブルの内容を示した図である。
【図6】第二の実施例の全体の動作を処理内容を示したフローチャートである。
【図7】第二の実施例における処理前のデータレコードテーブルおよび関連レコードテーブルの内容を示した図である。
【図8】第二の実施例における処理中のデータレコードテーブルおよび関連レコードテーブルの内容を示した図である。
【図9】第二の実施例における処理後のデータレコードテーブルおよび関連レコードテーブルの内容を示した図である。
【符号の説明】
1 記憶装置(データベース)
2 データ処理装置
11 データレコードテーブル
12 関連レコードテーブル
21 グループ設定処理部
22 グループ番号生成処理部
23 グループ更新処理部
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a group number setting device and a group number setting method, and more particularly to a group number setting device including a data record and a related record, and setting a group number in a data record based on the content of a newly added related record. And a group number setting method.
[0002]
[Prior art]
Conventionally, as this type of group number setting device, there is a technology disclosed in Japanese Patent Application Laid-Open No. 2-234269.
The present technology includes a data input unit that inputs data for each record, and a group that determines whether an input record belongs to the same group as a record input immediately before based on an item value of a grouping item. Identification means; two-term relation generating means for outputting a pair of item values of two consecutive records when it is determined that two consecutive records belong to the same group; Integrated appearance order updating means for creating and executing integrated appearance order information expressing the appearance order of consistent item values for all groups at any time, based on the integrated appearance order information after input of all data is completed. Item name order output means for outputting item name order information. In such a configuration, the order of appearance of the item values in all groups is generally consistent with the order of appearance of the item names.
Further, as a similar group number setting device, a technology disclosed in Japanese Patent Application Laid-Open No. 8-241228 is known.
[0003]
[Problems to be solved by the invention]
The conventional group number setting device described above has a problem that the processing speed is reduced when there are a large number of data records and related records. Further, in such a group number setting device, when a predetermined data record is deleted, if it is determined that the data record is not to be deleted, all data records related to this data record are deleted. Excluded processing is required.
[0004]
SUMMARY OF THE INVENTION The present invention has been made in view of the above problems, and makes it possible to realize a process for deleting the above-mentioned required predetermined data record, and to reduce a processing speed by using an index given to a database. It is an object of the present invention to provide a group number setting device and a group number setting method capable of realizing high speed.
[0005]
[Means for Solving the Problems]
To achieve the above object, the invention according to claim 1, and a relevant record table including the record having the data record table and a binary relation between data records table for managing each record in the group number in the database A group number setting device for setting a group number of the data record table, wherein related name reading means for sequentially reading related names stored in related records from a related record table having at least one or more related records; Specifying means for specifying two records including the relation name read in the data record table, and setting means for setting the group number of the specified data record by a newly generated group number in accordance with the reading order of the related record And a configuration that includes
[0006]
In the invention according to claim 1 configured as described above, in a system including a data record and its related record (binary relation), a group number is assigned to the data record based on the content of the newly added related record. Is realized. A group number setting device according to the present invention includes a data record table for managing each record by a group number, and a related record table having a record having a binary relation with the data record table. Set the number.
[0007]
In this setting, the related name reading means sequentially reads the related names stored in the related record from the related record table having at least one or more related records, and specifies the related name read from the data record table by the specifying means. Identify the two records containing the first name. Then, the setting means sets the group number of the specified data record to the newly generated group number in accordance with the reading order of the related records.
[0008]
According to a second aspect of the present invention, in the group number setting device according to the first aspect, the setting means sets the two records when the group numbers of the two records specified by the specifying means are not set. The same group number generated by the setting means is set as the group number.
In the invention according to claim 2 configured as described above, when the group numbers of the two records specified by the specifying unit are not set, the setting unit generates the two group numbers by the setting unit. Set the same group number.
[0009]
Further, according to a third aspect of the present invention, in the group number setting device according to any one of the first and second aspects, the setting means is configured to determine a group number of the two records specified by the specifying means. When only the group number of one record is set, the group number of the record is set to the other group number that is not set.
[0010]
In the invention according to claim 3 configured as described above, when only the group number of one record is set for the group numbers of the two records specified by the specifying means, the setting means Is set to the other group number that has not been set.
[0011]
Further, according to a fourth aspect of the present invention, in the group number setting device according to any one of the first to third aspects, the setting means is configured to determine a group number of the two records specified by the specifying means. When the group numbers of both records have already been set, these already set group numbers are compared with each other, and the group number of the smaller value is set as the group number of the record having the larger group number. is there.
[0012]
In the invention according to claim 4 configured as described above, if the group numbers of both records have already been set for the group numbers of the two records specified by the specifying means, the setting means The group numbers that have already been set are compared with each other, and a group number having a smaller value is determined. Then, the record number of the record having the record number that matches the group number that has been set to a large value in the comparison is updated and set to the small record number described above.
[0013]
Further, according to a fifth aspect of the present invention, in the group number setting device according to any one of the first to fourth aspects, the related record table is formed by a predetermined integer N with the data record table. The configuration has a term relation.
In the invention according to claim 5 configured as described above, the related record table and the data record table are formed to have an N-term relationship with a predetermined integer N.
[0014]
As described above, the method for setting the group number of the data record table is not necessarily provided with the data record table for managing each record by the group number and the related record table having the record having the binary relation with the data record table. It is easy to understand that the present invention does not need to be limited to a tangible device and also functions as a method.
[0015]
Therefore, the invention according to claim 6, and a related record table including the record having the data record table and a binary relation between data records table for managing each record in the group number on the database, the data record A group number setting method for setting a group number of a table, comprising: a related name reading step of sequentially reading related names stored in related records from a related record table having at least one or more related records; And a setting step of setting the group number of the specified data record by a newly generated group number in accordance with the reading order of the related record. There is a configuration.
In other words, there is no difference that the present invention is not necessarily limited to a substantial device and is effective as a method.
[0016]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, an embodiment of the present invention will be described with reference to the drawings.
FIG. 1 is a block diagram showing a group number setting device according to an embodiment of the present invention.
Here, in a system including a data record table and its related record table (binary relation), the group number setting device according to the present embodiment assigns a group number to the data record table based on the content of a newly added related record. This implements a setting method.
[0017]
As shown in FIG. 1, the group number setting device of the present embodiment has a storage device (database) 10 and a data processing device 20, and the storage device 10 stores a data record table 11 and a related record table 12 The data processing device 20 includes a group number generation processing unit 22 and a group update processing unit 23.
[0018]
Here, the group setting processing unit 21 sets a group number in the corresponding data record table 11 based on the contents of the related record table 12. However, even if the data records are not directly related to each other in the related record table, they may be indirectly related through other related records. To set the same group number.
[0019]
Also, when a different group number has already been set, it is necessary to merge the group numbers. Here, these association processes are decomposed into (1) a process in a case where they are directly associated, and (2) a process in which a group number is already associated and a group number is merged, and are indirectly associated. Even in this case, the processing is executed by a combination of (1) and (2).
[0020]
In merging group numbers, two different group numbers are merged into one group number.In this case, the group number of all data records having one group number is changed to the other group number. Become. Since the database index is set in the group number column in the data record, the data record having the specified group number is searched at high speed.
[0021]
For example, regarding data records 1 to 4, data record 1 and data record 2 are related to related record 1, data record 3 and data record 4 are related to related record 2, and data record 2 and data record 3 are related to related record 3. Suppose you have In this case, it is necessary to set the same group number for all of the data records 1 to 4. The related record 1 and the related record 2 perform (1) a process in a case where they are directly related, and the related record 3 performs a process in a case where a group number is merged. Can be set to the same group number.
[0022]
In this way, it is possible to set the same group number for all related data records, even if they are not directly related.
Here, it is based on the following premise.
(1) Data records that are not related at all need not hold the group number.
(2) Related records are not deleted.
[0023]
In FIG. 1, a group setting processing unit 21 extracts a newly added related record from the related record table 12 and extracts a corresponding data record from the data record table 11. Since the related record holds a binary relation with respect to the data record, two corresponding data records are extracted.
[0024]
Depending on whether or not the group numbers are set in the two retrieved data records, the subsequent processing is divided into the following three cases.
(1) If a group number is not set in either data record, a new number is extracted from the group number generation processing unit 22, this group number is set in both data records, and stored in the data record table 11. I do. The group number generation processing unit 22 holds the next group number and increments each time one is returned.
[0025]
(2) If a group number is set in one of the data records, this number is set in the data record that has not been set, and is stored in the data record table 11.
[0026]
(3) When a group number is set in both data records, the two group numbers are classified into a larger group and a smaller group number, and the process proceeds to the group update processing unit 23. The group update processing unit 23 first extracts all data records having the larger number as the group number from the data record table 11, and sets the smaller number as a new group number.
Here, as described above, in the present embodiment, the group setting processing unit 21 constitutes the related name reading unit and the specifying unit according to the present invention, and the group update processing unit 23, the group number generation processing unit 22, and the group setting processing unit The processing unit 21 forms a setting unit.
[0027]
Next, the overall operation of this embodiment will be described in detail with reference to the block diagram of FIG. 1 and the flowchart of FIG.
First, an unprocessed related record is extracted. Next, two data records 1 and 2 related by the related record are extracted (step A2). If the group numbers of the data records 1 and 2 have not been set (steps A3 and A4), a new number is extracted (step A6), and the number is set as the group number of the data records 1 and 2 (step A6). Step A7).
[0028]
If the group number is not set for data record 1 (step A3), but the group number is set for data record 2 (step A4), the group number of data record 2 is set for data record 1. (Step A8).
[0029]
On the other hand, if the group number is set for data record 1 (step A3), but the group number is not set for data record 2 (step A5), the group number of data record 1 is set for data record 2. (Step A9). Finally, if the group numbers are set for both data records 1 and 2 (steps A3 and A5), the smaller group number is determined (step A10), and the larger group number of the two group numbers is set. All data records having numbers are extracted (step A11), and the group numbers of these data records are updated based on the smaller group number (step A12).
[0030]
Next, it is determined whether the update of the numbers has been completed for all the data records retrieved in step A11 (step A13). If not completed, the process returns to step S12 to repeat the process of updating the numbers. As described above, when the setting and updating of steps A7, A8, A9, and A12 are completed, the related record database is searched to determine whether or not there is an unprocessed related record for the setting and updating of each group number. That is, it is determined whether or not the processing has been completed for all the related records (step A14). If there is any remaining, the process returns to step A1 to repeat the above-described processing.
[0031]
Next, a description will be given using a specific example.
In the examples shown in FIGS. 3, 4, and 5, the contents of the data record and the related record before processing are shown in FIG. In the first related record, since neither data record has a group number, a new group number 1 is generated, and this group number is set in the data records 1 and 2. Since the second and third related records have no group number as well as the first related record, new group numbers 2 and 3 are generated, and these group numbers are respectively assigned to data record 3 , 4 and data records 6 and 8.
[0032]
In the fourth related record, since only one of the data records 4 has the group number 2, the same group number 2 is set in the other data record 10. In the fifth related record, similarly to the first to third related records, since neither data record has a group number, a new group number 4 is generated, and this group number is set in the data records 5 and 9. I have. The results so far are shown in FIG. Finally, in the sixth related record, since both data records have a group number, the smaller group number 1 is set to the data records 3, 4, and 10 having the larger number 2. The end result is shown in FIG.
[0033]
Next, another embodiment of the present invention will be described in detail with reference to the drawings.
This embodiment is different in that the related record holds the relation between N data records. Since the configuration of the embodiment is the same as that of FIG. 1, the description will be made using FIG. 1 as it is.
Here, it is based on the following premise.
(1) Data records that are not related at all need not hold the group number.
(2) Related records are not deleted.
(3) In each related record, it is not necessary to always maintain the same number of relations. For example, one record holds a relation between three data records, and another book holds a relation between five data records. It is possible.
[0034]
In FIG. 1, a group setting processing unit 21 extracts a newly added related record from the related record table 12 and extracts a corresponding data record from the data record table 11. Here, since the related record holds the N-term relation with respect to the data record, N corresponding data records are extracted. The subsequent processing is divided into the following three depending on whether or not the group numbers are set in the extracted N data records.
[0035]
(1) If no group number has been set for any data record, a new number is taken out from the group number generation processing unit 22 and this group number is set for all N data records. save. The group number generation processing unit 22 holds the next group number and increments each time one is returned.
[0036]
(2) If the same group number is set for all data records for which a group number has been set, this number is set for the data record for which no group number has been set, and stored in the data record table 11.
[0037]
(3) In cases other than the above, after the smaller number is determined, the process proceeds to the group update processing unit 23. The group update processing unit 23 first retrieves all data records having a group number other than the determined smaller number from the data record table 11 and sets the determined smaller number as a new group number.
[0038]
Next, the overall operation of the present embodiment will be described in detail with reference to the flowcharts of FIGS.
First, an unprocessed related record is extracted. Next, N data records 1 to N associated with the related record are extracted (step A2). If the group numbers of all the data records 1 to N have not been set (step A3), a new number is extracted (step A5), and the number is set as the group number of the data records 1 to N (step A5). Step A6). If the same group number is set for all data records to which a group number is set (step A4), the group number is set to a data record for which no group number is set (step A7).
[0039]
Finally, if a different group number is set in the data record in which the group number is set (step A4), the smallest group number is determined (step A8), and the data record in which the group number is not set is determined. Is set to this group number (step A9).
Next, all data records having group numbers other than the smallest group number are extracted (step A10), and the group numbers of these data records are updated based on the smallest group number (step 11).
[0040]
Next, it is determined whether or not the update of the numbers has been completed for all the data records retrieved in step A10 (step A12). If not completed, the process returns to step A11 to repeat the process of updating the numbers. As described above, when the setting and updating of steps A6, A7, and A11 are completed, the related record database is searched to determine whether or not there is an unprocessed related record for the setting and updating of each group number. I do. That is, it is determined whether or not the processing has been completed for all the related records (step A13). If there is any remaining, the process returns to step A1 to repeat the above-described processing.
[0041]
Next, a specific example will be described.
In the examples shown in FIGS. 7, 8, and 9, the contents of the data records and the related records before processing are shown in FIG. In the first related record, since neither data record has a group number, a new group number 1 is generated, and this group number is set in the data records 1 and 2. Since the second and third related records have no group number as well as the first related record, new group numbers 2 and 3 are generated, and these group numbers are respectively assigned to data record 3 , 4 and data records 6 and 8.
[0042]
In the fourth related record, since only one data record 4 has the group number 2, the same group number 2 is set in the other data records 9 and 10. The results so far are shown in FIG. Finally, in the fifth related record, since all three data records have group numbers, data records 3, 4, 6, 8, 9, and 10 having group numbers 2 and 3 other than the smallest group number 1 The smallest group number 1 is set. The end result is shown in FIG.
[0043]
【The invention's effect】
The first effect is that without having to traverse the associated path with potentially infinitely related records, and to retrieve them all, without retrieving all relevant data records in main storage. In addition, it can be processed. The reason is that the group number on the data record is directly updated, and (1) the processing when directly related, and (2) the group number already related and merged. This is because, even when the processing is decomposed into and indirectly related, the processing is performed by a combination of (1) and (2).
[0044]
The second effect is that the group number can be set at high speed even when there are a large number of data records and related records. The reason is that, since the group number is stored as a part of the data record, the data index having the designated group number can be searched at high speed by placing the database index.
[Brief description of the drawings]
FIG. 1 is a block diagram of a group number setting device according to an embodiment of the present invention.
FIG. 2 is a flowchart showing processing contents of the entire operation of the first embodiment.
FIG. 3 is a diagram showing contents of a data record table and a related record table before processing in the first embodiment.
FIG. 4 is a diagram showing the contents of a data record table and a related record table during processing in the first embodiment.
FIG. 5 is a diagram showing contents of a data record table and a related record table after processing in the first embodiment.
FIG. 6 is a flowchart showing the processing contents of the entire operation of the second embodiment.
FIG. 7 is a diagram showing contents of a data record table and a related record table before processing according to the second embodiment.
FIG. 8 is a diagram showing the contents of a data record table and a related record table during processing in the second embodiment.
FIG. 9 is a diagram showing the contents of a data record table and a related record table after processing in the second embodiment.
[Explanation of symbols]
1 storage device (database)
2 Data processing device 11 Data record table 12 Related record table 21 Group setting processing unit 22 Group number generation processing unit 23 Group update processing unit

Claims (6)

各レコードをグループ番号で管理するデータレコードテーブルと、このデータレコードテーブルと二項関係を有するレコードを有する関連レコードテーブルとをデータベース上に備え、上記データレコードテーブルのグループ番号を設定するグループ番号設定装置であって、
少なくとも1つ以上の関連レコードを有する関連レコードテーブルから順次関連レコードに格納された関連名を読み出す関連名読出手段と、
上記データレコードテーブルにて読み出された関連名を含む二つのレコードを特定する特定手段と、
上記特定されたデータレコードのグループ番号を上記関連レコードの読み出し順に従って新しく生成したグループ番号によって設定する設定手段とを具備することを特徴とするグループ番号設定装置。
A group number setting device that has a data record table that manages each record by a group number and a related record table that has a record having a binary relation with the data record table on a database, and sets a group number of the data record table And
Related name reading means for sequentially reading related names stored in related records from a related record table having at least one or more related records;
Specifying means for specifying two records including the related name read in the data record table,
Setting means for setting the group number of the specified data record by a newly generated group number in accordance with the reading order of the related records.
上記請求項1に記載のグループ番号設定装置において、
上記設定手段は、上記特定手段にて特定された二つのレコードのグループ番号が未設定の場合、この二つのグループ番号に、上記設定手段にて生成した同一のグループ番号を設定することを特徴とするグループ番号設定装置。
The group number setting device according to claim 1,
The setting means, when the group numbers of the two records specified by the specifying means are not set, sets the same group number generated by the setting means to the two group numbers. Group number setting device.
上記請求項1または請求項2のいずれかに記載のグループ番号設定装置において、
上記設定手段は、上記特定手段にて特定された二つのレコードのグループ番号について、一方のレコードのグループ番号のみが設定されている場合、当該レコードのグループ番号を設定されていない他方のグループ番号に設定することを特徴とするグループ番号設定装置。
In the group number setting device according to any one of claims 1 and 2,
The setting means, when only the group number of one record is set for the group numbers of the two records specified by the specifying means, sets the group number of the record to the other group number not set. A group number setting device for setting.
上記請求項1〜請求項3のいずれかに記載のグループ番号設定装置において、
上記設定手段は、上記特定手段にて特定された二つのレコードのグループ番号について、既に両方のレコードのグループ番号が設定されている場合、これらの既に設定されているグループ番号どうしを比較し、小さい値のグループ番号を大きい値のグループ番号を有するレコードのグループ番号として設定することを特徴とするグループ番号設定装置。
In the group number setting device according to any one of claims 1 to 3,
The setting means, for the group numbers of the two records specified by the specifying means, when the group numbers of both records are already set, compares these already set group numbers, and A group number setting device for setting a value group number as a group number of a record having a large value group number.
上記請求項1〜請求項4のいずれかに記載のグループ番号設定装置において、
上記関連レコードテーブルは、上記データレコードテーブルと所定の整数Nにて形成されるN項関係を有することを特徴とするグループ番号設定装置。
In the group number setting device according to any one of claims 1 to 4,
The group number setting device, wherein the related record table has an N-term relation formed by the data record table and a predetermined integer N.
各レコードをグループ番号にて管理するデータレコードテーブルとこのデータレコードテーブルと二項関係を有するレコードを有する関連レコードテーブルとをデータベース上に備え、上記データレコードテーブルのグループ番号を設定するグループ番号設定方法であって、
少なくとも1つ以上の関連レコードを有する関連レコードテーブルから順次関連レコードに格納された関連名を読み出す関連名読出工程と、
上記データレコードテーブルにて読み出された関連名を含む二つのレコードを特定する特定工程と、
上記特定されたデータレコードのグループ番号を上記関連レコードの読み出し順に従って新しく生成したグループ番号によって設定する設定工程とを具備することを特徴とするグループ番号設定方法。
A group number setting method in which a database is provided with a data record table for managing each record by a group number and a related record table having a record having a binary relation with the data record table, and setting a group number of the data record table And
A related name reading step of sequentially reading related names stored in related records from a related record table having at least one or more related records;
A specifying step of specifying two records including the related name read in the data record table,
Setting a group number of the specified data record by a newly generated group number in accordance with the reading order of the related records.
JP2000064030A 2000-03-08 2000-03-08 Group number setting device and group number setting method Expired - Fee Related JP3555542B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2000064030A JP3555542B2 (en) 2000-03-08 2000-03-08 Group number setting device and group number setting method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2000064030A JP3555542B2 (en) 2000-03-08 2000-03-08 Group number setting device and group number setting method

Publications (2)

Publication Number Publication Date
JP2001256249A JP2001256249A (en) 2001-09-21
JP3555542B2 true JP3555542B2 (en) 2004-08-18

Family

ID=18583798

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2000064030A Expired - Fee Related JP3555542B2 (en) 2000-03-08 2000-03-08 Group number setting device and group number setting method

Country Status (1)

Country Link
JP (1) JP3555542B2 (en)

Also Published As

Publication number Publication date
JP2001256249A (en) 2001-09-21

Similar Documents

Publication Publication Date Title
US6484181B2 (en) Method and system for handling foreign key update in an object-oriented database environment
JP2014197425A (en) Method of managing storage of individually accessible data units
US20120158793A1 (en) Automatic Elimination Of Functional Dependencies Between Columns
JP3555542B2 (en) Group number setting device and group number setting method
JP4562749B2 (en) Document compression storage method and apparatus
JP3649472B2 (en) Information retrieval device
JP2002140218A (en) Data processing method, computer-readable recording medium and data processing device
JPH07152615A (en) Data base reorganization system
JP2003157249A (en) Document compressing and storing method
JPH1011338A (en) Relational database system, method for storing and reading data in it and recording medium for recording program for it
JP2596332B2 (en) Data combination extraction method and apparatus
JPH04139546A (en) Relational data base device
JPH035886A (en) Relational data base computing system
JPH10301942A (en) Data mining device
JPH02190970A (en) Index structure and search processing method using the structure
JP2001155028A (en) Aggregate calculation processing method and device for relational database, and computer readable recording medium recorded with aggregate arithmetic processing program
JP2001273178A (en) Method and system for controlling database
JPH05120338A (en) Index retrieving system
JP2002183142A (en) Device and method for storing data, and computer- readable recording medium with recorded program making computer to implement data storing method
JPH11212838A (en) System and method for change record history management by table split
JPH0962553A (en) Journal output system
JPH02302869A (en) File edition system
JPH05165891A (en) Data registration/retrieval system of data base
JPH07210570A (en) Directed graph editing processor
JPH04137035A (en) Software design structure storage device

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20040106

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20040305

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20040420

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20040503

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees