# Communicating with Databases in Natural Language - Wallace M.

**Download**(direct link)

**:**

**49**> 50 51 52 53 54 55 .. 59 >> Next

(b) relj is a non-empty derived relation containing all and only those tuples of ‘rel’ which satisfy ‘atti @i q’ for i= 1, „, . n (or i = 1),

(c) each ‘relj(att2 G3,, , ,)’ is true.

(.3) If atti has ‘set type’:

(a) Gi is a set with subsets Ñö,, . . Gln whose union is Gb

(b) rel; is a non-empty derived relation containing all and only those tuples of ‘rel’ which satisfy ‘atti G^’. (Unless the comparison ‘@i’ is defined on sets, ‘atti @i Gu’ is meaningless. Semantically, therefore, the QUALIFIER is well-defined only if ‘@i’ is ‘=’.)

(c) each ‘rel, (att2 @2 G2,, . ,.)’ is true.

136 SPECIFICATION OF D&Qs

[Appendix

(4) If attj has ‘bag type’:

(a) Gi is a bag and Gn,G12, . . . Gln are bags whose union (as defined in Chapter 4, section 2.1) is Gb

(b) as for 3(b),

(c) as for 3(c).

(5) If attx has ‘list type’:

(a) G! is a list which results from appending Ñö, G12, . . Gln,

(b) as for 3(b),

(c) as for 3(c).

3.2 Satisfaction of Curried QUALIFIERS

A Curried QUALIFIER has the form lqual(V,Qual)’ where ‘Qual’ is a QUALIFIER, and ‘V’ is a variable. It is satisfied by X=Gx and ‘returns’ the group Gy if ‘Qual’ is satisfied by

V—Gb X=Gx, and by V=G2, X=Gx, and by . .

and by V=Gn, X=Gx

where Gv is the union of G!,G2, ¦ ¦ Gn.

If Qual is the simple QUALIFIER ‘peison(name=X,age>Y)’, then ‘qual(Y, person(name=X,age>Y))’ is satisfied by X= [‘SMITH’, ‘JONES’] and returns the set [50] only if ‘person(name=X,age>Y)’ is satisfied by

Xs [‘SMITH’, ‘JONES’], Y = [50].

If Qual is any simple QUALIFIER, with free variable V, the ‘qual(V,Qual)’ is satisfied by X=Gxand returns Gv only if Qual is satisfied by V=Gv, X=Gx However, if Qual is a QUALIFIER such as ‘Desc is qual(V2,Qual2)’, where ‘Desc’ is a DESCRIPTION and ‘qual(V2,Qual2)’ another Curried QUALIFIER then the above equivalence does not necessarily hold. A counter-example will be given in section ,3,4,

If V is not free in Qual, the ‘qual(V,Qual)’ is satisfied by X=Gxand returns any group if Qual is satisfied by the same association set

3.3 The reference of a DESCRIPTION

3.3.1 Simple DESCRIPTIONS

A Curried QUALIFIER can return either a set, a bag or a list. The reference of a DESCRIPTION on the other hand may only be a bag or a list.

3.3.2 Compound DESCRIPTIONS

A compound DESCRIPTION has the form ‘Determiner-Number-qual(V,Qual)’. If ‘qual(V,Qual)’ is satisfied by X=Gx and returns the group Gv with more than N elements, then the DESCRIPTION ‘Det-N-qual(V,Qual)’ is also satisfied, with

2]

SPECIFICATION OF D&Qs 137

the same association set. If the group Gv is a bag or a list then this is its reference. If Gv is a set, however, then the reference is a bag containing each of the elements of Gv only once.

Thus “2 people”, ‘Det-2-qual(V,person(name=V))’ is satisfied by the empty association set. It refers to the bag [‘SMITH’, ‘JONES’] if ‘peison(name=V)’ is satisfied by V=[‘SMITH’,‘JONES’].

3.3.3 Disjunctive DESCRIPTIONS

A disjunctive DESCRIPTION has the foim ‘Desc! or Desc2’, If Desci has fiee variables X, and Desc2 has free variables Y, then ‘Desc! or Desc2’ is satisfied by ‘X^Gx union Y=Gy’ and refers to the group G if:

(1) X^Gx and Y=Gy are compatible,

(2) Desc! is satisfied by X^Gxand refers to G (in which case Gy is any group), or Desc2 is satisfied by Y^Gy and refers to G (in which case Gx is any group).

3.3.4 Conjunctive DESCRIPTIONS

A conjunctive DESCRIPTION has the form ‘Desci & Desc2’, It is satisfied by ‘X=Gx union YsGy’ if Descx is satisfied by X=Gx, Desc2 is satisfied by a compatible association list Y=GY Its reference is the union of the two groups referred to by Desc! and Desc2.

3.3.5 Natural language functions

A natural language function has the form ‘Desci is funct(V,Desc2)’. It is satisfied by ‘X=Gx union Y=Gy’ if

(1) Descx is satisfied by X=Gxand refers to G,

(2) there exist groups Gb . . Gn (generally each G; is a singleton) whose union is G,

(.3) Desc2 is satisfied by ‘V=Gyi union Y^Gy’ and refers to Ref; for each i=l, . . .n,

(4) each of the pairs Gj and Gyj are equal groups (by the definition in Chapter

4, section 2.1).

The reference of ‘Desci is funct(V,Desc2)’ may be a bag or list depending which the reference of Desc! is.

If Desci refers to a bag then the reference of the whole natural language function ‘Desci is funct(V,Desc2)’, is ‘Refi union Ref2 . . union Refn’, where these are defined above.

If Desci refers to a list, then each of the Ref; must be converted into a list, L;. (If Ref; is a list itself, or a singleton, then Lj=Reff Otherwise L, results from Ref; by imposing an arbitrary ordering on it.) The whole reference of the natural language function, ‘Desc! is funct(V,Desc2)’, is the list, ‘Lj union L2 . . . union Ln’.

138 SPECIFICATION OF D&Qs

[Appendix

3.3.6 Example of a natural language function This is all best illustrated by an example,

“The orders for which two Berkshire customers”.

The DESCRIPTION corresponding to Desc! is,

what-2-qual(X, customer(name=X, region=‘berkshire’)) “ . , which two Berkshire customers”

**49**> 50 51 52 53 54 55 .. 59 >> Next