JP3719125B2 - Data storage apparatus and method - Google Patents

Data storage apparatus and method Download PDF

Info

Publication number
JP3719125B2
JP3719125B2 JP2000311114A JP2000311114A JP3719125B2 JP 3719125 B2 JP3719125 B2 JP 3719125B2 JP 2000311114 A JP2000311114 A JP 2000311114A JP 2000311114 A JP2000311114 A JP 2000311114A JP 3719125 B2 JP3719125 B2 JP 3719125B2
Authority
JP
Japan
Prior art keywords
data
xml data
xml
child
stored
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
JP2000311114A
Other languages
Japanese (ja)
Other versions
JP2002117020A (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 JP2000311114A priority Critical patent/JP3719125B2/en
Publication of JP2002117020A publication Critical patent/JP2002117020A/en
Application granted granted Critical
Publication of JP3719125B2 publication Critical patent/JP3719125B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Document Processing Apparatus (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Description

【0001】
【発明の属する技術分野】
本発明は、要素(タグ)の入れ子構造、繰り返し、再帰的構造を含むXML(Extensible Markup Language)文書をテーブル形式のデータベースに格納する際に用いて好適なデータ格納装置及び方法に関する。
【0002】
【従来の技術】
XML(eXtensible Markup Language;拡張可能なマーク付け言語)は、W3C(World Wide Web Consortium)で標準化が進められているWeb上で構造化文書をやりとりするためのデータフォーマットである。XMLは、SGML(Standard Generalized Markup Language)[ISO 8879]の利用を前提とし、そのサブセットとして設計されている。XML文書は、ルートと呼ばれる文書実体から始まり、それぞれマーク付けされ、かつ入れ子構造を有している宣言、要素、コメント、文字参照および処理命令を含んでいる。各文書は一つ以上の要素を含み、各文書にはルートまたは文書要素という要素が一つだけ存在し、これは他の要素の内容に含まれない。各要素は、開始タグと終了タグで区切られ、入れ子構造をなしている。すべての要素は、その開始タグが他の要素の内容に含まれれば、対応する終了タグも同じ要素の内容に含まれる。また、要素Bが要素Aの内容に含まれ、かつ要素Aの内容に含まれる他の要素に含まれないとき、要素Aを要素Bの親といい、要素Bを要素Aの子という。
【0003】
図18を参照して、XML文書を構成するデータ(以下、XMLデータ)をテーブル形式のデータベースに格納するためのXMLデータ格納方式について説明する。図18において、データ格納手段401は、XMLデータ421の内容を解析し、XMLデータ421内に含まれる各要素を抽出してデータベース402内のテーブル422に格納する。XMLデータ421が図19に示すような内容を有している場合を例にして、図18に示すデータ格納手段401の動作について説明する。この場合、XMLデータ421は1つのルート要素421aを持ち、要素421aの子要素として、次の1つ下位の階層に要素421b(421b1,421b2)の繰り返しを持っている。各要素421b1,421b2は、要素421c,d,eからなる同じ子要素の列をそれぞれ含んでいる。データ格納手段401はXMLデータ421を入力として受け取り、要素412aの各子要素412b1,412b2をテーブル422の行B01,B02に対応させて格納する。また各子要素412b1,412b2の子要素412c〜eを各行の列C,D,Eに対応させて格納する。テーブル422の例を図20に示す。
【0004】
【発明が解決しようとする課題】
上述したような従来技術には、次のような問題点があった。第1の問題点は、要素421aの子要素421b1,2の子要素421c〜eがさらに子要素を持つ場合にテーブルの列に対応させて格納することができないということである。その理由は、テーブルの列が要素421aの子要素421b1,2の子要素421c〜eに対応しているためである。第2の問題点は、要素421aの子要素421b1,2の内部に繰り返しを持つ場合にテーブルに格納することができないということである。その理由は、テーブルの行が表現する繰り返しが要素421aの子要素にだけ対応しているためである。第3の問題点は、再帰的なタグ構造をテーブルに格納できないということである。その理由は、テーブルが再帰的なデータ構造をそのまま格納できないためである。
【0005】
本発明は、従来の構成では対応できなかった、3階層以上の要素(タグ)の入れ子構造、繰り返し、または再帰的構造を含むXML文書を、テーブル形式のデータベースに格納することができるようにするデータ格納装置及び方法を提供することを目的とする。
【0006】
【課題を解決するための手段】
上記課題を解決するため、請求項1記載の発明は、XML(eXtensible Markup Language)データを表形式のデータに変換して所定の記憶手段に格納するデータ格納装置において、入力された第1のXMLデータ( 221 )の内部の繰り返し要素であってルート要素Aの子要素Bでない要素Fを分離し、要素Fが取り除かれた第2のXMLデータ( 222 )と、新たなXMLデータに要素Fを追加した第3のXMLデータ( 223 )とを作成する第1のデータ変換手段( 202 )と、第2のXMLデータ( 222 )の内部の再帰になっている要素Dを分離し、要素Dが取り除かれた第4のXMLデータ( 224 )と、新たなXMLデータに要素Dを追加した第5のXMLデータ( 225 )とを作成する第2のデータ変換手段( 203 )と、第4のXMLデータ( 224 )の内部の3レベル以上入れ子になっている要素Eをルート要素Aの子要素Bの子要素として移動して第6のXMLデータ( 226 )を作成する第3のデータ変換手段( 204 )と、第6のXMLデータ( 226 )を第1のテーブルに格納し、第5のXMLデータ( 225 )を第2のテーブルに格納し、第3のXMLデータ( 223 )を第3のテーブルに格納するデータ格納手段( 205 )とを備えることを特徴とする。
【0007】
請求項2記載の発明は、XML (eXtensible Markup Language )データを表形式のデータに変換して所定の記憶手段に格納するデータ格納装置において、入力されたXMLデータ( 321 )の内部の繰り返し要素である要素Cと文字列を分離し、新たなXMLデータにルート要素Aの子要素Bとその要素としての要素Cと文字列を、要素Bの順序位置を示す要素IDとともに追加したXMLデータ( 323 )を作成するデータ変換手段( 302 )と、XMLデータ( 323 )をテーブルに格納し、かつその際、要素Cと文字列を要素IDともに格納するデータ格納手段( 303 )とを備えることを特徴とする。
【0008】
請求項3記載の発明は、XML (eXtensible Markup Language )データを表形式のデータに変換して所定の記憶手段に格納するデータ格納方法において、入力された第1のXMLデータ( 221 )の内部の繰り返し要素であってルート要素Aの子要素Bでない要素Fを分離し、要素Fが取り除かれた第2のXMLデータ( 222 )と、新規のXMLデータに要素Fを追加した第3のXMLデータ( 223 )とを作成する第1のデータ変換過程と、第2のXMLデータ( 222 )の内部の再帰になっている要素Dを分離し、要素Dが取り除かれた第4のXMLデータ( 224 )と、新規のXMLデータに要素Dを追加した第5のXMLデータ( 225 )とを作成する第2のデータ変換過程と、第4のXMLデータ( 224 )の内部の3レベル以上入れ子になっている要素Eをルート要素Aの子要素Bの子要素として移動して第6のXMLデータ( 226 )を作成する第3のデータ変換過程と、第6のXMLデータ( 226 )を第1のテーブルに格納し、第5のXMLデータ( 225 )を第2のテーブルに格納し、第3のXMLデータ( 223 )を第3のテーブルに格納するデータ格納過程とを含んでいることを特徴とする。
【0009】
【発明の実施の形態】
以下、図面を参照して本発明によるデータ格納装置の実施形態について説明する。
【0010】
図1は、本発明によるデータ格納装置の一実施形態を説明するためのブロック図である。図1において、データ変換手段111はXMLデータ101から文書型定義上ルート要素の子要素以外に繰り返しのある部分を分離し、分離した部分を除いたXMLデータ102と、分離した部分を新規のルート要素の下に同じ要素が繰り返しになるように配置することで作成されたXMLデータ103およびその他のXMLデータとする。データ変換手段112はXMLデータ102から文書定義上再帰的な構造になっている部分を分離し、分離した部分を再帰的に現れる要素がルート要素の子要素の繰り返し形式となるように変換することで作成したXMLデータ105およびその他のXMLデータと、分離した部分を除いたXMLデータ104とする。XMLデータ103等、データ変換手段111のその他の出力XMLデータもXMLデータ102と同様の変換を行う。データ変換手段113はXMLデータ104の文書定義上3レベル以上の要素の入れ子になっている要素をルート要素の子要素の子要素とする形式に変換しXMLデータ106とする。XMLデータ105等、データ変換手段112のその他の出力XMLデータについても同様に変換を行う。データ変換手段111〜113の変換によりXMLデータ101はルート要素の子要素としてそれぞれ同じ要素の繰り返しを持ち子要素の内部に同じ要素の列を持つXMLデータ106およびその他のXMLデータに変換される。データ更新手段114はこれらのXMLデータのルート要素の子要素の子要素をテーブルの列に対応付けることによってXMLデータをデータベース121のテーブルに格納する。このようにして、3レベル以上のタグの入れ子構造、繰り返し、再帰的タグ構造を含むXML文書をテーブル形式のデータベースに格納することを可能にする。
【0011】
次に、図2を参照して本発明によるデータ格納装置の他の実施形態について説明する。図2を参照すると、本発明のXMLデータ格納装置の一実施形態は、XMLデータ入力手段201と、データ変換手段202と、データ変換手段203と、データ変換手段204と、データ格納手段205と、データベース211から構成されている。XMLデータ221の例を図3に示す。XMLデータ221はルート要素A(開始タグ:<A>、終了タグ:</A>;以下同様。ただし図面では開始タグに参照符号の引き出し線を付けている。)から構成されている。要素Aは要素B(B01,B02)の繰り返しで構成されている。要素B01は要素C(C01)と、要素D(D01,D02)から構成されている。要素B02は要素C(C02)と、要素D(D03)から構成されている。要素C01は1つの要素E(E01)と、要素F(F01,F02)の繰り返しから構成されている。要素C02は1つの要素E(E02)と、要素F(F03)から構成されている。要素D01は1つの要素G(G01)と1個の要素D(D02)から構成されている。要素D03は1つの要素G(G03)から構成されている。要素F(F01,F02,F03)はそれぞれ要素Iと要素Jから構成されている。要素E、要素G、要素I、要素Jは文字列から構成されている。
【0012】
上記各手段はそれぞれ概略つぎのように動作する。データ入力手段201は、XMLデータ221を入力しデータ変換手段202へ渡す。データ変換手段202は、XMLデータ221の内部の繰り返し要素である要素F(F01,F02)を分離しXMLデータ222とXMLデータ223とする。要素B(B01,B02)も繰り返しになっているが、ルート要素Aの子要素なので変換しない。データ変換手段203は、XMLデータ222の内部の再帰になっている要素D(D01,D02)を分離しXMLデータ224とXMLデータ225とする。データ変換手段204は、XMLデータ224の内部の3レベル以上入れ子になっている要素Eをルート要素Aの子要素Bの子要素として移動しXMLデータ226とする。データ格納手段205は、XMLデータ226をテーブルAに格納する。このとき要素Eの内容を列Eに格納する。XMLデータ225をテーブルYに格納する。このとき要素Gの内容を列Gに格納する。XMLデータ223をテーブルXに格納する。このとき要素Iの内容を列Iに、要素Jの内容を列Jに格納する。
【0013】
[実施形態の動作の説明]
次に、図4、図5、図6、図7のフローチャートを参照して本実施形態の全体の動作について詳細に説明する。
【0014】
XMLデータ221をデータ変換手段202へ入力する。要素Xをルート要素とする新しいXMLデータ223を生成する(図4のステップA101)。ここでXは変数である。XMLデータ221に要素Bがなければ終わり(ステップA102)、要素Bがあれば最初の要素Bを要素B1とする(ステップA103)。ここで、BおよびB1は変数を示す。次に、要素B1に要素Fがなければ終わり(ステップA104)、要素B1に要素Fがあれば要素B1の最初の要素FをF1とする(ステップA105)。ここでFおよびF1は変数である。要素F1を要素B1から取り除き要素Xに追加する(ステップA106)。要素B1に次の要素FがあればステップA108へ、なければステップA109へ進む(ステップA107)。ステップA108では次の要素FをF1として、ステップA106へ戻る。ステップA109では、次の要素BがあればステップA110へ、なければ終わる。ステップA110では、次の要素BをB1として、ステップA104へ戻る。終了時には総ての要素Fが取り除かれたXMLデータ221をXMLデータ222とする。
【0015】
データ変換手段203はデータ変換手段202からXMLデータ222を入力する。要素Yをルート要素とする新しいXMLデータ225を生成する(図5のステップA201)。ここでYは変数である。XMLデータ222に要素Bがなければ終わり(ステップA202)、要素Bがあれば最初の要素Bを要素B1とする(ステップA203)。次に要素B1の子要素の要素DをD1とする(ステップA204)。ここでDおよびD1は変数である。次に要素D1を親要素から取り除き要素Yの子要素として追加する(ステップA205)。要素D1の子要素に要素DがあればステップA207へ、なければステップA208へ進む(ステップA206)。ステップA207では子要素DをD1としてステップA205へ戻る。ステップA208では次の要素BがあればステップA209へ、なければ終わる。ステップA209では次の要素BをB1としてステップA204へ戻る。終了時には総ての要素Dが取り除かれたXMLデータ222をXMLデータ224とする。
【0016】
データ変換手段204はデータ変換手段203からXMLデータ224を入力する。XMLデータ224に要素Bがなければ終わり(図6のステップA301)、要素Bがあれば最初の要素Bを要素B1とする(ステップA302)。要素B1の子要素Cの子要素Eを要素Cから取り除き、要素B1の子要素として追加する(ステップA303)。ここでC,Eは変数である。要素B1から要素Cを削除する(ステップA304)。次の要素BがあればステップA306へ、なければ終わる(ステップA305)。ステップA306では次の要素BをB1としてステップA303へ戻る。終了時には総ての要素C、要素Eの変換が行われたXMLデータ224をXMLデータ226とする。
【0017】
データ格納手段205は、データ変換手段204からXMLデータ226を、データ変換手段203からXMLデータ225を、データ変換手段203からXMLデータ223を入力する。XMLデータ226に要素BがなければステップA407へ進む(図7のステップA401)。XMLデータ226に要素BがあればXMLデータ226の最初の要素Bを要素B1とする(ステップA402)。次にテーブルAに行A1を追加する(ステップA403)。ここでA1は変数である。次に要素B1の子要素Eの内容を行A1の列Eに格納する(ステップA404)。次の要素BがあればステップA406へ、なければステップA407へ進む(ステップA405)。ステップA406では次の要素BをB1とし、ステップA403へ戻る。ステップA407では、XMLデータ225に要素DがなければステップA413へ進み、要素DがあればステップA408へ進む。ステップA408ではXMLデータ225の最初の要素Dを要素D1とする。テーブルYに行Y1を追加する(ステップA409)。ここでY1は変数である。次に要素D1の子要素Gの内容を行Y1の列Gに格納する(ステップA410)。ここでGは変数である。次の要素DがあればステップA412へ、なければステップA413へ進む(ステップA411)。ステップA412では次の要素DをD1としてステップA409へ戻る。ステップA413ではXMLデータ223に要素Fがなければ終わり、要素FがあればステップA414へ進む。ステップA414では、XMLデータ223の最初の要素Fを要素F1とする。テーブルXに行X1を追加する(ステップA415)。次に要素F1の子要素Iの内容を行X1の列Iに格納する(ステップA416)。ここでX1,Iは変数である。次に要素F1の子要素Jの内容を行X1の列Jに格納する(ステップA417)。ここでJは変数である。次に、次の要素FがあればステップA419へ、なければ終了する(ステップA418)。ステップA419では次の要素FをF1としてステップA415へ戻る。以上で処理が終了する。
【0018】
次に、図3に示すXMLデータ221を入力する場合の具体例を用いて説明する。XMLデータ221をデータ変換手段202へ入力する。データ変換手段202では、要素Xをルート要素とする新しいXMLデータ223を生成する(図4のステップA101)(図8(a)参照)。図3に示すXMLデータ221の最初の要素B、要素B01を取り出す(ステップA103)。要素B01の最初の要素F、要素F01取り出す(ステップA105)。F01をB01から取り除き要素Xに追加する(ステップA106)(図8(b)(図8の右上))。要素B01の次の要素F、要素F02を取り出す(ステップA108)。F02をB01から取り除き要素Xに追加する(ステップA106)(図8(c))。次の要素B、要素B02を取り出す(ステップA110)。要素B02の最初の要素F、要素F03取り出す(ステップA105)。F03をB02から取り除き要素Xに追加する(ステップA106)(図8(d))。総ての要素Fが取り除かれたXMLデータ221をXMLデータ222(図8(e))とする。
【0019】
データ変換手段203はデータ変換手段202から図8(e)に示すXMLデータ222を入力する。要素Yをルート要素とする新しいXMLデータ225を生成する(図5のステップA201)(図9(a))。図8(e)のXMLデータ222の最初の要素B、要素B01を取り出す(ステップA203)。要素B01の子要素の要素D、要素D01を取り出す(ステップA204)。D01をB01から取り除き要素Yの子要素として追加する(ステップA205)(図9(b)(図9の右上))。要素D01の子要素の要素D、要素D02を取り出す(ステップA207)。D02をD01から取り除き要素Yの子要素として追加する(ステップA205)(図9(c))。次の要素B、要素B02を取り出す(ステップA209)。要素B02の子要素の要素D、要素D03をB02から取り除き要素Yの子要素として追加する(ステップA205)(図9(d))。総ての要素Dが取り除かれたXMLデータ222をXMLデータ224とする(図9(e))。
【0020】
データ変換手段204はデータ変換手段203から図9(e)に示すXMLデータ224を入力する。XMLデータ224の最初の要素B、要素B01を取り出す(ステップA302)。要素B01の子要素C(C01)の子要素E(E01)を要素Cから取り除き要素B01の子要素として追加する(ステップA303)(図10(a))。要素B01から要素Cを削除する(ステップA304)(図10(b))。次の要素B、要素B02を取り出す(ステップA306)。要素B02の子要素C(C02)の子要素E(E02)を要素Cから取り除き要素B02の子要素として追加する(ステップA303)(図10(c))。要素B02から要素Cを削除する(ステップA304)(図10(d))。総ての要素C、要素Eの変換が行われたXMLデータ224をXMLデータ226とする(図10(e))。
【0021】
データデータ格納手段205は変換手段204から図10(e)に示すXMLデータ226を、データ変換手段203から図9(d)に示すXMLデータ225を、データ変換手段203から図8(d)に示すXMLデータ223を入力する。XMLデータ226の最初の要素B、要素B01を取り出す(図7のステップA402)。テーブルAに行A01を追加する(ステップA403)(図11(a))。要素B01の子要素Eの内容を行A1の列Eに格納する(ステップA404)(図11(b))。次の要素B、要素B02を取り出す(ステップA406)。テーブルAに行A02を追加する(ステップA403)(図11(c))。要素B02の子要素Eの内容を行A2の列Eに格納する(ステップA404)(図11(d))。XMLデータ225の最初の要素D、要素D01を取り出す(ステップA408)。テーブルYに行Y01を追加する(ステップA409)(図11(e))。XMLデータ225の要素D01の子要素Gの内容を行Y01の列Gに格納する(ステップA410)(図11(f))。次の要素D、要素D02を取り出す(ステップA412)。テーブルYに行Y02を追加する(ステップA409)。要素D02の子要素Gの内容を行Y02の列Gに格納する(ステップA410)。次の要素D、要素D03を取り出す。テーブルYに行Y03を追加する(ステップA409)。要素D03の子要素Gの内容を行Y03の列Gに格納する(ステップA410)(図11(g))。XMLデータ223の最初の要素F、要素F01を取り出す(ステップA414)。テーブルXに行X01を追加する(ステップA415)(図11(h))。要素F01の子要素Iの内容を行X01の列Iに格納する(ステップA416)。要素F01の子要素Jの内容を行X01の列Jに格納する(ステップA417)(図11(i))。次の要素F、要素F02を取り出す(ステップA419)。テーブルXに行X02を追加する(ステップA415)(図11(j))。要素F02の子要素Iの内容を行X02の列Iに格納する(ステップA416)。要素F02の子要素Jの内容を行X02の列Jに格納する(ステップA417)(図11(k))。次の要素F、要素F03を取り出す(ステップA419)。テーブルXに行X03を追加する(ステップA415)(図11(l))。要素F03の子要素Iの内容を行X03の列Iに格納する(ステップA416)。要素F03の子要素Jの内容を行X03の列Jに格納する(ステップA417)(図11(m))。
【0022】
本実施形態によれば次のような効果を得ることができる。第1の効果は、タグの繰り返し構造を含むXML文書をテーブル形式のデータベースに格納できることにある。その理由は、タグの繰り返し構造を持つ部分を別のデータとして括り出しテーブル形式に格納できる形に変換したためである。第2の効果は、再帰的タグ構造を含むXML文書をテーブル形式のデータベースに格納できることにある。その理由は、再帰的タグ構造を持つ部分を別のデータとして括り出しテーブル形式に格納できる形に変換したためである。第3の効果は、3レベル以上のタグ入れ子構造を含むXML文書をテーブル形式のデータベースに格納できることにある。その理由は、3レベル以上の入れ子構造を持つ部分の要素を上位の要素へ移動しテーブル形式のデータベースに格納できる形に変換したためである。
【0023】
[発明の他の実施形態]
次に、本発明の他の実施形態について図面を参照して詳細に説明する。図12を参照すると、本発明のXMLデータ格納装置の他の実施形態は、XMLデータ入力手段301と、データ変換手段302と、データ格納手段303と、データベース311から構成されている。XMLデータ321の例を図13に示す。XMLデータ321はルート要素Aから構成されている。要素Aは要素Bの繰り返し(B01,B02)で構成されている。要素B01は要素C(CT02)と文字列の繰り返し(CT01,CT03)から構成されている。要素B02は要素Cの繰り返し(CT04,CT06)と文字列(CT05)から構成されている。
【0024】
上記各手段はそれぞれ概略つぎのような機能を有する。データ入力手段301は、XMLデータ321を入力しデータ変換手段302へ渡す。データ変換手段302は、XMLデータ321の内部の繰り返し要素である要素Cと文字列を分離しXMLデータ322とXMLデータ323とする。データ格納手段303は、XMLデータ323をテーブルXに格納する。要素Cの内容を列Cに、文字列を列TEXTに、要素Bの位置情報を列IDに格納する。
【0025】
次に、図14及び図15のフローチャートを参照して本実施形態の全体の動作について詳細に説明する。XMLデータ321をデータ変換手段302へ入力する。要素Xをルート要素とする新しいXMLデータ323を生成する(図14のステップA501)。XMLデータ321に要素Bがなければ終わる(ステップA502)。最初の要素Bを要素B1とする(ステップA503)。要素B1の順序位置をID1とする(ステップA504)。要素B1に要素Cか文字列がなければA514へ進む(ステップA505)。要素B1に要素Cか文字列があれば、要素B1の最初の要素Cか文字列をCT1とする(ステップA506)。要素Yを生成しY1とする(ステップA507)。要素XにY1を追加する(ステップA508)。CT1をB1から取り除き要素Y1に追加する(ステップA509)。要素Y1に要素IDを追加する(ステップA510)。要素IDの内容としてID1を設定する(ステップA511)。要素B1に次の要素Cか文字列があればステップA513へ、なければステップA514へ進む(ステップA512)。次の要素Cか文字列をCT1とする(ステップA513)。次の要素BがあればステップA515へ、なければ終わる(ステップA514)。次の要素BをB1とする(ステップA515)。要素Bの子の総ての要素Fと文字列が取り除かれたXMLデータ321をXMLデータ322とする。
【0026】
データ格納手段303はデータ変換手段302からXMLデータ323を入力する。XMLデータ323に要素Yがなければ終わる(図15のステップA601)。XMLデータ323の最初の要素Yを要素Y1とする(ステップA602)。テーブルXに行X1を追加する(ステップA603)。要素Y1に子要素Cがあれば内容を行X1の列Cに格納する(ステップA604、A605)。要素Y1に文字列があれば行X1の列TEXTに格納する(ステップA606、A607)。要素Y1の子要素IDの内容を列X1の要素IDに格納する(ステップA608)。次の要素BがあればステップA610へ、なければ終わる。次の要素BをB1とする(ステップA610)。次に、具体例について説明する。
【0027】
XMLデータ321をデータ変換手段302へ入力する。要素Xをルート要素とする新しいXMLデータ323を生成する(図14のステップA501)。最初の要素B、要素B01を取り出す(ステップA503)。要素B01の順序位置1をID1とする(ステップA504)。要素B01の最初の文字列CT01を取り出す(ステップA506)。要素Yを生成しY01とする(ステップA507)。要素XにY01を追加する(ステップA508)。CT01をB01から取り除き要素Y01に追加する(ステップA509)。要素Y01に要素IDを追加する(ステップA510)。要素IDの内容としてID1の値1を設定する(ステップA511)。次の要素C、要素CT02を取り出す(ステップA513)。要素Yを生成しY02とする(ステップA507)。要素XにY02を追加する(ステップA508)。CT02をB01から取り除き要素Y02に追加する(ステップA509)。要素Y02に要素IDを追加する(ステップA510)。要素IDの内容としてID1の値1を設定する(ステップA511)。次の文字列、CT03を取り出す(ステップA513)。要素Yを生成しY03とする(ステップA507)。要素XにY03を追加する(ステップA508)。CT03をB01から取り除き要素Y03に追加する(ステップA509)。要素Y03に要素IDを追加する(ステップA510)。要素IDの内容としてID1の値1を設定する(ステップA511)。次の要素B、要素B02を取り出す(ステップA515)。要素B02の順序位置2をID1とする(ステップA504)。要素B02の最初の要素C、要素CT04を取り出す(ステップA506)。要素Yを生成しY04とする(ステップA507)。要素XにY01を追加する(ステップA508)。CT04をB02から取り除き要素Y04に追加する(ステップA509)。要素Y04に要素IDを追加する(ステップA510)。要素IDの内容としてID1の値2を設定する(ステップA511)。次の文字列、CT05を取り出す(ステップA513)。要素Yを生成しY05とする(ステップA507)。要素XにY05を追加する(ステップA508)。CT05をB02から取り除き要素Y05に追加する(ステップA509)。要素Y05に要素IDを追加する(ステップA510)。要素IDの内容としてID1の値2を設定する(ステップA511)。次の要素C、CT06を取り出す(ステップA513)。要素Yを生成しY06とする(ステップA507)。要素XにY06を追加する(ステップA508)。CT06をB02から取り除き要素Y06に追加する(ステップA509)。要素Y06に要素IDを追加する(ステップA510)。要素IDの内容としてID1の値2を設定する(ステップA511)。要素Bの子の総ての要素Cと文字列が取り除かれたXMLデータ321をXMLデータ322とする。作成されたXMLデータ323を図16に示す。
【0028】
データ格納手段303はデータ変換手段302からXMLデータ323を入力する。XMLデータ323の最初の要素Y、要素Y01を取り出す(図15のステップA602)。テーブルXに行X01を追加する(ステップA603)。要素Y01の文字列を行X01の列TEXTに格納する(ステップA607)。要素Y01の子要素IDの内容を行X01の列IDに格納する(ステップA608)。次の要素Y、要素Y02を取り出す(ステップA610)。テーブルXに行X02を追加する(ステップA603)。要素Y02の子要素Cの内容を行X02の列Cに格納する(ステップA605)。要素Y02の子要素IDの内容を行X02の列IDに格納する(ステップA608)。次の要素Y、要素Y03を取り出す(ステップA610)。テーブルXに行X03を追加する(ステップA603)。要素Y03の文字列を行X01の列TEXTに格納する(ステップA607)。要素Y03の子要素IDの内容を列X03の列IDに格納する(ステップA608)。次の要素Y、要素Y04を取り出す(ステップA610)。テーブルXに行X04を追加する(ステップA603)。要素Y04の子要素Cの内容を行X04の列Cに格納する(ステップA605)。要素Y04の子要素IDの内容を行X04の列IDに格納する(ステップA608)。次の要素Y、要素Y05を取り出す(ステップA610)。テーブルXに行X05を追加する(ステップA603)。要素Y05の文字列を行X05の列TEXTに格納する(ステップA607)。要素Y05の子要素IDの内容を列X05の列IDに格納する(ステップA608)。次の要素Y、要素Y06を取り出す(ステップA610)。テーブルXに行X06を追加する(ステップA603)。要素Y06の子要素Cの内容を行X06の列Cに格納する(ステップA605)。要素Y06の子要素IDの内容を行X06の列IDに格納する(ステップA608)。作成されたテーブルXを図17に示す。
【0029】
本実施形態の第1の効果は、文字列、要素が混在した繰り返しがテーブル形式のデータベースに格納できることである。その理由は、タグと文字列の繰り返し構造を持つ部分を要素あるいは文字列を内容として持つ要素で括り、別のデータとして括り出しテーブル形式に格納できる形に変換したためである。第2の効果は、テーブル形式のデータベースに格納された文字列、要素のデータの元の位置情報を格納できることにある。その理由は、文字列や要素を括り出す時に親要素の位置情報を付加し、その情報もテーブルに格納したためである。
【0030】
なお、本発明の実施の形態は上述した形態に限定されるものではなく適宜変更可能である。例えば、各実施形態における変換手段の位置は他の変換手段と交換可能である。図2を参照して説明した実施形態に、図18を参照して説明した実施形態で用いた要素の位置情報を表す要素を追加する構成を付加することなどが考えられる。また、本発明のデータ格納装置は、コンピュータとそのコンピュータで実行されるプログラムとを用いて実現することができ、そのコンピュータで実行されるプログラムはコンピュータ読み取り可能な記録媒体あるいは通信回線を介して頒布することが可能である。
【0031】
【発明の効果】
以上説明したように発明によれば、次のような効果を得ることができる。第1の効果は、タグの繰り返し構造を含むXML文書をテーブル形式のデータベースに格納できることにある。その理由は、タグの繰り返し構造を持つ部分を別のデータとして括り出しテーブル形式に格納できる形に変換したためである。第2の効果は、再帰的タグ構造を含むXML文書をテーブル形式のデータベースに格納できることにある。その理由は、再帰的タグ構造を持つ部分を別のデータとして括り出しテーブル形式に格納できる形に変換したためである。第3の効果は、3レベル以上のタグ入れ子構造を含むXML文書をテーブル形式のデータベースに格納できることにある。その理由は、3レベル以上の入れ子構造を持つ部分の要素を上位の要素へ移動しテーブル形式のデータベースに格納できる形に変換したためである。第4の効果は、文字列、要素が混在した繰り返しがテーブル形式のデータベースに格納できることである。その理由は、タグと文字列の繰り返し構造を持つ部分を要素あるいは文字列を内容として持つ要素で括り、別のデータとして括り出しテーブル形式に格納できる形に変換したためである。第5の効果は、テーブル形式のデータベースに格納された文字列、要素のデータの元の位置情報を格納できることにある。その理由は、文字列や要素を括り出す時に親要素の位置情報を付加し、その情報もテーブルに格納したためである。
【図面の簡単な説明】
【図1】 本発明によるデータ格納装置の一実施の形態の構成を示すブロック図。
【図2】 本発明によるデータ格納装置の一実施の形態の構成を示すブロック図。
【図3】 図2のXMLデータ221の一例を示す図。
【図4】 図2の構成(データ変換手段202)の動作を示すフローチャート。
【図5】 図2の構成(データ変換手段203)の動作を示すフローチャート。
【図6】 図2の構成(データ変換手段204)の動作を示すフローチャート。
【図7】 図2の構成(データ格納手段205)の動作を示すフローチャート。
【図8】 図2におけるデータ変換手段202によるXMLデータ223の作成経過(a)〜(d)と作成されたXMLデータ222(e)を示す図。
【図9】 図2におけるデータ変換手段203によるXMLデータ225の作成経過(a)〜(d)と作成されたXMLデータ224(e)を示す図。
【図10】 図2におけるデータ変換手段204によるXMLデータ224の変換経過(a)〜(d)と作成されたXMLデータ226(e)を示す図。
【図11】 図2におけるデータ格納手段205によるデータベース211内のテーブルA,X,Yの作成経過(a)〜(m)を示す図。
【図12】 本発明によるデータ格納装置の他の実施の形態の構成を示すブロック図。
【図13】 図12のXMLデータ321の一例を示す図。
【図14】 図12の構成(データ変換手段302)の動作を示すフローチャート。
【図15】 図12の構成(データ格納手段303)の動作を示すフローチャート。
【図16】 図12においてデータ変換手段302によって作成されたXMLデータ323の内容の一例を示す図。
【図17】 図12のデータ格納手段305によるデータベース311内のテーブルXの作成例を示す図。
【図18】 従来のデータ格納装置の構成を示すブロック図。
【図19】 図18のXMLデータ421の内容を示す図。
【図20】 図18のテーブル422の内容を示す図。
【符号の説明】
101〜106,221〜226,321〜323…XMLデータ
111〜113,202〜204,302…データ変換手段
201,301…データ入力手段
121,211,311…データベース
114…データ更新手段
205,303…データ格納手段
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a data storage device and method suitable for use in storing an XML (Extensible Markup Language) document including an element (tag) nested structure, repetition, and recursive structure in a table format database.
[0002]
[Prior art]
XML (eXtensible Markup Language) is a data format for exchanging structured documents on the Web that is being standardized by the World Wide Web Consortium (W3C). XML is designed as a subset of SGML (Standard Generalized Markup Language) [ISO 8879]. An XML document includes declarations, elements, comments, character references, and processing instructions that begin with a document entity called a root and are each marked and have a nested structure. Each document contains one or more elements, and each document has only one element, the root or document element, which is not included in the contents of other elements. Each element is delimited by a start tag and an end tag and has a nested structure. For all elements, if the start tag is included in the contents of other elements, the corresponding end tag is also included in the contents of the same element. When element B is included in the contents of element A and not included in other elements included in the contents of element A, element A is referred to as the parent of element B, and element B is referred to as a child of element A.
[0003]
With reference to FIG. 18, an XML data storage method for storing data constituting an XML document (hereinafter referred to as XML data) in a table format database will be described. In FIG. 18, the data storage unit 401 analyzes the contents of the XML data 421, extracts each element included in the XML data 421, and stores it in the table 422 in the database 402. The operation of the data storage unit 401 shown in FIG. 18 will be described by taking as an example a case where the XML data 421 has contents as shown in FIG. In this case, the XML data 421 has one root element 421a, and has a repetition of the element 421b (421b1, 421b2) in the next lower hierarchy as a child element of the element 421a. Each element 421b1, 421b2 includes a sequence of the same child elements consisting of elements 421c, d, e, respectively. The data storage unit 401 receives the XML data 421 as input, and stores the child elements 412b1 and 412b2 of the element 412a in association with the rows B01 and B02 of the table 422. The child elements 412c to 4e of the child elements 412b1 and 412b2 are stored in correspondence with the columns C, D, and E in the respective rows. An example of the table 422 is shown in FIG.
[0004]
[Problems to be solved by the invention]
The conventional technology as described above has the following problems. The first problem is that when the child elements 421c1 to 421c1 of the element 421a further have child elements, they cannot be stored in correspondence with the columns of the table. The reason is that the column in the table corresponds to the child elements 421c to e of the child elements 421b1 and 421b of the element 421a. The second problem is that it cannot be stored in the table when there are repetitions inside the child elements 421b1 and 2 of the element 421a. This is because the repetition represented by the row of the table corresponds only to the child element of the element 421a. A third problem is that a recursive tag structure cannot be stored in a table. The reason is that the table cannot store a recursive data structure as it is.
[0005]
The present invention makes it possible to store an XML document including a nested structure, a repetition structure, or a recursive structure of elements (tags) of three or more layers, which cannot be supported by a conventional configuration, in a table format database. It is an object to provide a data storage device and method.
[0006]
[Means for Solving the Problems]
  In order to solve the above-mentioned problem, the invention according to claim 1 is a data storage device for converting XML (eXtensible Markup Language) data into tabular data and storing it in a predetermined storage means.Input first XML data ( 221 ) In the second XML data (in which the element F which is not the child element B of the root element A is separated and the element F is removed) 222 ) And the third XML data (the element F added to the new XML data) ( 223 ) And the first data conversion means ( 202 ) And second XML data ( 222 ) Inside the recursive element D, and the fourth XML data with the element D removed ( 224 ) And the fifth XML data (the element D added to the new XML data) ( 225 ) And the second data conversion means ( 203 ) And fourth XML data ( 224 ) To move the element E nested at three or more levels inside as a child element of the child element B of the root element A to obtain the sixth XML data ( 226 ) To create a third data conversion means ( 204 ) And sixth XML data ( 226 ) In the first table and the fifth XML data ( 225 ) In the second table and the third XML data ( 223 ) In the third table 205 ).
