JPH10116188A - Method and device for generating instruction sentence - Google Patents

Method and device for generating instruction sentence

Info

Publication number
JPH10116188A
JPH10116188A JP9219886A JP21988697A JPH10116188A JP H10116188 A JPH10116188 A JP H10116188A JP 9219886 A JP9219886 A JP 9219886A JP 21988697 A JP21988697 A JP 21988697A JP H10116188 A JPH10116188 A JP H10116188A
Authority
JP
Japan
Prior art keywords
sentence
sql
statement
error
presenting
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
Application number
JP9219886A
Other languages
Japanese (ja)
Inventor
Hiroshi Kumamoto
浩 熊本
Koji Maekawa
浩二 前川
Hiroshi Nakajima
宏 中嶋
Masayuki Horiuchi
雅之 堀内
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Omron Corp
Original Assignee
Omron Corp
Omron Tateisi Electronics Co
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Omron Corp, Omron Tateisi Electronics Co filed Critical Omron Corp
Priority to JP9219886A priority Critical patent/JPH10116188A/en
Publication of JPH10116188A publication Critical patent/JPH10116188A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)
  • Devices For Executing Special Programs (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Stored Programmes (AREA)

Abstract

PROBLEM TO BE SOLVED: To enable even a beginner to generate an instruction sentence by following a representing method by matching the structure analytic result of an input sentence against grammar and diagnosing whether or not there is an error. SOLUTION: An SQL(structural query language) sentence extracting device 101 automatically extracts only an SQL sentence from an application source file and an SQL analyzing device 102 classifies the extracted SQL sentence into respective elements to obtain its structure. An SQL inference device 104 matches the structure of the SQL sentence obtained by the SQL analyzing device against the grammar stored in an SQL grammar storage means 103 to detect whether or not there is a grammatical error and its error place by inference. An SQL correcting plan showing device 106 reads a correction plan corresponding to the error out of an SQL correction plan storage device 105 when the grammatical error is inferred in the generated SQL sentence and shows it to the SQL sentence writer by using characters, an image, voice, etc.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、コンピュータシス
テムに所定の作業を指令するための命令文の作成支援方
法及び装置に係り、特に、データベースシステムに採用
されるSQL(Structured Querry Language)文の作成
等の際に好適な命令文の作成支援方法及び装置に関す
る。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a method and apparatus for supporting creation of a command sentence for instructing a computer system to perform a predetermined operation, and more particularly, to creation of an SQL (Structured Querry Language) statement used in a database system. The present invention relates to a method and an apparatus suitable for supporting creation of a command sentence in such a case.

【0002】[0002]

【従来の技術】昨今、任意のアプリケーションプログラ
ムの実行中に、データベースシステムにアクセスして、
所望のデータを検索することがしばしば行われる。この
ようなアプリケーションプログラムを実行するために
は、当該アプリケーションプログラムを構成するソース
ファイル中に、データベースシステムの検索のために、
SQL文を記述しておかねばならない。
2. Description of the Related Art Recently, a database system is accessed during execution of an arbitrary application program.
Retrieving desired data is often performed. In order to execute such an application program, in order to search a database system in a source file constituting the application program,
An SQL statement must be described.

【0003】[0003]

【発明が解決しようとする課題】ところで、SQL文に
は固有の表記方法乃至文法が存在するため、それに習熟
していない初心者にとっては、SQL文を作成するとい
う作業はなかなか容易なことではない。加えて、SQL
文の表記方法は各データベースの提供者により微妙に異
なるため、特定のデータベースに習熟したプログラマー
であっても、それ以外のデータベースに採用されたSQ
L文の作成に当たってはしばしば戸惑うこともある。
By the way, since an SQL sentence has a unique notation or grammar, the task of creating an SQL sentence is not easy for a beginner who is not familiar with it. In addition, SQL
Since the notation of sentences is slightly different depending on the provider of each database, even a programmer who is proficient in a specific database, SQ adopted in other databases
Creating an L-sentence can often be confusing.

【0004】従来、SQL文の作成支援装置としては、
データベース検索におけるパフォーマンス向上の観点よ
り、SQL文のチューニングを支援するものが提案され
ているが、表記方法の観点よりSQL文の作成を支援し
ようとするものは未だ例を見ないのが現状である。
Conventionally, as an apparatus for supporting the creation of an SQL statement,
From the viewpoint of performance improvement in database search, a proposal for supporting the tuning of an SQL statement has been proposed. However, there is no example that supports the creation of a SQL statement from the viewpoint of a notation method. .

【0005】この発明は、このような従来の問題点に着
目してなされたものであり、その目的とするところは、
SQL文に代表されるような命令文の作成に習熟してい
ない初心者等にあっても、当該命令文の表記方法に従っ
て、当該指令作業に合致した命令文を容易に作成できる
ようにした命令文の作成支援方法及び装置を提供するこ
とにある。
[0005] The present invention has been made in view of such conventional problems.
Even a beginner who is not proficient in creating a statement such as an SQL statement can easily create a statement matching the instruction work according to the notation method of the statement. It is an object of the present invention to provide a method and an apparatus for supporting creation of a document.

【0006】[0006]

【課題を解決するための手段】この出願の請求項1(又
は請求項6)に記載の発明は、入力された命令文の構造
を解析する文構造解析手段(又はステップ)と、前記文
構造解析(又はステップ)による解析により得られた命
令文の構造を文法と照合することにより、入力された命
令文中に誤りの有無を診断する命令文診断手段(又はス
テップ)と、前記命令文診断手段(又はステップ)によ
り命令文中に誤り有りと診断されるときには、その誤り
に対する修正案を診断結果として提示する修正案提示手
段(又はステップ)と、を具備することを特徴とする命
令文の作成支援装置(又は方法)にある。
According to the invention described in claim 1 (or claim 6) of this application, a sentence structure analyzing means (or step) for analyzing the structure of an input command sentence, and the sentence structure A statement diagnosing means (or step) for diagnosing the presence or absence of an error in the input statement by comparing the structure of the statement obtained by the analysis (or step) with the grammar; (Or step), when it is diagnosed that there is an error in the command sentence, a correction plan presenting means (or step) for presenting a correction plan for the error as a diagnosis result; In the device (or method).

【0007】ここで、『文構造解析』とは、入力される
命令文を各構成要素に分類することにより、命令文の構
造を取得する等の作業を意味するものである。
Here, "sentence structure analysis" means a work of acquiring the structure of a command sentence by classifying the input command sentence into each component.

【0008】また、『命令文診断』とは、入力された命
令文中に誤りの有無を診断することを意味し、この診断
は命令文の構造をその命令文の言語固有の文法と照合す
ることにより行われる。
[0008] Further, "diagnosis of imperative sentence" means diagnosing the presence or absence of an error in an input imperative sentence. This diagnosis is performed by checking the structure of the imperative sentence with a language-specific grammar of the imperative sentence. It is performed by

【0009】さらに、『修正案提示』とは、単に誤りが
あることを提示するのではなく、その誤りをどのように
すれば修正することができるかを提示するものであり、
その提示のためには、画像や音声など適宜な報知手段が
採用される。
[0009] Further, "presentation of a correction plan" does not merely indicate that there is an error, but indicates how the error can be corrected.
For the presentation, an appropriate notification means such as an image and a sound is adopted.

【0010】そして、この請求項1(又は請求項6)に
記載の発明によれば、提示される修正案に従って操作す
るだけで、その命令文の表記方法に不慣れな者であって
も、この種の命令文の作成を簡単かつ確実に行わせるこ
とができる。
[0010] According to the invention described in claim 1 (or claim 6), even if a person who is not accustomed to the instruction notation method only by operating according to the proposed correction plan, It is possible to easily and reliably create various kinds of command statements.

【0011】この出願の請求項2(又は請求項7)に記
載の発明は、前記修正案提示手段(又はステップ)は、
修正案に相当する自然言語による解説文を表示すること
により、前記修正案の提示を行うことを特徴とする請求
項1に記載の命令文の作成支援装置(又は方法)にあ
る。
According to the invention described in claim 2 (or claim 7) of the present application, the correction plan presenting means (or step)
The command sentence creation support apparatus (or method) according to claim 1, wherein the amendment is presented by displaying a commentary in a natural language corresponding to the amendment.

【0012】そして、この請求項2(又は請求項7)に
記載の発明によれば、自然言語による解説文として修正
案が提示されることから、コンピュータ言語に不慣れな
初心者であっても、修正案の内容を容易に理解すること
ができる。
According to the invention described in claim 2 (or claim 7), the proposed amendment is presented as a commentary in a natural language, so that even beginners unfamiliar with computer languages can modify The contents of the plan can be easily understood.

【0013】この出願の請求項3(又は請求項8)に記
載の発明は、前記修正案提示手段(又はステップ)は、
前記誤りが語の綴りミスにある場合には、前記の自然言
語による解説文に加えて、その綴りミスのある単語を作
成された命令文中において特徴的に表示させることを特
徴とする請求項2に記載の命令文の作成支援装置(又は
方法)にある。
According to the invention described in claim 3 (or claim 8) of the present application, the modification proposal presenting means (or step)
3. The method according to claim 2, wherein when the error is a misspelling of a word, the misspelled word is characteristically displayed in a prepared command sentence in addition to the commentary sentence in the natural language. In the statement support system (or method).

【0014】ここで、『特徴的に表示』とは、画面中に
おいてアンダーラインを付したり、表示色を異ならせた
り、輝度を異ならせたりすることを意味している。
Here, "characteristically displayed" means that an underline is added, a display color is changed, or luminance is changed in a screen.

【0015】そして、この請求項3(又は請求項8)に
記載の発明によれば、自らが作成された命令文のどの単
語に綴りミスがあるかを、表示態様の特徴により直接的
に認識させることができる。
According to the invention described in claim 3 (or claim 8), it is possible to directly recognize which word of the command sentence that the user has created has a misspelling by the feature of the display mode. Can be done.

【0016】この出願の請求項4(又は請求項9)に記
載の発明は、前記命令文は、データベースの検索に使用
されるSQL文であることを特徴とする請求項1(又は
請求項6)〜請求項3(又は請求項8)のいずれかに記
載の命令文の作成支援装置(又は方法)にある。
[0016] The invention described in claim 4 (or claim 9) of this application is characterized in that the statement is an SQL statement used for searching a database. ) To (3) (8).

