JP2001344267A - XML document query language processor - Google Patents
XML document query language processorInfo
- Publication number
- JP2001344267A JP2001344267A JP2000165800A JP2000165800A JP2001344267A JP 2001344267 A JP2001344267 A JP 2001344267A JP 2000165800 A JP2000165800 A JP 2000165800A JP 2000165800 A JP2000165800 A JP 2000165800A JP 2001344267 A JP2001344267 A JP 2001344267A
- Authority
- JP
- Japan
- Prior art keywords
- document
- function
- processing
- xml
- query
- 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.)
- Pending
Links
Landscapes
- Document Processing Apparatus (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
(57)【要約】
【課題】 XML文書を対象とする既存の問い合わせ言
語を極力変更することなく記述内容の処理操作の柔軟性
と高度化とを図ることができるXML文書問い合わせ言
語処理装置を提供する。
【解決手段】 XML文書型で記述されている文書デー
タに対して問い合わせを行う問い合わせ手段1と、問い
合わせを解析して内部形式に変換する変換手段4と、変
換された内部形式に基づいて問い合わせ内容を実行して
文書データを出力する実行手段5と、汎用プログラミン
グ言語で記述されかつ問い合わせ言語の記述内容処理に
よっては処理不可能な処理を行うための外部関数が保存
されている外部関数保存手段6とを備え、問い合わせ手
段1は、外部関数に記述されているプログラムに従って
処理を行わせるために汎用プログラミング言語で記述さ
れた処理内容をXML言語で記述された処理内容に対応
づけて外部関数を定義する外部関数定義手段を備え、問
い合わせに外部関数が指定されているときに、実行手段
5が外部関数を呼び出すことにより汎用プログラミング
言語で記述された処理を実行する。
(57) [Summary] [Problem] To provide an XML document query language processing device capable of improving the flexibility and sophistication of the processing operation of the description content without changing the existing query language for XML documents as much as possible. I do. SOLUTION: An inquiry means 1 for making an inquiry about document data described in an XML document type, a conversion means 4 for analyzing the inquiry and converting it into an internal format, and a content of the inquiry based on the converted internal format And an external function storage means 6 for storing external functions for performing processing which is described in a general-purpose programming language and which cannot be processed by the description content processing of an inquiry language. The query means 1 defines an external function by associating processing contents described in a general-purpose programming language with processing contents described in an XML language in order to perform processing according to a program described in an external function. Executing means 5 calls the external function when the external function is specified in the query. To execute the processing described in the general-purpose programming language.
Description
【0001】[0001]
【発明の属する技術分野】本発明は、XML文書問い合
わせ言語処理装置の改良に関する。[0001] 1. Field of the Invention [0002] The present invention relates to an improved XML document query language processing device.
【0002】[0002]
【従来の技術】近年、インターネットの爆発的な普及に
伴って、各種の文書データベースの構築やその利用の高
度化が急速に進展しつつある。なかでも、XML言語形
式で記載された構造化文書は、人間が理解できるタグを
用いた階層構造で文書データが構築されているので、益
々その利用が活発になることが予想されている。2. Description of the Related Art In recent years, with the explosive spread of the Internet, the construction and utilization of various document databases has been rapidly advanced. In particular, the use of structured documents described in the XML language format is expected to become more and more active because the document data is constructed in a hierarchical structure using human-understandable tags.
【0003】そのXMLでは、文書型(DTD)が定義
されており、この文書型に基づいて、文書データベース
が構築されている。[0003] In XML, a document type (DTD) is defined, and a document database is constructed based on this document type.
【0004】例えば、新聞記事の文書がXML言語で記
載され、この文書型が以下に記載するDTDで与えられ
ているものとする。[0004] For example, it is assumed that a document of a newspaper article is described in an XML language, and this document type is given by a DTD described below.
【0005】<データベースに与えられているDTD> <!ELEMENT 文書 記事+> <!ELEMENT 記事(掲載日,見出し,本文)> <!ELEMENT 本文 段落+> <!ELEMENT 掲載日 #PCDATA> <!ELEMENT 見出し #PCDATA> <!ELEMENT 段落 #PCDATA> このDTDは、以下のことを意味している。<DTD given to database> <! ELEMENT document article +> <! ELEMENT article (posting date, headline, text)> <! ELEMENT text Paragraph +> <! ELEMENT Posted date #PCDATA> <! ELEMENT heading #PCDATA> <! ELEMENT paragraph #PCDATA> This DTD means the following.
【0006】データベースには、新聞の記事が複数個保
存されており、その記事は、「掲載日」と「見出し」と
「本文」との3つからなり、本文は1個以上の段落から
なっていることを意味している。[0006] The database stores a plurality of newspaper articles, each of which is composed of three items, "posting date", "headline", and "text", and the text is composed of one or more paragraphs. That means.
【0007】このDTDで与えられる新聞記事の文書を
XML言語を用いてテキスト文書で記載した一例を以下
に示す。 これらのテキストデータがデータベースに保存されてい
るものとする。これらのテキストデータには、このXM
L言語を対象とする問い合わせ言語、例えば、XML−
QL、XQLを用いて問い合わせを行い、データベース
から目的とする文書を取り出すことができる。An example in which a newspaper article document given by the DTD is described in a text document using the XML language is shown below. It is assumed that these text data are stored in a database. These text data include this XM
Inquiry language targeting L language, for example, XML-
An inquiry can be made using QL and XQL, and a target document can be extracted from the database.
【0008】[0008]
【発明が解決しようとする課題】しかしながら、これら
のXMLを対象とする問い合わせ言語は、文書構造に対
する操作機能は優れているが、記述内容の処理に関する
操作は極めて限られており、柔軟に記述内容を処理する
ことができないという不都合がある。However, these query languages for XML are excellent in the operation function for the document structure, but the operations related to the processing of the description contents are extremely limited, and the description contents are flexible. Cannot be processed.
【0009】従って、電子商取引をはじめとして、XM
L構造化文書の利用が益々活発になると予想される今
日、記述内容処理機能の一層の拡充が必須の課題であ
る。[0009] Therefore, in addition to e-commerce, XM
Today, the use of L-structured documents is expected to become more and more active, and it is essential to further enhance the description processing function.
【0010】その際に、XMLを対象とする問い合わせ
言語そのもののプログラムを完全に作り変えるものとす
ると、その問い合わせ言語に柔軟性がなくなり、好まし
くない。At this time, if the program of the query language itself for XML is completely rewritten, the query language loses flexibility, which is not preferable.
【0011】本発明は、上記の事情に鑑みて為されたも
ので、その目的とするところは、XMLを対象とする既
存の問い合わせ言語を極力変更することなく記述内容の
処理操作の柔軟性と高度化とを図ることのできるXML
文書問い合わせ言語処理装置を提供することにある。SUMMARY OF THE INVENTION The present invention has been made in view of the above circumstances, and has as its object the flexibility and the flexibility of the operation of processing description contents without changing the existing query language for XML as much as possible. XML that can be advanced
A document query language processing device is provided.
【0012】[0012]
【課題を解決するための手段】請求項1に記載のXML
文書問い合わせ言語処理装置は、XML文書型で記述さ
れている文書データに対して問い合わせを行う問い合わ
せ手段と、前記問い合わせを解析して内部形式に変換す
る変換手段と、変換された内部形式に基づいて問い合わ
せ内容を実行して前記文書データを問い合わせに基づき
出力する実行手段と、汎用プログラミング言語で記述さ
れかつ問い合わせ言語の記述内容処理によっては処理不
可能な処理を行うための外部関数が保存されている外部
関数保存手段とを備え、前記問い合わせ手段は、前記外
部関数に記述されているプログラムに従って処理を行わ
せるために前記汎用プログラミング言語で記述された処
理内容をXML言語で記述された処理内容に対応づけて
外部関数を定義する外部関数定義手段を備え、前記問い
合わせに前記外部関数が指定されているときに、前記実
行手段が前記外部関数を呼び出すことにより前記汎用プ
ログラミング言語で記述された処理を実行することを特
徴とする。An XML document according to claim 1, wherein:
The document query language processing apparatus includes: a query unit that makes a query about document data described in an XML document type; a conversion unit that analyzes the query and converts the query into an internal format; Execution means for executing the contents of the inquiry and outputting the document data based on the inquiry, and an external function for performing processing which is described in a general-purpose programming language and which cannot be processed by the processing of the description contents of the inquiry language are stored. External function storage means, wherein the inquiry means corresponds to the processing content described in the XML language in order to cause the processing content to be performed according to the program described in the external function. External function definition means for defining an external function, and When the number is specified, the executing means and executes the written in the general-purpose programming language processing by calling the external function.
【0013】請求項2に記載のXML文書問い合わせ言
語処理装置は、前記実行手段がXSLT言語処理装置で
あることを特徴とする。According to a second aspect of the present invention, in the XML document query language processing apparatus, the execution means is an XSLT language processing apparatus.
【0014】請求項3に記載のXML文書問い合わせ言
語処理装置は、前記外部関数が、前記汎用プログラミン
グ言語で記述されかつ文書から要約を生成する要約生成
手段に対応する関数であることを特徴とする。According to a third aspect of the present invention, in the XML document query language processing apparatus, the external function is a function that is described in the general-purpose programming language and corresponds to a summary generating unit that generates a summary from a document. .
【0015】請求項4に記載のXML文書問い合わせ言
語処理装置は、前記外部関数が、文書の見出しの項目と
類似度を判断して、文書の見出しに関連する段落の文書
を抽出する類似度抽出手段に対応する関数であることを
特徴とする。According to a fourth aspect of the present invention, in the XML document query language processing apparatus, the external function determines a similarity between the headline item of the document and the similarity, and extracts a document of a paragraph related to the headline of the document. It is a function corresponding to the means.
【0016】請求項5に記載のXML文書問い合わせ言
語処理装置は、前記外部関数が、文書の本文から先頭行
を抽出する文書文字抽出手段に対応する関数であること
を特徴とする。According to a fifth aspect of the present invention, in the XML document query language processing apparatus, the external function is a function corresponding to a document character extracting means for extracting a first line from a document body.
【0017】[0017]
【発明の実施の形態】図1において、1は問い合わせ手
段としての入出力インターフェース、2はデータベー
ス、3は問い合わせ処理系である。データベース2には
XML言語に従って、新聞記事等のXML文書が多数保
存されているものとする。DESCRIPTION OF THE PREFERRED EMBODIMENTS In FIG. 1, reference numeral 1 denotes an input / output interface as an inquiry means, 2 denotes a database, and 3 denotes an inquiry processing system. It is assumed that a large number of XML documents such as newspaper articles are stored in the database 2 according to the XML language.
【0018】入出力インターフェースではXML文書型
で記述されている文書データに対して問い合わせを行う
問い合わせ手段としてのXML−QLを拡張した形式の
ものが用いられる。As the input / output interface, an extended form of XML-QL is used as inquiry means for inquiring document data described in XML document type.
【0019】問い合わせ処理系3は、問い合わせを解析
して内部形式に変換する変換手段4と、変換された内部
形式に基づいて問い合わせ内容を実行してデータベース
2に保存されているXML文書データを出力する実行手
段5とを備えている。その変換手段4には既存の手段を
用いるために、ここでは、XSLT言語処理装置を用い
るものとする。The query processing system 3 analyzes the query and converts it into an internal format. The query processing system 3 executes the content of the query based on the converted internal format and outputs the XML document data stored in the database 2. And execution means 5 for performing the operation. In order to use an existing means for the conversion means 4, an XSLT language processing device is used here.
【0020】その問い合わせ処理系3は、汎用プログラ
ミング言語で記述されかつ問い合わせ言語の記述内容処
理によっては処理不可能な処理を行うための外部関数が
保存されている外部関数保存手段6とスタブ手段7を介
して通信可能である。その外部関数(記述内容処理関数
又はユーザ定義関数ともいう)は例えば汎用プログラミ
ング言語としてのJAVA(登録商標)で記述される。The query processing system 3 is composed of an external function storage means 6 and a stub means 7 which are described in a general-purpose programming language and store external functions for performing processing which cannot be performed by processing the description contents of the query language. Can be communicated via The external function (also referred to as a description processing function or a user-defined function) is described in, for example, JAVA (registered trademark) as a general-purpose programming language.
【0021】その外部関数は、例えば、文書が記事であ
る場合に、その記事の要約を自動的に生成する要約自動
生成機能を有するものであっても良いし、文書の見出し
に関連する段落の文書を抽出する類似度抽出機能を有す
るものであっても良いし、文書の本文から先頭行を抽出
する文書文字抽出機能を有するものであっても良い。For example, when the document is an article, the external function may have a function of automatically generating a summary of the article, or may have a function of automatically generating a summary of the article. It may have a similarity extraction function for extracting a document, or may have a document character extraction function for extracting the first line from the text of the document.
【0022】その入出力インターフェース1は、外部関
数として記述されているプログラムに従って処理を行わ
せるために汎用プログラミング言語で記述された処理内
容をXML言語で記述された処理内容に対応づけて外部
関数を定義する外部関数定義手段を備えている。The input / output interface 1 associates processing contents described in a general-purpose programming language with processing contents described in an XML language so as to perform processing in accordance with a program described as an external function. There is an external function definition means for defining.
【0023】ここでは、文書の本文から先頭行を抽出す
る文書文字抽出機能を有する外部関数を用いて問い合わ
せを行うものとする。Here, it is assumed that an inquiry is made using an external function having a document character extracting function for extracting the first line from the body of the document.
【0024】その問い合わせは、例えば、以下のように
記述される。 この記述の中で、「function string head(content st
r)defined-by "」が外部関数の定義であり、この定義に
基づいて問い合わせを実行すると、変換手段4がその問
い合わせを内部形式に変換し、実行手段5がその問い合
わせを実行する。The inquiry is described, for example, as follows. In this description, "function string head (content st
r) defined-by "" is the definition of the external function. When the query is executed based on this definition, the conversion means 4 converts the query into an internal format, and the execution means 5 executes the query.
【0025】実行手段5は問い合わせに外部関数が指定
されているときには、スタブ手段7を介して外部関数保
存手段6にアクセスし、その問い合わせにより指定され
た外部関数を呼び出し、この外部関数によりXML文書
を処理する。When an external function is specified in the inquiry, the execution means 5 accesses the external function storage means 6 through the stub means 7, calls the external function specified by the inquiry, and uses the external function to convert the XML document into an XML document. Process.
【0026】この例では、記事の本文から先頭行を取り
出す外部関数が指定されており、実行手段5はこの外部
関数の処理機能により、各記事の本文から先頭行を取り
出す操作をそれぞれ行って、XML文書として出力す
る。In this example, an external function for extracting the first line from the body of the article is specified, and the execution means 5 performs an operation for extracting the first line from the body of each article by using the processing function of the external function. Output as an XML document.
【0027】本発明によれば、既存の問い合わせ言語の
記述内容処理によっては処理不可能な処理を外部関数と
して実装可能としたので、既存の問い合わせ言語そのも
のを極力変更することなく高度な処理内容を柔軟に追加
できる。According to the present invention, processing that cannot be performed by the description processing of the existing query language can be implemented as an external function, so that advanced processing contents can be implemented without changing the existing query language itself as much as possible. Can be added flexibly.
【0028】以下に、その詳細を論文に基づき説明す
る。 文書構造変換規則と記述内容処理関数に基づく構造化文
書操作記述方式 要旨 近年、インターネットの爆発的な普及に伴い、XML をは
じめとする構造化文書データベースの構築とその高度利
用の要求が増大している。構造化文書データベースに対
する処理記述においては、タグの階層構造で与えられる
文書構造に対する処理と、文字列テキストで与えられる
記述内容に対する処理の両者を対象とする必要がある。The details will be described below based on a paper. Structured document operation description method based on document structure conversion rules and description processing functions Abstract In recent years, with the explosive spread of the Internet, the demand for the construction of XML and other structured document databases and their advanced use has increased. I have. In the process description for the structured document database, it is necessary to target both the process for the document structure given by the hierarchical structure of tags and the process for the description content given by the character string text.
【0029】XML を対象とする問合せ言語は、これまで
にも幾つか提案されている。これらの多くは文書構造に
対しては比較的強力な操作機能を持つが、記述内容処理
に関しては極めて限定された機能しか提供していない。Several query languages have been proposed for XML. Many of these have relatively powerful operation functions for document structures, but provide only very limited functions for description processing.
【0030】今後、構造化文書の高度利用の要求へ対応
するためには、記述内容処理機能の一層の拡充が必須で
あると考えられる。In the future, in order to respond to the demand for advanced use of structured documents, it is considered that the description content processing function must be further expanded.
【0031】特に、大量の文書から目的とする情報を効
率的に獲得するためには、意味的な類似度に基づく文書
要素の絞り込みやランキング、要約や話題抽出等の機能
が必要である。 1.はじめに 近年、各種文書データベースの構築やその利用の高度化
が急速に進みつつある。特に、インターネットの爆発的
な普及に伴い、XML をはじめとする構造化文書データベ
ースの構築とその高度利用の要求が増大している 。In particular, in order to efficiently obtain desired information from a large number of documents, functions such as narrowing down document elements based on semantic similarity, ranking, abstracting, and topic extraction are required. 1. Introduction In recent years, the construction and utilization of various document databases has been rapidly advanced. In particular, with the explosive spread of the Internet, there has been an increasing demand for the construction and advanced use of structured document databases such as XML.
【0032】構造化文書データベースに対する処理記述
においては、タグの階層構造で与えられる文書構造に対
する処理と、文字列テキストで与えられる記述内容に対
する処理の両者を対象とする必要がある 。In the process description for the structured document database, it is necessary to cover both the process for the document structure given by the hierarchical structure of tags and the process for the description content given by the character string text.
【0033】構造化文書データベースに対する基本的な
処理記述言語として、これまでに各種の問合せ言語が提
案されている 。Various query languages have been proposed as basic processing description languages for structured document databases.
【0034】XML を対象とした問合せ言語の代表例とし
ては、XML-QL やXQL 等がある。また、半構造データを
対象とした問合せ言語であるLorel、UnQL、StruQL、YAT
L 等もその適用対象の一つとして XML 構造化文書を想
定している。[0034] XML-QL and XQL are typical examples of query languages for XML. Also, Lorel, UnQL, StruQL, and YAT, query languages for semi-structured data
L also assumes that XML structured documents are one of the applications.
【0035】これらの問合せ言語のいずれにおいても、
何らかの意味で文書構造処理と記述内容処理の両者に関
する機能が提供されている。In any of these query languages,
In some sense, functions related to both document structure processing and description content processing are provided.
【0036】特に、XML-QL や半構造データ問合せ言語
は、文書構造に対する比較的強力な操作体系を有する。
しかし、これに対比して記述内容処理に関しては、指定
した語句やパターンに合致する部分文字列を有する文書
要素を選択するといった、極めて限定された機能しか提
供していない。In particular, XML-QL and a semi-structured data query language have a relatively powerful operation system for a document structure.
However, in contrast to this, the description content processing provides only a very limited function such as selecting a document element having a partial character string that matches a specified word or pattern.
【0037】今後、電子商取引をはじめとして、構造化
文書の利用がますます活発になると予想される。様々な
利用者の要求に応えるためには、構造化文書のより高度
な利用が必要である。その一つの方向として、記述内容
処理機能の一層の拡充は重要な課題である。It is expected that the use of structured documents, including electronic commerce, will become more active in the future. In order to meet the needs of various users, more advanced use of structured documents is required. As one direction, further expansion of the description processing function is an important issue.
【0038】特に、大量の構造化文書から目的とする情
報を効率的に獲得するためには、与えられたキーワード
群との意味的な類似度に基づく文書要素の絞り込みやラ
ンキング、文書要素の要約や話題抽出等の機能を上記の
ような文書構造操作の枠組みに統合することが極めて重
要であると考えられる。In particular, in order to efficiently obtain target information from a large number of structured documents, document elements are narrowed down and ranked based on the degree of semantic similarity to a given keyword group, and document elements are summarized. It is considered very important to integrate functions such as word extraction and topic extraction into the framework of document structure operation as described above.
【0039】例えば、XML 構造化文書群として与えられ
た新聞記事データベースに対する問合せを考えてみた場
合、該当する記事の掲載日や見出しを抽出して適当な一
覧に再構成するといった文書構造操作に加えて、記事内
容と問合せの類似度を測定し、必要に応じて要約を添付
する等の記述内容処理を伴うような要求が処理できる事
が求められる。For example, when considering a query for a newspaper article database given as an XML structured document group, in addition to document structure operations such as extracting the publication date and headline of the relevant article and reconstructing it into an appropriate list, Therefore, it is required to be able to measure the similarity between the content of the article and the inquiry, and to process a request that involves the processing of the description content such as attaching an abstract as necessary.
【0040】ここで、類似度の計算方法や要約の作成方
法は、対象文書や文書要素の種類に依存するということ
にも注意する必要がある。例えば、見出しのような特定
の文書要素に出現する語には、他の文書要素に含まれる
語句に比べ、より大きな重み付けを行なう等がしばしば
行なわれる。Here, it should be noted that the method of calculating the similarity and the method of creating the abstract depend on the type of the target document or document element. For example, words that appear in a specific document element such as a headline are often weighted more heavily than words included in other document elements.
【0041】また、自動要約生成、話題抽出等に対して
は各種の方式が提案されている。それゆえ、類似度の導
出や要約の作成等の具体的な記述内容処理の詳細は、利
用者がその目的に合致するものを必要に応じて外部から
与えられる拡張性を有することが望ましい。Various methods have been proposed for automatic summary generation, topic extraction, and the like. Therefore, it is desirable that the details of specific description processing such as derivation of similarity and creation of an abstract have expandability that allows a user to externally provide a content that meets the purpose as needed.
【0042】本研究では、このような要求に対応するた
め、構造化文書に対する問合せ言語が持つ文書構造操作
機能と、類似検索や要約生成等のより高次の記述内容処
理機能を統合した、構造化文書操作記述方式を提案す
る。In this research, in order to respond to such a request, a document structure operation function of a query language for a structured document and a higher-level description content processing function such as similarity search and summary generation are integrated. We propose a simplified document operation description method.
【0043】本操作記述は、XML 構造化文書を操作対象
とし、XML-QLに準じた様式で与えられる文書構造変換規
則群と、記述内容処理関数を組み合わせることで、上記
の統合を実現する。This operation description realizes the above-mentioned integration by combining a document structure conversion rule group given in a format conforming to XML-QL and a description processing function with an XML structured document as an operation target.
【0044】この記述内容処理関数は利用者がその目的
に応じて追加定義できるものとする。また、本操作記述
で与えられる XML 構造化文書操作を、ある種の制約の
下でXSLT に基づく文書操作へと変換するための手順を
示す。従って、ここでの制約を満たす入力の範囲内で
は、本操作記述処理系を XSLT 処理系上に実装すること
が可能である。This description processing function can be additionally defined by the user according to the purpose. In addition, the procedure for converting the XML structured document operation given in this operation description into the XSLT-based document operation under certain restrictions is shown. Therefore, this operation description processing system can be implemented on the XSLT processing system within the range of input that satisfies the restrictions here.
【0045】以下では、まず 2 節で文書構造操作と高
次の記述内容処理の統合を必要とする構造化文書操作例
を示す。次に、3 節で XML-QL について概説し、4 節で
本操作記述方式について詳細を述べる。また、5節で本
操作記述方式からXSLTによる記述への変換方式を述べ
る。6 節で関連研究について言及し、7 節でまとめと今
後の課題を示す。 2.構造化文書操作例 本節では、記述内容処理と文書構造操作の両者の能力を
必要とする構造化文書操作の例を示す。4 節では、本節
の例 1 を利用して本操作記述方式を説明する。以下で
は、必要に応じて <識別子> で ``識別子'' という文
書要素名もしくはその文書要素を表記する。また、属性
名も同様に表記する。In the following, Section 2 shows an example of a structured document operation requiring integration of the document structure operation and the processing of higher-order description contents. Next, Section 3 outlines XML-QL, and Section 4 details the operation description method. Section 5 describes the conversion method from this operation description method to XSLT description. Section 6 refers to related research, and Section 7 summarizes and discusses future work. 2. Example of structured document operation This section shows an example of a structured document operation that requires both the capabilities of description content processing and document structure operation. Section 4 describes this operation description method using Example 1 in this section. In the following, the document element name of "identifier" or its document element is described as <identifier> as necessary. The attribute names are also described in the same manner.
【0046】例 1 ある新聞の記事の記事データベースとして構成された X
ML 文書を考える。各記事には、掲載日、見出し、本文
が含まれているものとし、文書の DTD は次で与えられ
るものとする。Example 1 X constructed as an article database of articles of a newspaper
Consider an ML document. Each article shall include the publication date, headline, and text, and the DTD of the document shall be given below.
【0047】 <!-- 入力文書の DTD --> <!ELEMENT 文書 記事+> <!ELEMENT 記事 (掲載日,見出し,本文)> <!ELEMENT 本文 段落+> <!ELEMENT 掲載日 #PCDATA> <!ELEMENT 見出し #PCDATA> <!ELEMENT 段落 #PCDATA> 読者はある事件に興味を持っており、この文書から興味
に合致する記事を掲載日別にn 件ずつ抽出し、得られた
各記事の見出しと内容の要約を得たいと仮定する。これ
は、例えば次のような操作で実現される。 1.<文書>から<記事>を取り出し、それらを<掲載
日>によってグルーピングを行なう。 2.グループ毎に、読者が与えた興味内容を表わすキー
ワード群に対する各<記事>の類似度を調べ、ランキン
グ結果の上位 n 件を選び出す。 3.選び出された各<記事>について、<見出し>を抽
出し、更に<本文>からその要約となる文書要素を生成
する。<!-DTD of input document-><! ELEMENT document article +><! ELEMENT article (posting date, headline, text)><! ELEMENT text paragraph +><! ELEMENT posting date #PCDATA>< ! ELEMENT Heading #PCDATA><! ELEMENT Paragraph #PCDATA> Readers are interested in a case, extract n articles that match their interest from this document by date of publication, Suppose you want to get a summary of the content. This is realized by the following operation, for example. 1. Extract <Articles> from <Documents> and group them by <Post Date>. 2. For each group, the similarity of each <article> to the keyword group indicating the content of interest given by the reader is examined, and the top n results of the ranking result are selected. 3. For each of the selected <articles>, a <headline> is extracted, and a document element serving as an abstract is generated from the <body>.
【0048】この例において、1は文書構造操作の典型
例の一つである。また、2は<掲載日>別に分類された
<記事>集合の各々に対して類似度に基づく文書要素の
選択を行なっている。3では、結果の各<記事>につい
て文書構造の再構成と<本文>の自動要約生成を行なっ
ている。要約生成には様々な方法があるが、ここでは<
見出し>との類似度が高い段落や文を一定量抽出すると
いう方法を考える。これは抽出単位となる段落や文等の
文書要素が導入されていれば、2と同様な処理であると
みなせる。具体的な抽出単位として、<段落>を用い
る。本操作の結果として得られる文書は次に示す DTD
に従ったものとする。In this example, 1 is one of the typical examples of the document structure operation. Reference numeral 2 selects a document element based on the degree of similarity for each of the <article> sets classified according to <posting date>. In 3, the document structure is reconstructed for each <article> of the result and the automatic summary generation of the <body> is performed. There are various methods for summarization, but here <
Consider a method of extracting a certain amount of paragraphs and sentences having a high degree of similarity to heading>. This can be considered to be the same processing as 2 if document elements such as paragraphs and sentences as extraction units are introduced. <Paragraph> is used as a specific extraction unit. The document obtained as a result of this operation is the following DTD
Shall be followed.
【0049】 <!-- 出力文書の DTD --> <!ELEMENT 文書 日別+> <!ELEMENT 日別 記事+> <!ELEMENT 記事 (見出し,本文)> <!ELEMENT 本文 段落+> <!ELEMENT 見出し #PCDATA> <!ELEMENT 段落 #PCDATA> 例 2 ある分野の製品シェアに関する調査結果表と、それらの
製品の比較・評価に関する記事を含む構造化文書があ
る。記事は段落分けされており、この文書は次のDTD に
従うものとする。<!-DTD of output document-><! ELEMENT document daily +><! ELEMENT daily article +><! ELEMENT article (headline, body)><! ELEMENT body paragraph +><! ELEMENT Heading #PCDATA><! ELEMENT Paragraph #PCDATA> Example 2 There is a structured document that contains a survey of product share in a certain field and articles on the comparison and evaluation of those products. The article is paragraphed and this document is subject to the following DTD:
【0050】 <!-- 入力文書の DTD --> <!ELEMENT 文書 (シェア表,評価記事)+> <!ELEMENT シェア表 製品情報+> <!ELEMENT 製品情報 (製品名,シェア)> <!ELEMENT 評価記事 段落+> <!ELEMENT 製品名 #PCDATA> <!ELEMENT シェア #PCDATA> <!ELEMENT 段落 #PCDATA> この文書に対して、評価記事の中でシェア 30% 以上の
製品について触れている「部分」を抜き出したいという
状況を考える。ここで「部分」とは、文書要素として明
示的に与えられてはいない、複数の段落から構成される
「話題単位」を示すものとする。テキストタイリングで
行なわれているように、話題単位の境界は、連続する段
落間の類似度の推移グラフがある深さ以上の谷となる段
落の境界によって与えるものとする。この要求は、例え
ば次のような処理で実現され、その結果として与えられ
る文書は下に示す DTD に従ったものとする。 1.<評価記事>について、<段落>間の類似度の推移
条件に従って話題単位を構成する<段落>列を抽出し、
新たな文書要素である<話題単位>としてまとめる。 2.<シェア表>から<シェア>が30% 以上の製品の<
製品名>を抽出し、1で得られた<話題単位>の列か
ら、<製品名>を文字列として含むものを選択する。<!-DTD of input document-><! ELEMENT document (share table, evaluation article) +><! ELEMENT share table Product information +><! ELEMENT product information (product name, share)><! ELEMENT Evaluation Article Paragraph +><! ELEMENT Product Name #PCDATA><! ELEMENT Share #PCDATA><! ELEMENT Paragraph #PCDATA> Consider the situation where you want to extract the "parts". Here, the “part” indicates a “topic unit” composed of a plurality of paragraphs, which is not explicitly given as a document element. As in text tiling, the boundaries of topic units are given by the boundaries of paragraphs that are valleys that are equal to or greater than a certain depth in the transition graph of similarity between consecutive paragraphs. This request is fulfilled, for example, by the following processing, and the resulting document conforms to the DTD shown below. 1. For <evaluation article>, extract <paragraph> columns that form a topic unit according to the transition condition of similarity between <paragraphs>
This is summarized as a new document element <topic unit>. 2. From the <Share Table>, <Products> with <Share> of 30% or more
Product name> is extracted, and a character string including <product name> as a character string is selected from the column of <topic unit> obtained in 1.
【0051】 <!-- 出力文書の DTD --> <!ELEMENT 文書 製品+> <!ELEMENT 製品 (製品名,記事)> <!ELEMENT 記事 話題単位+> <!ELEMENT 話題単位 段落+> <!ELEMENT 製品名 #PCDATA> <!ELEMENT 段落 #PCDATA> ここで、例 1 では、1のグルーピングによって得られ
る<日別>に対して2の処理を行ない、また、例2では
1による再構成で生成される<話題単位>に対して2の
処理を行なっている。このように、同じ部分について複
数の処理を重ねて行なう必要がある。このような、処理
結果を中間結果とみなし、更に処理を重ねることを多段
階の処理という。 3.XML-QL 本稿で提案する操作記述方式は、基本構文として XML-Q
Lをベースとしている。これは、従来の問合せ言語との
親和性を高め、可読性の高い記述とするためである。本
節では、4節での操作記述方式を理解する上で必要なXM
L-QLの機能について説明する。 3.1 問合せ XMl-QLはXML文書に対する問合せ言語であり、基本構文
は次の通りである。<!-DTD of output document-><! ELEMENT document product +><! ELEMENT product (product name, article)><! ELEMENT article topic unit +><! ELEMENT topic unit paragraph +><! ELEMENT ELEMENT product name #PCDATA><! ELEMENT paragraph #PCDATA> Here, in Example 1, 2 processing is performed on <daily> obtained by grouping of 1, and in Example 2, it is generated by restructuring by 1. 2 is performed for the <topic unit> to be executed. As described above, it is necessary to perform a plurality of processes on the same portion in a superimposed manner. Such a processing result is regarded as an intermediate result, and further processing is called multi-step processing. 3. XML-QL The operation description method proposed in this paper uses XML-Q as the basic syntax.
L based. This is to enhance the affinity with the conventional query language and make the description highly readable. In this section, XM necessary to understand the operation description method in section 4
The function of L-QL is explained. 3.1 Query XMl-QL is a query language for XML documents, and its basic syntax is as follows.
【0052】 例えば、前節の例1 の1は次のように記述される。出力
は<日別>の列を内容とする<文書>である。[0052] For example, 1 in Example 1 in the previous section is described as follows. The output is a <document> containing the <daily> column.
【0053】 where 節 問合せ条件の指定を行ない、対象文書ないし
文書要素中のパターン式に適合する文書要素に対して、
必要ならば変数を束縛する。パターン式は、ルートを起
点とする文書要素の並びであり、変数の束縛は適合する
全ての組合せに対して行なわれる。尚、文書要素の属性
も同様に対象とする事ができるが、本稿では説明を省略
する。[0053] where clause Specify the query conditions, and for the document element that matches the pattern expression in the target document or document element,
Bind variables if necessary. A pattern expression is a sequence of document elements starting from the root, and variable binding is performed for all matching combinations. Note that the attribute of the document element can be similarly targeted, but the description is omitted in this document.
【0054】パターン式<a><b></> element#as$x </>
は、<a>の子要素である<b>を変数$xに割り当てる。
また、パターン式 <a><b></> content#as$x </> は、<a
><b>$x </></> と等価であり、<a>の子要素である<b
>の内容全体を$x に割り当てる。パターン式 <a><$x><
/>$i</> は<a>の任意の子要素の文書要素名をタグ変
数$x に割り当て、$i にその出現位置を示す添字番号
(0,1,...) を割り当てる。Pattern expression <a><b></> element # as $ x </>
Assigns <b>, a child element of <a>, to variable $ x.
Also, the pattern expression <a><b></> content # as $ x </>
><b> $ x </></>, which is a child element of <a><b
Assign the entire contents of> to $ x. Pattern expression <a><$x><
/> $ i </> assigns the document element name of any child element of <a> to the tag variable $ x, and $ i is the subscript number indicating the occurrence position
Assign (0,1, ...).
【0055】構造指定にはパス正規表現のサブセットを
利用できる。<a|b>は<a>もしくは<b>に、<a.b>は<
a>の子要素である<b>に適合する。For the structure specification, a subset of the path regular expression can be used. <a | b> is <a> or <b>, <ab> is <
Matches <b>, which is a child element of a>.
【0056】*, + はそれぞれ、直前のパス名の0 回以
上, 1 回以上の繰返しを示し、$は任意の文書要素に適
合する。尚、パターン式中での文書要素の出現順序は、
対象文書要素中での出現順序を規定しない。冒頭の記述
例では、一つ目のwhere節で<文書>の内部を$xに束縛
し、二つ目のwhere 節では$x中の各<記事>を$aに、そ
の<掲載日>を$dに束縛する。construct節 where
節のパターン式に適合する変数の各組合せに対する出力
の構成を指定する節であり、変数を含む文書要素もしく
は文字列の形式で記述される。問合せ結果は、この記述
の変数を展開する事で生成される文書要素の列となる。* And + respectively indicate 0 or more times and 1 or more times of the immediately preceding path name, and $ matches any document element. Note that the order in which document elements appear in the pattern expression is
Does not specify the order of appearance in the target document element. In the example at the beginning, in the first where clause, the inside of <document> is bound to $ x, and in the second where clause, each <article> in $ x is converted to $ a, and the <post date> To $ d. construct clause where
This section specifies the output configuration for each combination of variables that match the pattern expression of the section, and is described in the form of a document element or a character string containing the variable. The query result is a sequence of document elements generated by expanding the variables of this description.
【0057】また、construct 節中にwhere〜construct
節を入れ子にする事ができる。この場合、外側のwhere
節で適合する変数の値を固定した上で、内側のwhere〜
construct 節が処理される。In the construct section, where-construct
Clauses can be nested. In this case, the outer where
After fixing the value of the variable that matches in the clause,
The construct clause is processed.
【0058】生成する文書要素には、その<ID>属性を
スコーレム関数で与えることができ、同じ<ID>を持つ
文書要素は一つの文書要素実体に集約される。スコーレ
ム関数はその引数と返値が一対一対応する。これを利用
することによりグルーピングを実現できる。冒頭の例で
は、副問合せの処理結果を内容とする、ただ一つの<文
書>が生成される。また、副問合せでは<記事>($a)
を内容とする<日別>の列が生成される。それぞれの<
日別>は、construct 節中でスコーレム関数DateID()
によって<掲載日>の値$dから生成された<ID> が与
えられる。このため、同じ[掲載日]から生成された[日
別]は一つにまとめられる。結果として、<掲載日>に
よって<記事>が<日別>にグルーピングされる。 order-by 節 文書要素の出力順を指定する節で、出
力は指定されたキーの値について昇順に、descendingが
指定された場合には降順にソートされる。冒頭の例で
は、出力の<日別>文書要素を変数$dの値によって日付
順にソートして出力を行なう。 3.2関数定義 次の構文を用いて、ユーザは必要に応じて関数を定義す
ることができる。The document element to be generated can be given its <ID> attribute by a Skolem function, and document elements having the same <ID> are aggregated into one document element entity. The Skolem function has one-to-one correspondence between its argument and its return value. By using this, grouping can be realized. In the first example, only one <document> containing the processing result of the subquery is generated. In the subquery, <article> ($ a)
Is generated as a <daily> column. Each <
Daily> is the skolem function DateID () in the construct clause
Gives <ID> generated from the value $ d of <Posting date>. For this reason, [daily] generated from the same [posting date] are combined into one. As a result, <article> is grouped into <daily> by <post date>. order-by clause This section specifies the output order of the document elements. The output is sorted in ascending order for the specified key value, and in descending order when descending is specified. In the example at the beginning, the output <daily> document elements are sorted in chronological order according to the value of the variable $ d and output. 3.2 Function Definition The following syntax allows a user to define a function as needed.
【0059】 function 関数名( 引数リスト ) where〜construct 問合せ end 関数定義中の問合せ結果が関数呼出しの返値として扱わ
れる。このため、XML-QL で定義可能な関数は問合せと
して表現できるものに限られる。 4 提案記述方式 4.1 文書構造変換規則 本操作記述方式では、構造化文書に対する記述内容処理
関数を含んだ操作を文書構造変換規則に基づいて記述す
る。文書構造変換規則(以下、変換規則)はパターンに適
合する部分構造に対する変換方法を表す。ルール指向の
記述を用いることは、本来、文書構造操作機能とより高
次の記述内容処理機能を統合することとは独立な事項で
はあるが、次のような利点がある。 1.様々な文書に共通に現れる部分構造に対する変換操
作をより簡潔に記述することが容易になる。例えば、種
々の文書構造の中に埋めこまれているある種の文書要素
を別の文書要素で置き換えるような処理を実現するに
は、XML-QLでは上位の文書構造に応じて異なる問合せ記
述とし、更にその上位の構造を保存するよう記述する必
要がある。これは記述に繁雑さをもたらす。また、あら
かじめ上位の文書構造がある程度限定できない場合に
は、記述自体が困難な場合もある。 2. XSLT をはじめとするルール指向の処理方式が今後
広く普及する可能性があるが、それらとの整合性が高
い。例えば、YATLやXQL等、ルール指向の枠組をベース
とした構造化文書記述系も既に幾つか存在する。また、
本論文では5節においてXSLT への変換方法を示す。 3.例えば、XML-QL 等での通常の問合せ記述は、一定
の条件を満たす単一の変換規則からなる変換規則と捉え
ることが可能であり、この意味で従来の問合せ記述の自
然な拡張になっている。Function function name (argument list) where to construct query end The query result in the function definition is treated as the return value of the function call. For this reason, functions that can be defined in XML-QL are limited to those that can be expressed as queries. 4. Proposed Description Method 4.1 Document Structure Conversion Rule In this operation description method, an operation including a description content processing function for a structured document is described based on a document structure conversion rule. The document structure conversion rule (hereinafter, conversion rule) indicates a conversion method for a substructure that matches the pattern. Although the use of the rule-oriented description is originally independent of integrating the document structure operation function and the higher-level description content processing function, it has the following advantages. 1. It becomes easier to describe the conversion operation for the substructure that appears commonly in various documents in a more concise manner. For example, to implement a process that replaces a certain document element embedded in various document structures with another document element, XML-QL uses different query descriptions depending on the upper-level document structure. Need to be described so as to preserve the higher-level structure. This adds complexity to the description. In addition, if the upper-level document structure cannot be limited to some extent in advance, the description itself may be difficult. 2. There is a possibility that rule-oriented processing methods such as XSLT will be widely spread in the future, but they are highly consistent with them. For example, there are already some structured document description systems based on rule-oriented frameworks such as YATL and XQL. Also,
In this paper, Section 5 shows how to convert to XSLT. 3. For example, an ordinary query description in XML-QL etc. can be regarded as a conversion rule consisting of a single conversion rule that satisfies certain conditions. In this sense, it is a natural extension of the conventional query description. I have.
【0060】個々の変換規則の記述は、可読性と既存の
問合せ言語との親和性を考慮し、XML-QL をベースとす
る。変換規則の基本構文は次の通りである。The description of each conversion rule is based on XML-QL in consideration of readability and compatibility with existing query languages. The basic syntax of the conversion rule is as follows.
【0061】 文書操作においては、上位 n件のみといったように、出
力として生成される文書要素列の長さをランキング結果
に従って限定するという場面が現れる。これに対応する
ため、本操作記述では first 節及びrank-by〜top 節を
導入する。この指定により、construct 節で生成される
出力が出力数計算式の評価結果の個数に限定される。[0061] In a document operation, a scene appears in which the length of a document element sequence generated as an output is limited according to the ranking result, such as only the top n items. To cope with this, this operation description introduces the first clause and the rank-by to top clauses. By this specification, the output generated in the construct clause is limited to the number of evaluation results of the output number calculation formula.
【0062】first 節は、出力の生成順で先頭から、あ
るいはfrom〜bottom の指定がある場合には最後尾か
ら、指定数の文書要素を出力する。この時、order-by節
があればソート結果に対して作用する。The first clause outputs a specified number of document elements from the top in the order of output generation, or from the end if from to bottom is specified. At this time, if there is an order-by clause, it operates on the sort result.
【0063】rank-by〜top節は、順序評価基準式の評価
結果を基準にしてランキングを行ない、順位が出力数計
算式の評価結果以内のもののみを生成順に出力する。こ
れは、order−by 節とfirst 節を用いた指定と似た作用
を持つが、出力の物理的な位置に影響を与えない。ま
た、物理的なソートを行なわないため、descending及び
from〜bottom修飾句を持たない。 4.3 記述例と適用手順 2節の例 1 で述べた文書操作に対応する変換規則を以
下に示す。三つの変換規則は、例1における操作1〜3
にそれぞれ対応する。The rank-by to top clauses perform ranking based on the evaluation result of the order evaluation criterion formula, and output only those whose rank is within the evaluation result of the output number calculation formula in the order of generation. This has a similar effect to using the order-by and first clauses, but does not affect the physical location of the output. Also, since there is no physical sorting, descending and
It has no from ~ bottom modifier. 4.3 Description example and application procedure The conversion rules corresponding to the document operations described in Example 1 in Section 2 are shown below. The three conversion rules correspond to operations 1 to 3 in Example 1.
Respectively.
【0064】XML-QL ではパターン照合の起点は常にル
ート文書要素であるが、本操作記述では異なる解釈を行
なう。前節の項目1に対応するため、以下の適用手順に
示すようにパターン照合の対象はルート文書要素に限ら
ず、より限定的な部分文書とする。具体的な変換規則の
適用手順を以下に示す。In XML-QL, the starting point of pattern matching is always the root document element, but this operation description makes a different interpretation. To correspond to item 1 in the previous section, the target of pattern matching is not limited to the root document element, but is a more limited partial document as shown in the application procedure below. The specific application procedure of the conversion rule is shown below.
【0065】 // 変換規則 1 : 例 1.1 におけるグルーピングに相当 rule where <文書></> content#as $x construct <文書> where <記事> <掲載日> $d </> </> element#as $a in $x order-by $d construct #<日別 ID=DateID($d)> $a </> </> // 変換規則 2 : 例 1.2 における絞り込みに相当 rule where <日別></> content#as $x construct <日別> where <記事></> element#as $a in $x order-by $a.sim#cosine(keywords) first 5 construct #$a </> // 変換規則 3 : 例 1.3 における要約生成に相当 rule where <記事> <見出し></> element#as $h <本文></> element#as $b construct <記事> $h <本文> where <段落></> element#as $p in $b rank-by sim#cosine($h,$b) top 3 construct $p </> </> なお、「keywords」は、ここではゴシック体であるが、
実際はイタリック体を使用する。// Conversion rule 1: Equivalent to grouping in example 1.1 rule where <document></> content # as $ x construct <document> where <article><date> $ d </></> element # as $ a in $ x order-by $ d construct # <Daily ID = DateID ($ d)> $ a </></> // Conversion rule 2: Equivalent to filtering in Example 1.2 rule where <Daily></> content # as $ x construct <daily> where <article></> element # as $ a in $ x order-by $ a.sim # cosine (keywords) first 5 construct # $ a </> / / Conversion rule 3: Equivalent to summarization in example 1.3 rule where <article><headline></> element # as $ h <body></> element # as $ b construct <article> $ h <body> where <Paragraph></> element # as $ p in $ b rank-by sim # cosine ($ h, $ b) top 3 construct $ p </></> Note that “keywords” is in Gothic here But,
In fact, italics are used.
【0066】 0.初期状態としてルートの文書要素を照合対象とし
て、変換規則を次のように多段階に適用する。 1.照合対象の文書要素と変換規則とのパターン照合が
行なわれる。変換規則群中にwhere 節が適合する変換規
則が見つかった時は、それを適用し、更に他の照合対象
候補が存在する場合には次の照合対象を処理する。出力
文書中で照合対象に合致した部分は、そのconstruct 節
の出力結果によって置き換えられる。複数の変換規則が
適合する場合には、先に定義したものを優先する。[0066] 0. The conversion rule is applied in multiple stages as follows, with the root document element as the initial state to be collated. 1. The pattern matching between the document element to be matched and the conversion rule is performed. If a conversion rule that matches the where clause is found in the conversion rule group, it is applied, and if there is another candidate for matching, the next matching object is processed. The portion of the output document that matches the match is replaced by the output of the construct clause. If more than one conversion rule matches, the one defined above takes precedence.
【0067】一方、適合する変換規則がなく、現在の照
合対象が子要素を持つ時は、それらを出力順に照合対象
として順次、同様の処理を行なう。この繰り返しは、下
方への再帰が優先され、その処理が終わった後に後続の
兄弟文書要素が照合対象とされる。以上が文書の末尾に
到達するまで行なわれる。On the other hand, when there is no suitable conversion rule and the current collation target has child elements, the same processing is sequentially performed with the child elements as collation targets in the output order. In this repetition, recursion downward is prioritized, and after the processing is completed, the subsequent sibling document element is set as a collation target. The above is repeated until the end of the document is reached.
【0068】例1 においては、<文書>が最初の照合対
象となる。これは、変換規則1によって処理されるた
め、子要素への再帰は発生しない。また、副問合せで適
合した全ての<記事>から、3節の例と同様に掲載日別
にグルーピングされた[日別]の列が生成され、これらを
子とする<文書>によって元の<文書>が置き換えられ
る。元の文書の構造により、<文書>は一つだけ生成さ
れる。この処理の終了時に得られる文書は、2節で示し
た出力文書のDTDに従っている。以上で、例1の1の操作
が完了する。 2.続いて例1 の2以降の操作を行なうが、上記の手順
だけではその処理に移行することができない。このよう
な多段階の処理を実現するため、照合対象指定子``#''
を導入する。文書全体のパターン照合が終わった時点で
その出力文書が照合対象指定子を含む場合には、更に変
更処理が続けられる。これについては、construct 節中
で照合対象指定された文書要素が順次、照合対象として
扱われ、同様に再帰的に処理が行なわれる。照合対象指
定されたものの評価順序は文書中での出現順序に従う。In Example 1, <document> is the first collation target. Since this is processed by the conversion rule 1, recursion to the child element does not occur. In addition, from all <articles> matched by the subquery, columns of [daily] grouped by publication date are generated in the same manner as in the example in section 3, and the <document> having these as children is used to generate the original <document>> Is replaced. Due to the structure of the original document, only one <document> is generated. The document obtained at the end of this process complies with the DTD of the output document described in Section 2. Thus, the operation 1 of Example 1 is completed. 2. Subsequently, the operations of the second and subsequent steps of Example 1 are performed, but the above-described procedure alone cannot shift to that processing. In order to realize such multi-step processing, the matching target specifier `` # ''
Is introduced. If the output document includes the matching specifier at the time when the pattern matching of the entire document is completed, the change processing is further continued. In this case, the document elements designated as collation targets in the construct clause are sequentially treated as collation targets, and are similarly processed recursively. The evaluation order of the items to be collated follows the order of appearance in the document.
【0069】例の場合は、<日別>が照合対象指定され
ているため、これによって構成された全ての記事列が 2
パス目の照合対象の候補となる。これは例1の2に相当
する変換規則 2に適合する。尚、「keywords」(イタリ
ック体表示)にはユーザが指定したキーワード群が文字
列として埋めこまれているものとする。sim#cosine()は
記述内容処理関数である。これは 4.3 節で述べるよ
うに $a 即ち<記事>のメソッドであり、引数のキーワ
ード群との類似度を返す。その際、[見出し]に含まれる
語の重み付けを大きくする、といった<記事>固有の類
似度の測り方を行なう。これを利用して、各<記事>と
キーワード群との類似度を求め、それに基づいたランキ
ング結果の上位 n を出力とする。また、出力中の各<
記事>が照合対象指定されているため、文書の末尾まで
処理が行なわれた後に出力文書中での照合対象として扱
われる。 3.更に、3 パス目として、<記事>に対して 2 と同
様にパターン照合が行なわれ、変換規則 3 の処理が適
用される。これにより、例 1の 3の処理が適用され
る。ここでは、記事内の全ての<段落>に対して<見出
し>との類似度を<段落>の類似度として与え、そのラ
ンキング結果に従って上位 3 件の<段落>のみが要約
結果として残される。ここでも、記述内容処理関数であ
るsim#cosine()を用いている。4.3節で述べるよう
に、これは類似度を測定する汎用の関数であり、ある文
書要素固有のメソッドではない。そのため、変換規則 2
のそれとは異なり、特殊な類似度の測り方は行なわれ
ない。尚、変換規則では照合対象指定が行なわれていな
いので、この処理が全て終了した時点で処理が完了す
る。 4.3 記述内容処理関数 XML-QL で定義可能な関数は問合せとして記述できるも
ののみであることを述べた。このため、柔軟な処理を行
なう関数を記述できない。また、組み込み関数の拡充に
よって記述内容処理が必要とする機能を網羅的に提供す
ることも不可能である。そこで、本操作記述方式におい
ては、Java 等の言語を用いて外部プログラムとして記
述内容処理関数を定義可能とする。In the case of the example, since <daily> is specified as the collation target, all the article columns constituted by this are 2
It is a candidate for the collation target in the pass. This conforms to Conversion Rule 2 which corresponds to 2 in Example 1. It is assumed that a keyword group specified by the user is embedded in “keywords” (displayed in italics) as a character string. sim # cosine () is a description content processing function. This is the method of $ a, or <article>, as described in section 4.3, and returns the similarity of the argument with the keyword group. At this time, a method of measuring the similarity unique to <article> such as increasing the weight of the word included in [heading] is performed. By utilizing this, the similarity between each <article> and the keyword group is obtained, and the top n of the ranking result based on the similarity is output. In addition, each <
Since the article> is specified as the collation target, the processing is performed to the end of the document, and is then treated as the collation target in the output document. 3. Further, in the third pass, pattern matching is performed on <article> in the same manner as in 2, and the processing of conversion rule 3 is applied. As a result, the processing of 3 in Example 1 is applied. Here, the similarity to <heading> is given to all <paragraphs> in the article as the similarity of <paragraph>, and only the top three <paragraphs> are left as summary results according to the ranking result. Here, sim # cosine () which is a description processing function is used. As described in section 4.3, this is a general-purpose function for measuring similarity, not a method specific to a certain document element. Therefore, conversion rule 2
Unlike that of No, no special similarity measure is performed. Since the conversion rule does not specify the collation target, the process is completed when all the processes are completed. 4.3 Description processing function It was stated that only functions that can be defined in XML-QL can be described as queries. For this reason, a function that performs flexible processing cannot be described. Further, it is impossible to comprehensively provide the functions required for the description content processing by expanding the built-in functions. Therefore, in this operation description method, a description processing function can be defined as an external program using a language such as Java.
【0070】一般に、対象文書の従うDTD は変換規則の
想定する範囲内で揺れを持っている。例えば、同じ名前
の文書要素であっても、DTD 毎に内容の記述フォーマッ
トや特徴量の抽出方法が異なっていたり、定められるタ
グ名等がまちまちであったりという事は容易に想定でき
る。このような多様性を吸収するため、記述内容処理関
数群の定義は DTD 毎に与える (図2)。これにより、記
述内容処理の実装方法が抽象化され、同一の方法で利用
可能になる。In general, the DTD according to the target document has a fluctuation within the range assumed by the conversion rule. For example, it can easily be assumed that even for document elements having the same name, the description format of the content and the method of extracting the feature amount differ for each DTD, and the tag names and the like to be determined are different. In order to absorb such diversity, the definitions of the description processing functions are given for each DTD (Fig. 2). As a result, the implementation method of the description content processing is abstracted and can be used in the same manner.
【0071】また、sim#cosine() で例示したように、
同じ DTD 内であっても、文書要素の種類に応じてその
記述内容に対する処理が異なっていることが想定され
る。即ち、関数名が同じであっても文書要素毎の多態性
を持つことがある。この他、最初の人名が主著者である
ような<著者リスト>と本文中の<段落>とでは「重要
なフレーズ」は抽出法が異なる等も考えられる。この点
から、ある文書要素固有のメソッドとして``文書要素
名.メソッド名()''という形式で関数を定義し、``文書
要素変数.メソッド名()'' という形式で利用できるもの
とする。記述内容処理関数の構文は次の通りである。Also, as exemplified by sim # cosine (),
Even within the same DTD, it is assumed that the processing for the description content differs depending on the type of document element. That is, even if the function name is the same, there is a case where each document element has polymorphism. In addition, the extraction method of "important phrases" may be different between <author list> in which the first person's name is the main author and <paragraph> in the text. From this point, it is possible to define a function in the form of `` document element name.method name () '' as a method specific to a certain document element and use it in the form of `` document element variable.method name () ''. I do. The syntax of the description processing function is as follows.
【0072】 function データ型 関数名( 引数リスト ) define-by "関数実装を含む URI" function データ型 文書要素名.メソッド名( 引数リスト ) define-by "関数実装を含む URI" 引数リスト ::= データ型 引数名 [, データ型 引数名 ]* 記述内容処理関数の定義ではデータ型を明示する。関数
の引数及び返値として有効なデータ型は、number (数
値)、string (文字列)、element (文書要素)、 content
s (要素内容) である。ここで、contents 型は、文書要
素の内容として許される文字列に相当し、テキスト (#P
CDATA) と文書要素からなる列が許される。他のデータ
型は、要素数が 1 の列とみなせ、その意味でcontents
型は常に他の型の値を受け取ることができる。Function data type function name (argument list) define-by "URI including function implementation" function data type document element name. Method name (argument list) define-by "URI including function implementation" argument list :: = Data type Argument name [, Data type Argument name] * Specify the data type in the description processing function definition. Valid data types for function arguments and return values are number (number), string (string), element (document element), and content.
s (element content). Here, the contents type is equivalent to a character string permitted as the content of the document element, and the text (#P
A sequence of (CDATA) and document elements is allowed. Other data types can be considered as columns with one element, in that sense contents
Types can always receive values of other types.
【0073】例えば、sim#cosine()は、それぞれ次のよ
うに定義が与えられる。前者の実装は cosine、後者の
実装はsimであることを示している。For example, the definition of sim_cosine () is given as follows. The former implementation is cosine and the latter implementation is sim.
【0074】 function number sim#cosine( contents x, contents y ) define-by "http://fqdn/path/common/vecspace#cosine" function number 記事.sim\#cosine( ocntents x ) define-by "http://fqdn/path/dtd1/article#sim" 5 XSLT 記述への変換 本節では、本操作記述の XSLT 記述への変換について述
べる。これによって、既存の XSLT 変換系を利用した本
操作記述処理系のプロトタイプシステムの構築が可能に
なる。 5.1 XSLT XSLT は W3C で策定中のXSL (XML スタイルシート言語)
で用いられる変換言語であり、本操作記述方式と同
様、ルール指向である。XSLT記述のことを XSLTスタイ
ルシートと呼ぶ。XSLT スタイルシートは XML 文書とし
て記述され、主に次に示すテンプレートと拡張関数定義
で構成される。Function number sim # cosine (contents x, contents y) define-by "http: // fqdn / path / common / vecspace # cosine" function number article.sim \ #cosine (ocntents x) define-by "http : // fqdn / path / dtd1 / article # sim "5. Conversion to XSLT description This section describes the conversion of this operation description to XSLT description. This makes it possible to construct a prototype system for this operation description processing system using the existing XSLT transformation system. 5.1 XSLT XSLT is an XSL (XML style sheet language) being developed by W3C.
This is a conversion language used in this example, and is rule-oriented similarly to this operation description method. An XSLT description is called an XSLT style sheet. The XSLT stylesheet is described as an XML document and mainly consists of the following templates and extension function definitions.
【0075】以下では、次の変換規則を例として説明を
行なう。これは、<文書>中の<項目>をその<番号>
順にソートする。In the following, the following conversion rule will be described as an example. This means that <item> in <document> is replaced by <number>
Sort in order.
【0076】 上記の本操作記述に対応するテンプレートは次である。[0076] The template corresponding to the above operation description is as follows.
【0077】 5.1.1テンプレート XSLT スタイルシートは複数のテンプレートによって構
成される。これは本操作記述方式の変換規則に相当す
る。[0077] 5.1.1 Template The XSLT stylesheet is composed of multiple templates. This corresponds to the conversion rule of this operation description method.
【0078】xsl:template テンプレートを定義するも
ので、次の基本構造を持つ。Xsl: template Defines a template and has the following basic structure.
【0079】 <xsl:template>の<match> 属性が変換規則の最初の
where節の条件記述に相当し、適用対象の選択を行な
う。<!-- 処理 --> には、他の節に相当する記述がXSLT
で定められる文書要素、例えば以下で説明する<xsl:v
ariable> や<xsl:for-each>等によって行なわれる。
これらはXSLT 処理系によって解釈される。それら以外
の文書要素は変数等の展開がされ、その結果がリテラル
として出力される。<match>で選択された各ノードは
カレントとして扱われる。テンプレート内部はこのカレ
ントに対して適用され、その結果でカレントを置き換え
る。ここで、ノードとは文書中の文書要素、属性、テキ
スト等に対応し、その親子関係、所属関係等がツリーの
親子関係で表されている。[0079] <Xsl: template><match> attribute is the first in the conversion rule
It corresponds to the condition description in the where clause, and selects the application target. <!-Processing-> contains XSLT equivalent to other sections.
Document elements defined in, for example, <xsl: v
ariable> and <xsl: for-each>.
These are interpreted by the XSLT processor. For other document elements, variables and the like are expanded, and the result is output as a literal. Each node selected by <match> is treated as current. The inside of the template is applied to this current, replacing the current with the result. Here, a node corresponds to a document element, attribute, text, or the like in a document, and its parent-child relationship, affiliation relationship, and the like are represented by a parent-child relationship in a tree.
【0080】<match>にはロケーションパスと呼ばれ
るパス式を記述する。ロケーションパスは、以下で説明
する[]を除いた末端のノードを選択する。4節の例を変
換するために必要となる主な記法として次がある。 (1) ``.'' はそのノード自身を、(2) ``..'' は親のノ
ードを選択する。また、(3)a/b は<a>の子である<b
>を、(4)a/@b は<a>の属性である<b> を、(5)は条
件xを満たす<a>を、(6)a/node()は<a>の全ての子ノ
ードを選択する。条件Xにはロケーションパスも記述で
き、複数の条件をand,or で組み合わせられる。<Match> describes a path expression called a location path. For the location path, select the terminal node excluding [] described below. The main notations needed to convert the example in verse four are: (1) ``. '' Selects the node itself, and (2) `` .. '' selects the parent node. (3) a / b is a child of <a><b
>, (4) a / @ b is <b> which is the attribute of <a>, (5) is <a> that satisfies condition x, and (6) a / node () is all of <a> Select child nodes of The condition X can also describe a location path, and a plurality of conditions can be combined by and, or.
【0081】xs:variable 変数の束縛をする。<name
>属性で変数名を指定し、<expr>属性もしくは記述内
容によって値を指定する。これは、属性を記述する値と
して利用でき、変数名の前に ``$'' を付けることで参
照される。Xs: variable Constrains a variable. <Name
> Specify the variable name with the attribute, and specify the value with the <expr> attribute or the description contents. This can be used as a value to describe the attribute and is referenced by prefixing the variable name with "$".
【0082】xsl:for-each 入れ子問合せは、これを用
いて実現される。これは <select>属性で指定された
ロケーションパスで選択された各ノードをカレントとし
て、その記述内容を適用する。入れ子になったwhere 節
に対応する。Xsl: for-each A nested query is implemented using this. This applies each node selected by the location path specified by the <select> attribute to its description contents. Corresponds to nested where clauses.
【0083】xsl:sort これは <xsl:for-each>の子
要素として与えることができ、その出力を<select>属
性で指定されたソートキーでソートする。また、これを
複数指定することで、辞書順のソートを行なえる。orde
r-by 節に直接対応し、rank-by 節もこれを用いて実現
される。Xsl: sort This can be given as a child element of <xsl: for-each>, and its output is sorted by the sort key specified by the <select> attribute. Also, by specifying a plurality of them, sorting in dictionary order can be performed. orde
It directly corresponds to the r-by clause, and the rank-by clause is also realized using this.
【0084】xsl:copy-of <select>属性のロケーシ
ョンパスで選択されたノードを複製する。Xsl: copy-of <select> Copies the node selected by the attribute location path.
【0085】冒頭のテンプレートの例では、入力の<文
書>について、出力として<文書>を作り、その内部を
<xsl:for-each>によって生成する。この内部は、<番
号>を子に持つ<項目>全てを<xsl:copy-of>によっ
て複製している。また、結果は変数$n 即ち<番号>に
よってソートされる。結果として、変換規則と同等の処
理が記述されている。In the template example at the beginning, for the input <document>, a <document> is created as an output, and the inside thereof is generated by <xsl: for-each>. Inside this, all <items> having <number> as a child are copied by <xsl: copy-of>. Also, the results are sorted by variable $ n or <number>. As a result, processing equivalent to the conversion rule is described.
【0086】また、変数$d と$i は実際には使用され
ず、$n は直接展開することができるため、上記のテン
プレートは次のように簡略化可能である。Since the variables $ d and $ i are not actually used and $ n can be directly expanded, the above template can be simplified as follows.
【0087】 xsl:if XSLT では条件分岐のために、<xsl:if>と<x
sl:choose>が利用できる。特に<xsl:if>は、<test
>属性に記述された条件式が真である時に限り、その記
述内容が適用される。 5.1.2拡張関数 これはユーザ関数の定義に相当する。[0087] xsl: if <xsl: if> and <x
sl: choose> can be used. In particular, <xsl: if> replaces <test
> The description content is applied only when the conditional expression described in the attribute is true. 5.1.2 Extended function This corresponds to the definition of a user function.
【0088】xsl:functions これは関数の宣言を行な
うものであり、他の要素の子とはならない。<ns>属性
でその関数が属する名前空間名を指定する。<code>属
性がある時、<ns>をそのプレフィックスとしたURIで
指定される実装を用い、与えられてなければ<xsl:func
tions>の記述内容で実装を与える。尚、XSLTでは4.
3 節で示したような実装と異なる名前で関数名を利用
することはできないため、実装名は一意でなければなら
ない。 例 func() として利用するプログラムの実装がhttp://
fqdn/classpath/classname に含まれている時、次のよ
うに記述される。ここで、名前空間globalは``http://f
qdn/classpath'' として定義されているものとする。Xsl: functions This declares a function and does not become a child of another element. The <ns> attribute specifies the name of the namespace to which the function belongs. If there is a <code> attribute, use the implementation specified by the URI with <ns> as its prefix, and <xsl: func if not provided
The implementation is given in the description of <tions>. In XSLT, 4.
Since the function name cannot be used with a different name from the implementation as shown in Section 3, the implementation name must be unique. Example: The implementation of the program used as func () is http: //
When included in fqdn / classpath / classname, it is described as follows. Here, the namespace global is `` http: // f
It is assumed to be defined as qdn / classpath ''.
【0089】 5.2XSLT への変換方法 5.2.1処理機構 変換規則からスタイルシートへ変換するに当たって、ま
ずXSLT処理系をどのように利用するかを明確にする。提
案記述方式では照合対象指定によって多段階の処理を実
現しているが、XSLT では直接これをサポートしない。
このため、多段階の処理を行なうためには、スタイルシ
ートを複数回適用する必要がある。即ち、XSLT 処理系
を上位のモジュールから複数回呼出さねばならない。こ
の適用回数は文書依存であり、あらかじめ決定できない
ため、上位のモジュールはスタイルシートの適用が不要
となったことを文書操作時に判断する必要がある。そこ
で、スタイルシートを更に適用する必要のあるテンプレ
ートが適用された時、そのことを拡張関数NOTIFY() を
用いて上位モジュールに通知する。これによって、上位
モジュールはスタイルシートの適用終了時までに通知が
なければ、全ての処理が終わったものとして終了するこ
とが可能になる。 5.2.2 テンプレートへの変換 次に、個々の変換規則をテンプレートへ変換する際の主
な点について説明する。ここでは、以下の条件を満たす
変換規則のみを対象とする。[0089] 5.2 Conversion method to XSLT 5.2.1 Processing mechanism When converting from the conversion rules to the style sheet, it is first clarified how to use the XSLT processing system. Although the proposed description method realizes multi-step processing by specifying the matching target, XSLT does not directly support this.
Therefore, in order to perform multi-stage processing, it is necessary to apply the style sheet a plurality of times. That is, the XSLT processing system must be called multiple times from a higher-level module. Since the number of times of application is document-dependent and cannot be determined in advance, it is necessary for a higher-level module to determine at the time of document operation that application of a style sheet is no longer necessary. Therefore, when a template that requires further application of the style sheet is applied, this is notified to the upper module using the extension function NOTIFY (). As a result, if there is no notification by the end of the application of the style sheet, the upper module can end assuming that all processes have been completed. 5.2.2 Conversion to Template Next, the main points when converting individual conversion rules to templates will be described. Here, only conversion rules that satisfy the following conditions are targeted.
【0090】XML-QL に準じた正規パス表現のサブセッ
トを用いた記述はないものとする。これは、XSLT では
これらを直接扱えないことによる。It is assumed that there is no description using a subset of regular path expressions according to XML-QL. This is because XSLT cannot handle them directly.
【0091】副ブロック及び、スコーレム関数によって
<ID>が指定された文書要素の入れ子はないものとす
る。 1. 基本変換 変換規則における where,order−by, con
struct 節の基本構造は、5.1で述べたような文書要
素に変換される。ここで、XSLT では直前の<xsl:templ
ate>の<match>属性や<xsl:for-each>の<select>
属性等のロケーションパスの末端のノードが起点となる
が、提案記述方式ではwhere 節で指定する文書構造は照
合対象ノードもしくは、in による指定を起点とする。
構造に関する条件を変換する際に、この点を考慮する必
要がある。 2. 照合対象指定子 これが指定された文書要素は必ず
パターン照合が行なわれる。このため、前述のNOTIFY()
を呼出す必要がある。 3.first 節 これに相当する処理は、NOTIFY() を用い
て、2 段階の処理として実現する。最初の実行パスで<
xsl:sort>による結果の列を生成し、次のパスでその先
頭の指定件数だけを出力する。 4. rank-by〜top 節 これもfirst 節と同様だが、最終
的な出力の順序を保存するため、次のように位置を保存
した上で 2 段階の処理を行なう。最初のパスで<xsl:s
ort>により、rank-by 節の指定された順の結果を生成
する。その際、各要素には元の文書中での位置を付加し
ておく。次のパスで、先頭の指定件数分を対象として抽
出する。更に、付加しておいた元の位置情報に従って再
度<xsl:sort> を用いて最終的な結果を生成する。 5. スコーレム関数 スコーレム関数の返値は、引数の
値と一対一の対応を持つ。即ち、これによって与えられ
る<ID>の一意性は、引数の値の組の一意性と等しい。
そこで、これによって実現されるグルーピングは次の手
順へ変換を行なう。まず、スコーレム関数による<ID>
が同じ文書要素のうち、最初の一つのみを選ぶ。これ
は、<xsl:if>を用いた値の組の一致性判定で実現され
る。そして、その内部でグルーピング結果に相当する結
果を抽出するような記述を行なう。これは、<xsl:for-
each>を用いて、同じ<ID>を割り当てられるもの全て
について必要な構造を生成すれば良い。以上によって、
スコーレム関数の値毎に一つずつ、グルーピング結果が
得られる。 5.2.3 スタイルシートの生成 上記のテンプレート生成方法を用いて、実行パスに応じ
たスタイルシートの生成を行なう。 1. 名前変換の対応表 照合対象指定されているものに
ついて、それぞれ一意な別名を用意する。これは、以下
でパターン照合を行なう対象を、照合対象指定された文
書要素に限定するために用いられる。 2. 1 パス目のスタイルシート 全ての変換規則につい
て、construct 節の照合対象指定されている文書要素の
名前を対応表に従って別名に置換する。これをテンプレ
ートへ変換したものをスタイルシートとして利用する。
これによって、次パス以降で照合対象のみにテンプレー
トを適用可能になる。 3. 2 パス目以降のスタイルシート いずれの照合対象
指定されている文書要素も適合しない変換規則を除去す
る。残ったものについて、照合対象指定されている文書
要素名と、条件部に出現するそれを対応表に従って置換
し、それから変換されたテンプレートをスタイルシート
として利用する。これによって、以前のパスで照合対象
指定された文書要素のみがテンプレートの適用対象とな
る。また、出力が照合対象指定されていない部分は置換
されないため、そのテンプレートが適用されることで自
動的に元の名前に戻る。このため、処理が終了した文書
要素にテンプレートが過剰に適用されることはない。 4. 終了時のスタイルシート 上記では名前が置換され
たまま出力されるため、適合するテンプレートがない場
合には別名のまま終了してしまう。この問題を解決する
ため、3 のスタイルシートの適用が終了した時点で、対
応表に従って逆の置換を行なうスタイルシートを適用す
る。 5.3 変換例 変換規則を、上記の規則に従ってXSLT の記述に変換し
た結果の一部を以下に示す。テンプレート 1〜3 が、そ
れぞれ変換規則 1〜3 に相当する。It is assumed that there is no nesting of sub-blocks and document elements for which <ID> is specified by the Skolem function. 1. Basic conversion where, order-by, con in conversion rules
The basic structure of a struct clause is converted into a document element as described in 5.1. Here, in XSLT, the previous <xsl: templ
ate><match> attribute and <xsl: for-each><select>
Although the terminal node at the end of the location path such as the attribute is the starting point, in the proposed description method, the document structure specified by the where clause is specified by the node to be matched or the specification by in.
This must be taken into account when translating structural conditions. 2. Matching target specifier The document element for which this is specified is always subjected to pattern matching. For this reason, the NOTIFY ()
Need to be called. 3. first clause The corresponding process is realized as a two-stage process using NOTIFY (). In the first execution pass <
xsl: sort> to generate a sequence of results, and in the next pass, output only the specified number at the beginning. 4. rank-by to top clause This is the same as the first clause, but in order to preserve the final output order, save the position as follows and perform a two-step process. <Xsl: s in the first pass
ort> generates a result in the order specified by the rank-by clause. At this time, a position in the original document is added to each element. In the next pass, extract the specified number of records at the beginning. Further, a final result is generated using <xsl: sort> again according to the added original position information. 5. Skolem function The return value of the Skolem function has a one-to-one correspondence with the argument value. That is, the uniqueness of <ID> given by this is equal to the uniqueness of the set of argument values.
Therefore, the grouping realized by this transforms to the next procedure. First, <ID> by Skolem function
Selects only the first one of the same document elements. This is realized by determining the consistency of a set of values using <xsl: if>. Then, a description for extracting a result corresponding to the grouping result therein is made. This is <xsl: for-
By using each>, it is only necessary to generate a necessary structure for all objects to which the same <ID> is assigned. By the above,
A grouping result is obtained for each value of the Skolem function. 5.2.3 Generation of Style Sheet Using the above-described template generation method, a style sheet is generated according to the execution path. 1. Correspondence table for name conversion Prepare unique aliases for each of the specified collation targets. This is used in order to limit the pattern matching target in the following to the document element designated as the matching target. 2. First-pass style sheet For all conversion rules, replace the name of the document element specified as the matching target in the construct clause with an alias according to the correspondence table. Convert this to a template and use it as a style sheet.
This makes it possible to apply the template only to the collation target in the next pass and thereafter. 3. Stylesheets after the second pass Remove any conversion rules that do not match any document element specified for collation. For the remaining ones, the document element name designated as the collation target and the one appearing in the condition part are replaced in accordance with the correspondence table, and the template converted therefrom is used as a style sheet. As a result, only the document element designated as the collation target in the previous pass becomes the target of application of the template. In addition, since the portion where the output is not specified as the collation target is not replaced, the original name is automatically returned by applying the template. Therefore, the template is not excessively applied to the processed document element. 4. Style sheet at the end Because the above is output with the name replaced, if there is no matching template, it ends with an alias. To solve this problem, apply the style sheet that performs the reverse replacement according to the correspondence table when the application of style sheet 3 is completed. 5.3 Conversion example A part of the result of converting the conversion rules into the XSLT description according to the above rules is shown below. Templates 1 to 3 correspond to conversion rules 1 to 3, respectively.
【0092】ここで、テンプレート 1 は変換規則 1 か
ら生成されるテンプレートである。このスコーレム関数
によるグルーピングは、<xsl:if>以下へ変換されてい
る。また、変換規則 2, 3 はそれぞれ、テンプレート
2, 4 及び、3, 5 へ変換されている。特に、変換規則 2
のfirst 節はテンプレート 4 で、変換規則 3 のrank-
by〜top 節はテンプレート 5 で実現されている。Here, template 1 is a template generated from conversion rule 1. The grouping by this Skolem function is converted to <xsl: if> and below. Conversion rules 2 and 3 are
2, 4 and 3, 5 have been converted. In particular, conversion rule 2
The first clause of template 4 is
The by to top clauses are implemented in Template 5.
【0093】これらのうち、テンプレート 1 は 1 パス
目の、残りのものは2 パス目以降のスタイルシートとし
て利用される。1パス目のスタイルシートには、5.2
節の方法に従って生成された他のテンプレートが含まれ
るが、実際には利用されないため、記述を省いた。Of these, template 1 is used as a style sheet for the first pass, and the rest is used as a style sheet for the second and subsequent passes. 5.2 for the first pass style sheet
Other templates generated according to the method of section are included, but are not actually used, so the description is omitted.
【0094】尚、照合対象指定された文書要素名には `
`・照合対象'' という語尾を付加している。この語尾は
全ての処理が完了した後、除去される。 <!-- テンプレート 1 --> <xsl:template match="文書"> <文書> <xsl:for-each match="記事"> <xsl:variable name="d" expr="掲載日"/> <xsl:sort select="掲載日"/> <!-- スコーレム関数によるグルーピング : 各<掲載日>の最初の<記事>のみに適用 --> <xsl:if test="count(from-preceding-siblings()[掲載日=$d])=0"> <!-- # <日別> --> <xsl:variable name=DMY" expr="NOTIFY()"/> <日別-照合対象> <xsl:for-each select="../記事[掲載日=$d]"> <xsl:copy-of select="."/> </xsl:for-each> </日別-照合対象> </xsl:if> </xsl:for-each> </文書> </xsl:template> 拡張可能XML問い合わせ言語X2QLとその処理系 1.はじめに 近年、各種文書データベースの構築やその利用の高度化
が急速に進みつつある。特に、インターネットの著しい
普及に伴い、XML をはじめとする構造化文書データベー
スの構築とその利用の高度化の要求が増大している 。
構造化文書データベースに対する基本的な処理記述言語
として、これまでに各種の問合せ言語が提案されてい
る。Note that the document element name specified as the collation target is `
Adds the ending of `. This ending is removed after all processing is completed. <!-Template 1-><xsl: template match = "document"><document><xsl: for-each match = "article"><xsl: variable name = "d" expr = "post date" / ><xsl: sort select = "post date"/><!-Grouping by Skolem function: Apply only to the first <article> of each <post date>-><xsl: if test = "count (from- preceding-siblings () [Date = $ d]) = 0 "><!-#<daily>-><xsl: variable name = DMY" expr = "NOTIFY ()"/><daily- Matching target><xsl: for-each select = "../ Article [Posted date = $ d]"><xsl: copy-of select = "."/></ Xsl: for-each></ By day -Collation target></ xsl: if></ xsl: for-each></document></ xsl: template> Extensible XML query language X 2 QL and its processing system 1. Introduction Recently, construction of various document databases In particular, with the remarkable spread of the Internet, there has been an increasing demand for the construction of XML and other structured document databases and the advancement of their use.
Various query languages have been proposed as basic processing description languages for structured document databases.
【0095】XML を対象とした問合せ言語の代表例とし
ては、XML-QL やXQL 等がある。また、Lorel、UnQL、St
ruQL、YATL等の半構造データを対象とした問合せ言語で
も、その適用対象の一つに XML 構造化文書を想定して
いるものがある。これらの多くは高水準な宣言的記述に
よる高い問合せ記述能力を持っており、特に、XML-QL
や半構造データ問合せ言語の幾つかは文書構造に対する
比較的強力な再構成機能を提供する。しかし、多様化、
複雑化する文書処理要求に対して、以下のように必ずし
も十分な機能を提供しているとは言えない。Representative examples of query languages for XML include XML-QL and XQL. Also, Lorel, UnQL, St
Some query languages for semi-structured data such as ruQL, YATL, etc., assume that XML structured documents are one of the applications. Many of these have high query description capabilities with high-level declarative descriptions, especially XML-QL
Some semi-structured data query languages provide relatively powerful reconstruction capabilities for document structures. But diversification,
It cannot be said that sufficient functions are always provided as follows in response to complicated document processing requirements.
【0096】構造化文書データベースに対する処理記述
では、タグの階層構造で与えられる文書構造に対する処
理と文字列テキストで与えられる記述内容に対する処理
の、両者を扱う必要がある。前述の問合せ言語では、比
較的強力な構造操作を宣言的に記述可能である。一方
で、記述内容処理に関しては極めて限定された機能しか
提供していない。例えば、指定した語句やパターンに合
致する部分文字列を含む文書要素を選択するといったよ
うに、記述の内容に踏み込んだ処理は行なわれていな
い。特に、大量の構造化文書から目的とする情報を効率
的に獲得するためには、より内容に踏み込んだ処理、例
えば、与えられたキーワード群との意味的な類似度に基
づく文書要素の絞り込みやランキング、文書要素の要約
や話題抽出等の記述内容処理機能が重要となる。また、
構造操作に関しても、宣言的に記述する事が困難な応用
処理も存在する。このような場合には、より詳細かつ具
体的な記述能力が要求される。一方で、これらの機能は
必ずしも汎用的なものではなく、一般には処理の適用対
象である文書要素の特性や問合せの目的に依存する。例
えば、見出し等の特定の文書要素は、他の文書要素に比
べて重要な語を多く含んでいる。それゆえ、見出しに出
現する語には大きな重みを与えるといった処理が行なわ
れる事がある。また、記述内容の処理方式において、自
動要約生成、話題抽出等については様々な手法が提案さ
れている。In the process description for the structured document database, it is necessary to handle both the process for the document structure given by the hierarchical structure of tags and the process for the description content given by the character string text. In the aforementioned query language, relatively powerful structural operations can be described declaratively. On the other hand, only very limited functions are provided for the description content processing. For example, processing that goes into the content of the description, such as selecting a document element that includes a partial character string that matches a specified phrase or pattern, is not performed. In particular, in order to efficiently obtain the desired information from a large number of structured documents, more detailed processing, such as narrowing down document elements based on the degree of semantic similarity with a given keyword group, Description processing functions such as ranking, document element summarization and topic extraction are important. Also,
There are also application processes that are difficult to describe declaratively for structural operations. In such a case, a more detailed and specific description ability is required. On the other hand, these functions are not necessarily general-purpose, and generally depend on the characteristics of the document element to which the processing is applied and the purpose of the query. For example, a particular document element such as a heading contains more important words than other document elements. Therefore, a process of giving a large weight to a word appearing in a heading may be performed. Also, in the description content processing method, various methods have been proposed for automatic summary generation, topic extraction, and the like.
【0097】それゆえ、それらの機能を網羅的に提供す
る事は現実的ではない。この問題を解決するには、問合
せ言語に柔軟な拡張性を持たせる事で、利用者がその目
的に合わせて必要な処理機能を導入可能にする必要があ
る。本研究では、このような問題に対し、構造化文書に
対する問合せ言語が持つ文書構造操作機能に加え、拡張
可能な記述内容処理機能を統合的に利用可能とした拡張
可能 XML 問合せ言語X2QLを提案する。X2QLは XM
L-QL をベースとして拡張した問合せ言語であり、記述
内容処理機能の拡張性はユーザ定義関数によって与えら
れる。ユーザは、必要に応じて関数を導入する事で、問
合せとして宣言的に記述する事が困難な処理を外部化
し、関数呼出しを通じた拡張機能として利用可能とな
る。これにより、XML-QL が元々持つ文書構造操作機能
に加え、類似検索や要約生成等のより高次の記述内容処
理機能も利用可能となる。また、本稿では、X2QL 問
合せをある種の制約下で XSLT に基づく文書操作へ変換
し、処理系を実現する手法についても説明する。また、
これを用いて、実際に実装を行なっている。Therefore, it is not realistic to provide those functions comprehensively. In order to solve this problem, it is necessary to allow the query language to have flexible extensibility so that the user can introduce necessary processing functions according to the purpose. In this research, in order to solve such problems, in addition to the document structure operation function of the query language for structured documents, the extensible XML query language X 2 QL, which enables the integrated use of the extensible description content processing function, was developed. suggest. X 2 QL is XM
This is a query language extended based on L-QL, and the extensibility of the description processing function is given by a user-defined function. By introducing functions as needed, the user can externalize processes that are difficult to declaratively describe as queries and use them as extended functions through function calls. As a result, in addition to the original document structure operation function of XML-QL, higher-order description processing functions such as similarity search and summary generation can be used. This paper also describes a method for transforming an X 2 QL query into a document operation based on XSLT under certain restrictions and implementing a processing system. Also,
The implementation is actually performed using this.
【0098】尚、論文 では、文書構造変換規則と記述
内容処理関数を用いた XML 処理系の基本的構想を示し
た。本研究では、特に後者に関する機能拡張に焦点を当
て、実装を含めたより掘り下げた検討を行なう。In the dissertation, the basic concept of an XML processing system using document structure conversion rules and description contents processing functions has been described. In this research, we focus on the extension of the latter, and conduct a more in-depth study including implementation.
【0099】以下では、まず2 節で文書構造操作と高次
の記述内容処理の両者を用いて実現される、構造化文書
に対する問合せ例を示す。次に、3 節で XML-QL につい
て概説し、4 節でX2QLについて詳細を述べる。ま
た、5 節でX2QL 問合せのXSLT による記述への変換
方式を述べる。 2.構造化文書に対する問合せ例 本節では、文書構造操作に加え、記述内容処理の機能を
必要とする構造化文書問合せの例を示す。4節では、本
節の例を用いてX2QLを説明する。以下では、必要に
応じて<識別子>で ``識別子'' という文書要素名もし
くはその文書要素を表記する。また、属性についても同
様に表記する。例 1 ある新聞の記事データベースとし
て構成された XML 文書を考える。各記事は、掲載日、
見出し、本文を含み、文書の DTD は次で与えられるも
のとする。In the following, first, in Section 2, an example of an inquiry to a structured document realized by using both the document structure operation and the higher-level description contents processing will be described. Next, Section 3 outlines XML-QL, and Section 4 details X2QL. Section 5 describes how to convert X2QL queries into XSLT descriptions. 2. Example of Query for Structured Document This section shows an example of a structured document query that requires a function of description content processing in addition to document structure operations. Section 4 describes X2QL using the example of this section. In the following, a document element name of "identifier" or its document element is described by <identifier> as necessary. In addition, attributes are similarly described. Example 1 Consider an XML document organized as a newspaper article database. Each article has a publication date,
The DTD of the document, including the headline and body, shall be given below.
【0100】 <!-- 入力文書の DTD --> <!ELEMENT 文書 記事+> <!ELEMENT 記事 (掲載日,見出し,本文)> <!ELEMENT 本文 段落+> <!ELEMENT 掲載日 #PCDATA> <!ELEMENT 見出し #PCDATA> <!ELEMENT 段落 #PCDATA> このような XML 文書に対し、記事を掲載日別に分け、
各記事に要約を付加する。これを実現するためには、<
掲載日>によるグルーピングという文書構造操作と、要
約生成という記述内容処理が必要とされる。 例 2 例 1 の XML 文書を想定する。読者がある事件に興味を
持っており、この文書から興味に合致する上位 N 件以
内の記事を抽出したいとする。これは読者の興味に基づ
いた記事の選択であり、その際、興味への合致性の判定
ないし、その基準の計測のための記述内容処理が必要と
される。 3.XML−QL 本稿で提案する問合せ言語 X2QLは、XML に対する代
表的な問合せ言語の一つである XML-QL をベースとして
いる。本節では、以下の説明を理解する上で必要な XML
-QL の機能について説明する。 3.1 XML-QL 問合せ XML-QL は XML 文書に対する問合せ言語であり、基本構
文は次で与えられる。<!-DTD of input document-><! ELEMENT document article +><! ELEMENT article (posting date, headline, text)><! ELEMENT text paragraph +><! ELEMENT posting date #PCDATA>< ! ELEMENT Heading #PCDATA><! ELEMENT Paragraph #PCDATA> For such an XML document, separate articles by publication date,
Add a summary to each article. To achieve this, <
A document structure operation called grouping by publication date> and a description content process called summary generation are required. Example 2 Assume the XML document from Example 1. Suppose your reader is interested in an incident and you want to extract from this document the top N articles that match your interest. This is the selection of articles based on the interests of the reader, and in this case, it is necessary to judge the match with the interests or to process the description contents for measuring the criteria. 3. XML-QL The query language X 2 QL proposed in this paper is based on XML-QL, one of the typical query languages for XML. This section describes the XML required to understand the following
Describe the function of -QL. 3.1 XML-QL query XML-QL is a query language for XML documents, and its basic syntax is given below.
【0101】 例えば、前節の例 1 は要約の付加を省くと次のように
記述される。出力は<日別>の列を内容とする<文書>
であり、<日別>は同じ値の<掲載日>を持つ<記事>
の列である。[0101] For example, in Example 1 in the previous section, omitting the addition of a summary would be written as follows: Output contains <daily> column <document>
Where <daily> has the same value <post date><article>
In the column.
【0102】 where <文書></> content#as $x construct <文書> where <記事><掲載日>$d</></> element\#as $a in $x order-by $d construct <日別 ID=DateID($d) 掲載日=$d> $a </> </> where 節 問合せ条件として適合すべき文書構造やそれ
が満たすべき条件を指定し、必要に応じて変数の束縛を
指定する節である。変数は文書要素, 文書要素内容, 文
書要素名, 属性名, 属性値のいずれかに束縛され、それ
に関する述語によってその値の満たすべき条件が記述さ
れる。特に、パターン式中のelement#as $x とcontent#
as $x は、それぞれその直前の文書要素およびそのタグ
を除去した文書要素の内容で変数$xを束縛する。尚、こ
の変数の束縛は適合する全ての組合せに対して行なわれ
る。Where <document></> content # as $ x construct <document> where <article><postdate> $ d </></> element \ #as $ a in $ x order-by $ d construct <Daily ID = DateID ($ d) Publication date = $ d> $ a </></> where clause Specify the document structure to be satisfied as query conditions and the conditions to be satisfied. This clause specifies the binding. A variable is bound to a document element, document element content, document element name, attribute name, or attribute value, and a predicate related to it describes the conditions that must be satisfied by that value. In particular, element # as $ x and content # in the pattern expression
as $ x binds the variable $ x with the contents of the immediately preceding document element and the document element with its tags removed. Note that this variable binding is performed for all matching combinations.
【0103】冒頭の記述例では、一つ目のwhere 節で<
文書>の内部を$xに束縛し、二つ目のwhere 節で$x中の
各<記事>を$a に、その<掲載日>の内容で$dを束縛
する。 construct 節 where 節のパターン式中で束縛された変
数の各組合せから生成される出力の構成を指定する節で
ある。問合せ結果は、この記述の変数を展開して得られ
る文書要素の列となる。construct節中にはwhere〜cons
truct 節を入れ子にする事ができる。In the description example at the beginning, in the first where clause, <
The inside of document> is bound to $ x, each <article> in $ x is bound to $ a in the second where clause, and $ d is bound to the content of <post date>. construct clause This clause specifies the structure of the output generated from each combination of variables bound in the pattern expression of the where clause. The query result is a sequence of document elements obtained by expanding the variables of this description. where ~ cons in the construct clause
You can nest truct clauses.
【0104】また、生成する文書要素の属性<ID>を、
その引数と返値が一対一対応するスコーレム関数で与え
る事ができる。この時、親を共有し、同じ<ID>を持つ
文書要素は、一つの文書要素実体に集約される。グルー
ピングはこれを利用して実現される。The attribute <ID> of the document element to be generated is
The argument and the return value can be given by a Skolem function that has a one-to-one correspondence. At this time, document elements sharing a parent and having the same <ID> are aggregated into one document element entity. Grouping is realized using this.
【0105】冒頭の例では、副問合せの処理結果を内容
とする、ただ一つの<文書>が生成される。また、副問
合せでは<記事>($a) を内容とする<日別>の列が生
成される。それらは、要素<掲載日>の内容である$dを
値とする属性<掲載日>が与えられる。また、スコーレ
ム関数<DateID()>によって<記事>が<日別>にグル
ーピングされる。 order-by 節 文書要素の出力順を指定する節である。
出力は指定されたキーの値について昇順に、descending
が指定された場合にはその逆順にソートされる。冒頭
の例では、出力の<日別>文書要素を変数$dの値によっ
て日付順にソートして出力を行なう。 3.2 関数定義 次の構文を用いて、ユーザは必要に応じて関数を定義す
る事ができる。関数定義中の問合せ結果が返値となる。In the example at the beginning, only one <document> containing the processing result of the subquery is generated. In the subquery, a <daily> column containing <article> ($ a) is generated. They are given an attribute <posting date> whose value is $ d which is the content of the element <posting date>. Also, <article> is grouped into <daily> by the skolem function <DateID ()>. order-by clause This clause specifies the output order of document elements.
Output descending for the specified key value, descending
If is specified, it is sorted in reverse order. In the example at the beginning, the output <daily> document elements are sorted in chronological order according to the value of the variable $ d and output. 3.2 Function definition The following syntax allows the user to define a function as needed. The query result in the function definition is the return value.
【0106】function 関数名( 引数リスト ) where〜construct 問合せ end 4.拡張可能 XML 問合せ言語 X2QL X2QL 問合せは、XML-QL をベースとした構文によっ
て記述される。また、問合せ中には外部プログラムとし
て与えられるユーザ定義関数が利用可能であり、これに
よって高い機能拡張性が要求される処理へ対応する事が
可能である。4.1節でX2QL問合せについて説明
し、4.2節でユーザ定義関数について述べる。また、
4.3節で記述例を示す。 4.1 X2QL問い合わせ X2QL は、可読性と既存の問合せ言語との親和性を考
慮し、XML-QL をベースとした。拡張された基本構文を
次に示す。Function Function name (argument list) where-construct Query end Extensible XML Query Language X 2 QL X2QL inquiry is described by syntax which is based on XML-QL. In addition, a user-defined function provided as an external program can be used during the inquiry, thereby making it possible to cope with a process that requires high function expandability. Section 4.1 describes the X 2 QL query, and section 4.2 describes the user-defined function. Also,
A description example is given in section 4.3. 4.1 X 2 QL query X 2 QL was based on XML-QL in consideration of readability and compatibility with existing query languages. The extended basic syntax is shown below.
【0107】 このうち、where, order-by, construct 節はXML-QL と
同様である。但し、後述のユーザ定義関数が適宜利用可
能である。[0107] Of these, the where, order-by, and construct clauses are the same as in XML-QL. However, a user-defined function described later can be used as appropriate.
【0108】rank-by〜top 節 where 節で束縛された
変数群に対して、その要素の順位付け基準式の順位に基
づいた選択を指定する節である。既存の SQL 等を拡張
した問合せ言語においても、ソート指定と組み合わせて
出力要素数の指定が可能なものがある。しかし、文書に
おいては文書要素の出現順序が意味を持つため、順位付
けに基づく選択の目的で出力順序を安易に変えるわけに
はいかない。そのため、両者の指定を厳密に区別する必
要がある。Rank-by to top clause This is a clause for designating a variable group bound by a where clause based on the rank of the ranking criteria expression of the element. In some query languages that extend existing SQL, etc., the number of output elements can be specified in combination with the sort specification. However, since the appearance order of document elements is significant in a document, the output order cannot be easily changed for the purpose of selection based on ranking. Therefore, it is necessary to strictly distinguish between the two specifications.
【0109】X2QLでは、順位付けによる選択条件の
指定を与えるためにrank-by〜top節を導入した。rank-b
y 節の順位付け基準式に従って降順に並べた結果の上位
から高々top 節で与えられる選択件数のみを選択し、そ
れらをconstruct 節に渡す。それに対して、order-by
節は、XML-QL のそれと同様、出力順序基準式に従ってc
onstruct 節による出力をソートする。 4.2 ユーザ定義関数 XML-QL で定義可能な関数は問合せとして記述できるも
ののみである事を述べたが、これは柔軟かつ詳細な処理
を行なう関数を記述できない。また、高度な文書処理に
必要とされる機能は多岐に渡るため、組込み関数を拡充
するというアプローチで網羅的に提供する事も不可能で
ある。そこで、X2QLにおいては、Java 等の汎用プロ
グラミング言語による外部プログラムとしてユーザ定義
関数を与える事で、これらの問題を解決する。In X2QL, rank-by to top clauses are introduced to give designation of selection conditions by ranking. rank-b
Select only the number of choices given in the top clause at most from the top of the results sorted in descending order according to the ranking criterion expression in the y clause and pass them to the construct clause. On the other hand, order-by
Clause is c according to the output order standard expression, similar to that of XML-QL.
Sort output by onstruct clause. 4.2 User-defined functions Although the functions that can be defined in XML-QL are only those that can be described as queries, this cannot describe functions that perform flexible and detailed processing. In addition, since the functions required for advanced document processing are diverse, it is impossible to provide comprehensive functions by expanding the built-in functions. Therefore, in X 2 QL, these problems are solved by providing a user-defined function as an external program in a general-purpose programming language such as Java.
【0110】ユーザ定義関数は、不特定の対象に適用可
能な一般関数と、特定の文書要素名を持つ文書要素に対
して限定的に適用されるメソッドとに分けられる。これ
は、文書要素の種別をクラス、実際の文書要素をそのイ
ンスタンスに相当すると捉える事で、オブジェクト指向
の文脈で意味付けられる。特に、同じ目的であるもの
の、具体的な処理方法が文書要素の種類に依存するよう
な場合等に、その処理をそれぞれのメソッドとして与え
る事によって一種の多態性を持たせる事が可能となる。The user-defined functions are divided into general functions applicable to unspecified objects and methods limitedly applied to document elements having specific document element names. This is meaningful in an object-oriented context by considering the type of a document element as a class and the actual document element as an instance. In particular, if the same purpose is used, but the specific processing method depends on the type of document element, etc., it is possible to give a kind of polymorphism by giving the processing as each method. .
【0111】例えば、2節の例 1 を考える。ここで
は、<記事>の要約を生成するためのユーザ定義関数を
定義する。その際、<見出し>に含まれる語は重要語と
みなして要約を生成するというような、<記事>の特性
を活かした固有の実装を与える事が考えられる。このよ
うな機構は特に、特定の変数に不特定の種類の文書要素
が束縛されるような問合せにおいて有効に働くと期待さ
れる。また、例 2ではユーザが与えたキーワード群と<
記事>との類似度を計算する関数を定義、利用する事で
ランキング処理が可能になる。その類似度の計算方法と
しては様々なものが提案されているが、本研究のアプロ
ーチによってユーザの目的に適したものを利用可能であ
る。ユーザ定義関数の定義構文は次の通りである。メソ
ッドは、問合せ中で``文書要素変数.メソッド名( 引数
リスト )'' という形式で利用される。For example, consider Example 1 in Section 2. Here, a user-defined function for generating a summary of <article> is defined. At that time, it is conceivable to give a unique implementation utilizing the characteristics of <article> such that a word included in <headline> is regarded as an important word and a summary is generated. Such a mechanism is particularly expected to work effectively in queries where an unspecified type of document element is bound to a specific variable. In Example 2, the keywords given by the user and <
By defining and using a function that calculates the degree of similarity with Article>, ranking processing becomes possible. Although various methods of calculating the similarity have been proposed, a method suitable for the purpose of the user can be used by the approach of this research. The definition syntax of the user-defined function is as follows. The method is used in the query in the format of "document element variable. Method name (argument list)".
【0112】 function データ型 関数名( 引数リスト ) defined-by "関数実装を含む URI" function データ型 文書要素名.メソッド名( 引数リスト ) defined-by "関数実装を含む URI" 引数リスト ::= データ型 引数名 [, データ型 引数名 ]* ユーザ定義関数の定義では型を明示的に与える。関数の
引数および返値として有効な型は、number (数値)、str
ing (文字列)、element (文書要素)、content(要素内
容) である。ここで、element 型と content 型は、ele
ment#as およびcontent#as によって束縛された変数の
型に相当する。特にcontent#asはテキスト(#PCDATA) と
文書要素からなる列を値とする。他の型は、単一の要素
で構成される列とみなせるため、content 型は常に他の
型の値を受け取る事ができる。Function data type function name (argument list) defined-by "URI including function implementation" function data type document element name.method name (argument list) defined-by "URI including function implementation" argument list :: = Data type Argument name [, Data type Argument name] * In the definition of the user-defined function, the type is explicitly given. Valid types for function arguments and return values are number, str
ing (character string), element (document element), and content (element content). Where the element and content types are ele
Corresponds to the type of the variable bound by ment # as and content # as. In particular, content # as takes as its value a column consisting of text (#PCDATA) and a document element. Since other types can be regarded as a sequence consisting of a single element, the content type can always receive values of other types.
【0113】上記の例で必要とされるユーザ定義関数を
要約生成メソッドabstract() および類似度計算関数sim
#cosine()として実現するものとすると、例えば次のよ
うに定義が与えられる。前者は返値として<要約>を返
すものとする。The user-defined function required in the above example is defined as a summary generation method abstract () and a similarity calculation function sim.
If it is realized as #cosine (), the definition is given as follows, for example. The former shall return <summary> as a return value.
【0114】 function element 記事.abstract() defined-by "http://fqdn/path/pkg.article#abstract" function number sim#cosine( content y ) defined-by "http://fqdn/path/common.vecspace#cosine" Java マッピングでは、それぞれの型はX2QL用のパッ
ケージ内のNumber, String, Element, Content インタ
フェースを実装したクラスとして扱われる。尚、 これ
らの内部実装はJava 標準のDouble, String と W3C DOM
の Node, NodeList で与えている。また、メソッド呼
出しの際には、暗黙の第一引数としてその文書要素自身
が自動的に引数として追加される。即ち、上記の一つめ
のメソッドの Java による実装は次の形式で与えられ
る。クラス名やメソッド名等の実装における識別子はJa
vaの命名規則に従って対応付けられる。self の文書要
素名はメソッドを呼び出す前に問合せ処理系によって検
査される。Function element article.abstract () defined-by "http: //fqdn/path/pkg.article#abstract" function number sim # cosine (content y) defined-by "http: // fqdn / path / common in .vecspace # cosine "Java mapping, Number in each of the mold package for X 2 QL, String, Element, is treated as a class that implements the Content interface. These internal implementations are Java standard Double, String and W3C DOM.
Node, NodeList of the given. When a method is called, the document element itself is automatically added as an argument as an implicit first argument. That is, the implementation of the first method in Java is given in the following format. Identifier in implementation such as class name and method name is Ja
They are associated according to the naming rules of va. The document element name of self is checked by the query processing system before calling the method.
【0115】 // http://fqdn/path/ から取得可能なクラス package pkg; class Article [ Element abstract(Element self)[ ... ] ] 4.3 問合せ記述例 2節の例 1, 2 の問合せの記述例を以下に示す。 問合せ記述例 1 において、3節の例と同様に、出力の
<文書>内には、副問合せで適合した全ての<記事>を
掲載日別にグルーピングした結果の<日別>の列が日付
順に生成される。その属性として<掲載日>を付加して
いる。また、出力の<記事>には<記事>のメソッドab
stract() によって生成された<要約>が付加される。// Class that can be obtained from http: // fqdn / path / package pkg; class Article [Element abstract (Element self) [...]] 4.3 Query description example A description example of the query is shown below. In query description example 1, as in the example in section 3, in the output <document>, the <daily> column, which is the result of grouping all <articles> that matched the subquery by publication date, in chronological order. Generated. <Posting date> is added as the attribute. Also, in the output <article> is the method ab of <article>
<Summary> generated by stract () is added.
【0116】問合せ記述例 2 では、類似度計算関数sim
#cosine() を用いる事でランキングおよび順位による絞
り込みを行なっている。これは rank-by〜top節によっ
て実現されている。ここでは入力文書中での出現順序が
保存される。 5.XSLT 記述への変換 我々は、X2QL 問合せをXSLT 記述へ変換するという
アプローチを用いて、既存の XSLT 処理系上に部分的な
実装を行なった。既存の処理系を利用する事で短期間で
実装が可能であった。以下では、まず XSLT について概
説し、実装において採用した変換・処理手法を説明す
る。 5.1 XSLT XSLT はW3C で策定中の XSL (XML スタイルシート言語)
で用いられる変換言語である。その記述は、複数のテ
ンプレートと呼ばれる変換の規則で与えられ、その条件
に適合した部分構造に対して適用される。このXSLT 記
述の事をスタイルシートと呼ぶ。スタイルシート自体も
<xsl:stylesheet>をルートとする XML文書であり、主
に以下の記述で与えられる複数のテンプレートで構成さ
れる。In query description example 2, the similarity calculation function sim
By using #cosine (), we narrow down by ranking and rank. This is achieved by rank-by to top sections. Here, the order of appearance in the input document is stored. 5. Conversion to XSLT description We used the approach of converting X 2 QL contact the XSLT described, was performed a partial implementation on existing XSLT processors. Implementation was possible in a short time by using the existing processing system. Below, we first outline XSLT and describe the transformation and processing methods adopted in the implementation. 5.1 XSLT XSLT is an XSL (XML style sheet language) being developed by W3C.
It is a conversion language used in. The description is given by a plurality of conversion rules called templates, and is applied to a substructure that meets the conditions. This XSLT description is called a style sheet. The style sheet itself is also an XML document rooted at <xsl: stylesheet>, and is mainly composed of multiple templates given by the following description.
【0117】以下では、次のX2QL問合せを例として
説明を行なう。これは、<文書>中の[項目]を抽出し、
その<番号>順にソートする。In the following, the following X2QL inquiry will be described as an example. This extracts [items] in <document>,
Sort in the order of <number>.
【0118】 上記の操作記述に対応するテンプレートは次である。[0118] The template corresponding to the above operation description is as follows.
【0119】 5.1.1 テンプレート スタイルシートは、複数のテンプレートによって構成さ
れ、その処理内容は以下の記述要素によって指示され
る。[0119] 5.1.1 Template The style sheet is composed of a plurality of templates, and the processing content is specified by the following description elements.
【0120】ロケーションパス XML 文書は文書要素、
属性、テキスト (#PCDATA) 等をノードとする木構造デ
ータとして扱われる。これに対し、それぞれの処理は、
ロケーションパスと呼ばれるパス式によって選択された
コンテキストノードリストの個々のノードに対して適用
される。特に、現在の適用対象をコンテキストノードと
いう。ロケーションパスは、以下で説明する記法で記述
される。相対パスである時、コンテキストノードを起点
として評価される。A location path XML document is a document element,
It is treated as tree-structured data with attributes, text (#PCDATA), etc. as nodes. In contrast, each process
Applied to individual nodes in the context node list selected by a path expression called a location path. In particular, the current application target is called a context node. The location path is described in a notation described below. When it is a relative path, it is evaluated starting from the context node.
【0121】本稿の例を変換するために必要となる主な
記法として次がある。(1) ``.'' はそのノード自身を、
(2) ``..'' は親のノードを選択する。また、(3)a/bは
<a>の子である<b>を、(4)a/@b は<a>の属性であ
る<b>を、(5)a[x]は条件xを満たす<a>を、(6)a/nod
e()は<a>の全ての子ノードを選択する。条件xはロケ
ーションパスと述語によっても記述され、複数の条件を
and, orで組み合わせられる。尚、これらは省略記法で
あり、実際にはより詳細な指定が可能であるが、ここで
は説明を省く。The main notations required to convert the examples in this document are as follows. (1) ``. '' Is the node itself,
(2) ".." selects the parent node. (3) a / b is <b> which is a child of <a>, (4) a / @ b is <b> which is an attribute of <a>, and (5) a [x] is a condition <a> that satisfies x is (6) a / nod
e () selects all child nodes of <a>. Condition x is also described by a location path and a predicate.
Can be combined with and, or. Note that these are abbreviated notations, and in practice more detailed designation is possible, but the description is omitted here.
【0122】xsl:template <xsl:template>はテンプ
レートを定義し、次の基本構造を持つ。Xsl: template <xsl: template> defines a template and has the following basic structure.
【0123】 この<match>属性でコンテキストノードリストを選択
し、コンテキストノードに対する処理を上記の<!-- 処
理 --> に記述する。これは、XSLT で定められる以下に
示すような文書要素を用いて行なわれ、XSLT 処理系に
よって解釈、処理される。XSLT で定められているもの
以外の文書要素は、必要なら変数を展開し、出力され
る。この処理結果は、出力文書における現在の出力位置
に挿入される。[0123] The context node list is selected by this <match> attribute, and the processing for the context node is described in the above <!-Processing->. This is performed using the following document elements defined by XSLT, and is interpreted and processed by the XSLT processor. Document elements other than those specified in XSLT are output by expanding variables if necessary. This processing result is inserted at the current output position in the output document.
【0124】xs:variable 変数の束縛を行なう。<nam
e>属性で変数名を指定し、<select>属性もしくは記
述内容によって値を指定する。また、その値の参照は `
`$''を付ける事で行なわれる。これは、属性を記述する
値としても利用できる。Xs: variable A variable is bound. <Nam
Specify the variable name in the e> attribute, and specify the value in the <select> attribute or the description. Also, refer to the value with `
This is done by adding `$ ''. This can also be used as a value that describes the attribute.
【0125】xsl:for-each 複数の変数の束縛や入れ子
問合せは、これを用いて実現される。特に、入れ子問合
せのwhere 節に対応する。これは、<select>属性で指
定されたロケーションパスで選択されたコンテキストノ
ードリストに対して、その記述内容を適用する。Xsl: for-each Binding of a plurality of variables and nested queries are realized using this. In particular, it corresponds to the where clause of a nested query. This applies the content of the description to the context node list selected by the location path specified by the <select> attribute.
【0126】xsl:sort これは<xsl:for-each>の最初
の子要素としてのみ与える事ができ、コンテキストノー
ドリストの処理に先立ち、<select>属性の指定をキー
として、コンテキストノードリスト中のノードをソート
する。また、これを複数指定すると辞書順のソートが行
なわれる。order-by 節、rank-by 節は、これを用いて
実現される。Xsl: sort This can be given only as the first child element of <xsl: for-each>. Prior to the processing of the context node list, the specification of the <select> attribute is used as a key to Sort nodes. When a plurality of items are specified, sorting in dictionary order is performed. The order-by clause and the rank-by clause are implemented using this.
【0127】xsl:copy-of <select>属性のロケーシ
ョンパスで選択されたノードを複製する。Xsl: copy-of <select> Copies the node selected by the attribute location path.
【0128】xsl:if XSLTでは条件分岐を行なうため
に、<xsl:if>と<xsl:choose>が利用できる。特に<
xsl:if>は、<test>属性に記述された条件式が真であ
る時に限り、その記述内容が適用される。Xsl: if In XSLT, <xsl: if> and <xsl: choose> can be used to perform conditional branching. Especially <
xsl: if> is applied only when the conditional expression described in the <test> attribute is true.
【0129】冒頭のテンプレートの例では、入力の<文
書>について、出力として<文書>を作り、その内部を
<xsl:for-each>によって生成する。この内部は、<項
目>下の<番号>を全て選択し、ソートした結果の順に
それが所属する<項目>を<xsl:copy-of>によって複
製している。結果として、X2QL問合せと同等の処理
が記述されている。冒頭の例で<番号>を<項目>に先
立って処理しているのは、コンテキストノードリストが
出力の全てを生成できるようにするためである。In the example of the template at the beginning, for the input <document>, a <document> is created as an output, and the inside is generated by <xsl: for-each>. In this inside, all <numbers> under <items> are selected, and <items> to which they belong are copied in the order of the sorted result by <xsl: copy-of>. As a result, a process equivalent to the X 2 QL query is described. The reason why <number> is processed before <item> in the first example is to enable the context node list to generate all of the output.
【0130】ここでは、変数$iは値を参照している部分
をロケーションパスに展開可能であり、変数$dと$nは使
用されていないため、その束縛を省略可能である。ま
た、<項目>中に<番号>が一つしか存在しない場合に
は、<項目>を選択する<xsl:for-each>のみで同等の
ソート対象のノードリストを選択可能である。以上によ
り、上記のテンプレートは次のように簡略化可能であ
る。Here, the variable $ i can expand the part referring to the value into the location path, and the variables $ d and $ n are not used, so that the binding can be omitted. If only one <number> exists in <item>, an equivalent sort target node list can be selected only by selecting <item><xsl:for-each>. As described above, the above template can be simplified as follows.
【0131】 5.1.2 拡張関数 XSLT では拡張関数を利用可能であり、ユーザの定義し
た特定の名前空間をプリフィックスに持つ関数呼出しが
これらの拡張として扱われる。但し、その実装・利用方
法は処理系依存であり、その拡張関数を利用できない場
合、処理系はエラーを発する。尚、その利用可能性はfu
nction-available() 関数で判別可能である。本研究で
テスト実装に用いた、IBM alphaworks によるXSLT 処理
系 LotusXSL では、拡張関数の Java による実装は次の
形式の<lxslt:component>で与える。[0131] 5.1.2 Extended functions In XSLT, extended functions can be used, and function calls having a specific namespace defined by the user as a prefix are treated as these extensions. However, the implementation / use method depends on the processing system, and if the extended function cannot be used, the processing system issues an error. The availability is fu
It can be determined by the nction-available () function. In the XSLT processor LotusXSL by IBM alphaworks used for the test implementation in this study, the Java implementation of the extension function is given by the following format <lxslt: component>.
【0132】 例:head 名前空間で実装された MyHead クラスを利用す
る拡張関数の定義が次で与えられているとする。ここで
read 関数は、渡された文字列の先頭から指定文字数を
返すMyHead のメソッドである。[0132] Example: Suppose the definition of an extension function that uses the MyHead class implemented in the head namespace is given below. here
The read function is a method of MyHead that returns a specified number of characters from the beginning of the passed string.
【0133】 これを利用して文書の先頭 10 文字を取り出す例を以下
に示す。[0133] An example of using this to extract the first 10 characters of a document is shown below.
【0134】 5.2 変換の概要とその適用手順 X2QL問合せをXSLT スタイルシートへ変換する事で
問合せ処理系の実装を行なった。この変換は、問合せの
記述によっては複数のスタイルシートを適用する必要が
ある。XSLT は複数回のスタイルシートの適用を行なう
機構は持っていないため、これを実現する制御プログラ
ムが必要となる。これを含めた全体の処理の流れを、以
下に示す。[0134] 5.2 Overview of conversion and its application procedure The query processing system was implemented by converting an X2QL query into an XSLT stylesheet. This conversion requires the application of multiple style sheets depending on the description of the query. XSLT does not have a mechanism to apply style sheets multiple times, so a control program that implements this is required. The overall processing flow including this will be described below.
【0135】また、問合せの変換に際しては、以下の条
件を満たす問合せのみを仮定する。In the conversion of the query, only queries satisfying the following conditions are assumed.
【0136】・ 複数文書にまたがる結合処理等を行な
わないものとする。It is assumed that the merging process or the like over a plurality of documents is not performed.
【0137】・ XML-QL に準じた、特定の文書要素名
を含むクロージャを指定する正規パス表現を含まないも
のとする。これは、XSLT ではこれらを直接扱えない事
による。 ・ 副ブロック('[', ]' で括られたwhere〜construct 節を指し、これは外部結合等に利用される)およびスコ
ーレム関数によって <ID>が指定された文書要素が、
入れ子関係になっていないものとする。 5.3 テンプレートへの変換 まず、rank-by, order-by 節を含まない問合せについ
て、X2QL問合せの個々の記述から5.1節で述べた
ような XSLTにおける記述への変換方法を述べる。この
場合、一度のスタイルシートの適用で処理が完了する。 5.3.1 基本変換 where, construct 節の基本構造と各変数の束縛は、XSL
T の基本的な記述に対応する。変数は、X2QLで使用
されているもの全てに加え、幾つかの補助的な変数を利
用する。変数の束縛は[xsl:variable] によって行なわ
れる。A regular path expression that specifies a closure including a specific document element name in accordance with XML-QL shall not be included. This is because XSLT cannot handle them directly.・ Document elements for which <ID> is specified by sub-blocks (where-construct clauses enclosed by '[',] '), which are used for outer joins, etc., and by the Skolem function,
Assume that they are not nested. 5.3 Conversion to Template First, for a query that does not include rank-by and order-by clauses, a method of converting individual descriptions of X2QL queries into descriptions in XSLT as described in Section 5.1 will be described. In this case, the processing is completed by applying the style sheet once. 5.3.1 Basic transformation The basic structure of the where and construct clauses and the binding of each variable are XSL
Corresponds to the basic description of T. The variables make use of all those used in X 2 QL, plus some auxiliary variables. Variable binding is done by [xsl: variable].
【0138】一般には X2QL 問合せ中には複数の変
数が利用されるが、それらは<xsl:for-each>を用いて
順次束縛を行なう。変数を束縛する順番は、construct
節の指定に従い、出力を構成する順序によって決定され
る。これは、テンプレートの記述が出力構造を表すもの
であるためである。また、同じノードの構成に関与する
変数についてはスコーレム関数に使用されるものを最優
先とし、続いてソート基準に用いられるもの、それ以外
のものの順とする。また、これによって同じ優先順位が
与えられたものについては、それの問合せ中での束縛順
とする。In general, a plurality of variables are used in an X 2 QL query. These variables are sequentially bound using <xsl: for-each>. The order of binding variables is construct
Determined by the order in which the output is constructed, as specified in the clause. This is because the description of the template represents the output structure. Regarding variables related to the configuration of the same node, the variable used for the Skolem function is given the highest priority, followed by the variable used for the sorting criterion and the others. If the same priority is given by this, the binding order in the query is used.
【0139】変数の束縛を行なう際には、X2QL 問合
せにおける構造パターンの指定がロケーションパスでの
記述に変換されるが、これはコンテキストノードからの
相対指定、もしくは束縛済みの変数で始まるパスで与え
る。特に、共通の祖先となる文書要素が存在する場合
は、その最も近い共通の祖先を変数に束縛しておいてロ
ケーションパスの指定に利用する。これにより、適切な
祖先まで遡るような相対パスを導出する必要がなくな
り、ロケーションパスへの変換が容易になる。When a variable is bound, the specification of the structure pattern in the X 2 QL query is converted into a description by a location path, which is specified relative to a context node or a path starting with a bound variable. Give in. In particular, if there is a document element that is a common ancestor, the closest common ancestor is bound to a variable and used for specifying a location path. This eliminates the need to derive a relative path that traces back to the appropriate ancestor, and facilitates conversion to a location path.
【0140】 <!-- 与えられた問合せ --> where <記事> <掲載日> $a </> <見出し> $b </> </> ... <!-- <記事>を束縛するよう変更された問合せ --> where <記事> $x </>, <掲載日> $a </> <見出し> $b </> in $x ... <!-- 変更された問合せから導出されるテンプレート --> <xsl:template match="記事"> <xsl:variable name="x" select="." /> <xsl:for-each select "掲載日"> <xsl:variable name="a" select="." /> <!-- カレントは<掲載日>だが、制約されない --> <xsl:for-each select "$x/見出し"> <xsl:variable name="b" select="$x/見出し" /> ... </xsl:for-each> </xsl:for-each> </xsl:template> この他、コンテキストノードリストが変わってしまう事
で、評価値が変わってしまう式については、評価可能に
なった時点で変数に束縛しておく。例えば、コンテキス
トノードリスト中でのコンテキストノードの位置を与え
るposition()組込関数を使っている場合等が該当する。 5.3.2 スコーレム関数によるグルーピング スコーレム関数の返値は引数の値と一対一の対応を持
つ。即ち、これによって与えられる<ID>の一意性は、
引数の値の組の一意性と等しい。そこで、グルーピング
の記述は次に変換する。<!-Given query-> where <article><postdate> $ a </><headline> $ b </></> ... <!-Bind <article> Changed query to-> where <article> $ x </>, <post date> $ a </><headline> $ b </> in $ x ... <!-Changed query Template derived from-><xsl: template match = "article"><xsl: variable name = "x" select = "."/><Xsl: for-each select "Post date"><xsl: variable name = "a" select = "."/><!-Current is <post date> but not restricted-><xsl: for-each select "$ x / heading"><xsl: variable name = " b "select =" $ x / headline "/> ... </ xsl: for-each></ xsl: for-each></ xsl: template> In addition, by changing the context node list, Expressions whose evaluation values change are bound to variables when evaluation becomes possible. For example, the case where the position () built-in function for giving the position of the context node in the context node list is used is applicable. 5.3.2 Grouping by Skolem function The return value of the Skolem function has a one-to-one correspondence with the argument value. That is, the uniqueness of <ID> given by this is
Equal to the uniqueness of the argument value pair. Therefore, the description of the grouping is converted next.
【0141】まず、スコーレム関数による<ID>が等し
い文書要素のうち、最初の一つのみを選ぶ。即ち、コン
テキストノードリストにおいて、それより前に同じ<ID
>を与えられるノードが存在しないようなノードを選択
する。これは、下記の変換例のように、<xsl:if>によ
って実現される。そして、その内部でグルーピング結果
に相当する結果を抽出する。ここでは、同じ<ID>を割
り当てられる全てのノードを選択し、それぞれから必要
な構造を生成すれば良い。以上によって、スコーレム関
数の値毎に一つずつ、グルーピング結果が得られる。First, only the first one of the document elements having the same <ID> by the Skolem function is selected. That is, in the context node list, the same <ID
Select a node that does not have a node given>. This is realized by <xsl: if> as in the following conversion example. Then, a result corresponding to the grouping result is extracted in the inside. Here, all nodes to which the same <ID> is assigned may be selected, and a necessary structure may be generated from each node. As described above, a grouping result is obtained for each value of the Skolem function.
【0142】 5.4 ユーザ定義関数のマッピング X2QLではユーザ定義関数において型を明示し、実装
言語へのマッピングを定めている。一方、XSLT では、
そのマッピング方法や拡張関数の提供は実装依存である
ため、この点を考慮した変換を行なう必要がある。今回
の実装では、XSLT 処理系は Java による拡張関数の実
装が可能な LotusXSL を用いた。[0142] 5.4 Mapping of User-Defined Function X2QL specifies a type in a user-defined function and defines a mapping to an implementation language. On the other hand, in XSLT,
Since the mapping method and the provision of the extension function are implementation-dependent, it is necessary to perform conversion in consideration of this point. In this implementation, the XSLT processor used LotusXSL, which can implement extension functions using Java.
【0143】ユーザ定義関数の変換・対応付けは、問合
せをスタイルシートに変換する前に行ない、その対応付
けに従ってスタイルシート中での関数呼出しの記述が生
成される。これらの処理系依存の機能はアダプタモジュ
ールとして実装する。The conversion / association of the user-defined function is performed before the query is converted into the style sheet, and the description of the function call in the style sheet is generated according to the association. These processing system-dependent functions are implemented as adapter modules.
【0144】LotusXSL 用アダプタモジュールは、ま
ず、X2QLにおけるユーザ定義関数のfunction による
定義を参照し、LotusXSL 用のスタブを自動生成する。
これは、LotusXSL の想定する型と、X2QLのユーザ定
義関数に使用する型の変換を行なう、中継用のクラス群
である。そのメソッドは、各ユーザ定義関数の引数の型
をLotusXSL でのJava マッピングに従って置き換えたシ
グネチャを持つ。また、その内部実装では、各引数を
4.2節で述べたX2QLにおけるJava マッピングに従
った型に変換し、それに従って作成されているクラスの
メソッドを呼び出す。返値についてはこれと逆方向の変
換を行なう。この時、実装クラスをネットワーク経由で
取得するため、独自のクラスローダを用いている。ま
た、実行時にクラスやそのメソッドの情報を解決するた
め、Javaのリフレクション API を用いている。First, the LotusXSL adapter module automatically generates a LotusXSL stub by referring to the definition of the function defined by the user-defined function in X 2 QL.
This is a type of assumptions LotusXSL, performs conversion of the type used for user-defined function of X 2 QL, a class group of relay. The method has a signature that replaces the argument types of each user-defined function according to the Java mapping in LotusXSL. In the internal implementation, each argument is converted into a type according to the Java mapping in X 2 QL described in section 4.2, and the method of the class created in accordance with the conversion is called. The return value is converted in the opposite direction. At this time, a unique class loader is used to acquire the implementation class via the network. In addition, Java's reflection API is used to resolve information on classes and their methods at runtime.
【0145】 function element 記事.abstract() defined-by "http://fqdn/path/pkg.article#abstract" // Java スタブ : ここでは // クラスパス file://localhost/x2ql/article/ // クラス名 pkg.Article とする pacage pkg; class Article[ Node abstract(Node self)[ if(!LotusXSL#Adaptor.testElement(self,"article")) throw ...; // クラスの取得 ClassLoader ldr = X2qlClassLoader .getClassLoader("http://fqdn/path/"); Class cls = ldr("article"); // メソッドの取得 Class[] sig = new Class[1]; sig[0] = Element.getClass(); Method mth = cls.getMethod("pkg.abstract",sig); // メソッド呼出し Object[] args = new Object[1]; args[0] = LotusXSL#Adaptor.toElement(self); // 返値 Element rc = mth.involke(); return LotusXSL#Adaptor.toNode(rc); ] ] <!-- LotusXSL における関数定義。名前空間は x2ql-article="file://x2ql/article/" --> <lxslt:component prefix="x2ql-article" functions="abstract"> <lxslt:script lang="javaclass" src="pkg.Article"/> </lxslt:component> 5.5rank-by, order-by 節 一般に、rank-by 及びorder-by 節を含む問合せの処理
には、複数回のスタイルシートの適用を必要とする。
5.1節のXSLT の説明に用いたX2QL問合せ例のよう
に、出力となる文書要素とそのソートキーの関係の決定
が容易で、ソート対象となる出力文書要素の全てが一つ
のコンテキストノードリストから生成可能な場合には、
一つのスタイルシートで同時に処理するよう最適化を行
なう事も可能であるが、ここでは基本的な変換方法を述
べるにとどめる。Function element article.abstract () defined-by "http: //fqdn/path/pkg.article#abstract" // Java stub: here // class path file: // localhost / x2ql / article / / / Class name pkg.Article pacage pkg; class Article [Node abstract (Node self) [if (! LotusXSL # Adaptor.testElement (self, "article")) throw ...; // Get class ClassLoader ldr = X2qlClassLoader .getClassLoader ("http: // fqdn / path /"); Class cls = ldr ("article"); // Get method Class [] sig = new Class [1]; sig [0] = Element.getClass (); Method mth = cls.getMethod ("pkg.abstract", sig); // Method call Object [] args = new Object [1]; args [0] = LotusXSL # Adaptor.toElement (self); // Return Value Element rc = mth.involke (); return LotusXSL # Adaptor.toNode (rc);]] <!-Function definition in LotusXSL. Namespace is x2ql-article = "file: // x2ql / article /"-><lxslt: component prefix = "x2ql-article" functions = "abstract"><lxslt: script lang = "javaclass" src = "pkg .Article "/></ lxslt: component> 5.5 rank-by, order-by clause In general, processing a query that includes rank-by and order-by clauses requires applying a style sheet multiple times. .
As X 2 QL query example using the XSLT description of Section 5.1, it is easy to determine the relationship between document elements and their sort key to be output, all one context node of the output document element to be sorted If it can be generated from a list,
Although it is possible to perform optimizations so that they can be processed simultaneously by a single style sheet, only the basic conversion method will be described here.
【0146】まず、order-by節のみを含む場合は、次の
ような 2段階の処理で実現される。 ・出力順序基準式の評価結果を付加した形で全ての出力
を生成。 ・評価された基準値に従って出力をソートし、作業用に
付加した情報を除去。一方、rank-by 節を含む場合に
は、次の 3 段階の処理が必要となる。 ・順位付け基準式の評価結果を付加した形で全ての出力
を生成。同時に、order-by が指定されていればその出
力順序基準式の評価結果を、さもなくば、元の文書中で
の位置情報を、出力順序の基準値として付加。 ・順位付けの基準値に従って出力をソートし、必要件数
に限定して出力。 ・出力順序の基準値に従って出力を再度ソートし、作業
用に付加した情報を除去。 処理の途中段階では、作業用の文書要素を利用する。こ
こでは、次のrank-by 節のみを含む問合せの変換結果を
例示する。First, when only an order-by clause is included, it is realized by the following two-stage processing. -All outputs are generated with the evaluation result of the output order standard expression added. -Sort the output according to the evaluated reference value and remove the information added for work. On the other hand, when a rank-by clause is included, the following three steps are required.・ All outputs are generated in the form of adding the evaluation result of the ranking criteria formula. At the same time, if order-by is specified, the evaluation result of the output order standard expression is added, otherwise, the position information in the original document is added as the output order standard value.・ Sort the output according to the criteria for ranking, and limit the output to the required number. -The output is sorted again according to the reference value of the output order, and information added for work is removed. In the middle of the processing, a work document element is used. Here, a conversion result of a query including only the next rank-by clause is exemplified.
【0147】 はじめに、construct 節で生成される文書要素を内容と
する<x2qlorder>を生成し、その属性として基準式の
評価結果と、元の位置情報を付加する。更に、これらを
要素とするよう<x2ql:sort>を構成する。これらは、
2, 3 段回目に適用されるスタイルシートで使用され、
最後に適用されるスタイルシートで除去される。[0147] First, <x2qlorder> that contains the document element generated by the construct clause is generated, and the evaluation result of the reference expression and the original position information are added as its attributes. Furthermore, <x2ql: sort> is configured to make these elements. They are,
Used in style sheets applied to the second and third rounds,
Removed in the last applied style sheet.
【0148】 次に、<x2ql:order>をコンテキストノードリストとし
て選択して<xsl:sort>でソートする。そして、<xsl:
if>を用いてソート結果における出現位置に従って、必
要件数を出力とする。[0148] Next, <x2ql: order> is selected as a context node list and sorted by <xsl: sort>. And <xsl:
Using if>, the required number is output according to the appearance position in the sorting result.
【0149】 最後に、同様にソートを行ない、コンテキストノード、
即ち<x2ql:order>の子要素のみを出力とする事で付加
した情報を除去している。[0149] Finally, sort in the same way, the context node,
That is, the added information is removed by outputting only the child element of <x2ql: order>.
【0150】 [0150]
【0151】[0151]
【発明の効果】本発明によれば、XML文書を対象とす
る既存の問い合わせ言語を極力変更することなく記述内
容の処理操作の柔軟性と高度化とを図ることができる。According to the present invention, it is possible to improve the flexibility and sophistication of the processing operation of the description contents without changing the existing query language for XML documents as much as possible.
【図1】 本発明のXML文書問い合わせ言語処理装置
の概念図である。FIG. 1 is a conceptual diagram of an XML document query language processing device of the present invention.
【図2】 外部関数とDTDの関係を説明するための図
である。FIG. 2 is a diagram for explaining a relationship between an external function and a DTD.
【図3】 XSLTを用いた実装の処理の流れを説明す
る図である。FIG. 3 is a diagram illustrating a flow of an implementation process using XSLT.
【図4】 メソッドの呼び出しの手順を説明する図であ
る。FIG. 4 is a diagram illustrating a procedure for calling a method.
1 問い合わせ手段 4 変換手段 5 実行手段 6 外部関数保存手段 1 inquiry means 4 conversion means 5 execution means 6 external function storage means
Claims (5)
タに対して問い合わせを行う問い合わせ手段と、前記問
い合わせを解析して内部形式に変換する変換手段と、変
換された内部形式に基づいて問い合わせ内容を実行して
前記文書データを出力する実行手段と、汎用プログラミ
ング言語で記述されかつ問い合わせ言語の記述内容処理
によっては処理不可能な処理を行うための外部関数が保
存されている外部関数保存手段とを備え、 前記問い合わせ手段は、前記外部関数に記述されている
プログラムに従って処理を行わせるために前記汎用プロ
グラミング言語で記述された処理内容をXML言語で記
述された処理内容に対応づけて外部関数を定義する外部
関数定義手段を備え、前記問い合わせに前記外部関数が
指定されているときに、前記実行手段が前記外部関数を
呼び出すことにより前記汎用プログラミング言語で記述
された処理を実行することを特徴とするXML文書問い
合わせ言語処理装置。1. Inquiry means for inquiring about document data described in an XML document type, conversion means for analyzing the inquiry and converting it to an internal format, and content of the inquiry based on the converted internal format And an external function storage means for storing the external function for performing a process which is described in a general-purpose programming language and which cannot be performed by the description content processing of the query language. The inquiry means associates the processing content described in the general-purpose programming language with the processing content described in the XML language so as to perform processing according to a program described in the external function, and associates the external function with the processing content. External function defining means for defining, and when the external function is specified in the inquiry, the Means XML document query language processing apparatus characterized by performing a process in which the written in a general-purpose programming language by calls the external function.
あることを特徴とする請求項1に記載のXML文書問い
合わせ言語処理装置。2. The XML document query language processing device according to claim 1, wherein said execution means is an XSLT language processing device.
グ言語で記述されかつ文書から要約を生成する要約生成
手段に対応する関数であることを特徴とする請求項1に
記載のXML文書問い合わせ言語処理装置。3. The XML document query language processing apparatus according to claim 1, wherein the external function is a function described in the general-purpose programming language and corresponding to a summary generating unit that generates a summary from a document. .
類似度を判断して、文書の見出しに関連する段落を抽出
する類似度抽出手段に対応する関数であることを特徴と
する請求項1に記載のXML文書問い合わせ言語処理装
置。4. The apparatus according to claim 1, wherein the external function is a function corresponding to a similarity extracting unit that determines a headline item of the document and a degree of similarity and extracts a paragraph related to the headline of the document. 2. The XML document query language processing device according to 1.
を抽出する文書文字抽出手段であることを特徴とする請
求項1に記載のXML文書問い合わせ言語処理装置。5. The XML document query language processing apparatus according to claim 1, wherein said external function is a document character extracting means for extracting a first line from a text of the document.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2000165800A JP2001344267A (en) | 2000-06-02 | 2000-06-02 | XML document query language processor |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2000165800A JP2001344267A (en) | 2000-06-02 | 2000-06-02 | XML document query language processor |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JP2001344267A true JP2001344267A (en) | 2001-12-14 |
Family
ID=18669223
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2000165800A Pending JP2001344267A (en) | 2000-06-02 | 2000-06-02 | XML document query language processor |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP2001344267A (en) |
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2007063582A1 (en) * | 2005-11-30 | 2007-06-07 | Fujitsu Limited | Serial conversion program, serial conversion method, and serial conversion apparatus |
| JP2009059241A (en) * | 2007-08-31 | 2009-03-19 | Toshiba Corp | Information processing apparatus and program |
| US11972255B2 (en) * | 2021-06-25 | 2024-04-30 | International Business Machines Corporation | Compliance content generation |
-
2000
- 2000-06-02 JP JP2000165800A patent/JP2001344267A/en active Pending
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2007063582A1 (en) * | 2005-11-30 | 2007-06-07 | Fujitsu Limited | Serial conversion program, serial conversion method, and serial conversion apparatus |
| JP2009059241A (en) * | 2007-08-31 | 2009-03-19 | Toshiba Corp | Information processing apparatus and program |
| US11972255B2 (en) * | 2021-06-25 | 2024-04-30 | International Business Machines Corporation | Compliance content generation |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN100527127C (en) | Query intermediate language method and system | |
| US6766330B1 (en) | Universal output constructor for XML queries universal output constructor for XML queries | |
| Bourret | XML and Databases | |
| JP4264118B2 (en) | How to configure information from different sources on the network | |
| US6487566B1 (en) | Transforming documents using pattern matching and a replacement language | |
| USRE48030E1 (en) | Computer-implemented system and method for tagged and rectangular data processing | |
| US20030135825A1 (en) | Dynamically generated mark-up based graphical user interfaced with an extensible application framework with links to enterprise resources | |
| US20030212698A1 (en) | Graphical specification of XML to XML transformation rules | |
| US8176030B2 (en) | System and method for providing full-text search integration in XQuery | |
| JP2002251388A (en) | Generalizer system and method | |
| US7409636B2 (en) | Lightweight application program interface (API) for extensible markup language (XML) | |
| CN101211336B (en) | Visualized system and method for generating inquiry file | |
| JP2002534741A (en) | Method and apparatus for processing semi-structured text data | |
| Nolan et al. | Javascript object notation | |
| Pluempitiwiriyawej et al. | A classification scheme for semantic and schematic heterogeneities in XML data sources | |
| JP2001344267A (en) | XML document query language processor | |
| CN1326078C (en) | Forming method for package device | |
| Robie | XML processing and data integration with XQuery | |
| Nelli | Pandas: reading and writing data | |
| Manghi et al. | Hybrid applications over XML: Integrating the procedural and declarative approaches | |
| Sudarsan et al. | Metamodel search: Using XPath to search domain-specific models | |
| US7805424B2 (en) | Querying nested documents embedded in compound XML documents | |
| Groppe et al. | Transforming XSLT stylesheets into XQuery expressions and vice versa | |
| Rajeswari et al. | Heterogeneous database integration for web applications | |
| Chen et al. | Set-at-a-time Access to XML through DOM |