@AllDescendants (式言語)

選択条件と一致する親文書の返答文書と返答の返答文書を返します。

構文

SELECT selectionFormula I @AllDescendants

戻り値

selectionFormula と一致するすべての文書とすべてのレベルの返答文書、および返答の返答文書が選択されます。

使用法

@AllDescendants は、ビュー選択式か選択複製式でのみ使用できます。論理演算子 OR ("|") を使用して、選択式の最後に追加します。式の複雑な表現式の中では使用しないでください。

@AllDescendants を使用すると、式に一致する一連の文書と、それらの文書に対するすべてのレベルの返答文書が表示されるようにビューを定義できます。また、一連の文書を次レベルの返答文書と共に複製するような選択複製式も作成できます。

@AllDescendants を使用する選択式のほうが、@IsResponseDoc を使用する式よりも優れています。@IsResponseDoc ではデータベース内に 1 つでも返答文書があると True が返されますが、@AllDescendants では条件と一致する文書の派生である返答文書だけが返されるからです。

  1. 返答文書の階層に、次のような文書が含まれているものとします。

    1.0 What is your favorite color?(Esteban Garcia) 1.1 Blue (Mary Lu) 1.2 Aqua (Jim Thompson) 1.2.1 Why do you like aqua? (Mary Lu) 1.2.2 It reminds me of the ocean (Jim Thompson) 1.3 I like the color orange (Bill Jones)

    最初の SELECT ステートメントでは 1.2、1.2.1、1.2.2 の文書が選択され、2 番目では 1.0、1.1、1.2、1.3 の文書、3 番目では 1.0、1.1、1.2、1.2.1、1.2.2、1.3 の文書、4 番目では 1.2.1 と 1.3 の文書が選択されます。

    SELECT @Author = "Jim Thompson" | @AllChildren
    SELECT @Author = "Esteban Garcia" | @AllChildren
    SELECT @Author = "Esteban Garcia" | @AllDescendants
    SELECT @Contains( Subject; "like" ) | @AllChildren
  2. [Flowers] というディスカッションデータベースがあり、蘭に関する文書だけが表示されるビューを新しく追加するものとします。[Orchid] ビューを作成し、[ビューのプロパティ] インフォボックスを使用して返答の階層表示で文書を表示するよう指定し、このビューに対して次の選択式を記述します。
    SELECT @Contains( Subject; "orchid" ) | @IsResponseDoc

    この場合、次のようなビューが表示されます。

    Date Topic 04/08/95 The orchid family of flowers (Anne Davis, 2 responses) 04/08/95 Sighting of new variation (Brad Sullivan) 04/08/95 The "ghost" orchid (Rachel Greenbaum) 04/08/95 Local flower shops that carry orchids (Mary Tsen, 1 response) 04/08/95 Try the Blumenhaus (Anne Davis)

    ところが、ビューでは蘭に関係なくデータベース全体のすべての返答文書が選択されています。例えば、返答文書の階層表示を解除するとビューは次のように表示されます。

    Date Topic 04/08/95 The orchid family of flowers (AnneDavis) 04/08/95 Sighting of new variation (Brad Sullivan) 04/08/95 Special varieties of roses (Michael Bowling) 04/08/95 My roses bloomed late this year (Marcel DuBois) 04/08/95 Local flower shops that carry orchids (Mary Tsen) 04/08/95 Try the Blumenhaus (Anne Davis) 04/08/95 The "ghost" orchid (Rachel Greenbaum)

    不要な文書が、データベースのあるサーバー上のビュー索引でかなりの容量を占めてしまいます。また、この同じ式で複製を実行すると、不要な文書も複製されてしまいます。

    ここで、@AllChildren を使用して選択式を書き直します。

    SELECT @Contains( Subject; "orchid" ) | @AllChildren

    この式では、親文書の [Subject] フィールドに「orchid」が含まれる返答文書だけが選択され表示されます。ビューには非表示返答文書は含まれません。

    Date Topic 04/08/95 The orchid family of flowers (Anne Davis, 2 responses) 04/08/95 Sighting of new variation (Brad Sullivan) 04/08/95 The "ghost" orchid (Rachel Greenbaum) 04/08/95 Local flower shops that carry orchids (Mary Tsen, 1 response) 04/08/95 Try the Blumenhaus (Anne Davis)

  3. 期待したとおりに、蘭に関する活発な議論が展開されます。すべての文書が選択されるデータベースのメインビューは、次のようになります。

    Date Topic 04/08/95 The orchid family of flowers (Anne Davis, 7 responses) 04/08/95 Sighting of new variation (Brad Sullivan, 2 responses) 04/08/95 What color? (Anne Davis) 04/08/95 Please post exact location (Mary Tsen) 04/08/95 The "ghost" orchid (Rachel Greenbaum, 3 responses) 04/08/95 Very difficult to see (Brad Sullivan, 1 response) 04/08/95 Only blooms for an hour or so! (Rachel Greenbaum) 04/08/95 Some sightings reported in Florida (AnneDavis) 04/08/95 Roses beginning to bloom (Peter Donovan, 2 responses) 04/08/95 Special varieties of roses (Michael Bowling) 04/08/95 My roses bloomed late this year (Marcel DuBois) 04/08/95 Local flower shops that carry orchids (Mary Tsen, 1 response) 04/08/95 Try the Blumenhaus (Anne Davis) 04/08/95 Tulip trips to Holland (Mary Tsen)

    しかし、作成したばかりの [Orchid] ビューには必要のない文書も含まれています。ここで、@AllChildren を使用すると、選択条件に合う親文書の次レベルの子文書だけが選択されます。

    Date Topic 04/08/95 The orchid family of flowers (Anne Davis, 4 responses) 04/08/95 Sighting of new variation (Brad Sullivan) 04/08/95 The "ghost" orchid (Rachel Greenbaum, 2 responses) 04/08/95 Very difficult to see (Brad Sullivan) 04/08/95 Some sightings reported in Florida (Anne Davis) 04/08/95 Local flower shops that carry orchids (Mary Tsen, 1 response) 04/08/95 Try the Blumenhaus (Anne Davis)

    この場合は、@AllDescendants を使用することをお勧めします。選択式を次のように書き直します。

    SELECT @Contains( Subject; "orchid" ) | @AllDescendants

    これで、[Orchid] ビューに含まれるのは、蘭に関する文書だけになります。

    Date Topic 04/08/95 The orchid family of flowers (Anne Davis, 7 responses) 04/08/95 Sighting of new variation (Brad Sullivan, 2 responses) 04/08/95 What color? (Anne Davis) 04/08/95 Please post exact location (Mary Tsen) 04/08/95 The "ghost" orchid (Rachel Greenbaum, 3 responses) 04/08/95 Very difficult to see (Brad Sullivan, 1 response) 04/08/95 Only blooms for an hour or so! (Rachel Greenbaum) 04/08/95 Some sightings reported in Florida (Anne Davis) 04/08/95 Local flower shops that carry orchids (Mary Tsen, 1 response) 04/08/95 Try the Blumenhaus (Anne Davis)