【0017】そして、この請求項4(又は請求項9)に
記載の発明によれば、SQL文の作成に習熟していない
初心者等にあっても、当該SQL文の表記方法に従っ
て、当該検索作業に合致したSQL文を容易に作成でき
る この出願の請求項5(又は請求項10)に記載の発明
は、前記文構造解析手段(又はステップ)の前段には、
アプリケーションプログラムを構成するソースファイル
中からSQL文のみを抽出するSQL文抽出手段(又は
ステップ)が設けられていることを特徴とする請求項4
に記載の命令文の作成支援装置(又は方法)にある。
According to the invention described in claim 4 (or claim 9), even a novice or the like who is not proficient in preparing an SQL sentence can perform the search operation according to the notation method of the SQL sentence. The invention according to claim 5 (or claim 10) of the present application can easily create an SQL statement that conforms to the following.
5. An SQL sentence extracting means (or step) for extracting only an SQL sentence from a source file constituting an application program.
In the statement support system (or method).

【0018】そして、この請求項5に記載の発明によれ
ば、アプリケーションプログラムにSQL文を組み込ん
でソースプログラムを完成させた後、このソースプログ
ラムを本発明の命令文の作成支援装置に適用すれば、ソ
ースプログラムからSQL文だけが自動的に抽出され
て、構造解析、正誤診断、修正案提示が順次に行われる
こととなる。
According to the fifth aspect of the present invention, after a source program is completed by incorporating an SQL statement into an application program, the source program is applied to the instruction statement creation support apparatus of the present invention. Only the SQL sentence is automatically extracted from the source program, and the structural analysis, correct / incorrect diagnosis, and suggestion of the correction plan are sequentially performed.

