next up previous contents
Next: Typical List Traversal in Up: Using Lists in FDs Previous: Encoding Lists as FDs

When to Use Lists: an Example

Lists should be used whenever you are thinking of using feature names of the form att1, att2 - i.e., whenever you want to go around the limitation of FDs that only one attribute with a given name exist by adding subscripts to the attribute names. Natural candidates for the use of lists are conjunction and the semantic encoding of non-singular objects.

In the following example, lists are used to encode the logical form of a sentence. This encoding encodes in FUF a KL-ONE type of knowledge representation based on entities and binary relations between these entities.

          
;; An FD used in Jacques Robin's Basketball Report Writing System
;; This is a list of entities and a list of relations in which they
;; participate.

Semantic content of the sentence: Malone scored 28 points and John Stockton added 27 points and 24 assists.

statistics(malone, 28points) statistics(stockton, 27points) statistics(stockton, 24assists)

FD notation:

(setf input '((cat semantic)

;; note the use of the ~ notation to encode a list of FDs. (ents ~(((concept player) (name malone)) ((concept stat) (value 28pts)) ((concept player) (name stockton)) ((concept stat) (value 27pts)) ((concept stat) (value 24asts))))

;; Note the usage of ^n~ to escape to the beginning of the ;; containing list and ~n to go down nth elt of a list. ;; ^2~ means `go up 2 levels and then to the beginning of the list' (rels ~(((concept stat-rel) (args ((carrier {^2~ ents ~1}) (stat {^2~ ents ~2})))) ((concept stat-rel) (args ((carrier {^2~ ents ~3}) (stat {^2~ ents ~4})))) ((concept stat-rel) (args ((carrier {^2~ ents ~3}) (stat {^2~ ents ~4})))))))))

The notation ~ and ^n~ are detailed below. They are used to ease the writing of lists as FDs and to traverse lists with path expressions. In this example, note how the lists ents (for entities) and rels (for relations) are encoded as regular FDs, and how parts of the ents list are used in the rels FD (for example, the first element of the rels list contains two paths to the first and second element of the ents list). This form of structure sharing between parts of lists would not be possible using a ``black box primitive'' list encoding.


next up previous contents
Next: Typical List Traversal in Up: Using Lists in FDs Previous: Encoding Lists as FDs
Michael Elhadad - elhadad@cs.bgu.ac.il