|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: B T
Length: 7254 (0x1c56)
Types: TextFile
Names: »B«
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
└─⟦129cab021⟧ »DATA«
└─⟦this⟧
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
└─⟦129cab021⟧ »DATA«
└─⟦e24fb53b7⟧
└─⟦this⟧
with Alias;
with F_Frames;
with Output_Stream;
with Slot;
use Slot;
package body F_General_Bundle is
use Alias;
use F_Frames;
use F_Kbs.Kbs.Predicate;
use F_Kbs.Kbs.Predicate.System_Defined_Predicate;
use F_Kbs.Kbs.Expression.System_Defined_Expression;
use F_Kbs.Kbs.Expression;
use F_Kbs.Kbs;
type Rule_Names is (Stop_Condition, Resolve_Sub_Goals,
Make_Sub_Goals, No_More);
---------------------------------------------------------------------------
package Stop_Condition_Rule is
function Premiss return F_Kbs.Kbs.Fact_Queries;
procedure Action (Objects : F_Kbs.Kbs.Fact_Collection);
end Stop_Condition_Rule;
package body Stop_Condition_Rule is
function Premiss return F_Kbs.Kbs.Fact_Queries is
begin
return (1 => (Factorials.Exist ((Number => Is_Equal (1),
Value => Is_Undefined,
Message => Is_Any))));
end Premiss;
procedure Action (Objects : F_Kbs.Kbs.Fact_Collection) is
The_Fact : F_Kbs.Kbs.Fact_Name renames Objects (1);
use Output_Stream;
begin
New_Line (Standard_Output);
Put_Line ("---- Stop condition rule -----", Standard_Output);
--New_Line (Standard_Output);
--Put ("Modifying : ", Standard_Output);
--Put (The_Fact, Standard_Output);
Factorials.Change (The_Fact, Value, Slot.Value (1));
Factorials.Change (The_Fact, Message, Slot.Value ("Hello world"));
New_Line (Standard_Output);
--Put ("Becomes : ", Standard_Output);
--F_Frames.Put (The_Fact, Standard_Output);
--New_Line (Standard_Output);
--New_Line (Standard_Output);
end Action;
end Stop_Condition_Rule;
---------------------------------------------------------------------------
package Resolve_Sub_Goals_Rule is
function Premiss return F_Kbs.Kbs.Fact_Queries;
procedure Action (Objects : F_Kbs.Kbs.Fact_Collection);
end Resolve_Sub_Goals_Rule;
package body Resolve_Sub_Goals_Rule is
function Premiss return F_Kbs.Kbs.Fact_Queries is
begin
return (Factorials.Exist
((Number => Define_As (N),
Value => Is_Defined,
Message => Is_Equal
(Value ("Hello ") & Value ("world")))),
Factorials.Exist ((Number => Is_Equal
(Value (N) + Value (1)),
Value => Is_Undefined,
Message => Is_Any)),
Factorials.Not_Any ((Number => Is_Less (N),
Value => Is_Undefined,
Message => Is_Any)));
end Premiss;
procedure Action (Objects : F_Kbs.Kbs.Fact_Collection) is
The_Known_Fact : F_Kbs.Kbs.Fact_Name renames Objects (1);
The_Unknown_Fact : F_Kbs.Kbs.Fact_Name renames Objects (2);
The_Number : Slot.Object := F_Frames.Factorials.Get
(The_Unknown_Fact, F_Frames.Number);
The_Value : Slot.Object := F_Frames.Factorials.Get
(The_Known_Fact, F_Frames.Value);
use Output_Stream;
use Slot.Operators;
begin
New_Line (Standard_Output);
Put_Line ("---- Resolve sub-goals rule -----", Standard_Output);
New_Line (Standard_Output);
--Put ("Modifying : ", Standard_Output);
--Put (The_Unknown_Fact, Standard_Output);
Factorials.Change (The_Unknown_Fact, Value, The_Number * The_Value);
Factorials.Change (The_Unknown_Fact, Message,
Value ("Hello world"));
New_Line (Standard_Output);
--Put ("Becomes : ", Standard_Output);
--F_Frames.Put (The_Unknown_Fact, Standard_Output);
New_Line (Standard_Output);
--Put ("Deleting: ", Standard_Output);
--F_Frames.Put (The_Known_Fact, Standard_Output);
--F_Frames.Factorials.Delete (The_Known_Fact);
end Action;
end Resolve_Sub_Goals_Rule;
---------------------------------------------------------------------------
package Make_Sub_Goals_Rule is
function Premiss return F_Kbs.Kbs.Fact_Queries;
procedure Action (Objects : F_Kbs.Kbs.Fact_Collection);
end Make_Sub_Goals_Rule;
package body Make_Sub_Goals_Rule is
function Premiss return F_Kbs.Kbs.Fact_Queries is
begin
return (Factorials.Exist ((Number => Define_As (N),
Value => Is_Undefined,
Message => Is_Any)),
Factorials.Not_Any
((Number => Is_Equal ((Value (N) - Value (1))),
Value => Is_Any,
Message => Is_Any)));
end Premiss;
procedure Action (Objects : F_Kbs.Kbs.Fact_Collection) is
use Output_Stream;
The_Fact : F_Kbs.Kbs.Fact_Name renames Objects (1);
The_Number : Integer := F_Frames.Factorials.Get
(The_Fact, F_Frames.Number);
begin
New_Line (Standard_Output);
Put_Line ("---- Make sub-goals rule -----", Standard_Output);
New_Line (Standard_Output);
--Put ("Creating : ", Standard_Output);
The_Number := The_Number - 1;
Factorials.Add ((Value (The_Number), Undefined_Value, Value (" ")));
--New_Line (Standard_Output);
end Action;
end Make_Sub_Goals_Rule;
---------------------------------------------------------------------------
package Rule_Bundle is new F_Kbs.Kbs.Rule_Base.Generic_Rule_Bundle
(The_Bundle => F_Kbs.F_Bundle,
Rule_Names => Rule_Names,
Nothing => Rule_Names'Last,
Rule_1 => Stop_Condition,
Premiss_1 => Stop_Condition_Rule.Premiss,
Action_1 => Stop_Condition_Rule.Action,
Rule_2 => Resolve_Sub_Goals,
Premiss_2 => Resolve_Sub_Goals_Rule.Premiss,
Action_2 => Resolve_Sub_Goals_Rule.Action,
Rule_3 => Make_Sub_Goals,
Premiss_3 => Make_Sub_Goals_Rule.Premiss,
Action_3 => Make_Sub_Goals_Rule.Action);
procedure Do_Action (For_Rule : F_Kbs.Kbs.Rule_Id;
On_Facts : F_Kbs.Kbs.Fact_Collection) is
begin
Rule_Bundle.Do_Action (For_Rule, On_Facts);
end Do_Action;
end F_General_Bundle;