【0019】この出願の請求項11に記載の発明は、前
記請求項6〜請求項10のいずれかに記載された方法を
実施するためのソフトウェアを格納したことを特徴とす
る記録媒体にある。
The invention according to claim 11 of the present application resides in a recording medium storing software for executing the method according to any one of claims 6 to 10.

【0020】ここで、『記録媒体』とは、フロッピーデ
ィスク、CD−ROM等のような、コンピュータに適用
される各種の記録媒体を意味している。
Here, the "recording medium" means various recording media applied to a computer, such as a floppy disk, a CD-ROM, and the like.

【0021】[0021]

【発明の実施の形態】以下、この発明の好ましい実施の
形態につき、添付図面を参照して詳細に説明する。
Preferred embodiments of the present invention will be described below in detail with reference to the accompanying drawings.

【0022】本発明の一実施形態である命令文の作成支
援方法及び装置の機能構成を図1のブロック図に概念的
に示す。
FIG. 1 is a block diagram conceptually showing a functional configuration of a method and an apparatus for supporting creation of a statement according to an embodiment of the present invention.

【0023】同図に示されるように、SQL文抽出装置
101は、アプリケーションプログラム言語であるC言
語文とデータベース検索用言語であるSQL文とを両者
の区切り記号(コロン『:』等)を頼りとして分離し、
アプリケーションソースファイル中からSQL文のみを
自動的に抽出するものである。なお、後に詳細に説明す
るが、このようにして抽出されたSQL文の一例(A,
B,C)が図3に示されている。
As shown in the figure, the SQL sentence extracting apparatus 101 relies on a delimiter (such as a colon ":") between a C sentence as an application program language and an SQL sentence as a database search language. Separated as
Only SQL statements are automatically extracted from the application source file. As will be described in detail later, an example of the SQL statement (A,
B, C) are shown in FIG.

【0024】SQL解析装置102は、SQL文抽出装
置101にて抽出されたSQL文を各要素に分類するこ
とによりその構造を取得するものである。
The SQL analysis device 102 acquires the structure of the SQL sentence extracted by the SQL sentence extraction device 101 by classifying the SQL sentence into each element.

【0025】SQL文法記憶装置103は、検索対象と
なるデータベースシステムに採用されているSQL文に
固有な文法を記憶するものである。前述のように、この
種のSQL文法はデータベースシステムの提供者により
微妙に異なるが、このSQL文法記憶手段103には実
際に採用されるデータペースシステムに合致したSQL
文法が記憶されるのである。なお、後に詳細に説明する
ように、文法に相当する推論知識の一例が図4に示され
ている。
The SQL grammar storage device 103 stores a grammar unique to an SQL sentence employed in a database system to be searched. As described above, this type of SQL grammar differs slightly depending on the provider of the database system. However, the SQL grammar storage means 103 stores an SQL grammar that matches the data pace system actually used.
The grammar is memorized. As will be described later in detail, an example of inference knowledge corresponding to a grammar is shown in FIG.

【0026】SQL推論装置104は、SQL解析装置
102にて得られたSQL文の構造を、SQL文法記憶
手段103に記憶された文法と照合することにより、当
該SQL文の文法的な間違いの有無並びにその間違い箇
所を推論により検出するものである。
The SQL inference unit 104 checks the structure of the SQL sentence obtained by the SQL analysis unit 102 against the grammar stored in the SQL grammar storage unit 103 to determine whether there is a grammatical error in the SQL sentence. In addition, the erroneous part is detected by inference.

【0027】SQL修正案記憶装置105は、SQL文
の作成においてありがちな文法上の様々な間違いに対し
て、それを修正するための修正案を予め記憶させたもの
である。なお、後に詳細に説明するように、このような
修正案の一例が図5に示されている。
The SQL modification plan storage device 105 stores, in advance, modification plans for correcting various grammatical errors that are likely to occur in SQL statement creation. As will be described later in detail, an example of such a modification is shown in FIG.

【0028】SQL修正案提示装置106は、作成され
たSQL文において文法上の誤りが推論された場合に、
その誤りに対応する修正案をSQL修正案記憶装置10
5から読み出してそのSQL文作成者に対して文字、画
像、音声等で提示するものである。なお、後に詳細に説
明するように、画像表示器の画面を利用して修正案を提
示した場合の表示態様の一例が図6並びに図9に示され
ている。
When the grammatical error is inferred in the created SQL sentence, the
The modification plan corresponding to the error is stored in the SQL modification plan storage device 10.
5 and presents it to the creator of the SQL sentence in characters, images, sounds, or the like. As will be described in detail later, FIGS. 6 and 9 show an example of a display mode when a correction plan is presented using a screen of an image display device.

【0029】そして、C言語で作成されたアプリケーシ
ョンプログラム中にSQL言語で作成されたSQL文を
記述挿入してソースプログラムを完成後、このソースプ
ログラムを図1に示される本発明の作成支援装置に適用
すれば、当該ソースプログラムに含まれているSQL言
語のみが自動的に抽出されて文法的な正誤診断が行わ
れ、それに誤りが存在する場合には、それに対する修正
案が利用者に対して自動的に提示されるのである。
Then, a source program is completed by describing and inserting an SQL statement created in the SQL language into an application program created in the C language, and this source program is transferred to the creation support device of the present invention shown in FIG. If applied, only the SQL language included in the source program will be automatically extracted and grammatical correctness / error diagnosis will be performed, and if there is an error in it, a correction plan for it will be sent to the user. It is presented automatically.

【0030】次に、図1に示される作成支援装置の動作
を、図2に示されるフローチャート並びに図3〜図6の
説明図を参照して詳細に説明する。
Next, the operation of the creation support device shown in FIG. 1 will be described in detail with reference to the flowchart shown in FIG. 2 and the explanatory diagrams of FIGS.

