Inheritance and backtracking

\dlpindex{inheritance} \dlpindex{backtracking} Applying inheritance in integrating data and knowledge may require that knowledge is used in an additive fashion. In other words, the pieces contained in the individual objects may all contribute to the solution. We have adapted the example given in  [HB88] to illustrate the need for using all knowledge available. For convenience, we introduce an abbreviation for accessing the value of the non-logical variables of a particular object. We use the expression \dlpindex{\varaccess} to stand for the value of the non-logical name of the object O. The idea of the example is that there are two kinds of researchers: associates and professors. They have similar interests, in that they both know of a number of topics. A researcher has a name and works in some field, that is given as a list of topics. A researcher knows of a topic whenever he has visited a conference that somehow concerns the topic. Naturally, a researcher knows all of his field.\ftn{ We assume that both member and append are available as system predicates. } \lprog{researcher}{ .ds researcher.pl } The constructor for researcher stores the name of the fellow and his field of interest, and then calls for work() that is interrupted only to answer what he knows of. A researcher inherits a number of things from an environment. For instance, whether a researcher is a visitor at a conference is assumed to be known by its environment. An associate is a researcher that works under a professor. Apart from what he knows of as a researcher he is also assumed to know of everything his professor knows of. \lprog{associate}{ .ds associate.pl } In case a new associate already is a researcher of some unidentified kind his non-logical variables of interest may simply be copied, as expressed in the second clause for associate.\ftn{ Since inheritance is static we cannot take the object itself. Instead we must copy its contents. The resulting associate object is an object that contains both the non-logical variable prof and the non-logical variables of the researcher object. } The other constructor explicitly takes his name and field of interest. A professor is a researcher and apart from what he knows of as a researcher he also knows of the topics of all conferences for which he is a member of the program committee. \lprog{professor}{ .ds professor.pl } Similarly as for an associate, two constructors are provided to be able to cope with his past. In the clause for knowsof, the non-logical variable name comes from being a researcher. Being a researcher, a professor inherits the environment declared for researchers. Whether a professor is a member of a program committee must be known by the environment. Next we define a conference, for instance one concerning parallel processing. \lprog{conference}{ .ds conference.pl } And all that remains to be done is to declare in what environment our actors live. We assume that an environment is just a collection of facts by which, among other things, it may be established that one is a member of a program committee or a visitor of a conference. \lprog{environment}{ .ds environment.pl } The bag of topics associate newman knows of is delivered by evaluating the goal
  ?- P = new( professor( turing, [computing] ) ),
     A = new( associate( newman, [engineering], P )),
     A !bagof(X, knowsof(X), Topics).
  
As a remark, we may ask an associate for all topics he or she knows of, since being a researcher he or she is willing to accept anything that interrupts the work.