in black and white
Main menu
Home About us Share a book
Biology Business Chemistry Computers Culture Economics Fiction Games Guide History Management Mathematical Medicine Mental Fitnes Physics Psychology Scince Sport Technics

Communicating with Databases in Natural Language - Wallace M.

Wallace M. Communicating with Databases in Natural Language - Ellis Horwood Limited, 1985. - 170 p.
Download (direct link): comumunicatingwthisdatabase1985.djvu
Previous << 1 .. 16 17 18 19 20 21 < 22 > 23 24 25 26 27 28 .. 59 >> Next

buy( any X customer(X, any Y.westcountry(Y)), ‘pencils’)
Just as in natural language we can combine noun phrases with “and” and “or”, so too we can combine DESCRIPTIONS, Thus “Good Co, and Better Co, buy pencils” is,
buy(‘Good Co’ & ‘Better Co’, ‘pencils’).
Notice that “Good Co, and Better Co, buy pencils” is not a simple ellipsis,
“Good Co, [buy pencils] and Better Co. buy pencils”,
yielding the conjunctive QUALIFIER,
buy(‘Good Co’, ‘pencils’) & buy(‘Better Co’, ‘pencils’),
since the verb is not singular. For verbs such as “allied”,
“Britain and Fiance are allied”
allied(‘Biitain’ & ‘Fiance’),
allied(‘Britain’) & allied(‘France’)
it is clear that only a conjunction of DESCRIPTIONS can lepresent the first sentence since the second interpretation has a different meaning (if any)
1.4 Currying
Before defining “Currying” we shall look at the problems of ‘variable scoping’ in oui cunent formalism
Foi the fiist example the definite determinei, ‘the’, must be introduced.
the X,customei(X, ‘wiltshiie’)
lefeis to all the customeis in Wiltshiie, Thus “All the Wiltshiie customeis buy pencils” is
buy(the X„customei(X, ‘wiltshiie’), ‘pencils’).
Using an embedded desciiption we can tefei to all the customeis in the West country:
the X.customei(X, any Y.westcountiy(Y)).
‘Y’ does not refer to a single county, but to each county in the West countiy in turn. The vaiiable Y cannot therefoie letain its value outside the DESCRIPTION in which it occuis
1 4.1
One scoping problem occuis when a DESCRIPTION occurs twice in a formula: “A Wiltshiie customer is seived by Smith and buys pencils”
We have to treat it like “A Wiltshire customer is served by Smith and a Wiltshire customer buys pencils”:
serve(‘SMITH’, any X customer(X,‘Wiltshire’))
buy( any Y.customer (Y,‘Wiltshire’), ‘pencils’)
A different variable, Y, appears in the second DESCRIPTION to emphasise that the variable in a DESCRIPTION has no meaning outside the DESCRIPTION It is “out of scope”. Clearly it is impossible to capture the fact that the same customer who is served by Smith buys pencils
Another problem crops up when two DESCRIPTIONS occur in a formula. Introducing a new predicate ‘salesman’ we can write:
serve( the X.saleman(X), any Y customer(Y, ‘Wiltshire’))
“All the salesmen serve a customer in Wiltshire”
However, this sentence is ambiguous. Does it assert that all the salesman serve a particular Wiltshire customer, or merely that they all serve possibly different Wiltshire customers? The problem is again one of scoping. Should one choose the customer first and then check if the salesmen all serve him, or should each salesman be taken in turn to see if he serves any Wiltshire customer? Since D&Qs is a formal language the scoping must be unambiguously defined
1 4.3
So that D&Qs has the power to represent each alternative meaning when required, we introduce a new syntax for QUALIFIERS:
This notation is as follows:
LHS :: — RHS, The left-hand side is defined by the right-hand side (NON-TERMINAL) Non-terminals on the RHS are put in angled brackets.
The structure ‘qual((VARIABLE),(QUALIFIER))’ is called a “Curried QUALIFIER”, The concept of taking a formula and letting one of its terms vary so that it becomes a function of that variable is known as “Currying” after Professor H B, Curry, Less pungently(!) it is also termed “Lambda abstraction”.
Using the new syntax we can represent the problem examples unambiguously
“A Wiltshire customer is served by Smith and buys pencils”,
any X.customet(X, ‘Wiltshire’) is qual(V, seive(‘SMITH’,V) & buy( V,
“All the salemen serve a particular customer in Wiltshire”,
any X.customer(X, ‘Wiltshire’) is qual(V, the Y, salesman(Y) is qual(W,
serve(W, V))),
The first formula above uses the variable ‘V’ to “represent” the customer in the rest of the formula In a sense this variable interprets a pronoun and perhaps a closer English rendering of the formula is, “A Wiltshire customer is served by Smith and he buys pencils” An example of a sentence with two pronouns is:
“Jack loves Jill and she loves him”,
‘JACK’ is qual(V, ‘JILL’ is qual(W, love(V,W) & love(W,V))).
(I apologise for the rather sugary example!)
1,5 Relations and attributes
In the previous sections predicates and theii arguments have been represented in the form, (PREDICATE) ( (ARGUMENT), (ARGUMENT), . , . ). A constraint on D&Qs, however, is that they should interface to a relational database. The relational data model specifies that the attributes are not in any order, but are identified by attribute name. To access a specific tuple in a database it is necessary to select on the relevant attributes. This is generally done by naming the attribute, a comparison operator and a value The comparison operators are
Since D&Qs do not use tuple variables, the same tuple can only be referred to twice in a formula by giving values for all its key attributes Thus the simplest D&Qs QUALIFIER may comprise a list of selections, e.g.
Previous << 1 .. 16 17 18 19 20 21 < 22 > 23 24 25 26 27 28 .. 59 >> Next