【0031】SQL抽出装置101を介してソースファ
イルから抽出されたSQL文の例を図3に、SQL文法
記憶装置103に記憶される文法の例を図4に、SQL
修正案記憶装置105に記憶されるSQL修正案の例を
図5に、さらに修正案提示装置106にて表示画面に提
示される修正案の例を図6にそれぞれ示す。
FIG. 3 shows an example of an SQL sentence extracted from a source file via the SQL extraction device 101, and FIG. 4 shows an example of a grammar stored in the SQL grammar storage device 103.
FIG. 5 shows an example of the SQL amendment stored in the amendment storage 105, and FIG. 6 shows an example of the amendment presented on the display screen by the amendment presentation device 106.

【0032】図3に示されるように、今仮に、3個のS
QL文(A,B,C)がSQL抽出装置101の作用に
よりソースファイルから抽出されたものと仮定する。
As shown in FIG. 3, suppose that three S
It is assumed that the QL sentence (A, B, C) is extracted from the source file by the operation of the SQL extraction device 101.

【0033】すると、SQL解析装置102は、それら
3個のSQL文(A,B,C)の構造を分析することに
より、それらSQL文の構造の特徴として、SQL文
(A)からは要素(SELECT,WHERE,NO
T,AND)を、SQL文(B)からは要素(UPDA
TE,WHERE)を、SQL文(C)からは要素(I
NSERT,INTO,VALUES)をそれぞれ取得
する。
Then, the SQL analyzing apparatus 102 analyzes the structure of the three SQL statements (A, B, C), and as a feature of the structure of the SQL statement, the element ( SELECT, WHERE, NO
T, AND) from the SQL statement (B) to the element (UPDA
TE, WHERE) from the SQL statement (C) to the element (I
NSERT, INTO, VALUES).

【0034】次いで、SQL推論装置104は、図2の
フローチャートに示されるように、SQL文ポインタ
(i)の値を初期値『1』から一つずつ歩進させながら
(ステップ201,210)、そのポインタ(i)にて
指定されるSQL文(A,B,C)の構造を順次に読み
出し(ステップ202)、その都度、推論知識IDポイ
ンタ(j)の値を初期値『1』から所定の最終値まで
(ステップ207)、一つずつ歩進させながら(ステッ
プ203,208)、そのポインタ(j)で指定される
推論知識をSQL文法記憶装置103から順次に読み出
しては(ステップ204)、両者(SQL文の構造と推
論知識)とを照合する(ステップ205)ことにより、
当該SQL文中に誤りの有無及び誤り箇所を診断する。
Next, as shown in the flowchart of FIG. 2, the SQL inference device 104 increments the value of the SQL statement pointer (i) one by one from the initial value “1” (steps 201 and 210). The structure of the SQL statement (A, B, C) specified by the pointer (i) is sequentially read (step 202), and each time, the value of the inference knowledge ID pointer (j) is predetermined from the initial value "1". (Step 207), while stepping one by one (Steps 203 and 208), sequentially read inference knowledge specified by the pointer (j) from the SQL grammar storage device 103 (Step 204). By comparing the two (the structure of the SQL sentence and the inference knowledge) (step 205),
The presence / absence of an error and the location of the error in the SQL statement are diagnosed.

【0035】ここで、両者が照合一致すると(ステップ
205YES)、SQL修正案提示装置106では、そ
の時点における推論知識IDポインタ(j)で指定され
る知識IDに相応する修正案をSQL修正案記憶装置1
05から読み出すことにより、修正案の作成を行う(ス
テップ206)。
Here, if the two match (step 205 YES), the SQL modification proposal presentation device 106 stores the SQL modification proposal corresponding to the knowledge ID specified by the inferred knowledge ID pointer (j) at that time. Apparatus 1
A correction plan is created by reading from step 05 (step 206).

【0036】以上の処理をSQL文ポインタ(i)の値
が所定の最終値に達するまで実行する。
The above processing is executed until the value of the SQL statement pointer (i) reaches a predetermined final value.

【0037】すると、図3に示される3個のSQL文の
場合には、次のように処理が行われる。すなわち、図3
に示されるSQL文(A)の場合には、その1行目に要
素『SELECT』が存在するにもか拘わらず、その後
の文中に要素『FROM』が存在しない。これは、2行
目の要素『FRAM』が『FROM』の綴りミスである
ことに起因する。加えて、4行目には要素『GROU
P』が存在するにも拘わらず、その後の文中に要素『B
Y』が存在しない。そのため、SQL文(A)の構造を
図4に示される推論知識と照合すると、知識ID(00
01,0002)に違反するとの判定が行われる。
Then, in the case of the three SQL statements shown in FIG. 3, the following processing is performed. That is, FIG.
In the case of the SQL sentence (A) shown in (1), although the element "SELECT" exists in the first line, the element "FROM" does not exist in the subsequent sentence. This is because the element “FRAM” on the second line is misspelled in “FROM”. In addition, in the fourth line, the element “GROU
Despite the existence of "P", the element "B"
Y "does not exist. Therefore, when the structure of the SQL sentence (A) is compared with the inference knowledge shown in FIG.
01,0002).

【0038】また、図3に示されるSQL文(B)の場
合には、その1行目に要素『UPDATE』が存在する
にも拘わらず、その後の文中に要素『SET』が存在し
ない。そのため、SQL文(B)の構造を図4に示され
る推論知識と照合すると、知識ID(0003)に違反
するとの判定が行われる。
In the case of the SQL sentence (B) shown in FIG. 3, although the element "UPDATE" exists in the first line, the element "SET" does not exist in the subsequent sentence. Therefore, if the structure of the SQL sentence (B) is compared with the inference knowledge shown in FIG. 4, it is determined that the knowledge ID (0003) is violated.

【0039】さらに、図3に示されるSQL文(C)の
場合には、その構造を図4に示される推論知識と照合す
ると、推論知識には一切違反していないとの判定が行わ
れることとなる。
Further, in the case of the SQL sentence (C) shown in FIG. 3, when the structure is compared with the inference knowledge shown in FIG. 4, it is determined that the inference knowledge is not violated at all. Becomes

