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 .. 19 20 21 22 23 24 < 25 > 26 27 28 29 30 31 .. 59 >> Next

total(0,[ ]).
total (N,[H IT]): - total(M,T), N is M+H,
attribute([total,R,_],result=R) /* In the data dictionary */
There is an important difference between ‘total’ and other predicates previously exampled: its second attribute, ‘arguments’ ranges over lists. (Compare with the ‘allied’ relation of 1 .3 above.)
The meaning of ‘total’ does not involve the ordering of these lists and in fact ‘total’ only requires a ‘bag’ (which is a set with possible repetitions) The second attribute to ‘count’ and ‘average’ is also a bag. ‘equal’ relates two sets. However, certain predicates do require an attribute ranging over ordered lists. The best example is the domain predicate which holds of ordered lists of values in the domain. An example might be ‘price-down’, with one attribute, used in the interpretation of “the products in decreasing order of price”
any-N-qual(P,price-down(values=P)) is
funct(X, the-M-qual(Prod, product(id=Prod, price=X)))
To reflect this difference each attribute of each predicate has a designated type which is either:
or list
A generic term ‘group’ will be used for sets, bags and lists. A group will be written as a PROLOG list, [Head | Tail], If the group is a bag, then [Head | Tail] will stand for all permutations of this list. If it is a set then [Head | Tail] will stand foi the set of elements of the PROLOG list.
We also define ‘equality’ and ‘union’ of groups:
(a) Equality of groups
A set is equal to another set, a bag 01 a list if it contains the same elements as the lattei group Two bags aie equal, 01 a bag equals a list if they contain the same elements each the same numbei of times. Two lists aie equal if they contain the same elements (the same numbei of times) in the same order.
(b) The union of two groups
The union of two sets is the set of elements contained in eithei. The union of two bags comprises the elements of both repeated if they occui in both. The union of two lists is not commutative (LI union L2 Ô L2 union LI), It is the result of appending the second list to the first. The union of two groups of different kinds is governed by the definition for the least structured kind Thus the union of a bag and a list is a bag. If LI is a list, for example, and B1 the bag containing the same elements as LI the same number of times, then for any bag, B2, LI union B2 = B1 union B2,
2.2 Satisfying a formula
Let us take two examples:
(1) Relation ‘person’:
person id age title
‘SMITH’ 61
‘TONES’ 56
The simple QUALIFIER ‘person( id=X, age>Y)’ is satisfied by the association set Xs[‘SMITH’, ‘JONES’], Y = [50] only if the substituted QUALIFIER, ‘person( id= [‘SMITH’, ‘JONES’], age=[50])’ is true. This holds if the predicates,
persongmith id age title
‘SMITH’ 61
personiones id age title
‘JONES’ 56
render the QUALIFIERS ‘personsmith (age>[50])’ and ‘personjones (age>[50])’ true
(2) Relation ‘total’
total result arguments
21 [9,5,2,5]
The relation ‘total’ would not be held as a table in the database, of course, but calculated as required The attribute ‘arguments’ is ‘bag valued’. The simple QUALIFIER ‘total(resu!t=X, arguments=Y)’ is satisfied by Xs[21],Y=[9,5,2,5] if the substituted QUALIFIER, ‘total(result=[21],arguments=[9,5,2,5])’ is true This is true if the predicate total2i:
total2i result arguments
21 [2,4,6,9]
21 [9,5,2,5]
renders the QUALIFIER ‘total21(arguments=[9,5,2,5])’ true
A full definition of satisfaction for D&Qs formulae is in Appendix 2, section .3.
2. 3 Formal determiners
The syntax for a D&Qs DESCRIPTION includes,
DETERMINER :: — the | any [ what.
The simplest determiner is ‘any’,
where N is a count and Qual a QUALIFIER, is satisfied if there is any group with N or more elements returned by the Curried QUALIFIER If N is variable then the DESCRIPTION can refer to any group with one or more elements,
‘what-N-qual(V,Qual)’ has the same semantics as ‘any-N-qual(V,Qual)’, The definition of satisfaction is, however, indeteiminate, A formula might be satisfied in a number of different ways. The difference between ‘any’ and ‘what’ is implementation-dependent. There is a possible implementation in which they are treated identically. However, the intention is that the implementation attempts to seek the largest possible reference group for DESCRIPTIONS with determiner ‘what’, that enables the whole formula to succeed. For DESCRIPTIONS with determiner ‘any’ on the other hand the implementation may just find the
smallest reference set for efficiency reasons. The definition of the largest reference set for a DESCRIPTION within a formula has not been formalised since it would unacceptably increase the definition of D&Qs semantics
A further practical use of the determiner ‘what’ is in mapping the complex D&Qs results onto a simpler format. For full natural language responses a system must take account of the words used in the original natural language query. Less sophisticated responses can be constructed utilising the formal D&Qs representation of the query and in this case the formal determiner ‘what’ is a useful clue to what would be an appropriate response. In converting D&Qs to simplified ‘List Commands’ as described below (section 3), the determiner is used by the converter in constructing the ‘list of columns’ to be output.
Previous << 1 .. 19 20 21 22 23 24 < 25 > 26 27 28 29 30 31 .. 59 >> Next