JP2007011998A - Xpath expression processing method, xpath expression processor, xpath expression processing program, storage medium storing the program, and automaton - Google Patents
Xpath expression processing method, xpath expression processor, xpath expression processing program, storage medium storing the program, and automaton Download PDFInfo
- Publication number
- JP2007011998A JP2007011998A JP2005195572A JP2005195572A JP2007011998A JP 2007011998 A JP2007011998 A JP 2007011998A JP 2005195572 A JP2005195572 A JP 2005195572A JP 2005195572 A JP2005195572 A JP 2005195572A JP 2007011998 A JP2007011998 A JP 2007011998A
- Authority
- JP
- Japan
- Prior art keywords
- update
- dfa
- nfa
- xpath expression
- state
- 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.)
- Granted
Links
Images
Landscapes
- Document Processing Apparatus (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
本発明は、オートマトンを用いたXPath式の処理に関し、殊にXPath式の差分追加を行う、XPath式処理方法、XPath式処理装置、XPath式処理プログラムおよびそのプログラムを記憶した記憶媒体、ならびに、オートマトンに関する。 The present invention relates to an XPath type process using an automaton, and in particular, an XPath type processing method, an XPath type processing apparatus, an XPath type processing program, a storage medium storing the program, and an automaton for adding an XPath type difference About.
例えば、XML(Extensible Markup Language)をベースにした新しいニュース配信フォーマットにNewsML(ニューズエムエル)がある。NewsMLは、ニュース記事、画像、動画、音声等のニュース素材を自由に組み合わせ、ウェブサイトや携帯電話、テレビ(テレビのデータ放送)等、さまざまな機器を対象に情報を送ることができる。NewsMLの受け側(ユーザ)は、フィルタエンジンに検索条件を登録しておくことで、必要な情報を得ることができる。検索条件はXML問い合わせ言語で記述されるため、フィルタエンジンは個々のXPath式を処理すると共に、XPath(XML Path Language)式の追加を処理することになる。 For example, a new news distribution format based on XML (Extensible Markup Language) is NewsML. NewsML can freely combine news materials such as news articles, images, videos, and voices, and can send information to various devices such as websites, mobile phones, and televisions (TV data broadcasts). A recipient (user) of NewsML can obtain necessary information by registering a search condition in the filter engine. Since the search condition is described in the XML query language, the filter engine processes each XPath expression and also adds an XPath (XML Path Language) expression.
XPath式を用いて入力されたXMLデータ(ストリームデータなど)をフィルタ処理する際には、XPath式から導出されたオートマトン(Automaton)を用いることが有効である。ちなみに、オートマトンとは、コンピュータ等の計算機構を数学的に表すモデルの総称であり、入力、出力、状態をもつ。このうち、決定性有限オートマトン(DFA:Deterministic Finite Automaton)は、入力に対する推移先(遷移先)が1つに決まるオートマトンである。一方、非決定性有限オートマトン(NFA:Nondeterministic Finite Automaton)は、ある状態において入力に対する推移先(遷移先)が複数存在するオートマトンである。 When filtering XML data (stream data or the like) input using the XPath expression, it is effective to use an automaton derived from the XPath expression. Incidentally, an automaton is a general term for models that mathematically represent a calculation mechanism such as a computer, and has an input, an output, and a state. Among these, a deterministic finite automaton (DFA) is an automaton in which a transition destination (transition destination) for an input is determined as one. On the other hand, a nondeterministic finite automaton (NFA) is an automaton having a plurality of transition destinations (transition destinations) for an input in a certain state.
既に入力されたXPath式に対して追加を行う従来技術では、XPath式を処理するためのDFAが、XPath式の追加の度に別途生成されていたため、XPath式の追加の度にDFAが増えてしまうとの問題があった。そこで特許文献1に開示された技術は、各ユーザの希望条件をXPath式を用いることで、XMLデータから複数のユーザの希望する部分XMLデータを抽出して配信するシステムにおいて、ユーザによるXPath式の追加に応じてXPath式から導出されたDFAを追加前と追加後との差分で更新することを可能とするものである。
DFAの差分更新(差分追加)に関する従来技術(特許文献1など)では、XPath式の差分追加のときに、XMLデータを必要としていた。そのため、XMLデータのデータ変換処理などの評価時に、XPath式の追加・削除をオートマトンに反映するオートマトンの更新処理がオーバーヘッドとなり、XMLデータの評価時の性能が劣化してしまう。その結果、最新のXMLデータをユーザが取得するまでに時間がかかってしまうという問題があった。特に、XMLデータが交通情報などの即時性のあるニュースデータのときには、ユーザにとって取得するまでに時間がかからないことが重要となる。 In the related art (for example, Patent Document 1) related to DFA difference update (difference addition), XML data is required when adding an XPath-type difference. Therefore, during the evaluation of data conversion processing of XML data, automaton update processing that reflects the addition / deletion of the XPath expression in the automaton becomes an overhead, and the performance at the time of evaluation of XML data deteriorates. As a result, there is a problem that it takes time until the user acquires the latest XML data. In particular, when the XML data is news data with immediacy such as traffic information, it is important for the user not to take time until acquisition.
そこで、本発明は、前記した問題を解決し、XMLデータを評価するためのオートマトンを差分更新するとともに、そのオートマトンがXMLデータを迅速に処理できるようにすることを主な目的とする。 Accordingly, the main object of the present invention is to solve the above-described problems, update the automaton for evaluating the XML data, and allow the automaton to process the XML data quickly.
前記課題を解決するために、本発明は、XMLデータを処理するために入力された更新前XPath式を示す更新前DFAを、入力された更新後XPath式を示す更新後DFAに更新するXPath式処理方法であって、コンピュータが、前記更新前XPath式と、当該更新前XPath式から導出した更新前NFAと、当該更新前NFAから導出した前記更新前DFAとを記憶手段に管理するオートマトン管理ステップと、前記更新前XPath式と前記更新後XPath式との差分となる差分XPath式から導出した差分NFAを記憶手段に管理する更新オートマトン管理ステップと、前記差分NFAを用いて、前記更新前NFAを更新後NFAに、前記更新前DFAを前記更新後DFAに、それぞれ差分更新するDFA更新ステップと、を実行することを特徴とする。 In order to solve the above-described problem, the present invention updates the pre-update DFA indicating the pre-update XPath expression input to process the XML data to the post-update DFA indicating the input post-update XPath expression. An automaton management step in which the computer manages the pre-update XPath expression, the pre-update NFA derived from the pre-update XPath expression, and the pre-update DFA derived from the pre-update NFA in a storage means. An update automaton management step for managing in a storage means a difference NFA derived from a difference XPath expression that is a difference between the pre-update XPath expression and the post-update XPath expression, and using the difference NFA, the NFA before update A DFA update step for differentially updating the pre-update DFA and the post-update DFA in the updated NFA, respectively. And executes the up and.
これにより、これまでに生成されているDFA(既存のDFA)に更新対象のXPath式の情報を差分更新するだけなので、新たなDFAを別に生成する必要がない。このため、メモリ空間の有効活用を図ることができる。また、差分更新にXMLデータを必要としないため、迅速にXPath式の情報を差分更新できる。 As a result, since only the XPath expression information to be updated is differentially updated to the DFA (existing DFA) generated so far, there is no need to generate a new DFA separately. For this reason, the memory space can be effectively used. In addition, since XML data is not required for the difference update, the information of the XPath expression can be updated quickly.
本発明は、前記DFA更新ステップが、前記更新前NFAに対して、推移に従って状態を順に辿る処理(深さ優先や幅優先など)を実行し、当該実行過程において前記更新前NFAにおける各推移に適合する前記更新前DFAの推移を特定して、前記更新前DFAの各状態が保持するNFA状態群および推移群を確認し、当該NFA状態群および推移群と差分NFAとの差分を更新することを特徴とする。 In the present invention, the DFA update step executes processing (depth priority, width priority, etc.) for sequentially tracing the state according to the transition with respect to the pre-update NFA, and adapts to each transition in the pre-update NFA in the execution process. Identifying the transition of the pre-update DFA, checking the NFA state group and the transition group held by each state of the pre-update DFA, and updating the difference between the NFA state group and the transition group and the difference NFA. Features.
これにより、確実にDFAに対するXPath式の情報の差分更新を行え、また、さらに効率的にメモリ空間を使用することができる。 As a result, it is possible to reliably update the difference of the XPath-type information for the DFA and to use the memory space more efficiently.
本発明は、前記差分XPath式が、前記更新前XPath式から前記更新後XPath式に追加されたXPath式の集合として構成され、前記DFA更新ステップが、前記更新前NFAおよび前記更新前DFAに、前記差分NFAを、それぞれ差分追加することを特徴とする。 In the present invention, the differential XPath expression is configured as a set of XPath expressions added from the pre-update XPath expression to the post-update XPath expression, and the DFA update step includes the pre-update NFA and the pre-update DFA, A difference is added to each difference NFA.
これにより、メモリ空間の有効活用を図りつつ、迅速にDFAを差分追加できる。 As a result, it is possible to quickly add a DFA difference while effectively utilizing the memory space.
本発明は、前記差分XPath式が、前記更新前XPath式から削除されたXPath式の集合として構成され、前記DFA更新ステップが、前記更新前NFAおよび前記更新前DFAから、前記差分NFAを、それぞれ差分削除することを特徴とする。 In the present invention, the differential XPath expression is configured as a set of XPath expressions deleted from the pre-update XPath expression, and the DFA update step includes the differential NFA from the pre-update NFA and the pre-update DFA, respectively. The difference is deleted.
これにより、メモリ空間の有効活用を図りつつ、迅速にDFAを差分削除できる。 As a result, the DFA difference can be quickly deleted while effectively utilizing the memory space.
本発明は、コンピュータが、前記更新後DFAをもとにXMLデータをフィルタ処理するデータ抽出ステップを実行することを特徴とする。 The present invention is characterized in that the computer executes a data extraction step of filtering XML data based on the updated DFA.
これにより、効率的に差分更新されたDFAを有効に活用することができる。 This makes it possible to effectively use the DFA that has been differentially updated efficiently.
本発明は、XMLデータを処理するために入力された更新前XPath式を示す更新前DFAを、入力された更新後XPath式を示す更新後DFAに更新するXPath式処理装置であって、前記更新前XPath式と、当該更新前XPath式から導出した更新前NFAと、当該更新前NFAから導出した前記更新前DFAとを管理するオートマトン管理部と、前記更新前XPath式と前記更新後XPath式との差分となる差分XPath式から導出した差分NFAを管理する更新オートマトン管理部と、前記差分NFAを用いて、前記更新前NFAを更新後NFAに、前記更新前DFAを前記更新後DFAに、それぞれ差分更新するDFA更新モジュールと、を有することを特徴とする。 The present invention is an XPath expression processing apparatus that updates a pre-update DFA indicating an XPath expression before update input to process XML data to an updated DFA indicating an input XPath expression after update. A previous XPath expression, an NFA before update derived from the pre-update XPath expression, an automaton management unit that manages the pre-update DFA derived from the pre-update NFA, the pre-update XPath expression, and the post-update XPath expression; An update automaton management unit that manages the difference NFA derived from the difference XPath expression that is the difference of the difference, and using the difference NFA, the pre-update NFA is the updated NFA, the pre-update DFA is the updated DFA, respectively. And a DFA update module for performing differential update.
これにより、これまでに生成されているDFA(既存のDFA)に追加対象のXPath式の情報を差分更新するだけなので、新たなDFAを別に生成する必要がない。このため、メモリ空間の有効活用を図るXPath式処理装置(後記するフィルタエンジン)を提供することができる。また、差分更新にXMLデータを必要としないため、迅速にXPath式の情報を差分更新できる。 As a result, since only the information of the XPath expression to be added is differentially updated in the DFA (existing DFA) generated so far, it is not necessary to generate a new DFA separately. For this reason, it is possible to provide an XPath processing device (a filter engine described later) that makes effective use of the memory space. Further, since XML data is not required for the difference update, the XPath-type information can be quickly updated by difference.
本発明は、請求項1ないし請求項5のいずれか1項に記載のXPath式処理方法をコンピュータに実行させるためのXPath式処理プログラムである。
The present invention is an XPath type processing program for causing a computer to execute the XPath type processing method according to any one of
これにより、このプログラムをインストールされたコンピュータに、プログラムに基づいた各ステップを実行させ、XPath式の処理(DFAの差分更新)を行う。 As a result, the computer in which this program is installed is caused to execute each step based on the program, and XPath type processing (DFA differential update) is performed.
本発明は、請求項7に記載のXPath式処理プログラムを格納したコンピュータが読み取り可能な記憶媒体である。
The present invention is a computer-readable storage medium storing the XPath processing program according to
このXPath式処理プログラムは、例えばCD−ROM等の記録媒体に複写・記録されて市場を流通されたり、例えばネットワーク上を伝送されたりする。そして、このプログラムをインストールされたコンピュータにXPath式の処理(DFAの差分更新)を実行させる。 This XPath processing program is copied and recorded on a recording medium such as a CD-ROM, and distributed in the market or transmitted over a network, for example. Then, the computer in which this program is installed is caused to execute XPath type processing (DFA differential update).
本発明は、XMLデータを処理するために入力された更新前XPath式を示す更新前DFAから生成される、入力された更新後XPath式を示すオートマトンであって、コンピュータが、前記更新前XPath式と、当該更新前XPath式から導出した更新前NFAと、当該更新前NFAから導出した前記更新前DFAとを記憶手段に管理するオートマトン管理ステップと、前記更新前XPath式と前記更新後XPath式との差分となる差分XPath式から導出した差分NFAを記憶手段に管理する更新オートマトン管理ステップと、前記差分NFAを用いて、前記更新前DFAを差分更新してオートマトンを生成するDFA更新ステップと、を実行することにより生成されることを特徴とする。 The present invention is an automaton that indicates an input post-update XPath expression that is generated from a pre-update XFA expression that indicates an input pre-update XPath expression for processing XML data, and the computer includes the pre-update XPath expression. An automaton management step for managing in the storage means the pre-update NFA derived from the pre-update XPath expression and the pre-update DFA derived from the pre-update NFA, the pre-update XPath expression and the post-update XPath expression, An update automaton management step for managing the difference NFA derived from the difference XPath expression, which is the difference of the above, in the storage means, and a DFA update step for generating an automaton by differentially updating the pre-update DFA using the difference NFA. It is generated by executing.
これにより、これまでに生成されているDFA(既存のDFA)に更新対象のXPath式の情報を差分更新するだけなので、新たなDFAを別に生成する必要がない。このため、メモリ空間の有効活用を図ることができる。また、差分更新にXMLデータを必要としないため、迅速にXPath式の情報を差分更新できる。 As a result, since only the information of the XPath expression to be updated is differentially updated in the DFA (existing DFA) generated so far, it is not necessary to generate a new DFA separately. For this reason, the memory space can be effectively used. Further, since XML data is not required for the difference update, the XPath-type information can be quickly updated by difference.
本発明によれば、これまでに生成されているDFAに追加・削除対象のXPath式を即時で差分更新するため、XMLデータの評価時にはDFAの差分更新操作が発生しない。このようにXPath式の追加・削除時に決定性オートマトンを更新するため、XMLデータの評価時にはXPath式の追加・削除操作の影響による性能劣化が生じない。 According to the present invention, since the XPath expression to be added / deleted is immediately updated in the DFA generated so far, the DFA difference update operation does not occur when the XML data is evaluated. As described above, since the deterministic automaton is updated when an XPath expression is added / deleted, performance degradation due to the influence of the addition / deletion operation of the XPath expression does not occur when XML data is evaluated.
以下、本発明のXPath式処理方法の実施形態を、図面を参照して詳細に説明する。なお、以下説明するXPath式処理方法は、XPath式処理装置、XPath式処理プログラムを具現化したものでもある。第1実施形態では既存のXPath式に新たなXPath式を追加する差分更新を、第2実施形態では既存のXPath式の一部を削除する差分更新を、それぞれ述べる。以下、第1実施形態を説明する。 Hereinafter, an embodiment of an XPath processing method of the present invention will be described in detail with reference to the drawings. Note that the XPath type processing method described below also embodies an XPath type processing apparatus and an XPath type processing program. In the first embodiment, difference update for adding a new XPath expression to an existing XPath expression will be described, and in the second embodiment, difference update for deleting a part of an existing XPath expression will be described. Hereinafter, the first embodiment will be described.
図1は、XPath式処理方法が適用されるフィルタエンジンの概要を示す図である。図示しないデータ提供者によりXML形式にしたがって生成されたXMLデータが、XPath式処理方法を実行するフィルタエンジン10にイントラネット等のネットワークを経由して送信される。フィルタエンジン10には、XMLデータを受け取る個々のユーザが、自分の欲しいデータの条件(個人プロファイル)を、従来例のように、XML問い合わせという形式でフィルタエンジン10に予め登録している。
FIG. 1 is a diagram showing an outline of a filter engine to which the XPath processing method is applied. XML data generated according to the XML format by a data provider (not shown) is transmitted to the
フィルタエンジン10は、登録されている個人プロファイルに応じて送られてくるニュースソース等のXMLデータをフィルタ・変換して個々のユーザにXMLデータとして配信する。ニュースソース等のXMLデータの具体例としては、NewsMLがある。NewsMLは前記のとおり、XMLをベースにした新しいニュース配信フォーマットであり、ニュース記事、画像、動画、音声等のニュース素材を自由に組み合わせ、ウェブサイトや携帯電話等さまざまな機器を対象に情報を送ることができる。また、ニュース記事、画像、動画、音声等のさまざまなニュース素材を構造化して一元管理するのに適する。
The
なお、フィルタエンジン10は、請求項のXPath式処理装置およびXPath式処理プログラムを内包するものでもある。ちなみに、XMLは、インターネットの標準としてW3C(World Wide Web Consortium)により勧告されたメタ言語である。メタ言語は、言語を作る言語という意味である。XMLデータ(XML文書:XMLDocumentともいう)は、XMLによって作られた言語を用いて作成された文書やデータである。
The
そして、フィルタエンジン10は、XMLデータから、ユーザの希望条件であるXPath式に適合するXMLデータを抽出する。ここで、フィルタエンジン10は、後記において詳細に説明するように、XPath式から導出されたDFAヘ即時に、かつ、全てXPath式の追加・削除を反映させることを特徴とする。これにより、XMLデータの処理時にはXPath式の更新に関わる操作が一切発生しないため処理が高速化されるという効果を奏する。
Then, the
図2は、図1のフィルタエンジン10の内部構成を示すブロック図である。この図2に示すように、フィルタエンジン10は、XMLパースモジュール11、問い合わせパースモジュール12、データ抽出モジュール13、DFA作成モジュール13B、オートマトン管理部15、データ変換モジュール16、DFA更新モジュール17、および、更新オートマトン管理部18を含んで構成される。フィルタエンジン10は、CPUおよびRAMから構成される主制御装置、ハードディスク等から構成される外部記憶装置、通信を行うためのNIC(Network Interface Card)を有するコンピュータと、ルータ(Router)とを含んで構成される。オートマトン管理部15および更新オートマトン管理部18は、例えば、外部記憶装置に格納される。
FIG. 2 is a block diagram showing an internal configuration of the
XMLパースモジュール(XMLパーサ)11は、入力されるXMLデータをパースして内部形式XMLデータ(SAX(Simple API for XML)イベント)に変換し、データ抽出モジュール13ヘ出力する。なお、パースとは、テキスト形式で記述されたXMLデータを読み込んで、XMLのタグで指定された文書要素や属性等を解析する解析処理である(本実施形態においてはパースの手順等は特に限定するものではない)。ちなみに、XMLパースモジュール11を通してXMLデータを操作するためのAPI(Application Programming Interface)には、DOM(Document Object Mode)とSAXという2種類の標準インターフェースがある。本実施形態では、XMLパースモジュール11は、後者のSAXに対応している。
The XML parsing module (XML parser) 11 parses input XML data, converts it into internal format XML data (SAX (Simple API for XML) event), and outputs the data to the
なお、SAXに対応したXMLパースモジュール11は、XMLデータを順次シーケンシャルに読み込みつつ、XMLのタグ(開始タグ、終了タグ、空要素タグ)を検出するごとにアドインされた各種ハンドラを起動する。ここでハンドラとは、SAXインターフェースに基づいてXMLデータの各要素を処理するためのメソッドを定義したプログラムである。また、タグとは、XMLデータにおいて、要素の位置を明示し、属性を収納するために記述される文字列である。
Note that the
問い合わせパースモジュール12は、XPath式を生成する。具体的には、問い合わせパースモジュール12は、追加される個人プロファイル(XML問い合わせ言語で記述される検索条件)をパース(解析処理)し、「データ変換操作」とデータ抽出操作である「個々のXPath式」とに分離する。XPath式は、DFA作成モジュール13Bによってオートマトンに変換されてからデータ抽出モジュール13ヘ出力され、データ変換操作はデータ変換モジュール16ヘ出力される。なお、XPath式は、XMLデータの特定の部分を指し示す言語である。XPath式を利用すれば、XMLデータ中にアンカ等が埋め込まれていなくとも、データ中の任意の位置を指し示すことができる。
The
DFA作成モジュール13Bは、問い合わせパースモジュール12から入力される個々のXPath式をNFAに変換(NFAを生成)し、そのNFAを結合NFAに結合し、その結合NFAからDFAを生成してオートマトン管理部15に登録(追加)する。
The
データ抽出モジュール13は、オートマトン管理部15に格納されたDFAを用いて、XMLパースモジュール11に入力されたXMLデータから抽出された部分XMLを内部形式XMLデータ(フィルタされた後の内部形式XMLデータ)としてデータ変換モジュール16ヘ出力する。
The
データ変換モジュール16は、データ変換操作と抽出された内部形式のXMLデータとから所定の変換を実行し、その結果をフィルタされたXMLデータ(変換後XMLデータ)として出力する。なお、所定の変換は本発明においては特に限定するものではない。
The
次に、オートマトン管理部15を詳細に説明する。図3は、図2におけるオートマトン管理部15のメモリ上でのデータ構成を示した図である。なお、DFAの詳細は図5に示す。
Next, the
図3に示すように、個々のXPath式ごとにNFAが生成される。こうして生成された複数のNFAは1つのノードにより結合され、そのルートからイプシロンエッジにより個々のNFAに接続される(結合NFA)。なお、イプシロンエッジとは、例えばオートマトンにおいて通常定義される”空文字列”のことである。DFAは、結合NFAを用いて順次生成および更新される。または、DFAは、結合NFAとXMLデータの入力に応じて、必要な状態が順次生成および更新される。 As shown in FIG. 3, an NFA is generated for each XPath expression. The plurality of NFAs generated in this way are combined by one node, and connected to individual NFAs from the root by epsilon edges (combined NFA). The epsilon edge is an “empty character string” normally defined in, for example, an automaton. The DFA is generated and updated sequentially using the combined NFA. Alternatively, DFA sequentially generates and updates necessary states according to the input of combined NFA and XML data.
図4は、図3の具体的なプログラム上でのデータ構造を示す図である。この図4において、Variableクラス(class Variable)は、個々のXPath式ごとにインスタンス(Instance)を生成するクラスであり、次のような属性を有する。なお、インスタンスとは、例えばオブジェクト指向プログラミングにおいて、あるクラスの定義をひな型として実際に作られたオブジェクトのことをいう。
*そのインスタンスごとに異なる内部識別子である”id”
*個々のXPath式表現である”XPath式”
*Variableをユーザが区別するための名称である”varName”
FIG. 4 is a diagram showing a data structure on the specific program of FIG. In FIG. 4, a variable class (class variable) is a class that generates an instance for each XPath expression, and has the following attributes. Note that an instance refers to an object actually created by using a class definition as a model in, for example, object-oriented programming.
* "Id" which is an internal identifier that is different for each instance
* "XPath expression" which is an expression of each XPath expression
* "VarName" which is a name for the user to distinguish Variable
Stateクラス(class State)は、NFAの状態を表現するクラスであり、次のような属性を有する。
*自身の状態から他の状態への推移を表現するエッジの集合”edges”
*自身の状態が終端か非終端かを示す”type”(なお、XPath式の表現をNFAに変換した場合、最後尾の状態は終端であり、それ以外の状態は非終端であるとする。)
*自身の状態がどのVariableインスタンスから(つまりそのXPath式から)生成されたかを示す”var”
The State class (class State) is a class that expresses the state of the NFA and has the following attributes.
* A set of edges “edges” representing transitions from one state to another
* “Type” indicating whether its own state is termination or non-termination (when the expression of the XPath expression is converted to NFA, the last state is termination, and the other states are non-termination)
* “Var” indicating from which Variable instance (that is, from the XPath expression) its state was created
DFAStateクラス(class DFAState)はDFAの状態を表現し、Stateクラスをオブジェクト指向的な継承を用いて定義され、次のような属性を有する。
*NFAを用いてDFAを生成する際に必要になる、NFAの状態群を表現する”states”
なお、edgesはStateクラスのものを継承しているが、処理の高速化を図るため、listではなくhashやmap構造を用いて再定義することも可能である。
The DFAState class (class DFAState) represents the state of the DFA, the State class is defined using object-oriented inheritance, and has the following attributes.
* “States” that expresses the NFA state group that is required when generating a DFA using NFA
Although “edges” is inherited from the “State” class, it can be redefined using a hash or map structure instead of “list” in order to increase the processing speed.
Edgeクラス(class Edge)はNFAの状態State間のエッジ、もしくはDFAの状態間のエッジを表現し、次のような属性を有する。
*自身のエッジのエッジ先である状態”to”
*自身のエッジのエッジ元である状態”from”
The Edge class (class Edge) represents an edge between NFA state states or an edge between DFA states, and has the following attributes.
* State "to" that is the edge destination of its own edge
* State "from" which is the edge source of its own edge
図5は、図4のDFAのメモリ上でのデータ構造を図示した図である。ただし、この図5では図4と異なり、”edges”を実現するためにlistではなくmap構造を利用している。 FIG. 5 is a diagram illustrating a data structure on the memory of the DFA of FIG. However, in FIG. 5, unlike FIG. 4, a map structure is used instead of a list in order to realize “edges”.
この図5の左に位置するDFAStateはDFAStateクラスのインスタンスであり、DFAの1状態を表現している。この図5の状態ではその属性値であるstates,edges,type,var,varIdの値がそれぞれ設定されている。ここで、statesはNFAの状態群を表す。edgesはエッジのラベルとエッジインスタンスヘの参照の組を表現している。typeは非終端であるので”non−terminal”になっている。varはVariableインスタンスヘの参照である。この例では、varIdは3であり、3番目のVariable(XPath式)までの状態をこのDFAStateが反映していることを意味している。 DFAState located on the left side of FIG. 5 is an instance of the DFAState class, and expresses one state of DFA. In the state of FIG. 5, the values of states, edges, type, var, and varId that are attribute values are set. Here, states represents an NFA state group. edge represents a set of a reference to an edge label and an edge instance. Since type is non-terminal, it is “non-terminal”. var is a reference to a Variable instance. In this example, varId is 3, which means that this DFAState reflects the state up to the third variable (XPath expression).
図5の中間(左中間)に位置するのがEdgeのインスタンス群である。また、図5の右中間に位置するのがEdgeの推移先に相当するDFAStateインスタンス群である。なお、図5に示すように、Edgeの推移先はNull(DFAStateが未生成)であることも許されている。 An Edge instance group is located in the middle (left middle) of FIG. Further, a DFAState instance group corresponding to the transition destination of Edge is located in the right middle of FIG. As shown in FIG. 5, the transition destination of Edge is allowed to be Null (DFAState is not generated).
DFA更新モジュール17は、オートマトン管理部15が管理する構築済みのDFAから更新後のオートマトンが許容する状態に対応する更新前のオートマトン状態を特定し、特定した個々の状態を差分で更新する。
The
つまり、差分で更新する処理とは、更新後XPath式を全て使用する代わりに、更新前XPath式と更新後XPath式との差分となる差分XPath式を用いて、更新前DFAから更新後DFAに更新する処理である。まず、オートマトン管理部15が、更新前XPath式と、その更新前XPath式から導出した更新前NFA(図3の中段のNFA)と、その更新前NFAから導出した更新前DFA(図3下段のDFA)を管理する。次に、更新オートマトン管理部18は、差分XPath式から導出する差分NFAを管理する。
In other words, the process of updating with the difference means that instead of using all the updated XPath expressions, the difference XPath expression that is the difference between the pre-update XPath expression and the post-update XPath expression is used to change from the pre-update DFA to the post-update DFA. It is a process to update. First, the
そして、DFA更新モジュール17は、差分NFAを用いて更新前DFAから更新後DFAへ部分更新する。つまり、DFA更新モジュール17は、差分XPath式を差分NFAに変換し、更新前NFAおよび更新前DFAに対して差分NFAを追加することにより、差分XPath式の情報を差分追加する。
Then, the
次に、図6に示す更新前のデータの一例、および、図7に示す更新後のデータの一例について説明する。 Next, an example of data before update shown in FIG. 6 and an example of data after update shown in FIG. 7 will be described.
図6は、オートマトン管理部15が管理するデータの一例を示す図である。DFA作成モジュール13Bは、3つのXPath式(更新前XPath式:図6(a)参照)から、各式に相当するNFAを導出し、それらのNFAを統合NFA(更新前NFA:図6(b)参照)にし、それからDFA(更新前DFA:図6(c)参照)を導出している。
FIG. 6 is a diagram illustrating an example of data managed by the
例えば、図6(a)に示す「/a//b」は、S1、S2、S3の状態と、a、*、bの推移から構成される。なお//labelは、入力XMLデータの任意の深さの要素の名称がlabelであるものにマッチするため、NFAではワイルドカード(*)による自己推移に対応付けられる。「/d//b」は、S4、S5、S6の状態と、d、*、bの推移から構成され、「/a/c/b」は、S7、S8、S9、S10の状態と、a、c、bの推移から構成される。 For example, “/ a // b” illustrated in FIG. 6A includes the states of S1, S2, and S3 and transitions of a, *, and b. Since // label matches the element whose name of the arbitrary depth of the input XML data is “label”, in NFA, it is associated with self-transition by a wild card (*). “/ D // b” is composed of the states of S4, S5, and S6 and transitions of d, *, and b. “/ A / c / b” is the states of S7, S8, S9, and S10. It consists of transitions of a, c, b.
次に、DFA作成モジュール13Bは、これらの3つのNFAを、S0の状態と、イプシロンの推移により、各NFAの開始状態を、S0の状態で統合させる(図6(b)に示す統合NFAの作成)。
Next, the
さらに、DFA作成モジュール13Bは、この統合NFAと同等なDFAを生成する(図6(c))。DFAは、例えばサブセットコンストラクションにより作成されるが、ここの例では特に特許文献1で示されるような遅延評価DFAの例を用いており、部分的に状態がNULLとなっている。DFAの各状態は推移群と対応するNFA状態を表すNFA状態群からなる。表記を簡略化するため、NFAの状態群の表記において、NFA状態を表すプレフィックスSを省略し番号のみを記載している。よって例えば、図6(b)の状態S0は、図6(c)の状態{0,1,4,7}の「0」に対応する。
Further, the
図7は、記憶装置に格納されるデータの一例を示す図である。更新オートマトン管理部18は、追加するXPath式(差分XPath式:図7(a)参照)、そのXPath式から導出されたNFA(差分NFA:図7(b)参照)を管理する。オートマトン管理部15は、差分NFAが更新前NFA(図6(b))に追加されたNFA(更新後NFA:図7(c)参照)を管理する。
FIG. 7 is a diagram illustrating an example of data stored in the storage device. The updated
図8、図9は、DFA更新モジュール17が、図6(c)に示された更新前DFAに対して、図7(b)の差分NFAを追加した結果である更新後DFAを示している。ハッチングされた状態は更新された状態を表している。
FIGS. 8 and 9 show the updated DFA, which is the result of the
以下、DFA更新モジュール17の処理の詳細について、フローチャートを参照して説明する。DFA更新モジュール17は、図10〜図12に示すフローチャートに沿ってDFAの差分更新を行う。
Details of the processing of the
図10はDFAの更新フローを示す。S200において、複数のXPath式(更新前XPath式)を処理するために導出されたDFA(更新前DFA)を読み込み、その開始状態を状態dsとして保持する。S210において、追加対象のXPath式(差分XPath式)を読み込み、それからNFA(差分NFA)を導出し、その開始状態を状態nsとして保持する。これらの状態ds、状態nsを引数として、S220に示すサブルーチンDFA(更新前DFA)状態の更新を行う。なお、DFAの更新フロー(図10)の任意のタイミングにおいて、DFA更新モジュール17は、図6(b)の更新前NFAに図7(b)の差分NFAを反映して、図7(c)の更新後NFAとする。
FIG. 10 shows a DFA update flow. In S200, the DFA (pre-update DFA) derived to process a plurality of XPath expressions (pre-update XPath expressions) is read, and the start state is held as the state ds. In S210, the XPath expression (difference XPath expression) to be added is read, an NFA (difference NFA) is derived therefrom, and the start state is held as the state ns. Using these state ds and state ns as arguments, the subroutine DFA (pre-update DFA) state shown in S220 is updated. At any timing in the DFA update flow (FIG. 10), the
図11はサブルーチンであるDFA状態の更新のフローの詳細を示す。ここでは特にXPath式の追加操作に対するフローを示している。本サブルーチンでは正規のDFAに加えて、特許文献1に記述されている遅延評価型のDFAにも対応するため、S310において状態dsがNULL(未評価)であるか否かを判定する。NULLである場合は(S310、Yes)、更新対象の状態が未評価であるため、本サブルーチンを終了(return)する。状態dsが存在する場合は(S310、No)、S320において状態dsが保持するNFA状態群に対して、追加対象のXPath式のNFA状態nsを追加する。
FIG. 11 shows details of the DFA state update flow which is a subroutine. Here, the flow for the addition operation of the XPath expression is particularly shown. In this subroutine, in addition to the regular DFA, the delay evaluation type DFA described in
続いてNFA状態nsからの推移を用いてDFAを更新するため、S330において状態nsからの推移群を取得する。S340において取得した推移群でS350、S360の処理が未処理である推移があるか否かを判定する。未処理の推移がない場合は、全ての推移に対するDFAの更新が終了(return)である。未処理の推移がある場合は、S350において未処理の推移を1つ選択し、推移neとして保持する。そして、状態dsと推移neを引数として、S360に示すサブルーチン「推移によるDFA状態更新」を行う。 Subsequently, in order to update the DFA using the transition from the NFA state ns, a transition group from the state ns is acquired in S330. It is determined whether or not there is a transition in which the processes of S350 and S360 are unprocessed in the transition group acquired in S340. If there is no unprocessed transition, updating of the DFA for all transitions is completed (return). If there is an unprocessed transition, one unprocessed transition is selected in S350 and held as a transition ne. Then, the subroutine “DFA state update by transition” shown in S360 is performed using the state ds and the transition ne as arguments.
図12はサブルーチンである推移によるDFA状態更新フローの詳細を示す。S400において、DFA状態dsが保持する推移群において、NFA側の推移neに適合する推移を特定する。S410において、適合する推移の有無を判定する。適合する推移がない場合は、S450へ進み、状態dsの推移群に新たに推移neを追加して、本サブルーチンを終了(return)する。適合する推移がある場合は、S420へ進み、未処理である推移の有無を判定する。 FIG. 12 shows details of the DFA state update flow based on the transition that is a subroutine. In S400, a transition that matches the transition ne on the NFA side is specified in the transition group held by the DFA state ds. In S410, it is determined whether there is a suitable transition. If there is no suitable transition, the process proceeds to S450, a transition ne is newly added to the transition group of the state ds, and this subroutine is terminated (return). If there is a matching transition, the process proceeds to S420, and it is determined whether there is a transition that has not been processed.
未処理である推移がない場合は、推移neによるDFA更新が終了であるため、本サブルーチンを終了(return)する。未処理である推移がある場合は、S430において未処理である推移を1つ選択し推移deとして保持する。S440において、推移deの推移先のDFA状態を状態ds1として保持し、推移neの推移先のNFA状態を状態ns1として保持する。これらの状態ds1、状態ns1を引数として、S220に示すサブルーチン「DFA状態の更新」を行う。 If there is no unprocessed transition, the DFA update by the transition ne is complete, so this subroutine is terminated (return). If there is a transition that has not been processed, one transition that has not been processed is selected in S430 and held as a transition de. In S440, the transition DFA state of the transition de is held as the state ds1, and the transition destination NFA state of the transition ne is held as the state ns1. Using these state ds1 and state ns1 as arguments, the subroutine “DFA state update” shown in S220 is performed.
図10〜図12で示したように、本発明は更新XPath式から導出されたNFAに対して、推移に従って状態を順に辿る処理を実行し、当該実行過程においてNFAにおける各推移に適合するDFAの推移を特定して、DFAの各状態が保持するNFA状態群および推移群を確認し、当該NFA状態群および推移群と差分NFAとの差分を更新することを特徴とする。 As shown in FIGS. 10 to 12, the present invention executes a process of sequentially tracing the state according to the transition for the NFA derived from the updated XPath expression, and in the execution process, the DFA conforming to each transition in the NFA. The transition is specified, the NFA state group and the transition group held by each state of the DFA are confirmed, and the difference between the NFA state group and the transition group and the difference NFA is updated.
以上説明した図10〜図12の処理を具体的に説明するため、図6〜図9に示した一例を適用して、DFA更新モジュール17が行うDFAの差分更新の方法を説明する。
In order to specifically describe the processing of FIGS. 10 to 12 described above, a method of differential update of DFA performed by the
図10のS200において、状態dsは{0,1,4,7}で構成される状態を保持する。S210で、状態nsは図7のS11の状態を保持する、S220で、これらの状態dsと状態nsからDFA状態更新を行う。 In S200 of FIG. 10, the state ds holds a state constituted by {0, 1, 4, 7}. In S210, the state ns holds the state of S11 in FIG. 7. In S220, the DFA state is updated from these states ds and ns.
図11のS310において状態ds{0,1,4,7}はNULLでないため、S320で状態nsのS11という状態を状態dsに加え、その結果、状態dsが保持するNFA状態群は{0,1,4,7,11}となる。次にS330で、状態nsからの推移としてaを取得する。S340において未処理である推移aがあるため、S350でaを推移neに保持する。 Since the state ds {0, 1, 4, 7} is not NULL in S310 of FIG. 11, the state S11 of the state ns is added to the state ds in S320, and as a result, the NFA state group held by the state ds is {0, 1, 4, 7, 11}. Next, in S330, a is acquired as a transition from the state ns. Since there is an unprocessed transition a in S340, a is held in transition ne in S350.
次に、状態dsと推移neでS360の「推移によるDFA状態更新」を行う。 Next, “update DFA state by transition” in S360 is performed with the state ds and the transition ne.
図12のS400において、状態ds({0,1,4,7,11})の推移群a、dのうち、推移ne(a)に適合する推移であるaを特定する。S410において適合する推移があったため、S420に進み、未処理である推移aがあるため、S430に進む。S430では適合する推移aを取り出し、推移deに保持する。S440では推移de(a)の推移先のDFA状態{2、8}を状態ds1として保持し、推移ne(a)の推移先のNFA状態S12を状態ns1として保持し、これらを引数としてS220のサブルーチンDFA状態更新を行う。 In S400 of FIG. 12, a which is a transition suitable for the transition ne (a) is specified from the transition groups a and d of the state ds ({0, 1, 4, 7, 11}). Since there is a suitable transition in S410, the process proceeds to S420, and since there is a transition a that has not been processed, the process proceeds to S430. In S430, a suitable transition a is extracted and held in the transition de. In S440, the DFA state {2, 8} of the transition destination of the transition de (a) is held as the state ds1, the NFA state S12 of the transition destination of the transition ne (a) is held as the state ns1, and these are used as arguments in the S220. Subroutine DFA status update is performed.
DFA状態更新サブルーチンの最初の再帰について説明する。 The first recursion of the DFA state update subroutine will be described.
図11のS310において状態ds{2,8}はNULLでないため、S320で状態nsのS12という状態を状態dsに加え、その結果状態dsが保持するNFA状態群は{2,8,12}となる。次にS330で、状態nsからの推移としてd、*を取得する、S340において未処理である推移dがあるため、S350でdを推移neに保持する。 Since the state ds {2, 8} is not NULL in S310 in FIG. 11, the state S12 of the state ns is added to the state ds in S320, and as a result, the NFA state group held by the state ds is {2, 8, 12}. Become. Next, in S330, d and * are acquired as transitions from the state ns. Since there is a transition d that is not processed in S340, d is held in the transition ne in S350.
次に、状態dsと推移neでS360の「推移によるDFA状態更新」を行う。図12のS400において、状態ds({2,8,12})の推移群b、c、otherのうち、推移ne(d)に適合する推移であるotherを特定する。S410において適合する推移があったため、S420に進み、未処理である推移dがあるため、S430に進む。 Next, “update DFA state by transition” in S360 is performed with the state ds and the transition ne. In S400 of FIG. 12, among the transition groups b, c, and other of the state ds ({2, 8, 12}), the other that is a transition that matches the transition ne (d) is specified. Since there is a suitable transition in S410, the process proceeds to S420, and since there is an unprocessed transition d, the process proceeds to S430.
S430では適合する推移dを取り出し、推移deに保持する。このとき、推移dが適合したDFAの推移がotherであったため、otherによる推移をotherとdとに分割し、推移先の構造をコピーする。S440では推移de(d)の推移先のDFA状態{2}を状態ds1として保持し、推移ne(d)の推移先のNFA状態S13を状態ns1として保持し、これらを引数としてS220のサブルーチンDFA状態更新を行う。 In S430, a suitable transition d is extracted and held in the transition de. At this time, since the transition of the DFA to which the transition d is matched is other, the transition by other is divided into other and d, and the structure of the transition destination is copied. In S440, the transition DFA state {2} of the transition de (d) is held as the state ds1, the transition destination NFA state S13 of the transition ne (d) is held as the state ns1, and these are used as arguments to the subroutine DFA of S220. Update the state.
DFA状態更新サブルーチンの二度目の再帰について説明する。 The second recursion of the DFA state update subroutine will be described.
図11のS310において状態ds{2}はNULLでないため、S320で状態nsのS13という状態を状態dsに加え、その結果状態dsが保持するNFA状態群は{2,13}となる。次にS330で、状態nsからの推移を取得するが推移はない。S340において未処理である推移がないため、本サブルーチンの処理を終了(return)する。図8はこの時点のDFAを示している。 Since the state ds {2} is not NULL in S310 in FIG. 11, the state S13 of the state ns is added to the state ds in S320, and as a result, the NFA state group held by the state ds is {2, 13}. Next, in S330, the transition from the state ns is acquired, but there is no transition. Since there is no unprocessed transition in S340, the processing of this subroutine is terminated (return). FIG. 8 shows the DFA at this point.
図12のS220の処理が完了したため、S420に進む。S420では未処理である推移がないため、本サブルーチンの処理を終了(return)する。 Since the process of S220 of FIG. 12 is completed, the process proceeds to S420. Since there is no unprocessed transition in S420, the processing of this subroutine is terminated (return).
図11のS360の処理が完了したため、S340に進む。S340において未処理である推移*があるため、S350で*を推移neに保持する。次に、状態dsと推移neでS360の「推移によるDFA状態更新」を行う。図12のS400において、状態ds({2,8,12})の推移群d、b、c、otherのうち、推移ne(*)に適合する推移であるd、b、c、otherを特定する。S410において適合する推移があったため、S420に進み、未処理である推移dがあるため、S430に進む。S430では適合する推移dを取り出し、推移deに保持する。 Since the process of S360 in FIG. 11 is completed, the process proceeds to S340. Since there is an unprocessed transition * in S340, * is held in transition ne in S350. Next, “update DFA state by transition” in S360 is performed with the state ds and the transition ne. In S400 of FIG. 12, among transition groups d, b, c, and other of state ds ({2, 8, 12}), d, b, c, and other that are transitions that match transition ne (*) are identified. To do. Since there is a suitable transition in S410, the process proceeds to S420, and since there is an unprocessed transition d, the process proceeds to S430. In S430, a suitable transition d is extracted and held in the transition de.
S440では推移de(d)の推移先のDFA状態{2,13}を状態ds1として保持し、推移ne(*)の推移先のNFA状態S12を状態ns1として保持し、これらを引数としてS220のサブルーチンDFA状態更新を行う。 In S440, the DFA state {2, 13} of the transition de (d) is held as the state ds1, the NFA state S12 of the transition ne (*) is held as the state ns1, and these are used as arguments in S220. Subroutine DFA status update is performed.
前記の処理を再帰的に繰り返すことにより、図6のDFAが更新されて最終的に図9に示すDFAになる。 By recursively repeating the above process, the DFA in FIG. 6 is updated to finally become the DFA shown in FIG.
以上、第1実施形態(差分追加)を説明した。次に第2実施形態(差分削除)を説明する。なお、第2実施形態におけるフィルタエンジン10の構成は、第1実施形態と同じであるため、説明を省略する。
The first embodiment (difference addition) has been described above. Next, a second embodiment (difference deletion) will be described. In addition, since the structure of the
図13は、図6に示す更新前のデータに対する削除するデータの一例を示している。図14〜図16は、図6に示されたDFAに対して、図13(b)のNFAを削除した結果のDFAを示している。ハッチングされた状態は更新された状態を表している。 FIG. 13 shows an example of data to be deleted from the pre-update data shown in FIG. 14 to 16 show the DFA obtained as a result of deleting the NFA of FIG. 13B from the DFA shown in FIG. The hatched state represents the updated state.
DFA更新モジュール17は、図17〜図19に示すフローに沿ってDFAの差分更新(差分削除)を行う。
The
図17はDFAの削除フローを示す。S500において、複数のXPath式を処理するために導出されたDFAを読み込み、その開始状態を状態dsとして保持する。S510において、削除対象に相当するNFAを読み込み、その開始状態を状態nsとして保持する。これらの状態ds、状態nsを引数として、S520に示すサブルーチンDFA状態の削除を行う。このDFA状態の削除後に、S530で削除対象に相当するNFAを削除する。 FIG. 17 shows a DFA deletion flow. In S500, the DFA derived to process a plurality of XPath expressions is read, and the start state is held as the state ds. In S510, the NFA corresponding to the deletion target is read, and the start state is held as the state ns. The subroutine DFA state shown in S520 is deleted using these state ds and state ns as arguments. After the deletion of the DFA state, the NFA corresponding to the deletion target is deleted in S530.
図18はサブルーチンであるDFA状態の削除のフローの詳細を示す。ここでは特にXPath式の削除操作に対するフローを示している。本サブルーチンでは差分追加と同様に、S610において、状態dsがNULL(未評価)であるか否かを判定する。NULLである場合は(S610,Yes)、追加対象の状態が未評価であるため、本サブルーチンを終了(return)する。 FIG. 18 shows the details of the DFA state deletion flow which is a subroutine. Here, a flow for an XPath-type deletion operation is particularly shown. In this subroutine, similarly to the difference addition, in S610, it is determined whether or not the state ds is NULL (not evaluated). If it is NULL (S610, Yes), the status of the addition target has not been evaluated, so this subroutine is terminated (return).
状態dsが存在する場合は、S620において状態dsが保持するNFA状態群に対して、削除対象のXPath式のNFA状態nsを削除する。この時、状態dsが保持するNFA状態群をS630にて確認し、NFA状態群がない場合、この状態ds配下をS640にて削除する。NFA状態群がある場合、NFA状態nsからの推移を用いてDFAを削除するため、S650において状態nsからの推移群を取得する。 When the state ds exists, the NFA state ns of the XPath expression to be deleted is deleted from the NFA state group held by the state ds in S620. At this time, the NFA state group held by the state ds is confirmed in S630. If there is no NFA state group, the subordinate of this state ds is deleted in S640. If there is an NFA state group, the transition group from the state ns is acquired in S650 in order to delete the DFA using the transition from the NFA state ns.
S650において取得した推移群でS670、S680の処理が未処理である推移があるか否かを判定する。未処理の推移がない場合は(S660,無)、全ての推移に対するDFAの削除が終了である。未処理の推移がある場合(S660,有)は、S670において未処理の推移を一つ選択し、推移neとして保持する。そして、状態dsと推移neとを引数として、S680に示すサブルーチン推移によるDFA状態削除を行い、S660に戻る。 It is determined whether or not there is a transition in which the processes of S670 and S680 are unprocessed in the transition group acquired in S650. If there is no unprocessed transition (S660, none), the DFA deletion for all transitions is completed. If there is an unprocessed transition (S660, yes), one unprocessed transition is selected in S670 and held as a transition ne. Then, using the state ds and the transition ne as arguments, the DFA state deletion by the subroutine transition shown in S680 is performed, and the process returns to S660.
図19はサブルーチンである推移によるDFA状態削除フローの詳細を示す。S700において、DFA状態dsが保持する推移群において、NFA側の推移neに適合する推移を特定する。S710において、適合する推移の有無を判定する。適合する推移がない場合は、本サブルーチンを終了(return)する。適合する推移がある場合は、S720へ進み。未処理である推移の有無を判定する。未処理である推移がない場合は、推移neによるDFA削除が終了であるため、本サブルーチンを終了(return)する。 FIG. 19 shows the details of the DFA state deletion flow by the transition which is a subroutine. In S700, a transition that matches the transition ne on the NFA side is identified in the transition group held by the DFA state ds. In S710, it is determined whether there is a suitable transition. If there is no matching transition, this subroutine is terminated (return). If there is a suitable transition, the process proceeds to S720. It is determined whether or not there is an unprocessed transition. If there is no unprocessed transition, the DFA deletion by the transition ne is complete, so this subroutine is terminated (return).
未処理である推移がある場合は、S730において未処理である推移を一つ選択し推移deとして保持する。S740において、推移deの推移先のDFA状態を状態ds1として保持し、推移neの推移先のNFA状態を状態ns1として保持する。これらの状態ds1、状態ns1を引数として、S520に示すサブルーチン「DFA状態の削除」を行う。 If there is a transition that has not been processed, one transition that has not been processed is selected in S730 and held as a transition de. In S740, the DFA state of the transition destination of the transition de is held as the state ds1, and the NFA state of the transition destination of the transition ne is held as the state ns1. Using these state ds1 and state ns1 as arguments, the subroutine “DFA state deletion” shown in S520 is performed.
以上説明した図17〜図19の処理を具体的に説明するため、図6、図13〜図16に示した一例を適用して、DFA更新モジュール17が行うDFAの差分更新の方法を説明する。
In order to specifically describe the processes of FIGS. 17 to 19 described above, a method of differential update of DFA performed by the
図17のS500において、状態dsは、{0,1,4,7}で構成される状態を保持する。S510で、状態nsは図13のS1の状態を保持する。S520で、これらの状態dsと状態nsからDFA状態削除を行う。 In S500 of FIG. 17, the state ds holds a state constituted by {0, 1, 4, 7}. In S510, the state ns holds the state of S1 in FIG. In S520, the DFA state is deleted from these state ds and state ns.
図18のS610において、状態ds{0,1,4,7}はNULLでないため、S620で状態nsのS1という状態を状態dsから削除し、その結果状態dsが保持するNFA状態群は、{0,4,7}となる。S630で状態ds{0,4,7}はNFA状態群を保持しているため、S650で、状態nsからの推移としてaを取得する。S660において未処理である推移aがあるため、S670でaを推移neに保持する。次に、状態dsと推移neとでS680の「推移によるDFA状態削除」を行う。 In S610 of FIG. 18, since the state ds {0, 1, 4, 7} is not NULL, the state S1 of the state ns is deleted from the state ds in S620, and as a result, the NFA state group held by the state ds is { 0, 4, 7}. Since the state ds {0, 4, 7} holds the NFA state group in S630, a is acquired as a transition from the state ns in S650. Since there is a transition a that has not been processed in S660, a is held in transition ne in S670. Next, “DFA state deletion by transition” of S680 is performed with the state ds and the transition ne.
図19のS700において、状態ds{0,4,7}の推移群a,dのうち、推移ne(a)に適合する推移であるaを特定する。S710において適合する推移があったため、S720に進み、未処理である推移aがあるため、S730に進む。S730では適合する推移aを取り出し、推移deに保持する。S740では推移de(a)の推移先のDFA状態{2,8}を状態ds1として保持し、推移ne(a)の推移先のNFA状態S2を状態ns1として保持し、これらを引数としてS520のサブルーチンDFA状態削除を行う。 In S700 of FIG. 19, a that is a transition that matches the transition ne (a) is specified from the transition groups a and d of the state ds {0, 4, 7}. Since there is a suitable transition in S710, the process proceeds to S720, and since there is a transition a that is not processed, the process proceeds to S730. In S730, a suitable transition a is extracted and held in the transition de. In S740, the DFA state {2, 8} of the transition de (a) is held as the state ds1, the NFA state S2 of the transition ne (a) is held as the state ns1, and these are used as arguments in S520. Subroutine DFA state deletion is performed.
DFA状態削除サブルーチンの最初の再帰について説明する。 The first recursion of the DFA state deletion subroutine will be described.
図18のS610において、状態ds{2、8}はNULLでないため、S620で状態nsのS2という状態を状態dsから削除し、その結果状態dsが保持するNFA状態群は{8}となる。S630で状態ds{8}はNFA状態を保持しているため、S650で、状態nsからの推移としてb、*を取得する。S660において未処理である推移bがあるため、S670でbを推移neに保持する。次に、状態dsと推移neでS680の「推移によるDFA状態削除」を行う。 In S610 of FIG. 18, since the state ds {2, 8} is not NULL, the state S2 of the state ns is deleted from the state ds in S620, and as a result, the NFA state group held by the state ds becomes {8}. Since the state ds {8} holds the NFA state in S630, b and * are acquired as transitions from the state ns in S650. Since there is an unprocessed transition b in S660, b is held in the transition ne in S670. Next, “DFA state deletion by transition” of S680 is performed with the state ds and the transition ne.
図19のS700において、状態ds{8}の推移群b,c,otherのうち、推移ne(b)に適合する推移であるb,otherを特定する。S710において適合する推移があったため、S720に進み、未処理である推移bがあるため、S730に進む。S730では適合する推移bを取り出し、推移deに保持する。S740では推移de(b)の推移先のDFA状態{2,3}を状態ds1として保持し、推移ne(b)の推移先のNFA状態S3を状態ns1として保持し。これらを引数としてS520のサブルーチンDFA状態削除を行う。 In S700 of FIG. 19, among the transition groups b, c, and other of the state ds {8}, b and other that are transitions that match the transition ne (b) are specified. Since there is a suitable transition in S710, the process proceeds to S720, and since there is a transition b that is not processed, the process proceeds to S730. In S730, the suitable transition b is extracted and held in the transition de. In S740, the transition DFA state {2, 3} of the transition de (b) is retained as the state ds1, and the transition destination NFA state S3 of the transition ne (b) is retained as the state ns1. Using these as arguments, the subroutine DFA state is deleted in S520.
DFA状態削除サブルーチンの二度目の再帰について説明する。 The second recursion of the DFA state deletion subroutine will be described.
図18のS610において、状態ds{2,3}はNULLではないため、S620で状態nsのS3という状態を状態dsから削除し、その結果状態dsが保持するNFA状態群は{2}となる。S630で状態ds{2}はNFA状態を保持しているため、S650で、状態nsからの推移を取得する。次に、S660で未処理である推移がないため、本サブルーチンの処理を終了(return)する。図14はこの時点のDFAを示している。 In S610 of FIG. 18, since the state ds {2, 3} is not NULL, the state S3 of the state ns is deleted from the state ds in S620, and as a result, the NFA state group held by the state ds becomes {2}. . Since the state ds {2} holds the NFA state in S630, the transition from the state ns is acquired in S650. Next, since there is no unprocessed transition in S660, the process of this subroutine is terminated (returned). FIG. 14 shows the DFA at this time.
図19のS520の処理が完了したため、S720に進む。S720では未処理である推移otherがあるため、S730に進む。S730では適合する推移otherを取り出し、推移deに保持する。S740では推移de(other)の推移先のDFA状態{2}を状態ds1として保持し、推移ne(other)の推移先のNFA状態S2を状態ns1として保持し、これらを引数としてS520のサブルーチンDFA状態削除を行う。 Since the process of S520 of FIG. 19 is completed, the process proceeds to S720. Since there is a transition other that has not been processed in S720, the process proceeds to S730. In S730, a suitable transition other is extracted and held in the transition de. In S740, the DFA state {2} of the transition de (other) is held as the state ds1, the NFA state S2 of the transition ne (other) is held as the state ns1, and these are used as arguments to the subroutine DFA of S520. Delete state.
DFA状態削除サブルーチンの三度目の再帰について説明する。 The third recursion of the DFA state deletion subroutine will be described.
図18のS610において、状態ds{2}はNULLでないため、S620で状態nsのS2という状態を状態dsから削除し、その結果状態dsが保持するNFA状態群はNULLとなる。S630で状態dsはNFA状態を保持していないため、S640で、d8を削除し、本サブルーチンの処理を終了(return)する。 In S610 of FIG. 18, since the state ds {2} is not NULL, the state S2 of the state ns is deleted from the state ds in S620, and as a result, the NFA state group held by the state ds becomes NULL. Since the state ds does not hold the NFA state in S630, d8 is deleted in S640, and the process of this subroutine ends (return).
図19のS520の処理が完了したため、S720に進む。S720では未処理である推移がないため、本サブルーチンの処理を終了(return)する。図15はこの時点のDFAを示している。 Since the process of S520 of FIG. 19 is completed, the process proceeds to S720. In S720, since there is no unprocessed transition, the processing of this subroutine is terminated (return). FIG. 15 shows the DFA at this time.
図18のS680の処理が完了したため、S660に進む。S660において未処理である推移*があるため、S670で*を推移neに保持する。次に、状態dsと推移neでS360の「推移によるDFA状態削除」を行う。 Since the process of S680 in FIG. 18 is completed, the process proceeds to S660. Since there is an unprocessed transition * in S660, * is held in transition ne in S670. Next, “DFA state deletion by transition” of S360 is performed with the state ds and the transition ne.
図19のS700において、状態ds{8}の状態群b,c,otherのうち、推移ne(*)に適合する推移であるb,c,otherを特定する。S710において適合する推移があったため、S720に進み、未処理である推移cがあるため、S730に進む。S730では適合する推移cを取り出し、推移deに保持する。S740では推移de(c)の推移先のDFA状態{2,9}を状態ds1として保持し、推移ne(*)の推移先のNFA状態S2を状態ns1として保持し、これらを引数としてS520のサブルーチンDFA状態削除を行う。 In S700 of FIG. 19, among the state groups b, c, other of the state ds {8}, the transitions b, c, other that are suitable for the transition ne (*) are specified. Since there is a suitable transition in S710, the process proceeds to S720, and since there is a transition c that has not been processed, the process proceeds to S730. In S730, the suitable transition c is extracted and held in the transition de. In S740, the DFA state {2, 9} of the transition de (c) is held as the state ds1, the NFA state S2 of the transition ne (*) is held as the state ns1, and these are used as arguments in S520. Subroutine DFA state deletion is performed.
前記の処理を繰り返すことにより、図6のDFAが更新されて最終的に図16に示すDFAになる。これにより、図17のS520で、DFA状態更新が終了した後、S530で図6のNFAから削除するXPath式に相当するNFAを削除し、図16のNFAになる。 By repeating the above processing, the DFA in FIG. 6 is updated to finally become the DFA shown in FIG. Thus, after the DFA state update is completed in S520 in FIG. 17, the NFA corresponding to the XPath expression to be deleted from the NFA in FIG. 6 is deleted in S530, and the NFA in FIG. 16 is obtained.
以上、第2実施形態(差分削除)を説明した。第1実施形態(図10〜図12)および第2実施形態(図17〜図19)で示したように、本発明は更新前XPath式から導出された更新前NFAに対して、推移に従って状態を順に辿る処理(深さ優先や幅優先など)を実行し、その実行過程において更新前NFAにおける各推移に適合する更新前DFAの推移を特定して、更新前DFAの各状態が保持するNFA状態群と推移群を確認し、当該NFA状態群および推移群と差分NFAとの差分を更新することを特徴とする。 The second embodiment (difference deletion) has been described above. As shown in the first embodiment (FIGS. 10 to 12) and the second embodiment (FIGS. 17 to 19), the present invention is in a state according to the transition with respect to the pre-update NFA derived from the pre-update XPath expression. Are executed in order (depth priority, width priority, etc.), the transition of the pre-update DFA that matches each transition in the pre-update NFA is specified in the execution process, and the NFA status held by each state of the pre-update DFA The group and the transition group are confirmed, and the difference between the NFA state group and the transition group and the difference NFA is updated.
なお、本発明は前記した実施形態に限定されることなく、幅広く変形実施することができる。例えば、NewsMLは一例でありXMLデータがNewsMLに限定されることはない。例えば、XMLデータがNITF(News Industry Text Format)データ等でもよい。また、フィルタエンジン10は、例えばASP(Application Service Provider)が企業や個人ユーザのために設置したり、企業や団体等が自社の社員や構成員等のために設置したりする。また、前記実施形態で示したDFAに対するXPath式の情報の差分追加の手段・手法は一例であり、本発明が前記実施形態で示した差分追加の手段・手法に限定されることはない。また、前記したフローなどは、XPath式処理プログラムとしてネットワーク上を伝送されたり、CD−ROM等の記憶媒体に記憶されて流通されたりする。
The present invention is not limited to the above-described embodiment, and can be widely modified. For example, NewsML is an example, and XML data is not limited to NewsML. For example, the XML data may be NITF (News Industry Text Format) data. The
また、フィルタエンジン10を構成する装置は、1台に限定されることはなく、複数の装置に機能を分散配置してもよい。例えば、フィルタ処理を実行する装置(XMLパースモジュール11、データ抽出モジュール13、および、データ変換モジュール16)と、フィルタ処理のためのオートマトンを作成する装置(問い合わせパースモジュール11、DFA作成モジュール13B、オートマトン管理部15、DFA更新モジュール17、更新オートマトン管理部18)とを、別々の装置として構成してもよい。これにより、各装置への負荷が分散され、高速な処理が実現可能となる。
Moreover, the apparatus which comprises the
10 フィルタエンジン
11 XMLパースモジュール
12 問い合わせパースモジュール
13 データ抽出モジュール
13B DFA作成モジュール
15 オートマトン管理部
16 データ変換モジュール
17 DFA更新モジュール
18 更新オートマトン管理部
DESCRIPTION OF
Claims (9)
コンピュータが、
前記更新前XPath式と、当該更新前XPath式から導出した更新前NFAと、当該更新前NFAから導出した前記更新前DFAとを記憶手段に管理するオートマトン管理ステップと、
前記更新前XPath式と前記更新後XPath式との差分となる差分XPath式から導出した差分NFAを記憶手段に管理する更新オートマトン管理ステップと、
前記差分NFAを用いて、前記更新前NFAを更新後NFAに、前記更新前DFAを前記更新後DFAに、それぞれ差分更新するDFA更新ステップと、
を実行することを特徴とするXPath式処理方法。 An XPath expression processing method for updating a pre-update DFA indicating an XPath expression before update input to process XML data to an updated DFA indicating an input XPath expression after update,
Computer
An automaton management step for managing the pre-update XPath expression, the pre-update NFA derived from the pre-update XPath expression, and the pre-update DFA derived from the pre-update NFA in a storage means;
An update automaton management step of managing a difference NFA derived from a difference XPath expression that is a difference between the pre-update XPath expression and the post-update XPath expression in a storage unit;
A DFA update step of performing a differential update using the differential NFA to update the pre-update NFA to the post-update NFA and the pre-update DFA to the post-update DFA, respectively;
XPath type processing method characterized by executing
前記更新前XPath式と、当該更新前XPath式から導出した更新前NFAと、当該更新前NFAから導出した前記更新前DFAとを管理するオートマトン管理部と、
前記更新前XPath式と前記更新後XPath式との差分となる差分XPath式から導出した差分NFAを管理する更新オートマトン管理部と、
前記差分NFAを用いて、前記更新前NFAを更新後NFAに、前記更新前DFAを前記更新後DFAに、それぞれ差分更新するDFA更新モジュールと、
を有することを特徴とするXPath式処理装置。 An XPath expression processing apparatus that updates a pre-update DFA indicating an XPath expression before update input to process XML data to an updated DFA indicating an input XPath expression after update,
An automaton management unit that manages the pre-update XPath expression, the pre-update NFA derived from the pre-update XPath expression, and the pre-update DFA derived from the pre-update NFA;
An update automaton management unit that manages a difference NFA derived from a difference XPath expression that is a difference between the pre-update XPath expression and the post-update XPath expression;
Using the differential NFA, the DFA update module for differentially updating the pre-update NFA to the post-update NFA, the pre-update DFA to the post-update DFA, and
An XPath type processing apparatus comprising:
コンピュータが、
前記更新前XPath式と、当該更新前XPath式から導出した更新前NFAと、当該更新前NFAから導出した前記更新前DFAとを記憶手段に管理するオートマトン管理ステップと、
前記更新前XPath式と前記更新後XPath式との差分となる差分XPath式から導出した差分NFAを記憶手段に管理する更新オートマトン管理ステップと、
前記差分NFAを用いて、前記更新前DFAを差分更新してオートマトンを生成するDFA更新ステップと、
を実行することにより生成されることを特徴とするオートマトン。
An automaton indicating an input post-update XPath expression generated from a pre-update DFA indicating an pre-update XPath expression input to process XML data,
Computer
An automaton management step for managing the pre-update XPath expression, the pre-update NFA derived from the pre-update XPath expression, and the pre-update DFA derived from the pre-update NFA in a storage means;
An update automaton management step of managing a difference NFA derived from a difference XPath expression that is a difference between the pre-update XPath expression and the post-update XPath expression in a storage unit;
A DFA update step of generating an automaton by differentially updating the pre-update DFA using the differential NFA;
An automaton that is generated by executing
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2005195572A JP4320004B2 (en) | 2005-07-04 | 2005-07-04 | XPath processing method, XPath processing device, XPath processing program, and storage medium storing the program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2005195572A JP4320004B2 (en) | 2005-07-04 | 2005-07-04 | XPath processing method, XPath processing device, XPath processing program, and storage medium storing the program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2007011998A true JP2007011998A (en) | 2007-01-18 |
JP4320004B2 JP4320004B2 (en) | 2009-08-26 |
Family
ID=37750346
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2005195572A Active JP4320004B2 (en) | 2005-07-04 | 2005-07-04 | XPath processing method, XPath processing device, XPath processing program, and storage medium storing the program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP4320004B2 (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2009177335A (en) * | 2008-01-22 | 2009-08-06 | Nippon Telegr & Teleph Corp <Ntt> | Stream data processing method, stream data processing program, and stream data processing system |
JP2009295013A (en) * | 2008-06-06 | 2009-12-17 | Hitachi Ltd | Method, apparatus and program for database management |
US10002326B2 (en) | 2014-04-14 | 2018-06-19 | Cavium, Inc. | Compilation of finite automata based on memory hierarchy |
US10110558B2 (en) | 2014-04-14 | 2018-10-23 | Cavium, Inc. | Processing of finite automata based on memory hierarchy |
US10466964B2 (en) | 2013-08-30 | 2019-11-05 | Cavium, Llc | Engine architecture for processing finite automata |
CN115801020A (en) * | 2023-02-13 | 2023-03-14 | 鹏城实验室 | Definite finite state automaton compression method, matching method, device and medium |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104714995B (en) * | 2013-08-30 | 2019-04-23 | 凯为有限责任公司 | System and method for traversing the NFA of regular expression pattern generation |
-
2005
- 2005-07-04 JP JP2005195572A patent/JP4320004B2/en active Active
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2009177335A (en) * | 2008-01-22 | 2009-08-06 | Nippon Telegr & Teleph Corp <Ntt> | Stream data processing method, stream data processing program, and stream data processing system |
JP2009295013A (en) * | 2008-06-06 | 2009-12-17 | Hitachi Ltd | Method, apparatus and program for database management |
US10466964B2 (en) | 2013-08-30 | 2019-11-05 | Cavium, Llc | Engine architecture for processing finite automata |
US10002326B2 (en) | 2014-04-14 | 2018-06-19 | Cavium, Inc. | Compilation of finite automata based on memory hierarchy |
US10110558B2 (en) | 2014-04-14 | 2018-10-23 | Cavium, Inc. | Processing of finite automata based on memory hierarchy |
CN115801020A (en) * | 2023-02-13 | 2023-03-14 | 鹏城实验室 | Definite finite state automaton compression method, matching method, device and medium |
CN115801020B (en) * | 2023-02-13 | 2023-04-11 | 鹏城实验室 | Definite finite state automaton compression method, matching method, device and medium |
Also Published As
Publication number | Publication date |
---|---|
JP4320004B2 (en) | 2009-08-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP4406609B2 (en) | Techniques for managing multiple hierarchies of data from a single interface | |
JP4320004B2 (en) | XPath processing method, XPath processing device, XPath processing program, and storage medium storing the program | |
JP5526128B2 (en) | Embed macros in web pages that contain advertisements | |
JP4824110B2 (en) | Computer-implemented method, computer program, and data processing system for inheriting page layout for a page | |
US7941417B2 (en) | Processing structured electronic document streams using look-ahead automata | |
JP4975783B2 (en) | Hierarchy construction method and hierarchy construction system | |
WO2007144853A2 (en) | Method and apparatus for performing customized paring on a xml document based on application | |
JP4384247B2 (en) | Lightweight application program interface (API) for extensible markup language (XML) | |
US7562079B2 (en) | Message generator | |
EP1594079A2 (en) | Generation of meaningful names in flattened hierarchical structures | |
JP2009543166A (en) | Computer-implemented method, computer program, and data processing system for defining page layout by page | |
JP2005234837A (en) | Structured document processing method, structured document processing system and its program | |
US20080276230A1 (en) | Processing bundle file using virtual xml document | |
CN109144514B (en) | JSON format data analysis and storage method and device | |
JP5063877B2 (en) | Information processing apparatus and computer program | |
JP2006127235A (en) | Structured document management system, structured document management method and program | |
US7584284B2 (en) | Path-token-based web service caching method | |
JP2010176489A (en) | Information processing apparatus, method and program | |
JP4523561B2 (en) | XPath processing equipment | |
JP4519028B2 (en) | XPath processing equipment | |
US9483578B2 (en) | Computer-readable storage medium storing update program, update method, and update device | |
JP5712496B2 (en) | Annotation restoration method, annotation assignment method, annotation restoration program, and annotation restoration apparatus | |
JP4801555B2 (en) | Document processing apparatus, document processing method, and document processing program | |
KR100691261B1 (en) | System and method for supporting xquery update language | |
CN102521288A (en) | Acquisition method of Web service information on Internet |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20090220 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20090303 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20090427 |
|
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: 20090526 |
|
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20090529 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120605 Year of fee payment: 3 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 4320004 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130605 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20140605 Year of fee payment: 5 |
|
S531 | Written request for registration of change of domicile |
Free format text: JAPANESE INTERMEDIATE CODE: R313531 |
|
R350 | Written notification of registration of transfer |
Free format text: JAPANESE INTERMEDIATE CODE: R350 |