【0040】SQL修正案提示装置106では、以上の
判定結果に基づいて、次のように処理が行われる。すな
わち、SQL文(A)に対しては、違反している知識I
D(0001,0002)に対応して、自然言語による
修正案(『SELECT文にはFROM句が必要で
す。』並びに『GROUP BYでひとつの句になりま
す。』)がSQL修正案記憶装置105から読み出され
る。
The SQL modification plan presentation device 106 performs the following processing based on the above determination results. That is, for the SQL sentence (A), the violating knowledge I
In response to D (0001,0002), the correction plan in natural language ("SELECT sentence requires FROM clause." And "GROUP BY forms one phrase.") Is SQL correction plan storage device 105. Is read from.

【0041】SQL文(B)に対しては、違反している
知識ID(0003)に対応して、自然言語による修正
案(『UPDATE文にはSET句が必要です。』)が
SQL修正案記憶装置105から読み出される。
For the SQL sentence (B), a correction plan in natural language (“UPDATE statement requires a SET clause”) is prepared in accordance with the offending knowledge ID (0003). It is read from the storage device 105.

【0042】そして、これらの読み出された修正案は、
図示しない画像表示器の画面上に自然言語として表示さ
れる。そのようにして表示された画面の一例が図6に示
されている。表示画面上に映し出されたウィンドウW1
内には、SQL文を表示するための上側小ウィンドウW
1と診断結果を表示するための下側小ウィンドウW2と
が含まれている。そして、上側小ウィンドウW1内には
この例では前述したSQL文(A)が表示されており、
また下側小ウィンドウW2内にはこの例では自然言語に
よる修正案が表示されている。従って、これら2個の小
ウィンドウの表示内容を比較しつつ確認することによ
り、SQL文(A)に誤りがあること及びその誤りをど
のように修正すべきかを容易に理解することができる。
Then, these read amendments are:
It is displayed as a natural language on the screen of an image display (not shown). FIG. 6 shows an example of a screen displayed in such a manner. Window W1 projected on the display screen
Inside the upper small window W for displaying the SQL statement
1 and a lower small window W2 for displaying a diagnosis result. In this example, the SQL sentence (A) described above is displayed in the upper small window W1.
In this example, a correction plan in a natural language is displayed in the lower small window W2. Therefore, by confirming while comparing the display contents of these two small windows, it is possible to easily understand that there is an error in the SQL sentence (A) and how to correct the error.

【0043】次に、本発明に係る命令文の作成支援方法
及び装置の他の実施の形態を図7〜図9を参照して説明
する。この実施の形態の特徴は、SQL文中に誤りがあ
る場合に、誤りの原因がいずれかの要素の綴りミスにあ
る場合には、その綴りミスに係る要素を自動的に検出し
て特徴的に表示させることにより、誤り箇所をより明確
に理解できるようにしたものである。
Next, another embodiment of the method and apparatus for supporting the creation of a statement according to the present invention will be described with reference to FIGS. The feature of this embodiment is that if there is an error in the SQL sentence, and if the cause of the error is misspelling of any element, the element related to the misspelling is automatically detected and By displaying, it is possible to more clearly understand the error location.

【0044】このような作用を実現するための機能ブロ
ック図を図7に示す。同図に示されるように、この例に
示されるSQL解析装置102は、解析装置本来の機能
を実現するためのSQL解析装置102−1と新たに設
けられた類似要素検索装置102−2とから構成されて
いる。そして、類似要素検索装置102−2は、SQL
文のコマンド名(要素)と類似した(例えば一字違いな
ど)文字列を抽出する機能を有する。この類似要素の自
動抽出は以下の手順により行われる。
FIG. 7 shows a functional block diagram for realizing such an operation. As shown in the figure, the SQL analysis apparatus 102 shown in this example is composed of an SQL analysis apparatus 102-1 for realizing the original function of the analysis apparatus and a newly provided similar element search apparatus 102-2. It is configured. Then, the similar element search device 102-2 uses the SQL
It has a function of extracting a character string similar to the command name (element) of a sentence (for example, a single character difference). The automatic extraction of the similar element is performed according to the following procedure.

【0045】先ず、類似要素抽出のための特徴量として
は、次式(数1)の(1)〜(4)に示す数値化された
特徴量が用いられる。
First, as feature quantities for extracting similar elements, numerical feature quantities shown in (1) to (4) of the following equation (Equation 1) are used.

【0046】[0046]

