# Communicating with Databases in Natural Language - Wallace M.

**Download**(direct link)

**:**

**21**> 22 23 24 25 26 27 .. 59 >> Next

year?”) require more drastic reshaping to be expressed without a quantifier

hierarchy.

3]

FORMALISING NATURAL LANGUAGE 55

2.3.3

A particular feature of natural language, and of D&Qs, is that mathematical functions like “total” are expressed in precisely the same way as database relations (e g “the total of ICL, IBM and AIC’s current balances’, “the names of ICL, IBM and AIC’s salesmen”), To determine the salesmen’s names it suffices to look up the names of the salesmen one at a time However, to determine the “total of ICL, IBM and AIC’s current balances” it requires that the balances be taken all at once. Thereby hangs the difference between one-at-a-time substitution and all-at-once.

2.3..4

Reference evaluation in D&Qs is the facility to retain the database items which satisfied each DESCRIPTION in the formal query. This is hard to do for a description which is not at the top of the quantifier hierarchy, since the reference set of a DESCRIPTION low in the hierarchy will be different for each different reference value higher in the hierarchy, (e g, “In Berkshire and Yorkshire who are the salesmen?”) The result returned from a D&Qs query is thus a tree rather than a table. For a given DESCRIPTION its final reference will be extracted from a number of different branches of the tree (in the above example, the reference of “salesmen” is compounded from two branches, Berkshire salesmen and Yorkshire salesmen)

In the next chapter we define the precise semantics of D&Qs

4

D&Qs

1. ARRIVING AT D&QS 1 1 Introduction

The concern of this chaptei is how natural language sentences map onto the formal language of DESCRIPTIONS & QUALIFIERS (D&Qs). This mapping defines a semantics foi the subset of natural language which QPROC can deal with. Because the data model is predefined, and the formal language is tied to the data model, the discussion of semantics will be moie restricted than would be necessaiy foi general linguistic puiposes.

1.2 Grammai and meaning

The attempt to foimalise language was first tackled by logicians who developed the predicate calculus. This formal mathematical language has two fundamental constructions, the “predicate” and the “term”. The piedicate calculus formula ‘ORDER’ (‘.J00026’, ‘ICL’, ‘19/02/83’) has a “piedicate”, ‘ORDER’, and thiee teims, ‘J00026’, ‘ICL’ and ‘19/02/8,3’,

The natural language noun-phiase has a meaning similai to a term. Natural language clauses also paiallel predicate calculus “subformulae” as shown by this example: (‘NP’ stands for “noun-phrase”)

Natural language:

Biros cost NP

Øð

NP

and pencils don’t

sell

NP

clause

clause

sentence (or “major clause”)

Predicate calculus:

cost ( ‘biros’, ‘10p’ ) & not sell (‘pencils’)

term term term

subformula subformula

formula

The predicate calculus formula includes two logical connectives:

‘&’ (“and”)

‘not’

A more sophisticated predicate calculus concept is that of quantification. Using a variable (e g„ “X”) as a term, we can express that “there is an X such that The symbol 3 means “there exists”. It is placed before the variable, and a formula containing the variable, and is written thus:

ÝÕ. buy( X, ‘pencils’)

This means that there is somebody (some ‘X’) who buys pencils. ‘X’ may occur more than once in the formula. Suppose there is a predicate ‘customer’ which records where the customers come from, e.g.,

customer(‘SMITH’, ‘Wiltshire’).

The formula expressing the fact that “There exists a customer from Wiltshire who buys pencils” would be:

ÝÕ customer(X, ‘Wiltshire’) & buy(X, ‘pencils’)

At this level of complication the parallel between predicate calculus formulae and the structure of natural language breaks down We can phrase the previous example more idiomatically thus:

Natuial language:

A Wiltshire customer buys pencils

NP NP

sentence (or “major clause”)

Predicate calculus:

customer ( X, ‘Wiltshire’) & buy( X, ‘pencils”

III 1 1 II 1

term term term term

subformula subformula

subformula

formula

13 DESCRIPTIONS

To provide a formal language more similar in structure to natural language we introduce the ‘DESCRIPTION’. A simple DESCRIPTION is just a predicate calculus term. However, the DESCRIPTION may include a

— determiner (e g, ‘any’, whose meaning is very like ‘3’) — variable

— QUALIFIER containing the variable.

A QUALIFIER is any predicate calculus formula possibly containing a DESCRIPTION wherever the predicate calculus requires a term

Now we can express “a Wiltshire customer” as a DESCRIPTION:

any X customer ( X,‘Wiltshire’)

This only differs from “3X. customer( X, ‘Wiltshire’)” because the latter is a formula which is either true or false- whilst a DESCRIPTION refers to a value or a set of values. We can express “A Wiltshire customer buys pencils” as

buy( any X customer(X, ‘Wiltshire’), ‘pencils’)

The QUALIFIER inside a DESCRIPTION may include DESCRIPTIONS in it. Thus there maybe a predicate which defines the counties in the West country: ‘westcountry(‘wiltshire’)’. Thus “A West country customer buys pencils” is

**21**> 22 23 24 25 26 27 .. 59 >> Next