[0007]
The invention according to claim 2 is XML. (eXtensible Markup Language ) In the data storage device that converts the data into tabular data and stores it in a predetermined storage means, the input XML data ( 321 ) Is separated from the element C and the character string, and the child element B of the root element A, the element C and the character string as the element are added to the new XML data, and the element ID indicating the order position of the element B XML data added with ( 323 ) To create data conversion means ( 302 ) And XML data ( 323 ) In the table, and at that time, the data storage means (the element C and the character string are stored together with the element ID) 303 ).
[0008]
The invention according to claim 3 is XML. (eXtensible Markup Language ) In a data storage method for converting data into tabular data and storing it in a predetermined storage means, the input first XML data ( 221 ) In the second XML data (in which the element F which is not the child element B of the root element A is separated and the element F is removed) 222 ) And third XML data (adding element F to the new XML data) 223 ) And a second XML data ( 222 ) Inside the recursive element D, and the fourth XML data with the element D removed ( 224 ) And fifth XML data (adding element D to the new XML data) 225 ) To create a second data conversion process and a fourth XML data ( 224 ) To move the element E nested at three or more levels inside as a child element of the child element B of the root element A to obtain the sixth XML data ( 226 ) To create a third data conversion process and sixth XML data ( 226 ) In the first table and the fifth XML data ( 225 ) In the second table and the third XML data ( 223 ) Is stored in the third table.
[0009]
DETAILED DESCRIPTION OF THE INVENTION
Embodiments of a data storage device according to the present invention will be described below with reference to the drawings.
[0010]
FIG. 1 is a block diagram for explaining an embodiment of a data storage device according to the present invention. In FIG. 1, the data conversion unit 111 separates a portion having repetitions other than the child element of the root element in the document type definition from the XML data 101, and removes the separated portion from the XML data 102 and the separated portion as a new route. The XML data 103 and other XML data created by placing the same element repeatedly below the element are used. The data conversion means 112 separates a portion having a recursive structure in the document definition from the XML data 102, and converts the separated portion so that an element that recursively becomes a repetitive form of a child element of the root element. The XML data 105 and other XML data created in the above and the XML data 104 excluding the separated portion. The other output XML data of the data conversion unit 111 such as the XML data 103 is converted in the same manner as the XML data 102. The data conversion unit 113 converts the element nested in three or more levels in the document definition of the XML data 104 into a format in which the element is a child element of the root element, and forms the XML data 106. Conversion is similarly performed for other output XML data of the data conversion unit 112 such as the XML data 105. By the conversion of the data conversion means 111 to 113, the XML data 101 is converted into XML data 106 having other repetitions of the same element as a child element of the root element and having the same element column inside the child element and other XML data. The data updating unit 114 stores the XML data in the table of the database 121 by associating the child elements of the root elements of the XML data with the columns of the table. In this manner, an XML document including a tag nesting structure of three or more levels, a repetition, and a recursive tag structure can be stored in a table format database.
[0011]
Next, another embodiment of the data storage device according to the present invention will be described with reference to FIG. Referring to FIG. 2, an XML data storage device according to an embodiment of the present invention includes an XML data input unit 201, a data conversion unit 202, a data conversion unit 203, a data conversion unit 204, a data storage unit 205, The database 211 is configured. An example of the XML data 221 is shown in FIG. The XML data 221 is composed of a root element A (start tag: <A>, end tag: </A>; the same applies below, but in the drawing, a reference line is attached to the start tag). Element A is composed of repetition of element B (B01, B02). The element B01 is composed of an element C (C01) and an element D (D01, D02). The element B02 is composed of an element C (C02) and an element D (D03). Element C01 is composed of a repetition of one element E (E01) and element F (F01, F02). The element C02 is composed of one element E (E02) and element F (F03). The element D01 is composed of one element G (G01) and one element D (D02). The element D03 is composed of one element G (G03). Element F (F01, F02, F03) is composed of element I and element J, respectively. Element E, element G, element I, and element J are composed of character strings.
[0012]
Each of the above means generally operates as follows. The data input unit 201 inputs the XML data 221 and passes it to the data conversion unit 202. The data conversion unit 202 separates the element F (F01, F02), which is a repetitive element inside the XML data 221, into XML data 222 and XML data 223. Element B (B01, B02) is also repeated, but is not converted because it is a child element of root element A. The data conversion unit 203 separates the recursive element D (D01, D02) inside the XML data 222 into XML data 224 and XML data 225. The data conversion unit 204 moves the element E nested in three or more levels inside the XML data 224 as a child element of the child element B of the root element A and sets it as XML data 226. The data storage unit 205 stores the XML data 226 in the table A. At this time, the contents of element E are stored in column E. The XML data 225 is stored in the table Y. At this time, the contents of the element G are stored in the column G. The XML data 223 is stored in the table X. At this time, the contents of element I are stored in column I, and the contents of element J are stored in column J.
[0013]
[Description of Operation of Embodiment]
Next, the overall operation of this embodiment will be described in detail with reference to the flowcharts of FIGS. 4, 5, 6, and 7.
[0014]
The XML data 221 is input to the data conversion unit 202. New XML data 223 having the element X as a root element is generated (step A101 in FIG. 4). Here, X is a variable. If there is no element B in the XML data 221, the process ends (step A102), and if there is an element B, the first element B is set as element B1 (step A103). Here, B and B1 indicate variables. Next, if there is no element F in the element B1, the process ends (step A104). If there is an element F in the element B1, the first element F of the element B1 is set to F1 (step A105). Here, F and F1 are variables. The element F1 is removed from the element B1 and added to the element X (step A106). If there is a next element F in element B1, the process proceeds to step A108, and if not, the process proceeds to step A109 (step A107). In step A108, the next element F is set to F1, and the process returns to step A106. In step A109, if there is a next element B, the process proceeds to step A110. In step A110, the next element B is set to B1, and the process returns to step A104. At the end, the XML data 221 from which all the elements F have been removed is referred to as XML data 222.
[0015]
The data conversion unit 203 receives the XML data 222 from the data conversion unit 202. New XML data 225 having the element Y as a root element is generated (step A201 in FIG. 5). Here, Y is a variable. If there is no element B in the XML data 222, the process ends (step A202), and if there is an element B, the first element B is designated as element B1 (step A203). Next, the element D of the child element of the element B1 is set to D1 (step A204). Here, D and D1 are variables. Next, the element D1 is removed from the parent element and added as a child element of the element Y (step A205). If there is an element D as a child element of the element D1, the process proceeds to step A207, and if not, the process proceeds to step A208 (step A206). In step A207, the child element D is set to D1, and the process returns to step A205. In step A208, if there is a next element B, the process proceeds to step A209. In step A209, the next element B is set to B1, and the process returns to step A204. At the end, the XML data 222 from which all elements D are removed is referred to as XML data 224.
[0016]
The data conversion unit 204 receives the XML data 224 from the data conversion unit 203. If there is no element B in the XML data 224, the process ends (step A301 in FIG. 6), and if there is an element B, the first element B is designated as element B1 (step A302). The child element E of the child element C of the element B1 is removed from the element C and added as a child element of the element B1 (step A303). Here, C and E are variables. The element C is deleted from the element B1 (step A304). If there is a next element B, the process proceeds to step A306, and if not, the process ends (step A305). In step A306, the next element B is set to B1, and the process returns to step A303. At the end, the XML data 224 in which all the elements C and E have been converted are set as XML data 226.
[0017]
The data storage unit 205 receives the XML data 226 from the data conversion unit 204, the XML data 225 from the data conversion unit 203, and the XML data 223 from the data conversion unit 203. If there is no element B in the XML data 226, the process proceeds to step A407 (step A401 in FIG. 7). If there is an element B in the XML data 226, the first element B of the XML data 226 is set as an element B1 (step A402). Next, row A1 is added to table A (step A403). Here, A1 is a variable. Next, the contents of child element E of element B1 are stored in column E of row A1 (step A404). If there is a next element B, the process proceeds to step A406, and if not, the process proceeds to step A407 (step A405). In step A406, the next element B is set to B1, and the process returns to step A403. In step A407, if there is no element D in the XML data 225, the process proceeds to step A413, and if there is an element D, the process proceeds to step A408. In step A408, the first element D of the XML data 225 is set as the element D1. A row Y1 is added to the table Y (step A409). Here, Y1 is a variable. Next, the contents of child element G of element D1 are stored in column G of row Y1 (step A410). Here, G is a variable. If there is a next element D, the process proceeds to step A412; otherwise, the process proceeds to step A413 (step A411). In step A412, the next element D is set to D1, and the process returns to step A409. In step A413, if there is no element F in the XML data 223, the process ends. If there is an element F, the process proceeds to step A414. In step A414, the first element F of the XML data 223 is set as an element F1. A row X1 is added to the table X (step A415). Next, the contents of child element I of element F1 are stored in column I of row X1 (step A416). Here, X1 and I are variables. Next, the contents of child element J of element F1 are stored in column J of row X1 (step A417). Here, J is a variable. Next, if there is a next element F, the process proceeds to step A419, and if not, the process ends (step A418). In step A419, the next element F is set as F1, and the process returns to step A415. The process ends here.
[0018]
Next, a description will be given using a specific example in the case of inputting the XML data 221 shown in FIG. The XML data 221 is input to the data conversion unit 202. The data conversion unit 202 generates new XML data 223 having the element X as a root element (step A101 in FIG. 4) (see FIG. 8A). The first element B and element B01 of the XML data 221 shown in FIG. 3 are extracted (step A103). The first element F and element F01 of the element B01 are taken out (step A105). F01 is removed from B01 and added to element X (step A106) (FIG. 8B (upper right of FIG. 8)). The element F and element F02 next to the element B01 are taken out (step A108). F02 is removed from B01 and added to element X (step A106) (FIG. 8C). The next element B and element B02 are taken out (step A110). The first element F and element F03 of the element B02 are extracted (step A105). F03 is removed from B02 and added to element X (step A106) (FIG. 8D). The XML data 221 from which all elements F have been removed is taken as XML data 222 (FIG. 8 (e)).
[0019]
The data conversion unit 203 inputs the XML data 222 shown in FIG. 8E from the data conversion unit 202. New XML data 225 having the element Y as a root element is generated (step A201 in FIG. 5) (FIG. 9A). The first element B and element B01 of the XML data 222 in FIG. 8E are extracted (step A203). The child element D and the element D01 of the element B01 are taken out (step A204). D01 is removed from B01 and added as a child element of element Y (step A205) (FIG. 9B (upper right of FIG. 9)). The element D and the element D02 that are the child elements of the element D01 are extracted (step A207). D02 is removed from D01 and added as a child element of element Y (step A205) (FIG. 9C). The next element B and element B02 are taken out (step A209). The element D and the element D03, which are child elements of the element B02, are removed from B02 and added as child elements of the element Y (step A205) (FIG. 9D). The XML data 222 from which all elements D have been removed is taken as XML data 224 (FIG. 9 (e)).
[0020]
The data conversion unit 204 inputs the XML data 224 shown in FIG. 9E from the data conversion unit 203. The first element B and element B01 of the XML data 224 are extracted (step A302). The child element E (E01) of the child element C (C01) of the element B01 is removed from the element C and added as a child element of the element B01 (step A303) (FIG. 10A). The element C is deleted from the element B01 (step A304) (FIG. 10B). The next element B and element B02 are taken out (step A306). The child element E (E02) of the child element C (C02) of the element B02 is removed from the element C and added as a child element of the element B02 (step A303) (FIG. 10C). The element C is deleted from the element B02 (step A304) (FIG. 10 (d)). The XML data 224 obtained by converting all the elements C and E is defined as XML data 226 (FIG. 10 (e)).
[0021]
The data data storage unit 205 converts the XML data 226 shown in FIG. 10E from the conversion unit 204, the XML data 225 shown in FIG. 9D from the data conversion unit 203, and the data conversion unit 203 shown in FIG. 8D. XML data 223 shown is input. The first element B and element B01 of the XML data 226 are extracted (step A402 in FIG. 7). A row A01 is added to the table A (step A403) (FIG. 11A). The contents of child element E of element B01 are stored in column E of row A1 (step A404) (FIG. 11 (b)). The next element B and element B02 are taken out (step A406). A row A02 is added to the table A (step A403) (FIG. 11 (c)). The contents of child element E of element B02 are stored in column E of row A2 (step A404) (FIG. 11 (d)). The first element D and element D01 of the XML data 225 are extracted (step A408). A row Y01 is added to the table Y (step A409) (FIG. 11 (e)). The contents of child element G of element D01 of XML data 225 are stored in column G of row Y01 (step A410) (FIG. 11 (f)). The next element D and element D02 are taken out (step A412). A row Y02 is added to the table Y (step A409). The contents of child element G of element D02 are stored in column G of row Y02 (step A410). The next element D and element D03 are taken out. A row Y03 is added to the table Y (step A409). The contents of child element G of element D03 are stored in column G of row Y03 (step A410) (FIG. 11 (g)). The first element F and element F01 of the XML data 223 are extracted (step A414). A row X01 is added to the table X (step A415) (FIG. 11 (h)). The contents of child element I of element F01 are stored in column I of row X01 (step A416). The contents of child element J of element F01 are stored in column J of row X01 (step A417) (FIG. 11 (i)). The next element F and element F02 are taken out (step A419). A row X02 is added to the table X (step A415) (FIG. 11 (j)). The contents of child element I of element F02 are stored in column I of row X02 (step A416). The contents of child element J of element F02 are stored in column J of row X02 (step A417) (FIG. 11 (k)). The next element F and element F03 are taken out (step A419). A row X03 is added to the table X (step A415) (FIG. 11 (l)). The contents of child element I of element F03 are stored in column I of row X03 (step A416). The contents of child element J of element F03 are stored in column J of row X03 (step A417) (FIG. 11 (m)).
[0022]
According to the present embodiment, the following effects can be obtained. The first effect is that an XML document including a tag repeating structure can be stored in a database in a table format. The reason is that the portion having the tag repetitive structure is converted into a form that can be stored as another data in a table format. The second effect is that an XML document including a recursive tag structure can be stored in a table format database. The reason is that the portion having the recursive tag structure is converted into a form that can be stored as separate data in a table format. The third effect is that an XML document including a tag nesting structure of three or more levels can be stored in a table format database. The reason is that the element of the part having a nested structure of three or more levels is moved to a higher element and converted into a form that can be stored in a table format database.
[0023]
[Other Embodiments of the Invention]
Next, another embodiment of the present invention will be described in detail with reference to the drawings. Referring to FIG. 12, another embodiment of the XML data storage device of the present invention includes an XML data input means 301, a data conversion means 302, a data storage means 303, and a database 311. An example of the XML data 321 is shown in FIG. The XML data 321 is composed of a root element A. Element A is composed of repetitions of element B (B01, B02). Element B01 is composed of element C (CT02) and repetition of character strings (CT01, CT03). Element B02 is composed of a repetition of element C (CT04, CT06) and a character string (CT05).
[0024]
Each of the above means generally has the following functions. The data input unit 301 inputs XML data 321 and passes it to the data conversion unit 302. The data conversion unit 302 separates the element C and the character string, which are repetitive elements inside the XML data 321, into XML data 322 and XML data 323. The data storage unit 303 stores the XML data 323 in the table X. The contents of element C are stored in column C, the character string is stored in column TEXT, and the position information of element B is stored in column ID.
[0025]
Next, the overall operation of this embodiment will be described in detail with reference to the flowcharts of FIGS. The XML data 321 is input to the data conversion unit 302. New XML data 323 having the element X as a root element is generated (step A501 in FIG. 14). If there is no element B in the XML data 321, the process ends (step A 502). The first element B is set as element B1 (step A503). The order position of element B1 is ID1 (step A504). If there is no element C or character string in element B1, the process proceeds to A514 (step A505). If element B1 contains element C or a character string, the first element C or character string of element B1 is set as CT1 (step A506). Element Y is generated and set as Y1 (step A507). Y1 is added to the element X (step A508). CT1 is removed from B1 and added to element Y1 (step A509). An element ID is added to the element Y1 (step A510). ID1 is set as the content of the element ID (step A511). If there is the next element C or character string in element B1, the process proceeds to step A513, and if not, the process proceeds to step A514 (step A512). The next element C or character string is set as CT1 (step A513). If there is a next element B, the process proceeds to step A515, and if not, the process ends (step A514). The next element B is set to B1 (step A515). The XML data 321 from which all the elements F and character strings of the children of the element B are removed is referred to as XML data 322.
[0026]
The data storage unit 303 receives the XML data 323 from the data conversion unit 302. If there is no element Y in the XML data 323, the process ends (step A601 in FIG. 15). The first element Y of the XML data 323 is set as an element Y1 (step A602). A row X1 is added to the table X (step A603). If there is a child element C in element Y1, the contents are stored in column C of row X1 (steps A604 and A605). If there is a character string in element Y1, it is stored in column TEXT of row X1 (steps A606 and A607). The contents of the child element ID of the element Y1 are stored in the element ID of the column X1 (step A608). If there is a next element B, the process proceeds to step A610. The next element B is set to B1 (step A610). Next, a specific example will be described.
[0027]
The XML data 321 is input to the data conversion unit 302. New XML data 323 having the element X as a root element is generated (step A501 in FIG. 14). The first element B and element B01 are taken out (step A503). The order position 1 of the element B01 is set to ID1 (step A504). The first character string CT01 of the element B01 is taken out (step A506). Element Y is generated and set to Y01 (step A507). Y01 is added to the element X (step A508). CT01 is removed from B01 and added to element Y01 (step A509). An element ID is added to the element Y01 (step A510). The value 1 of ID1 is set as the content of the element ID (step A511). The next element C and element CT02 are taken out (step A513). Element Y is generated and set as Y02 (step A507). Y02 is added to the element X (step A508). CT02 is removed from B01 and added to element Y02 (step A509). An element ID is added to the element Y02 (step A510). The value 1 of ID1 is set as the content of the element ID (step A511). The next character string, CT03, is extracted (step A513). Element Y is generated and set as Y03 (step A507). Y03 is added to the element X (step A508). CT03 is removed from B01 and added to element Y03 (step A509). An element ID is added to the element Y03 (step A510). The value 1 of ID1 is set as the content of the element ID (step A511). The next element B and element B02 are taken out (step A515). The order position 2 of the element B02 is set to ID1 (step A504). The first element C and element CT04 of the element B02 are taken out (step A506). Element Y is generated and set as Y04 (step A507). Y01 is added to the element X (step A508). CT04 is removed from B02 and added to element Y04 (step A509). An element ID is added to the element Y04 (step A510). The value 2 of ID1 is set as the content of the element ID (step A511). The next character string, CT05, is extracted (step A513). Element Y is generated and set to Y05 (step A507). Y05 is added to element X (step A508). CT05 is removed from B02 and added to element Y05 (step A509). An element ID is added to the element Y05 (step A510). The value 2 of ID1 is set as the content of the element ID (step A511). The next element C, CT06 is taken out (step A513). Element Y is generated and set to Y06 (step A507). Y06 is added to the element X (step A508). CT06 is removed from B02 and added to element Y06 (step A509). An element ID is added to the element Y06 (step A510). The value 2 of ID1 is set as the content of the element ID (step A511). The XML data 321 from which all the elements C and character strings of the children of the element B are removed is referred to as XML data 322. The created XML data 323 is shown in FIG.
[0028]
The data storage unit 303 receives the XML data 323 from the data conversion unit 302. The first element Y and element Y01 of the XML data 323 are extracted (step A602 in FIG. 15). A row X01 is added to the table X (step A603). The character string of element Y01 is stored in column TEXT of row X01 (step A607). The contents of the child element ID of the element Y01 are stored in the column ID of the row X01 (step A608). The next element Y and element Y02 are taken out (step A610). A row X02 is added to the table X (step A603). The contents of child element C of element Y02 are stored in column C of row X02 (step A605). The contents of the child element ID of the element Y02 are stored in the column ID of the row X02 (step A608). The next element Y and element Y03 are taken out (step A610). A row X03 is added to the table X (step A603). The character string of element Y03 is stored in column TEXT of row X01 (step A607). The contents of the child element ID of the element Y03 are stored in the column ID of the column X03 (step A608). The next element Y and element Y04 are taken out (step A610). A row X04 is added to the table X (step A603). The contents of child element C of element Y04 are stored in column C of row X04 (step A605). The contents of the child element ID of the element Y04 are stored in the column ID of the row X04 (step A608). The next element Y and element Y05 are taken out (step A610). A row X05 is added to the table X (step A603). The character string of element Y05 is stored in column TEXT of row X05 (step A607). The contents of the child element ID of the element Y05 are stored in the column ID of the column X05 (step A608). The next element Y and element Y06 are taken out (step A610). A row X06 is added to the table X (step A603). The contents of child element C of element Y06 are stored in column C of row X06 (step A605). The contents of the child element ID of the element Y06 are stored in the column ID of the row X06 (step A608). The created table X is shown in FIG.
[0029]
The first effect of this embodiment is that repetitions in which character strings and elements are mixed can be stored in a table format database. The reason is that a portion having a repeated structure of a tag and a character string is bundled with an element or an element having a character string as contents, and converted into a form that can be bundled as another data and stored in a table format. The second effect is that the original position information of the character string and element data stored in the database in the table format can be stored. The reason is that the position information of the parent element is added when the character string or element is bundled, and the information is also stored in the table.
[0030]
In addition, embodiment of this invention is not limited to the form mentioned above, It can change suitably. For example, the position of the conversion means in each embodiment can be exchanged with other conversion means. It is conceivable to add a configuration for adding an element representing position information of an element used in the embodiment described with reference to FIG. 18 to the embodiment described with reference to FIG. The data storage device of the present invention can be realized by using a computer and a program executed by the computer, and the program executed by the computer is distributed via a computer-readable recording medium or a communication line. Is possible.
[0031]
【The invention's effect】
As described above, according to the invention, the following effects can be obtained. The first effect is that an XML document including a tag repeating structure can be stored in a database in a table format. The reason is that the portion having the tag repetitive structure is converted into a form that can be stored as another data in a table format. The second effect is that an XML document including a recursive tag structure can be stored in a table format database. The reason is that the portion having the recursive tag structure is converted into a form that can be stored as separate data in a table format. The third effect is that an XML document including a tag nesting structure of three or more levels can be stored in a table format database. The reason is that the element of the part having a nested structure of three or more levels is moved to a higher element and converted into a form that can be stored in a table format database. A fourth effect is that repetitions in which character strings and elements are mixed can be stored in a table format database. The reason is that a portion having a repeated structure of a tag and a character string is bundled with an element or an element having a character string as contents, and converted into a form that can be bundled as another data and stored in a table format. The fifth effect is that the original position information of the character string and element data stored in the table format database can be stored. The reason is that the position information of the parent element is added when the character string or element is bundled, and the information is also stored in the table.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a configuration of an embodiment of a data storage device according to the present invention.
FIG. 2 is a block diagram showing a configuration of an embodiment of a data storage device according to the present invention.
FIG. 3 is a diagram showing an example of XML data 221 in FIG. 2;
4 is a flowchart showing the operation of the configuration (data conversion means 202) in FIG. 2;
FIG. 5 is a flowchart showing the operation of the configuration of FIG. 2 (data conversion means 203).
6 is a flowchart showing the operation of the configuration (data conversion means 204) in FIG.
FIG. 7 is a flowchart showing the operation of the configuration of FIG. 2 (data storage means 205).
FIG. 8 is a diagram showing the creation progress (a) to (d) of XML data 223 by the data conversion means 202 in FIG. 2 and the created XML data 222 (e).
FIG. 9 is a diagram showing creation progress (a) to (d) of XML data 225 by the data conversion unit 203 in FIG. 2 and created XML data 224 (e).
FIG. 10 is a diagram showing conversion progress (a) to (d) of XML data 224 by the data conversion means 204 in FIG. 2 and created XML data 226 (e).
11 is a diagram showing the progress (a) to (m) of creation of tables A, X, and Y in the database 211 by the data storage unit 205 in FIG.
FIG. 12 is a block diagram showing a configuration of another embodiment of a data storage device according to the present invention.
13 is a diagram showing an example of XML data 321 in FIG.
FIG. 14 is a flowchart showing the operation of the configuration of FIG. 12 (data conversion means 302).
15 is a flowchart showing the operation of the configuration of FIG. 12 (data storage means 303).
16 is a view showing an example of the contents of XML data 323 created by the data conversion means 302 in FIG.
17 is a diagram showing an example of creating a table X in the database 311 by the data storage unit 305 in FIG.
FIG. 18 is a block diagram showing a configuration of a conventional data storage device.
FIG. 19 is a view showing the contents of XML data 421 in FIG. 18;
20 is a view showing the contents of a table 422 in FIG.
[Explanation of symbols]
101-106, 221-226, 321-323 ... XML data
111-113, 202-204, 302 ... data conversion means
201, 301 ... Data input means
121, 211, 311 ... database
114: Data updating means
205, 303 ... Data storage means