【数1】 (1)文字列の長さの一致度(長さ) 長さが一致 :1.0 長さが1文字違う :0.8 長さが2文字違う :0.4 (2)キャラクタの種類の一致度(種類) 種類が同一 :1.0 種類が一つ違う :0.8 種類が二つ違う :0.4 (3)同一文字の順番の一致度(順番) 順番が一致 :1.0 順番が一つ違う :0.8 順番が二つ違う :0.4 (4)先頭文字の一致度(先頭) 先頭文字が一致 :1.0 先頭文字が違う :0.0(先頭文字を間違うことは
ないため) そして、上記各特徴量の重みづけ平均を取り、一定のし
きい値以上の文字列を類似要素として抽出するものであ
る。曖昧な類似要素検出のための類似度計算式の一例を
次式(数2)に示す。
(1) Character string length coincidence (length) Length match: 1.0 Length differs by one character: 0.8 Length differs by two characters: 0.4 (2) Matching degree of character types (type) Same type: 1.0 One type is different: 0.8 Two types are different: 0.4 (3) Matching degree (order) of same character order Order matches : 1.0 The order is different by one: 0.8 The order is different by two: 0.4 (4) Matching degree of first character (first) Matching first character: 1.0 Different first character: 0.0 ( (Because the first character is not mistaken.) Then, a weighted average of the above-mentioned respective characteristic amounts is calculated, and a character string having a certain threshold value or more is extracted as a similar element. An example of a similarity calculation equation for detecting an ambiguous similar element is shown in the following equation (Equation 2).

【0047】[0047]

【数2】 類似度=(長さ+種類+順番+先頭)/特徴量の数 (数2) 図3に示されるSQL文(A)の場合で説明すると、要
素『FRAM』と要素『FROM』との類似度は、次式
(数3)のように計算される。
## EQU2 ## Similarity = (length + type + order + head) / number of feature amounts (equation 2) In the case of the SQL sentence (A) shown in FIG. 3, the element "FRAM" and the element "FROM" Is calculated as in the following equation (Equation 3).

【0048】[0048]

【数3】 長さ=1.0 −−−− ともに4文字 種類=0.8 −−−− 1文字違い 順番=1.0 −−−− 同一文字の並びが同じ 先頭=1.0 −−−− 先頭文字が同一 類似度=(1.0+0.8+1.0+1.0)/4.0 =0.95 (数3) ここで、しきい値を0.7に設定したとすれば、上記の
計算により得られた類似度はしきい値を越えているた
め、要素『FRAM』は基準要素『FROM』の類似要
素として抽出されることとなる。
## EQU00003 ## Length = 1.0 -------- Four characters for both Type = 0.8 --- One character difference Order = 1.0 ------ Same character arrangement is the same First = 1.0- --- First character is the same Similarity = (1.0 + 0.8 + 1.0 + 1.0) /4.0=0.95 (Equation 3) Here, if the threshold value is set to 0.7, Since the similarity obtained by the above calculation exceeds the threshold value, the element “FRAM” is extracted as a similar element to the reference element “FROM”.

【0049】このようにして抽出された類似要素(例え
ば、『FRAM』)は、対応する基準要素(例えば、
『FROM』)と対にしてメモり内に記憶しておく。こ
の記憶は、図8に示されるように、基準となるSQL文
の要素とその類似要素とを関連づけて行うものとする。
The similar element (for example, “FRAM”) extracted in this manner is used as a reference element (for example, “FRAM”).
"FROM") and stored in a memory. This storage is performed, as shown in FIG. 8, by associating the elements of the SQL sentence as a reference with the similar elements.

【0050】図7に示されるように、この実施の形態に
おけるSQL修正案提示装置106は、修正案提示装置
本来の機能を実現するためのSQL修正案提示装置10
6−1と類似要素表示装置106−2とから構成されて
いる。そして、類似要素表示装置106−2は、SQL
修正案提示装置106−1で提示される診断結果と先に
抽出された類似要素とを関連づけて特徴的に表示する。
As shown in FIG. 7, the SQL amendment proposal presenting apparatus 106 in this embodiment is a SQL amendment proposal presenting apparatus 10 for realizing the original function of the amendment proposal presenting apparatus.
6-1 and a similar element display device 106-2. Then, the similar element display device 106-2 displays the SQL
The diagnostic result presented by the amendment proposal presenting apparatus 106-1 is characteristically displayed in association with the previously extracted similar element.

【0051】また、それら抽出された類似要素は修正候
補として選択できるように、別枠として表示するのが好
ましい。このとき、抽出された類似要素が複数存在する
場合には、適合度の高いものから順に並べて表示するの
が好ましい。
It is preferable that the extracted similar elements are displayed as separate frames so that they can be selected as correction candidates. At this time, when there are a plurality of extracted similar elements, it is preferable to display them in order from the one with the highest matching degree.

【0052】また、表示されるSQL文の要素とそれに
対応する類似要素とは、色分け、下線、輝度違い等で容
易に識別できるようにすることが好ましい。
It is preferable that the elements of the SQL sentence to be displayed and the similar elements corresponding thereto can be easily identified by color coding, underlining, difference in luminance, and the like.

【0053】さらに、修正候補が一つの場合には、修正
するか否かを選択するだけにしても良いであろう。
Further, when there is only one correction candidate, it may be sufficient to simply select whether or not to correct.

【0054】このようにして表示された画面の一例が図
9に示されている。上側の小ウィンドウW1内に表示さ
れたSQL文(A)には、構文要素である『SELEC
T』と綴りミスされた要素である『FRAM』とが含ま
れており、その内で要素『SELECT』には下線が引
かれ、また『FRAM』には二重下線が引かれている。
さらに、小ウィンドウW1の右上には、新たに別の小ウ
ィンドウW3が重ねて開かれており、この小ウィンドウ
W3内には要素『SELECT』と対をなす要素である
『FROM』の類似要素が複数かつ類似度の高いものか
ら順に並べて表示されている。また、このウィンドウW
3内には修正候補を確定させるための確定ボタンが設け
られており、カーソルでクリックする等の操作で修正候
補を選択した後、確定ボタンを操作することにより、ウ
ィンドウW1内に表示された綴りミスにかかる類似要素
『FRAM』は正しい要素である『FROM』へと自動
的に修正されることとなる。
FIG. 9 shows an example of the screen displayed in this manner. The SQL sentence (A) displayed in the upper small window W1 has a syntax element “SELEC
"T" and misspelled element "FRAM" are included therein, and the element "SELECT" is underlined, and "FRAM" is double underlined.
Further, another small window W3 is newly opened at the upper right of the small window W1 in an overlapping manner. In this small window W3, a similar element of “FROM” which is an element paired with the element “SELECT” is included. A plurality of items having a high degree of similarity are displayed in order. Also, this window W
A confirmation button for confirming a correction candidate is provided in 3. After selecting a correction candidate by an operation such as clicking with a cursor, the spelling displayed in the window W1 is operated by operating the confirmation button. The similar element "FRAM" which is related to the mistake is automatically corrected to the correct element "FROM".

【0055】このように、本実施の形態によれば、図6
に示される実施の形態の場合に比べて、SQL文の誤り
箇所をより一層簡単に修正することが可能となる。
As described above, according to the present embodiment, FIG.
It is possible to more easily correct the error portion of the SQL sentence as compared with the embodiment shown in FIG.

【0056】[0056]

