KnowledgeWorks and Prolog User Guide > 3 Rules > 3.2 Backward Chaining > 3.2.2 Backward Chaining Syntax

NextPrevUpTopContentsIndex Example

(defrule link-exists :backward
  ((link-exists ?town1 ?town2)
  (or (link ?link town1 ?town1 town2 ?town2)
      (link ?link town2 ?town1 town1 ?town2))
  (cut))((link-exists ?town1 ?town2) 
 (route-exists ?town1 ?town2)))

which says that a link exists between two towns either if there is a link object between them in the object base or if there is a route between the towns. The route-exists predicate would be defined by another backward chaining rule, or might be in the Prolog database.

KnowledgeWorks and Prolog User Guide (Macintosh version) - 22 Dec 2009