Claims (3)

XML(eXtensible Markup Language)データを表形式のデータに変換して所定の記憶手段に格納するデータ格納装置において、
入力された第1のXMLデータ( 221 )の内部の繰り返し要素であってルート要素Aの子要素Bでない要素Fを分離し、要素Fが取り除かれた第2のXMLデータ( 222 )と、新たなXMLデータに要素Fを追加した第3のXMLデータ( 223 )とを作成する第1のデータ変換手段( 202 )と、
第2のXMLデータ( 222 )の内部の再帰になっている要素Dを分離し、要素Dが取り除かれた第4のXMLデータ( 224 )と、新たなXMLデータに要素Dを追加した第5のXMLデータ( 225 )とを作成する第2のデータ変換手段( 203 )と、
第4のXMLデータ( 224 )の内部の3レベル以上入れ子になっている要素Eをルート要素Aの子要素Bの子要素として移動して第6のXMLデータ( 226 )を作成する第3のデータ変換手段( 204 )と、
第6のXMLデータ( 226 )を第1のテーブルに格納し、第5のXMLデータ( 225 )を第2のテーブルに格納し、第3のXMLデータ( 223 )を第3のテーブルに格納するデータ格納手段( 205 )と
を備えることを特徴とするデータ格納装置。
In a data storage device for converting XML (eXtensible Markup Language) data into tabular data and storing it in a predetermined storage means,
The second XML data ( 222 ) from which the element F that is a repetitive element inside the input first XML data ( 221 ) and is not a child element B of the root element A is separated and the element F is removed, and a new element First data conversion means ( 202 ) for generating third XML data ( 223 ) obtained by adding element F to the XML data ,
The recursive element D inside the second XML data ( 222 ) is separated, the fourth XML data ( 224 ) from which the element D is removed, and the fifth element D is added to the new XML data. Second data conversion means ( 203 ) for creating the XML data ( 225 ) of
A third XML element ( 224 ) is created by moving the element E nested in three or more levels inside the fourth XML data ( 224 ) as a child element of the child element B of the root element A to generate the sixth XML data ( 226 ) Data conversion means ( 204 );
The sixth XML data ( 226 ) is stored in the first table, the fifth XML data ( 225 ) is stored in the second table, and the third XML data ( 223 ) is stored in the third table. A data storage device comprising data storage means ( 205 ) .
XML(eXtensible Markup Language)データを表形式のデータに変換して所定の記憶手段に格納するデータ格納装置において、
入力されたXMLデータ( 321 )の内部の繰り返し要素である要素Cと文字列を分離し、新たなXMLデータにルート要素Aの子要素Bとその要素としての要素Cと文字列を、要素Bの順序位置を示す要素IDとともに追加したXMLデータ( 323 )を作成するデータ変換手段( 302 )と、
XMLデータ( 323 )をテーブルに格納し、かつその際、要素Cと文字列を要素IDともに格納するデータ格納手段( 303 )と
を備えることを特徴とするデータ格納装置。
In a data storage device for converting XML (eXtensible Markup Language) data into tabular data and storing it in a predetermined storage means,
The element C and the character string that are repetitive elements in the input XML data ( 321 ) are separated, and the child element B of the root element A and the element C and the character string as the elements are added to the new XML data. Data conversion means ( 302 ) for creating XML data ( 323 ) added together with an element ID indicating the order position of
Data storage means ( 303 ) for storing the XML data ( 323 ) in the table and storing the element C and the character string together with the element ID ;
A data storage device comprising:
XML (eXtensible Markup Language )データを表形式のデータに変換して所定の記憶手段に格納するデータ格納方法において、
入力された第1のXMLデータ( 221 )の内部の繰り返し要素であってルート要素Aの子要素Bでない要素Fを分離し、要素Fが取り除かれた第2のXMLデータ( 222 )と、新規のXMLデータに要素Fを追加した第3のXMLデータ( 223 )とを作成する第1のデータ変換過程と、
第2のXMLデータ( 222 )の内部の再帰になっている要素Dを分離し、要素Dが取り除かれた第4のXMLデータ( 224 )と、新規のXMLデータに要素Dを追加した第5のXMLデータ( 225 )とを作成する第2のデータ変換過程と、
第4のXMLデータ( 224 )の内部の3レベル以上入れ子になっている要素Eをルート要素Aの子要素Bの子要素として移動して第6のXMLデータ( 226 )を作成する第3のデータ変換過程と、
第6のXMLデータ( 226 )を第1のテーブルに格納し、第5のXMLデータ( 225 )を第2のテーブルに格納し、第3のXMLデータ( 223 )を第3のテーブルに格納するデータ格納過程と
を含んでいることを特徴とするデータ格納方法。
In a data storage method for converting XML (eXtensible Markup Language ) data into tabular data and storing it in a predetermined storage means,
The second XML data ( 222 ) from which the element F which is a repetitive element inside the input first XML data ( 221 ) and is not a child element B of the root element A is separated and the element F is removed, and a new A first data conversion process for creating third XML data ( 223 ) obtained by adding element F to the XML data of
The recursive element D in the second XML data ( 222 ) is separated, the fourth XML data ( 224 ) from which the element D is removed, and the fifth element in which the element D is added to the new XML data. A second data conversion process for generating XML data ( 225 ) of
A third XML element ( 224 ) is created by moving the element E nested in three or more levels inside the fourth XML data ( 224 ) as a child element of the child element B of the root element A to generate the sixth XML data ( 226 ) Data conversion process,
The sixth XML data ( 226 ) is stored in the first table, the fifth XML data ( 225 ) is stored in the second table, and the third XML data ( 223 ) is stored in the third table. Data storage process and
The data storage method characterized by including .
JP2000311114A 2000-10-11 2000-10-11 Data storage apparatus and method Expired - Fee Related JP3719125B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2000311114A JP3719125B2 (en) 2000-10-11 2000-10-11 Data storage apparatus and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2000311114A JP3719125B2 (en) 2000-10-11 2000-10-11 Data storage apparatus and method