【発明の効果】以上の説明から明らかなように、本発明
によれば、SQL文に代表されるような命令文の作成に
習熟していない初心者等にあっても、当該命令文の表記
方法に従って、当該指令作業に合致した命令文を容易に
作成できる。
As is apparent from the above description, according to the present invention, even a beginner who is not proficient in creating an imperative sentence represented by an SQL sentence, etc. Thus, a command sentence that matches the command operation can be easily created.

【図面の簡単な説明】[Brief description of the drawings]

【図1】本発明にかかる命令文の作成支援方法及び装置
の機能構成を概念的に示すブロック図である。
FIG. 1 is a block diagram conceptually showing a functional configuration of a method and an apparatus for supporting creation of a statement according to the present invention.

【図2】図1に示される装置の動作を説明するためのフ
ローチャートである。
FIG. 2 is a flowchart for explaining the operation of the device shown in FIG.

【図3】ソースファイルから抽出されたSQL文の一例
を示す説明図である。
FIG. 3 is an explanatory diagram showing an example of an SQL sentence extracted from a source file.

【図4】文法を構成する推論知識の一例を示す説明図で
ある。
FIG. 4 is an explanatory diagram showing an example of inference knowledge constituting a grammar;

【図5】文法的な誤りに対する修正案の一例を示す説明
図である。
FIG. 5 is an explanatory diagram showing an example of a correction plan for a grammatical error.

【図6】誤りを含むSQL文とそれに対する修正案とを
関連づけて表示させた表示画面の一例を示す説明図であ
る。
FIG. 6 is an explanatory diagram showing an example of a display screen on which an SQL sentence containing an error and a correction plan for the sentence are displayed in association with each other.

【図7】本発明にかかる命令文の作成支援方法及び装置
の機能構成の他の例を概念的に示すブロック図である。
FIG. 7 is a block diagram conceptually showing another example of the functional configuration of the method and apparatus for supporting creation of a command sentence according to the present invention.

【図8】SQL要素とその類似要素との記憶態様を概念
的に示す説明図である。
FIG. 8 is an explanatory diagram conceptually showing a storage mode of an SQL element and its similar element.

【図9】誤りを含むSQL文とそれに対する修正案とを
関連づけて表示させかつ綴りミスのある要素を特徴的に
表示させた表示画面の一例を示す説明図である。
FIG. 9 is an explanatory diagram showing an example of a display screen in which an SQL sentence including an error and a correction plan for the error are displayed in association with each other, and an element having a misspelling is characteristically displayed.

【符号の説明】[Explanation of symbols]

101 SQL抽出装置 102 SQL解析装置 103 SQL文法記憶装置 104 SQL推論装置 105 SQL修正案記憶装置 106 SQL修正案提示装置 Reference Signs List 101 SQL extraction device 102 SQL analysis device 103 SQL grammar storage device 104 SQL inference device 105 SQL correction plan storage device 106 SQL correction plan presentation device

───────────────────────────────────────────────────── フロントページの続き (72)発明者 堀内 雅之 京都府京都市右京区花園土堂町10番地 オ ムロン株式会社内 ──────────────────────────────────────────────────続 き Continued on the front page (72) Inventor Masayuki Horiuchi Omron Co., Ltd.

Claims (11)

【特許請求の範囲】[Claims] 【請求項1】 入力された命令文の構造を解析する文構
造解析手段と、 前記文構造解析手段による解析により得られた命令文の
構造を文法と照合することにより、入力された命令文中
に誤りの有無を診断する命令文診断手段と、 前記命令文診断手段により命令文中に誤り有りと診断さ
れるときには、その誤りに対する修正案を診断結果とし
て提示する修正案提示手段と、 を具備することを特徴とする命令文の作成支援装置。
1. A sentence structure analysis means for analyzing the structure of an input statement, and a structure of the statement obtained by the analysis by the statement structure analysis means is compared with a grammar, so that the input statement A statement diagnosing means for diagnosing the presence / absence of an error; and, when the statement diagnosing means diagnoses the statement as having an error, a correction plan presenting means for presenting a correction plan for the error as a diagnosis result. A statement creation support device characterized by the following.
【請求項2】 前記修正案提示手段は、修正案に相当す
る自然言語による解説文を表示することにより、前記修
正案の提示を行うことを特徴とする請求項1に記載の命
令文の作成支援装置。
2. The method according to claim 1, wherein the modification proposal presenting unit presents the modification proposal by displaying a commentary in a natural language corresponding to the modification proposal. Support equipment.
【請求項3】 前記修正案提示手段は、前記誤りが語の
綴りミスにある場合には、前記の自然言語による解説文
に加えて、その綴りミスのある単語を作成された命令文
中において特徴的に表示させることを特徴とする請求項
2に記載の命令文の作成支援装置。
3. If the error is a misspelling of a word, the correction suggesting means presents the misspelled word in the prepared command sentence in addition to the commentary sentence in the natural language. The command creation support apparatus according to claim 2, wherein the command statement creation support is displayed.
【請求項4】 前記命令文は、データベースの検索に使
用されるSQL文であることを特徴とする請求項1〜請
求項3のいずれかに記載の命令文の作成支援装置。
4. The apparatus according to claim 1, wherein the statement is an SQL statement used for searching a database.
【請求項5】 前記文構造解析手段の前段には、アプリ
ケーションプログラムを構成するソースファイル中から
SQL文のみを抽出するSQL文抽出手段が設けられて
いることを特徴とする請求項4に記載の命令文の作成支
援装置。
5. The SQL sentence extracting means according to claim 4, wherein said sentence structure analyzing means is provided with an SQL sentence extracting means for extracting only an SQL sentence from a source file constituting the application program. Instruction statement creation support device.
【請求項6】 入力された命令文の構造を解析する文構
造解析ステップと、 前記文構造解析ステップによる解析により得られた命令
文の構造を文法と照合することにより、入力された命令
文中に誤りの有無を診断する命令文診断ステップと、 前記命令文診断ステップにより命令文中に誤り有りと診
断されるときには、その誤りに対する修正案を診断結果
として提示する修正案提示ステップと、 を具備することを特徴とする命令文の作成支援方法。
6. A sentence structure analyzing step for analyzing the structure of an input sentence, and a structure of the sentence obtained by the analysis in the sentence structure analyzing step is compared with a grammar, so that the input sentence is A statement diagnosing step of diagnosing the presence / absence of an error; and a correction plan presenting step of presenting a correction plan for the error as a diagnosis result when the statement is diagnosed as having an error in the statement diagnosing step. A method for supporting the creation of an imperative sentence.
【請求項7】 前記修正案提示ステップは、修正案に相
当する自然言語による解説文を表示することにより、前
記修正案の提示を行うことを特徴とする請求項6に記載
の命令文の作成支援方法。
7. The preparation of a statement according to claim 6, wherein the step of presenting the modification plan presents the modification plan by displaying a commentary in a natural language corresponding to the modification plan. How to help.
【請求項8】 前記修正案提示ステップは、前記誤りが
語の綴りミスにある場合には、前記の自然言語による解
説文に加えて、その綴りミスのある単語を作成された命
令文中において特徴的に表示させることを特徴とする請
求項7に記載の命令文の作成支援方法
8. The method for presenting a correction plan, wherein when the error is a misspelling of a word, in addition to the commentary sentence in the natural language, the misspelled word is included in a prepared command sentence. 8. The method according to claim 7, wherein the command is displayed in a dynamic manner.
【請求項9】 前記命令文は、データベースの検索に使
用されるSQL文であることを特徴とする請求項6〜請
求項8のいずれかに記載の命令文の作成支援方法。
9. The method according to claim 6, wherein the statement is an SQL statement used for searching a database.
【請求項10】 前記文構造解析ステップの前段には、
アプリケーションプログラムを構成するソースファイル
中からSQL文のみを抽出するSQL文抽出ステップが
設けられていることを特徴とする請求項9に記載の命令
文の作成支援方法。
10. In the preceding stage of the sentence structure analysis step,
10. The method according to claim 9, further comprising an SQL statement extracting step of extracting only an SQL statement from a source file constituting the application program.
【請求項11】 前記請求項6〜請求項10のいずれか
に記載された方法を実施するためのソフトウェアを格納
したことを特徴とする記録媒体。
11. A recording medium storing software for executing the method according to any one of claims 6 to 10.
JP9219886A 1996-08-07 1997-07-31 Method and device for generating instruction sentence Pending JPH10116188A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP9219886A JPH10116188A (en) 1996-08-07 1997-07-31 Method and device for generating instruction sentence

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP22435396 1996-08-07
JP8-224353 1996-08-07
JP9219886A JPH10116188A (en) 1996-08-07 1997-07-31 Method and device for generating instruction sentence

