JP2009128945A - Data processing apparatus, method and program - Google Patents
Data processing apparatus, method and program Download PDFInfo
- Publication number
- JP2009128945A JP2009128945A JP2007299833A JP2007299833A JP2009128945A JP 2009128945 A JP2009128945 A JP 2009128945A JP 2007299833 A JP2007299833 A JP 2007299833A JP 2007299833 A JP2007299833 A JP 2007299833A JP 2009128945 A JP2009128945 A JP 2009128945A
- Authority
- JP
- Japan
- Prior art keywords
- schema
- xml document
- compression
- data processing
- xml
- 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.)
- Withdrawn
Links
Images
Landscapes
- Information Transfer Between Computers (AREA)
- Document Processing Apparatus (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
本発明は、テキスト形式き記述された構造化データをバイナリ化する技術に関する。 The present invention relates to a technique for binarizing structured data described in a text format.
XML文書に記述されている情報は、テキスト形式で記述されるため可読性の高い仕様となっている反面、同じ情報量をバイナリデータで記述するよりもデータサイズが大きくなる傾向がある。この問題を解決するために、XML文書を他の書式に変換、特にバイナリデータに変換してデータサイズを圧縮する取り組みが提案されている。 The information described in the XML document is written in a text format and thus has a high readable specification. On the other hand, the data size tends to be larger than that described in binary data. In order to solve this problem, an approach has been proposed in which an XML document is converted into another format, in particular, binary data to reduce the data size.
圧縮技術としては、従来XMLに限らず利用されている汎用的な可逆圧縮以外に、XMLの冗長な記述を他の表記に変換することで圧縮する技術(特許文献4、5、6など)が提案されている。また、スキーマと呼ばれるXML文書の文法規則を記述したデータを参照し、圧縮対象のXML文書より多くの情報を除いた上でXML文書をより高い圧縮率で圧縮する技術(特許文献1、2、7など)なども提案されている。このような圧縮技術は、圧縮率を高めるために圧縮結果をバイナリデータとして出力するのが一般的である。
As a compression technique, in addition to general-purpose lossless compression that has been used in the past, not only XML, but also compression techniques by converting redundant XML descriptions into other notations (
このような圧縮技術で利用されるスキーマは、一般的には事前に公開され広く共有されるものであるが、XML文書から動的に生成する技術(特許文献3)が利用されるなど、スキーマが共有されていない状況になることもある。 The schema used in such a compression technique is generally published in advance and widely shared, but a schema (Patent Document 3) that dynamically generates from an XML document is used. May not be shared.
しかしながら、従来のスキーマを利用したXML文書のバイナリ化技術では、XML文書の圧縮は考慮されていたが、スキーマ自体の圧縮は考慮されていなかった。スキーマが事前にバイナリXMLを扱う機器に配布されているのであればスキーマの圧縮に配慮する必要はあまりない。しかし、DTDのようにスキーマがXML文書そのものと併せて配布される場合や、特許文献3などのように一般的には配布されていないスキーマを利用する場合は、スキーマ自体のデータサイズを含めて圧縮を考えなければ効率的な運用はできない。一般的にスキーマは非常に大きなデータサイズになり、従来の技術ではスキーマのデータサイズを含めたバイナリXMLの圧縮は効率が良いものではなかった。効率を改善するためにスキーマ自体もXML文書と同様にバイナリ化することも考えられるが、更にスキーマのスキーマが必要になるなど、バイナリXMLを生成するための仕組みが複雑になってしまう。
However, in the conventional XML document binarization technology using a schema, compression of the XML document is considered, but compression of the schema itself is not considered. If the schema is distributed to devices that handle binary XML in advance, there is not much need to consider schema compression. However, when the schema is distributed together with the XML document itself as in DTD, or when a schema that is not generally distributed such as
そこで本発明は、XML文書をバイナリ化する際に、スキーマの情報量を減らし、スキーマも含めた総データサイズを縮小することを目的とする。 Therefore, the present invention has an object of reducing the amount of schema information when binarizing an XML document and reducing the total data size including the schema.
本発明の一側面によれば、XML文書が取り得る構造を記述したスキーマを用いて、テキスト形式で記述されたXML文書の少なくとも一部をバイナリ化するデータ処理装置であって、前記スキーマから、前記XML文書に関係しない要素を削除又は変更することで前記スキーマの情報量を圧縮するスキーマ圧縮手段と、前記スキーマ圧縮手段により情報量が圧縮されたスキーマを用いて、前記XML文書をバイナリ化するバイナリ化手段とを有することを特徴とするデータ処理装置が提供される。 According to one aspect of the present invention, there is provided a data processing apparatus that binarizes at least a part of an XML document described in a text format using a schema that describes a structure that an XML document can take. The XML document is binarized using a schema compression unit that compresses the information amount of the schema by deleting or changing an element not related to the XML document, and a schema whose information amount is compressed by the schema compression unit. There is provided a data processing apparatus characterized by comprising binarization means.
本発明によれば、XML文書をバイナリ化する際に、スキーマの情報量を減らし、スキーマも含めた総データサイズを縮小することができる。 According to the present invention, when an XML document is binarized, the amount of schema information can be reduced, and the total data size including the schema can be reduced.
以下、図面を参照して本発明の好適な実施形態について詳細に説明する。なお、本発明は以下の実施形態に限定されるものではなく、本発明の実施に有利な具体例を示すにすぎない。また、以下の実施形態の中で説明されている特徴の組み合わせの全てが本発明の課題解決手段として必須のものであるとは限らない。 DESCRIPTION OF EMBODIMENTS Hereinafter, preferred embodiments of the present invention will be described in detail with reference to the drawings. In addition, this invention is not limited to the following embodiment, It shows only the specific example advantageous for implementation of this invention. In addition, not all combinations of features described in the following embodiments are indispensable as means for solving the problems of the present invention.
<装置構成>
図1Aは、本実施形態における、XML文書を送受信する2つのデータ処理装置としてのコンピュータ装置の機能構成を概念的に示すブロック図である。
<Device configuration>
FIG. 1A is a block diagram conceptually showing a functional configuration of a computer device as two data processing devices that transmit and receive an XML document in the present embodiment.
データ送信側である第1コンピュータ装置10は、入力したXML文書(テキストXML)をバイナリ化するバイナリXML生成プロセッサ11を備えるとともに、入力したスキーマをバイナリ化するスキーマバイナリ化部12を備える。ここで、スキーマとは、XML文書の文法規則、すなわち、XML文書の取り得る構造を記述したデータである。スキーマバイナリ化部12は、スキーマの情報量を圧縮するための圧縮アルゴリズムが相異なる1つ以上のスキーマ圧縮部13を含んでいる。これにより、スキーマバイナリ化部12は、スキーマバイナリ化部12が採用するバイナリ化アルゴリズムに応じて圧縮アルゴリズムを変更することが可能である。矢印14で示されるように、圧縮スキーマはバイナリXML生成プロセッサ11に送られる。ただし、別の実施形態では、矢印15で示されるように、バイナリXMLとは独立に事前にデータ受信側である第2コンピュータ装置20に送信する構成をとることも可能である。他方、データ受信側である第2コンピュータ装置20は、第1コンピュータ装置10から受信したXML文書(バイナリXML)を解析してテキストXMLを生成する解析部としてのバイナリXMLパーサ21を備える。
The
なお、図1Aに示した構成は説明のための便宜的なものであり、通常は、各コンピュータ装置がバイナリXML生成プロセッサ11とバイナリXMLパーサ21とを備え、どちらのコンピュータ装置もデータ送信側にも受信側にもなれることは言うまでもない。
The configuration shown in FIG. 1A is for convenience of explanation. Normally, each computer device includes a binary XML
図1Bは、第1及び第2コンピュータ装置10,20のハードウェア構成を示すブロック図である。各コンピュータ装置は、単一のコンピュータで実現してもよいし、複数のコンピュータを含み、各コンピュータに機能を分散させたコンピュータシステムとして実現することもできる。複数のコンピュータで構成される場合は、各コンピュータはLocal Area Network (LAN) などで相互に通信可能に接続される。
FIG. 1B is a block diagram showing the hardware configuration of the first and
図1において、101はコンピュータ装置全体を制御するCentral Processing Unit (CPU) である。102は変更を必要としないプログラムやデータを格納するRead Only Memory (ROM) である。103は外部から供給されるプログラムやデータを一時記憶するRandom Access Memory (RAM) である。104はコンピュータ装置に固定して設置されたハードディスクやメモリカードなどを含む記憶部である。この記憶部104は、コンピュータ装置に対して着脱可能なフレキシブルディスク (FD) やCompact Disk (CD) 等の光ディスク、磁気や光カード、ICカード、メモリカード等で構成されてもよい。この記憶部104にはCPU101をバイナリXML生成プロセッサ11、スキーマバイナリ化部12、バイナリXMLパーサ21として機能させるためのプログラムが格納されている。105はポインティングデバイスやキーボードなどで構成される操作部である。106はコンピュータ装置が保持するデータや供給されたデータを表示する表示部である。107はLAN203などのネットワーク回線に接続するためのネットワークインタフェース (i/f) である。108は101〜107の各ユニットを通信可能に接続するシステムバスである。
In FIG. 1,
以下では、本実施形態における基本的なXMLバイナリ化手順について述べ、その後でスキーマの圧縮方法について具体的に述べる。 Hereinafter, a basic XML binarization procedure in this embodiment will be described, and then a schema compression method will be specifically described.
<基本的なXMLバイナリ化手順>
以下では、上述のコンピュータ装置が、圧縮したスキーマを利用してXML文書をバイナリ化する手順と、当該手順でバイナリ化したXML文書を圧縮したスキーマを利用して解析する手順とを説明する。なお、スキーマの圧縮手順の例は後述することとし、ここでは後述の圧縮アルゴリズムのうちの一つ又は複数を組み合わせて利用するものとする。本実施形態では、図2に示すバイナリ化プロセスに従いスキーマを圧縮して圧縮スキーマを生成し、図3に示す解析プロセスに従い圧縮スキーマを用いてバイナリXMLを解析する。また、本実施形態で利用されるスキーマは事前にバイナリ化を行うコンピュータ装置の記憶部104、ROM102、又はRAM103へ保存しておく。
<Basic XML binarization procedure>
Hereinafter, a procedure in which the above-described computer device binarizes an XML document using a compressed schema and a procedure in which an analysis is performed using a schema in which the XML document binarized by the procedure is compressed will be described. An example of the schema compression procedure will be described later, and here, one or a plurality of compression algorithms described later are used in combination. In this embodiment, a compressed schema is generated by compressing the schema according to the binarization process shown in FIG. 2, and binary XML is analyzed using the compressed schema according to the analysis process shown in FIG. The schema used in this embodiment is stored in advance in the
まず、バイナリ化を行うコンピュータ装置の処理手順を、図2を用いて説明する。 First, the processing procedure of the computer device that performs binarization will be described with reference to FIG.
本実施形態におけるコンピュータ装置は、XML文書のバイナリ化を指示されると、バイナリ化対象のXML文書に対応するスキーマがあるかどうかを確認する(S202)。各スキーマにはターゲットとなるXML文書を特定するための名前空間が記述されており、XML文書側にも同様にスキーマを特定するための名前空間が記述されている。そのため、XML文書と対応するスキーマがあるかどうかは、XML文書内で利用している名前空間を確認した上で、コンピュータ装置内に保存されている各スキーマの名前空間に関する技術と比較することで判断できる。名前空間宣言が一致するXML文書とスキーマとのペアが見つからないときは、対応するスキーマがないと判断する。スキーマがなければスキーマを利用しないバイナリ化が可能かどうかを確認する(S203)。確認する方法としては例えば、Fast Infosetや特許文献4に開示されたアルゴリズム等を実際に適用してみる方法がある。なお、Fast Infosetについては、http://java.sun.com/developper/technicalArticles/xml/fastinfoset/ を参照。あるいは、バイナリ化対象となるXML文書よりバイナリ化の対象となる記述(数字のみから構成される要素内容)が含まれているかどうかを調べる方法もある。スキーマを利用せずにバイナリ化することが可能であれば、XML文書のみを利用してバイナリ化XMLを生成する(S204)。
When instructed to binarize the XML document, the computer apparatus according to the present embodiment checks whether there is a schema corresponding to the XML document to be binarized (S202). Each schema describes a namespace for specifying a target XML document, and a namespace for specifying the schema is also described on the XML document side. Therefore, whether there is a schema corresponding to the XML document is confirmed by comparing the namespace used in the XML document with the technology related to the namespace of each schema stored in the computer device. I can judge. If a pair of an XML document and a schema whose namespace declaration matches is not found, it is determined that there is no corresponding schema. If there is no schema, it is checked whether the binarization without using the schema is possible (S203). As a confirmation method, for example, there is a method of actually applying Fast Infoset or the algorithm disclosed in
一方、S202においてスキーマがあるのであれば、そのスキーマを読み込み(S205)、スキーマの圧縮効果があるかどうかを判断する(S206)。判断方法は、後述するスキーマの圧縮アルゴリズムを実際に実行する方法や、各スキーマ圧縮アルゴリズム毎に必要とされるスキーマの記述("interleave"要素が必要、繰り返しを意味する要素が必要 等)の有無によって判断する方法がある。圧縮効果がないのであれば、通常のスキーマを利用したバイナリ化を行う(S207)。 On the other hand, if there is a schema in S202, the schema is read (S205), and it is determined whether there is a schema compression effect (S206). Judgment methods include the method of actually executing the schema compression algorithm, which will be described later, and the description of the schema required for each schema compression algorithm ("interleave" element is required, elements that mean repetition are required, etc.) There is a method to judge by. If there is no compression effect, binarization using a normal schema is performed (S207).
XML文書のスキーマの情報量を圧縮できるのであれば、スキーマの情報量を圧縮して圧縮スキーマを生成し(S208)、コンピュータ装置内の記憶部104又はRAM103へ出力する。更に、保存した圧縮スキーマを利用してXML文書を圧縮する(S209)。なお、S209でのバイナリ化のアルゴリズムはS207におけるバイナリ化のアルゴリズムと全く同じものになる。
If the schema information amount of the XML document can be compressed, a compression schema is generated by compressing the schema information amount (S208) and output to the
本実施形態におけるコンピュータ装置がバイナリ化を複数回行う場合は、上記のプロセスを行う前に次の処理を実行するようにしてもよい。はじめに、既に圧縮スキーマが生成され記憶部104又はRAM103に記憶されているかどうかを確認する(S210)。既に圧縮スキーマが生成され保存されていた場合には、その圧縮スキーマが今回のバイナリ化アルゴリズムに適切なものかどうかを判定する(S211)。適切な圧縮スキーマであるならば、圧縮スキーマを生成する一連の処理であるS202-S208を省略し、直ちにXML文書のバイナリ化を実行する(S209)。
When the computer apparatus according to the present embodiment performs binarization a plurality of times, the following process may be executed before performing the above process. First, it is confirmed whether a compression schema has already been generated and stored in the
その後、バイナリXMLを他のコンピュータ装置で扱う際はバイナリXML自体を転送する。このとき、転送先にスキーマ又は圧縮スキーマがない場合は併せて転送する必要がある。スキーマ又は圧縮スキーマは、バイナリXMLと同時に転送したり、又はバイナリXMLを解析するコンピュータが実際にスキーマ情報を必要とした時に転送するなどの方法が利用できる(図は省略)。圧縮スキーマを受け取ったコンピュータ装置は、受け取った圧縮スキーマを記憶部104、又はRAM103へ保存する。
Thereafter, when the binary XML is handled by another computer device, the binary XML itself is transferred. At this time, when there is no schema or compression schema at the transfer destination, it is necessary to transfer it together. The schema or the compressed schema can be transferred at the same time as the binary XML, or transferred when the computer that analyzes the binary XML actually needs the schema information (not shown). The computer apparatus that has received the compression schema stores the received compression schema in the
次に、コンピュータ装置におけるバイナリXMLの解析処理手順を、図3を用いて説明する。 Next, the binary XML analysis processing procedure in the computer apparatus will be described with reference to FIG.
本実施形態におけるコンピュータ装置は、バイナリXMLの解析を指示されると、解析対象のバイナリXMLの圧縮スキーマが記憶部104又はRAM103に保存されているかどうかを調べる(S302)。具体的には、バイナリ化の際と同様に、バイナリXML側の名前空間宣言と圧縮スキーマ側の名前空間宣言とを比較し、一致しているかどうかで判断できる。利用できる圧縮スキーマがあればその圧縮スキーマとバイナリXMLとを組み合わせ、バイナリ化前のXML文書の持つ情報を解析し取得する(S303-S304)。
When instructed to analyze binary XML, the computer device in this embodiment checks whether the binary XML compression schema to be analyzed is stored in the
一方、圧縮スキーマはないが通常のスキーマが利用できるのであれば(S305,YES)、スキーマとバイナリXMLとを組み合わせ、バイナリ化前のXML文書の持つ情報を解析し取得する(S306-S307)。この際の利用できるかどうかの判断も、バイナリXMLとスキーマの名前空間宣言を比較することで判断できる。 On the other hand, if there is no compression schema but a normal schema can be used (S305, YES), the schema and binary XML are combined, and the information of the XML document before binarization is analyzed and acquired (S306-S307). You can also determine whether it can be used by comparing the binary XML and the namespace declaration of the schema.
また、スキーマもないのであれば、バイナリXML単体での解析を行う(S308-S309)。 If there is no schema, the binary XML alone is analyzed (S308-S309).
<スキーマの圧縮方法>
以下、本実施形態におけるスキーマの圧縮アルゴリズムについて説明する。スキーマを記述する言語はRELAX NGとする。圧縮の対象とするスキーマの例を図12に、バイナリ化対象となるXML文書の一例を図13に示す(読みやすくするために適宜行番号、空白、改行を入れてあるが、本来は含まれていないものとする。以下同様)。なお、図12に示したスキーマの例は、基本的にはSVG(Scalable Vector Graphics) 1.1の仕様に準拠しているが、説明用に簡略化してある。実際にはSVGは更に多くの子要素・属性を持ち、子要素も更に子要素・属性を持つが、説明を分かり易くするために省略した。
<Schema compression method>
The schema compression algorithm according to this embodiment will be described below. The language for describing the schema is RELAX NG. An example of the schema to be compressed is shown in FIG. 12, and an example of the XML document to be binarized is shown in FIG. The same shall apply hereinafter). The schema example shown in FIG. 12 basically conforms to the specification of SVG (Scalable Vector Graphics) 1.1, but is simplified for explanation. Actually, SVG has more child elements / attributes, and child elements have more child elements / attributes, but they have been omitted for clarity.
なお、可逆圧縮/不可逆圧縮に関わらず、他にも様々なスキーマ圧縮アルゴリズムが利用できる。また、以下に示す例では圧縮スキーマをテキスト形式のままとしているが、バイナリ形式への変換技術を組み合わせることもできる。 Various other schema compression algorithms can be used regardless of lossless / lossy compression. In the example shown below, the compression schema is kept in the text format, but it is possible to combine the conversion technology to the binary format.
本実施形態におけるスキーマのバイナリ化アルゴリズムは、例えば次のようなものである。 The schema binarization algorithm in this embodiment is, for example, as follows.
(1)スキーマに定義されている要素毎に子要素の選択肢をリストアップし、宣言順にIDを割り振る。
(2)IDを格納するために必要な最小ビット数を計算する。
(3)XML文書をバイナリ化する時はXML文書に記述された親要素と子要素の組合せから置換するIDを選択し、IDと置換する。IDは上記最小ビット数の領域を確保して記述する。
(1) List the choices of child elements for each element defined in the schema, and assign IDs in the order of declaration.
(2) Calculate the minimum number of bits required to store the ID.
(3) When binarizing an XML document, an ID to be replaced is selected from a combination of a parent element and a child element described in the XML document and replaced with the ID. The ID is described by securing an area with the minimum number of bits.
図12のスキーマより、SVG要素は子要素として"rect"、"path"等の12個の選択肢を持つことが分かる。このことより、実際にIDを生成すると12種類のIDが割り振られる。この12個の選択肢は、実際にどの子要素が使われるのかに関わらずスキーマに記述された個数分だけカウントされる。実際に割り振られた結果を図14に示す。選択肢が12種類あるため、この選択肢を実際にデータとして記述するためには4ビットの領域が必要になる。図13に示すXML文書では、"svg"要素は子要素として"rect"要素と"image"要素を持つ。図13に示すXML文書をバイナリ化する時は、上記子要素にはそれぞれ"1"と"6"の値を割り振る必要があるので、それぞれ4ビットの領域を確保した上で値を設定する。 From the schema of FIG. 12, it can be seen that the SVG element has 12 options such as “rect” and “path” as child elements. As a result, when IDs are actually generated, 12 types of IDs are allocated. These 12 options are counted by the number described in the schema regardless of which child element is actually used. The actually allocated result is shown in FIG. Since there are 12 types of options, a 4-bit area is required to actually describe these options as data. In the XML document shown in FIG. 13, the “svg” element has a “rect” element and an “image” element as child elements. When the XML document shown in FIG. 13 is binarized, it is necessary to assign values “1” and “6” to the child elements. Therefore, values are set after securing a 4-bit area.
以上のバイナリ化に対するスキーマの圧縮アルゴリズムを以下に説明する。 The schema compression algorithm for the above binarization will be described below.
本圧縮アルゴリズムでは、バイナリ化対象のXML文書で利用される要素だけをスキーマに残し、それ以外の情報はスキーマの文法に反しない範囲で削除する。つまり、以下のパターンに従いスキーマを変換する。 In this compression algorithm, only the elements used in the XML document to be binarized are left in the schema, and other information is deleted as long as it does not violate the schema syntax. That is, the schema is converted according to the following pattern.
(1)各要素において、取り得る子要素の種類をリストアップする。
リストアップの方法としてとは例えば次のような方法がある。
・アプリケーション又はユーザから利用される子要素のリストを受け取る方法。
・バイナリ化対象となる1又は複数のXML文書から要素の親子関係をリストアップし、実際に利用されている子要素のリストを生成する方法。
(2)スキーマにおける"element"要素より、バイナリ化対象のXML文書において子要素として利用されない"element"子要素を削除する。
(1) For each element, list possible child element types.
Examples of the listing method include the following methods.
A method of receiving a list of child elements used from an application or user.
A method for listing the parent-child relationships of elements from one or more XML documents to be binarized and generating a list of actually used child elements.
(2) The “element” child element that is not used as a child element in the XML document to be binarized is deleted from the “element” element in the schema.
"svg"要素の子要素が、"rect"要素、"Image"要素のみである場合、図12の05行目乃至16行目のうち、残すべき行は05行目と10行目のみとなる。不要となった行を削除して生成した圧縮スキーマを図15に示す。オリジナルのスキーマは20行から構成されていたが、圧縮スキーマは10行に圧縮されていることが分かる。 When the child elements of the “svg” element are only the “rect” element and the “Image” element, among the 05th to 16th lines in FIG. 12, the only remaining lines are the 05th and 10th lines. . FIG. 15 shows a compression schema generated by deleting unnecessary lines. It can be seen that the original schema consisted of 20 lines, but the compressed schema was compressed to 10 lines.
実際に、圧縮スキーマに対し本実施形態におけるバイナリ化アルゴリズムを適用すると、次のようになる。 Actually, when the binarization algorithm in this embodiment is applied to the compression schema, the result is as follows.
図15の05行目、06行目より、"svg"要素は"rect"要素と"image"要素の2つの子要素を選択肢として持つことが分かる。これにより、2種類のIDが割り振られる。IDの割り振り結果の例を図16に示す。選択肢が2つのみのため、この選択肢を実際にデータとして記述するためには1ビットの領域しか必要としない。先に述べた通り、図13に示すXML文書では、"svg"要素は子要素として"rect"要素と"image"要素のみを持つ。図13に示すXML文書をバイナリ化する時は、上記子要素にそれぞれ"1"と"2"の値を割り振る必要があるので、それぞれ1ビットの領域のみ確保した上で値を設定する。 From the 05th and 06th lines in FIG. 15, it can be seen that the “svg” element has two child elements, “rect” element and “image” element, as options. As a result, two types of IDs are allocated. An example of the ID allocation result is shown in FIG. Since there are only two options, only one bit area is required to actually describe this option as data. As described above, in the XML document shown in FIG. 13, the “svg” element has only “rect” and “image” elements as child elements. When the XML document shown in FIG. 13 is binarized, the values “1” and “2” need to be allocated to the child elements, respectively, so that a value is set after securing only a 1-bit area.
以上のようなスキーマ圧縮アルゴリズムを利用することにより、本来のスキーマより小さいサイズの圧縮スキーマを用いて、バイナリXMLを生成・利用することができるようになる。なお、バイナリ化アルゴリズムは従来と共通のものを利用できるので、新たにバイナリ化アルゴリズムの処理系を追加する必要もない。 By using the schema compression algorithm as described above, binary XML can be generated and used using a compression schema having a size smaller than the original schema. In addition, since the same binarization algorithm can be used as before, it is not necessary to add a processing system for the binarization algorithm.
<変形例1>
以下の例では、圧縮の対象とするスキーマを図4に示すスキーマとし、バイナリ化対象のXML文書を図5に示すXML文書とする。
<
In the following example, the schema to be compressed is the schema shown in FIG. 4, and the XML document to be binarized is the XML document shown in FIG.
この例におけるバイナリ化アルゴリズム、次のようなものである。 The binarization algorithm in this example is as follows.
(1)スキーマに定義されている要素名、属性名、定数に対し、宣言順にIDを割り振る。
(2)XML文書をバイナリ化するときはXML文書に記述された要素名、属性名、定数を上記IDに置換する。
(1) Assign IDs in the order of declaration to element names, attribute names, and constants defined in the schema.
(2) When the XML document is binarized, the element name, attribute name, and constant described in the XML document are replaced with the ID.
図4のスキーマより要素名、属性名、定数にIDを割り振るためには、element要素のname属性の属性値・value要素の要素内容から文字列を取得することになる。図4のスキーマの先頭から順に要素名・属性名・定数を取得し、IDを割り振った結果を図6に示す。取得した文字列は、
・02行目の"top"
・04行目の"int_value"
・07行目の"ubyte_value"
・10行目の"int_list"
・19行目の"value_foo"
・20行目の"foo"
となり、1から順にIDを割り振っている。
In order to assign IDs to element names, attribute names, and constants from the schema shown in FIG. FIG. 6 shows the result of obtaining element names, attribute names, and constants from the top of the schema in FIG. 4 and assigning IDs. The obtained string is
・ "Top" on
・ "Int_value" on
・ "Ubyte_value" on
・ "Int_list" on
・ "Value_foo" on
・ "Foo" on
ID is assigned in order from 1.
一方、図6の対応表を利用して図5のXML文書をバイナリ化した結果を図7に示す。図7に示すように、
・01行目の"top"が1
・02行目の"int_value"が2
・03行目の"ubyte_value"が3
・04行目の"int_list"が4
・05行目の"value_foo"が5
・05行目の"foo"が6
・06行目の"top"が1
に、それぞれ置き換えられている。なお、図7では、置換結果を下線の付いた数字で記述しているが、実際は下線を引いた数字の部分は通常の文字と区別されたフォーマットで管理されている。
On the other hand, FIG. 7 shows the result of binarizing the XML document of FIG. 5 using the correspondence table of FIG. As shown in FIG.
・ "Top" on
・ "Int_value" on
・ "Ubyte_value" on
・ "Int_list" on
-"Value_foo" on
・ "Foo" on
・ "Top" on
Respectively. In FIG. 7, the replacement result is described with underlined numbers. Actually, the underlined numbers are managed in a format that is distinguished from normal characters.
バイナリXMLから元のXML文書の情報を取得する場合は、同様にスキーマからID対応表を生成し、図7に示したバイナリXMLの下線を引いた数字をID対応表にある文字列と置換する。 When acquiring the information of the original XML document from binary XML, similarly generate an ID correspondence table from the schema, and replace the underlined numbers in binary XML shown in FIG. 7 with the character strings in the ID correspondence table. .
以上のバイナリ化に対するスキーマの圧縮アルゴリズムを以下に説明する。 The schema compression algorithm for the above binarization will be described below.
本圧縮アルゴリズムでは、バイナリ化対象の要素名・属性名・要素内容に関する文字列を記述するために必要な要素・属性だけを圧縮スキーマに残し、それ以外の情報は、スキーマの文法に反しない範囲で削除する。つまり、以下のパターンに従いスキーマを変換する。 In this compression algorithm, only the elements and attributes necessary for describing the character string related to the element name, attribute name, and element content to be binarized are left in the compression schema, and other information is within the scope of the schema of the schema. Delete with. That is, the schema is converted according to the following pattern.
・start要素は残す。
・interleave、oneOrMore、listはIDを割り振る順番には影響しないため削除する。
・element要素とname属性のペアは文字列を取得するために残す。
・data要素は取得対象となる文字列を持たないので削除する。
・value要素はIDを割り振る文字列を持つために残す。
・要素内容を持たなくなった開始タグ、終了タグの組は空要素タグに置換する。
-Leave the start element.
・ Delete interleave, oneOrMore, and list because they do not affect the ID allocation order.
-Leave the element element and name attribute pair to get the string.
-Since the data element has no character string to be acquired, delete it.
• Leave the value element to have a string to allocate the ID.
• Replace the start tag and end tag pairs that no longer have element content with empty element tags.
この結果、図4で残すべき行は01行目、02行目、04行目、06行目、07行目、09行目、10行目、18行目、19行目、20行目、21行目、23行目、24行目のみとなる。また、05行目のdata要素が削除されるため、04行目と06行目にあるelement要素の開始・終了タグの組は一つの空要素タグに置換される。07・09行目の組、10・18行目の組も同様である。その結果、24行あったスキーマは10行の圧縮スキーマに変換される。生成された圧縮スキーマを図8に示す。 As a result, the lines to be left in FIG. 4 are the 01 line, 02 line, 04 line, 06 line, 07 line, 09 line, 10 line, 18 line, 19 line, 20 line, Only the 21st, 23rd and 24th lines. Since the data element on the 05th line is deleted, the set of start / end tags of the element element on the 04th and 06th lines is replaced with one empty element tag. The same applies to the 07/09 line group and the 10/18 line group. As a result, the schema with 24 lines is converted into a 10-line compressed schema. The generated compression schema is shown in FIG.
圧縮スキーマに対して本例におけるバイナリ化アルゴリズムを適用すると、次のようになる。図8の02行目より順に"top"、"int_value"、"ubyte_value"、"int_list"、"value_foo"、"foo"の6つの文字列が取得される。この順にIDを割り振ると、図6に示すID対応表と全く同じID対応表が生成される。同じID対応表を利用することになるため、バイナリ化アルゴリズムの残りの処理も全く同じ結果となり、図7に示すバイナリXMLが生成される。バイナリXMLを解析する際も同じID対応表が生成され同様の結果が得られる。 Applying the binarization algorithm in this example to the compression schema is as follows. Six character strings “top”, “int_value”, “ubyte_value”, “int_list”, “value_foo”, and “foo” are acquired in order from the second line in FIG. 8. If IDs are assigned in this order, an ID correspondence table identical to the ID correspondence table shown in FIG. 6 is generated. Since the same ID correspondence table is used, the remaining processing of the binarization algorithm has exactly the same result, and the binary XML shown in FIG. 7 is generated. When parsing binary XML, the same ID correspondence table is generated and the same result is obtained.
この例におけるバイナリ化アルゴリズムに対しては、以上に示したスキーマ圧縮アルゴリズムを利用することで、本来のスキーマより小さいサイズの圧縮スキーマを用いて同じサイズのバイナリXMLを生成・利用することができるようになる。また、バイナリ化アルゴリズムも共通のものを利用できるので、新たにバイナリ化アルゴリズムの処理系を追加する必要もない。 For the binarization algorithm in this example, using the schema compression algorithm shown above, it is possible to generate and use binary XML of the same size using a compression schema of a size smaller than the original schema. become. In addition, since a common binarization algorithm can be used, it is not necessary to add a new processing system for the binarization algorithm.
<変形例2>
以下の例では、次のようなバイナリ化アルゴリズムを採用する。
<
In the following example, the following binary algorithm is adopted.
(1)スキーマ中にループを意味する記述(ループ文)があれば、バイナリXMLの該当個所の先頭にループの繰り返し回数を記述する。
(2)データ型が指定されている文字列は指定されたデータ型に変換する。
(1) If there is a description (loop statement) that means a loop in the schema, describe the number of loop iterations at the beginning of the corresponding location in binary XML.
(2) A character string with a specified data type is converted to the specified data type.
図4のスキーマでループする記述は11行目から始まるoneOrMore要素となり、『int型の要素内容が3回連続する並び』が繰り返されると定義されている。図5の該当個所は05行目となり、『int型の要素内容が3回連続する並び』が2回繰り返されている。これをバイナリ化すると、先頭に値の『2』が入り、続いてint型の値として計6つの値が順に格納される。図9に、バイナリ化した結果の一部を示す。下線を引いた部分は、実際にはそれぞれ値として扱われている。 The looping description in the schema of FIG. 4 is a oneOrMore element starting from the 11th line, and it is defined that “a sequence in which int type element contents are continued three times” is repeated. The corresponding part in FIG. 5 is the 05th line, and “an array of int type element contents three times in succession” is repeated twice. When this is binarized, the value “2” is placed at the beginning, followed by a total of six values stored as int type values. FIG. 9 shows a part of the result of binarization. The underlined parts are actually treated as values.
バイナリXMLから元のXML文書の情報を取得する場合は、図4のスキーマから該当場所が『int型の要素内容が3回連続する並び』が繰り返されている情報を取得し、図9の先頭の値『2』から繰り返し回数が2回であると判断する。結果として、合計6個のintが並んでいると判断し、続く領域からintの領域を6個分読み取り、それぞれintの値として解析することで元の情報を正しく取得できる。 When acquiring the information of the original XML document from the binary XML, the information in which the corresponding location “a sequence in which the int type element contents are repeated three times” is repeated is acquired from the schema of FIG. From the value of “2”, it is determined that the number of repetitions is 2. As a result, it is determined that a total of six ints are arranged, and six int areas are read from the subsequent areas, and each is analyzed as an int value, whereby the original information can be acquired correctly.
以上のバイナリ化に対するスキーマの圧縮アルゴリズムを以下に説明する。 The schema compression algorithm for the above binarization will be described below.
本圧縮アルゴリズムでは、バイナリ化におけるループ回数のみ変化するようスキーマの記述を変更する。つまり、以下のパターンに従いスキーマを変換する。
・ループを意味する要素(oneOrMore、zeroOrMore)を見つける。
・ループの中があるパターンの繰り返し(『int型が3回』や『byte型とString型のペアが2回』など)の場合は、パターン1回分(『int型が1回』や『byte型とString型のペアが1回』など)に置換する。
In this compression algorithm, the schema description is changed so that only the number of loops in binarization changes. That is, the schema is converted according to the following pattern.
-Find the elements (oneOrMore, zeroOrMore) that mean the loop.
-If the pattern in the loop is repeated ("int type is 3 times" or "byte type and String type pair is 2 times"), the pattern is 1 time ("int type is 1 time") or "byte" Type / String type pair once ”etc.).
この結果、図4のスキーマの11行目乃至17行目は図10の11行目乃至13行目の3行に置換され、int型の要素内容を1回以上繰り返す圧縮スキーマとなる。なお、上記のルールだけを適用するとdata要素の親要素としてlist要素が残るが、子要素を1つしか持たないlist要素はlist要素を削除しても意味が変わらないため同時に変更を加えた。 As a result, the 11th to 17th lines in the schema of FIG. 4 are replaced with the 3rd line of the 11th to 13th lines of FIG. 10, resulting in a compressed schema that repeats the int type element contents one or more times. If only the above rule is applied, the list element remains as the parent element of the data element. However, the meaning of the list element having only one child element does not change even if the list element is deleted.
圧縮スキーマを用いて本例におけるバイナリ化アルゴリズムを適用すると、次のようになる。 Applying the binarization algorithm in this example using a compression scheme results in the following.
図10の11-13行目より、int_list要素の要素内容はint型1つが1回以上繰り返されることが分かる。一方、バイナリ化対象となる図5に示すXML文書は要素内容として6個の数値を列挙してあるので、繰り返し回数『6』と、int型の値6個のデータに変換される。変換結果を図11に示す。図9と異なり、05行目の先頭に記述されている繰り返し回数が『2』から『6』へ変化しているが、バイナリXMLのサイズ自体は同じ結果となる。バイナリ化XMLを解析する際も、圧縮スキーマを利用することでintの領域6個を取り出すことができるので、スキーマを変更する前と同じ結果が取得できる。 From the 11th to 13th lines in FIG. 10, it can be seen that one int type element content of the int_list element is repeated one or more times. On the other hand, since the XML document shown in FIG. 5 to be binarized lists six numerical values as element contents, it is converted into data of the number of repetitions “6” and six int type values. The conversion result is shown in FIG. Unlike FIG. 9, the number of repetitions described at the beginning of the 05th line changes from “2” to “6”, but the size of the binary XML itself is the same. When parsing binarized XML, it is possible to extract 6 int areas by using the compression schema, so the same result as before the schema change can be obtained.
この例におけるバイナリ化アルゴリズムに対しては、以上に示したスキーマ圧縮アルゴリズムを利用することで、本来のスキーマより小さいサイズの圧縮スキーマを用いて同じサイズのバイナリXMLを生成・利用することができるようになる。また、バイナリ化アルゴリズムも共通のものを利用できるので、新たにバイナリ化アルゴリズムの処理系を追加する必要もない。 For the binarization algorithm in this example, using the schema compression algorithm shown above, it is possible to generate and use binary XML of the same size using a compression schema of a size smaller than the original schema. become. In addition, since a common binarization algorithm can be used, it is not necessary to add a new processing system for the binarization algorithm.
<他の実施形態>
以上、本発明の実施形態を詳述したが、本発明は、複数の機器から構成されるシステムに適用してもよいし、また、一つの機器からなる装置に適用してもよい。
<Other embodiments>
As mentioned above, although embodiment of this invention was explained in full detail, this invention may be applied to the system comprised from several apparatuses, and may be applied to the apparatus which consists of one apparatus.
なお、本発明は、前述した実施形態の各機能を実現するプログラムを、システム又は装置に直接又は遠隔から供給し、そのシステム又は装置に含まれるコンピュータがその供給されたプログラムコードを読み出して実行することによっても達成される。 In the present invention, a program for realizing each function of the above-described embodiments is supplied directly or remotely to a system or apparatus, and a computer included in the system or apparatus reads and executes the supplied program code. Can also be achieved.
したがって、本発明の機能・処理をコンピュータで実現するために、そのコンピュータが実行可能なプログラムコード自体も本発明を実現するものである。つまり、上記機能・処理を実現するためのコンピュータプログラム自体も本発明の一つである。 Therefore, since the functions and processes of the present invention are implemented by a computer, the program code executable by the computer also implements the present invention. That is, the computer program itself for realizing the functions and processes is also one aspect of the present invention.
その場合、プログラムの機能を有していれば、オブジェクトコード、インタプリタにより実行されるプログラム、OSに供給するスクリプトデータ等、プログラムの形態を問わない。 In this case, the program may be in any form as long as it has a program function, such as an object code, a program executed by an interpreter, or script data supplied to the OS.
プログラムを供給するためのコンピュータ読み取り可能な記録媒体としては、例えば、フレキシブルディスク、ハードディスク、光ディスク、光磁気ディスク、MO、CD-ROM、CD-R、CD-RWなどがある。また、記録媒体としては、磁気テープ、不揮発性のメモリカード、ROM、DVD(DVD-ROM,DVD-R)などもある。 Examples of the computer-readable recording medium for supplying the program include a flexible disk, a hard disk, an optical disk, a magneto-optical disk, an MO, a CD-ROM, a CD-R, and a CD-RW. Further, examples of the recording medium include a magnetic tape, a nonvolatile memory card, a ROM, and a DVD (DVD-ROM, DVD-R).
また、プログラムは、クライアントコンピュータのブラウザを用いてインターネットのホームページからダウンロードしてもよい。すなわち、ホームページから本発明のコンピュータプログラムそのもの、もしくは圧縮され自動インストール機能を含むファイルをハードディスク等の記録媒体にダウンロードしてもよい。また、本発明のプログラムを構成するプログラムコードを複数のファイルに分割し、それぞれのファイルを異なるホームページからダウンロードする形態も考えられる。つまり、本発明の機能・処理をコンピュータで実現するためのプログラムファイルを複数のユーザに対してダウンロードさせるWWWサーバも、本発明の構成要件となる場合がある。 The program may be downloaded from a homepage on the Internet using a browser on a client computer. That is, the computer program itself of the present invention or a compressed file including an automatic installation function may be downloaded from a home page to a recording medium such as a hard disk. Further, it is also possible to divide the program code constituting the program of the present invention into a plurality of files and download each file from a different home page. In other words, a WWW server that allows a plurality of users to download a program file for realizing the functions and processing of the present invention on a computer may be a constituent requirement of the present invention.
また、本発明のプログラムを暗号化してコンピュータ読み取り可能なCD−ROM等のコンピュータ読み取り可能な記憶媒体に格納してユーザに配布してもよい。この場合、所定条件をクリアしたユーザにのみ、インターネットを介してホームページから暗号化を解く鍵情報をダウンロードさせ、その鍵情報で暗号化されたプログラムを復号して実行し、プログラムをコンピュータにインストールしてもよい。 Further, the program of the present invention may be encrypted and stored in a computer-readable storage medium such as a computer-readable CD-ROM and distributed to users. In this case, only the user who cleared the predetermined condition is allowed to download the key information to be decrypted from the homepage via the Internet, decrypt the program encrypted with the key information, execute it, and install the program on the computer May be.
また、コンピュータが、読み出したプログラムを実行することによって、前述した実施形態の機能が実現されてもよい。なお、そのプログラムの指示に基づき、コンピュータ上で稼動しているOSなどが、実際の処理の一部又は全部を行ってもよい。もちろん、この場合も、前述した実施形態の機能が実現され得る。 Further, the functions of the above-described embodiments may be realized by the computer executing the read program. Note that an OS or the like running on the computer may perform part or all of the actual processing based on the instructions of the program. Of course, also in this case, the functions of the above-described embodiments can be realized.
さらに、記録媒体から読み出されたプログラムが、コンピュータに挿入された機能拡張ボードやコンピュータに接続された機能拡張ユニットに備わるメモリに書き込まれてもよい。そのプログラムの指示に基づき、その機能拡張ボードや機能拡張ユニットに備わるCPUなどが実際の処理の一部又は全部を行ってもよい。このようにして、前述した実施形態の機能が実現されることもある。 Furthermore, the program read from the recording medium may be written in a memory provided in a function expansion board inserted into the computer or a function expansion unit connected to the computer. Based on the instructions of the program, a CPU or the like provided in the function expansion board or function expansion unit may perform part or all of the actual processing. In this way, the functions of the above-described embodiments may be realized.
101 CPU
102 ROM
103 RAM
104 記憶部
105 操作部
106 表示部
107 ネットワークi/f
108 システムバス
101 CPU
102 ROM
103 RAM
104
108 System bus
Claims (7)
前記スキーマから、前記XML文書に関係しない要素を削除又は変更することで前記スキーマの情報量を圧縮するスキーマ圧縮手段と、
前記スキーマ圧縮手段により情報量が圧縮されたスキーマを用いて、前記XML文書をバイナリ化するバイナリ化手段と、
を有することを特徴とするデータ処理装置。 A data processing apparatus that binarizes at least a part of an XML document described in a text format using a schema that describes a structure that an XML document can take.
Schema compression means for compressing the amount of information of the schema by deleting or changing elements not related to the XML document from the schema;
Binarization means for binarizing the XML document using a schema whose amount of information is compressed by the schema compression means;
A data processing apparatus comprising:
スキーマ圧縮手段が、前記スキーマから、前記XML文書に関係しない要素を削除又は変更することで前記スキーマの情報量を圧縮するスキーマ圧縮ステップと、
バイナリ化手段が、前記スキーマ圧縮ステップで情報量が圧縮されたスキーマを用いて、前記XML文書をバイナリ化するバイナリ化ステップと、
を有することを特徴とするデータ処理方法。 A data processing method for binarizing at least a part of an XML document described in a text format using a schema describing a structure that an XML document can take.
A schema compression step, wherein the schema compression means compresses the amount of information of the schema by deleting or changing an element not related to the XML document from the schema;
A binarizing unit that binarizes the XML document using the schema in which the information amount is compressed in the schema compressing step;
A data processing method characterized by comprising:
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2007299833A JP2009128945A (en) | 2007-11-19 | 2007-11-19 | Data processing apparatus, method and program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2007299833A JP2009128945A (en) | 2007-11-19 | 2007-11-19 | Data processing apparatus, method and program |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2009128945A true JP2009128945A (en) | 2009-06-11 |
Family
ID=40819850
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2007299833A Withdrawn JP2009128945A (en) | 2007-11-19 | 2007-11-19 | Data processing apparatus, method and program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2009128945A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2014021990A (en) * | 2012-07-20 | 2014-02-03 | Fujitsu Ltd | Exi schema document encoding |
WO2015052967A1 (en) * | 2013-10-08 | 2015-04-16 | ソニー株式会社 | Server device, client device, information processing method, and recording medium |
WO2017212726A1 (en) * | 2016-06-06 | 2017-12-14 | 岡田 泰成 | Method, program, recording medium, and device for assisting in creating homepage |
-
2007
- 2007-11-19 JP JP2007299833A patent/JP2009128945A/en not_active Withdrawn
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2014021990A (en) * | 2012-07-20 | 2014-02-03 | Fujitsu Ltd | Exi schema document encoding |
WO2015052967A1 (en) * | 2013-10-08 | 2015-04-16 | ソニー株式会社 | Server device, client device, information processing method, and recording medium |
US10282403B2 (en) | 2013-10-08 | 2019-05-07 | Sony Corporation | Server device, client device, information processing method, and recording medium |
WO2017212726A1 (en) * | 2016-06-06 | 2017-12-14 | 岡田 泰成 | Method, program, recording medium, and device for assisting in creating homepage |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7043686B1 (en) | Data compression apparatus, database system, data communication system, data compression method, storage medium and program transmission apparatus | |
RU2419846C2 (en) | Encoding markup language data | |
US8756489B2 (en) | Method and system for dynamic assembly of form fragments | |
US7886223B2 (en) | Generating a statistical tree for encoding/decoding an XML document | |
CN101809567B (en) | Two-pass hash extraction of text strings | |
US7260580B2 (en) | Binary XML | |
JP4653381B2 (en) | Structured document compression / decompression method | |
JP2004032774A (en) | Method and system for encoding markup language document | |
JP2007226813A (en) | Method for compressing/decompressing structured document | |
US20120086585A1 (en) | Local binary xml string compression | |
US20140297692A1 (en) | Encoder, encoding method, and program | |
US20080133443A1 (en) | Methods and Apparatus for User-Guided Inference of Regular Expressions for Information Extraction | |
JP2004102926A (en) | Identifier generating method, identity determining method, identifier sending method, identifier generating device, identity determining device, and identifier sending device | |
JP2009128945A (en) | Data processing apparatus, method and program | |
US20100049727A1 (en) | Compressing xml documents using statistical trees generated from those documents | |
JP2017126185A (en) | Encoding program, encoding method, encoder, decoding program, decoding method and decoder | |
KR101044870B1 (en) | Method and Apparatus for Encoding and Decoding XML Documents Using Path Code | |
RU2294012C2 (en) | Data structure and methods for transforming stream of bits to electronic document and generation of bit stream from electronic document based on said data structure | |
JP5194936B2 (en) | File conversion apparatus, file conversion method, and program | |
KR20020056593A (en) | Realtime Contents Conversion System and its Method for Coverting Wire Contents to Wireless Contents | |
JP2007148751A (en) | Encoding method, encoding device, encoding program and decoding device for structured document and data structure for encoded structured document | |
KR100952051B1 (en) | Method and Apparatus for Encoding and Decoding XML Documents Using Path Code | |
JPWO2005101210A1 (en) | Data analysis apparatus and data analysis program | |
KR101661646B1 (en) | Webpage service system and method using image code | |
US7716576B1 (en) | Flexible XML parsing based on p-code |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A300 | Application deemed to be withdrawn because no request for examination was validly filed |
Free format text: JAPANESE INTERMEDIATE CODE: A300 Effective date: 20110201 |