This section briefly describes an extended KB that captures the information in two sections of California Driver's Handbook: Right of Way on Mountain Roads and Speed Limits.
The extended example is organized similarly to the main example used in this tutorial. It consists of two files:
extended_example_KB.ergo -- contains the actual KB: the rules, the ontology, etc.
extended_example_tests.ergo -- contains the test data and test queries.
The second file contains the instruction ?- [+extended_example_KB]. so to load the example and run its tests one needs to just load the tests:
ergo> [extended_example_tests].
This will load the tests into the module main and will then add the KB to the same module as part of the loading process on behalf of extended_example_tests.ergo. The tests will run automatically.
The KB is subdivided in 8 sections, each formally capturing a group of English sentences from the driver's handbook. The sentences are listed at the top of each section and are followed by a brief explanation of the methodology used to capture each sentence. Some sentences are ignored, if they do not provide any operational information. For each section, a number of "basic tests" are provided; these verify the base-level correctness of each rule. Next follow more complex tests (Tests 9--14), which typically exercise several rules at once. The last set of tests, Tests N1--N7, are added after the KB was tested with the first two groups of tests. These last group is used to provide some assurance against "overfitting" the KB to the first two groups of tests.
The extended example can be adapted to run under Flora-2 by making a few small changes. First, the extension .ergo needs to be changed to .flr. Second, the test N4 uses the syntax \in and count(.) to test list membership and length. These are available in Ergo only and in Flora-2 should be replaced with the more verbose library methods, as indicated in that example.