Publications (1)

Publication Number Publication Date
JPH10116188A true JPH10116188A (en) 1998-05-06

Family

ID=26523389

Family Applications (1)

Application Number Title Priority Date Filing Date
JP9219886A Pending JPH10116188A (en) 1996-08-07 1997-07-31 Method and device for generating instruction sentence

Country Status (1)

Country Link
JP (1) JPH10116188A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009086851A (en) * 2007-09-28 2009-04-23 Hitachi Software Eng Co Ltd Display method and system for picture transition diagram
JP2009259141A (en) * 2008-04-21 2009-11-05 Jfe Steel Corp Apparatus for supporting creation of application program, database system, method of supporting creation of application program, and its program
JP2014503916A (en) * 2011-01-04 2014-02-13 トムソン ライセンシング Universal plug and play search condition conversion

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009086851A (en) * 2007-09-28 2009-04-23 Hitachi Software Eng Co Ltd Display method and system for picture transition diagram
JP2009259141A (en) * 2008-04-21 2009-11-05 Jfe Steel Corp Apparatus for supporting creation of application program, database system, method of supporting creation of application program, and its program
JP2014503916A (en) * 2011-01-04 2014-02-13 トムソン ライセンシング Universal plug and play search condition conversion

Similar Documents

Publication Publication Date Title
US6016467A (en) Method and apparatus for program development using a grammar-sensitive editor
CN107209759B (en) Annotation support device and recording medium
US6889361B1 (en) Educational spell checker
US7343371B2 (en) Queries-and-responses processing method, queries-and-responses processing program, queries-and-responses processing program recording medium, and queries-and-responses processing apparatus
US7191119B2 (en) Integrated development tool for building a natural language understanding application
US7818173B2 (en) Information retrieval system, method, and program
US20080077859A1 (en) Spelling and grammar checking system
JP2007172657A (en) Method and system for identifying and analyzing commonly confused word with natural language parser
JP2002215617A (en) Method for attaching part of speech tag
CN110647618A (en) Dialogue inquiry response system
JP2003223437A (en) Method of displaying candidate for correct word, method of checking spelling, computer device, and program
JPH06266780A (en) Character string retrieving method by semantic pattern recognition and device therefor
JP2008152760A (en) Machine-assisted translation tool
JPH07325828A (en) Grammar checking system
US11537797B2 (en) Hierarchical entity recognition and semantic modeling framework for information extraction
WO2021089129A1 (en) Analysis and comparison of character-coded digital data, in particular for job matching
CN113505195A (en) Knowledge base, construction method and retrieval method thereof, and question setting method and system based on knowledge base
JP2000267553A (en) Question preparing device and recording medium where question preparing program is recorded
JPH10116188A (en) Method and device for generating instruction sentence
JPH11296366A (en) Error detecting device and method therefor and recording medium
JP2021114120A (en) Ambiguous part correction support device and method
US7379862B1 (en) Method and apparatus for analyzing and debugging natural language parses
JP2005134691A (en) Automatic marking device in education system via network
JPH07160714A (en) Japanese sentence proofreading device
JP2009087009A (en) Sentence retrieval device, sentence retrieval program and sentence retrieval method

Legal Events

Date Code Title Description
S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313117

S533 Written request for registration of change of name

Free format text: JAPANESE INTERMEDIATE CODE: R313533

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

EXPY Cancellation because of completion of term