Publications (2)

Publication Number Publication Date
JP2002117020A JP2002117020A (en) 2002-04-19
JP3719125B2 true JP3719125B2 (en) 2005-11-24

Family

ID=18790937

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2000311114A Expired - Fee Related JP3719125B2 (en) 2000-10-11 2000-10-11 Data storage apparatus and method

Country Status (1)

Country Link
JP (1) JP3719125B2 (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4184155B2 (en) * 2003-05-22 2008-11-19 シャープ株式会社 Data processing apparatus, data processing method, data processing program, and computer-readable recording medium recording the data processing program
WO2004104857A1 (en) * 2003-05-22 2004-12-02 Sharp Kabushiki Kaisha Data processing device, data processing method, data processing program, and computer-readable recording medium containing the data processing program
WO2008015788A1 (en) * 2006-07-31 2008-02-07 Justsystems Corporation Document processing device and document processing method
JP2008225909A (en) * 2007-03-13 2008-09-25 Just Syst Corp Document processor and document processing method
JP2008225932A (en) * 2007-03-14 2008-09-25 Just Syst Corp Data processor and data processing method
JP6260339B2 (en) 2014-02-24 2018-01-17 富士通株式会社 Information processing apparatus, data conversion program, and data conversion method

Also Published As

Publication number Publication date
JP2002117020A (en) 2002-04-19

Similar Documents

Publication Publication Date Title
US10831449B2 (en) Process and system for automatic generation of functional architecture documents and software design and analysis specification documents from natural language
McComb et al. Mining process heuristics from designer action data via hidden Markov models
US20170003937A1 (en) Process and system for automatic generation of functional architecture documents and software design and analysis specification documents from natural language
JP3719125B2 (en) Data storage apparatus and method
Okuyama Discrete control systems
US7325229B2 (en) Method for graphically visualizing an automatism application and computer terminal for carrying out said method
US6446054B1 (en) Fuzzy inference system or adaptive neuro-fuzzy inference system, and intelligent agent for the dynamic generation and retrieval of user interface software modules
CN110489625A (en) A kind of generation method and device of collecting webpage data template
CN111443904A (en) Method for generating executable code and computer readable storage medium
Brenig Reducing nonlinear dynamical systems to canonical forms
Singh et al. The method of stages for non-Markov models
Goyal et al. New LMI conditions for H∞/H 2 output feedback control of linear discrete-time systems
Bertran et al. A generic methodology for superstructure optimization of different processing networks
CN104462687A (en) Repairable GO algorithm based on dynamic Bayesian network
Benavides et al. An ontology-based approach to knowledge representation for Computer-Aided Control System Design
Kalwar et al. Smart: Towards automated mapping between data specifications
Murray et al. Information fusion-2-text: Explainable aggregation via linguistic protoforms
Cao et al. Resistance furnace temperature control system based on OPC and MATLAB
JP2016162198A (en) Parameter learning method, device, and program
Cortés et al. Solving continuous models with dependent uncertainty: a computational approach
Kazemy et al. Adaptive synchronization of complex dynamical networks in presence of coupling connections with dynamical behavior
Bobobekov A polynomial method for synthesizing a two-channel regulator stabilizing a three-mass system
Rutledge et al. Displaying triple provenance with extensions to the Fresnel vocabulary for semantic browsers
Hernández et al. Process System Engineering Tool Integration in the Context of Industry 4.0
Kim et al. Inferring a relax NG schema from XML documents

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20040116

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20040120

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20040322

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: 20050816

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20050829

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20080916

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090916

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090916

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100916

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110916

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120916

Year of fee payment: 7

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130916

Year of fee payment: 8

LAPS Cancellation because of no payment of annual fees