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

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 .. 42 43 44 45 46 47 < 48 > 49 50 51 52 53 54 .. 59 >> Next

In 9.6 the prepositional phiase “in London” modifies the noun, “an election”.
Questions
9.1 Who stood in 2 elections?
Jones
132 A PILOT IMPLEMENTATION
[Appendix 1 ]
9.2 Who won by 1 vote?
Robson
9.3 Where is Newham?
London
9.4 Where was Smith standing?
Worthing
9.5 Who lost an election to Smith?
2 were found:
Jones Gladstone
9.6 Who lost an election in London?
Disraeli
10. Unrecognised words and symbols
QPROC ignores unexpected punctuation and words it cannot recognise. This is signalled to the user by a series of question marks underneath the word. This facility enables QPROC to deal with various colourfully worded queries successfully.
Questions.
10.1 Who is a PASCAL-loving professor around here???
???????? ?????? ???????????
Barron
Appendix 2
Specification of D&Qs
1. SYNTAX
LHS :: — RHS <Non Terminal)
A | Â
A { Â | Ñ } D nil
The full syntax of D&Qs is:
QUALIFIER — (PREDICATE) I (PREDICATE)((SELECTIONS>). QUALIFIER :(QUALIFIER) { & 101 } (QUALIFIER) I not (QUALIFIER).
QUALIFIER (DESCRIPTION) is qual((VARIABLE), (QUALIFIER)).
QUALIFIER ¦.:-tme I fail.
DESCRIPTION :: - (CONSTANT).
DESCRIPTION ::- (DETERMINER)-(COUNT)-qual((VARIABLE), (QUALIFIER)).
DESCRIPTION :: - (DESCRIPTION) is funct((VARIABLE>, (DESCRIPTION)).
DESCRIPTION (DESCRIPTION) { & ! or } (DESCRIPTION).
SELECTIONS :: - (ATTRIBUTE) (COMPARISON) (VARIABLE) { , (SELECTIONS) I nil}.
The left-hand side is defined by the right-hand side. On the RHS, non-teiminals are put in angled brackets. An ‘A’ or a ‘B’ may occur here on the RHS.
This is an ‘A’ on the RHS followed by a ‘B’ or ‘C\ then a ‘D\
Nothing
134 SPECIFICATION OF D&Qs
[Appendix
COMPARISON := | =? | < | > | < | >.
DETERMINER the I any I what COUNT :(INTEGER) I (VARIABLE)
CONSTANT is a PROLOG atom or integer
INTEGER is a PROLOG integer.
PREDICATE is a PROLOG atom
ATTRIBUTE is a PROLOG atom
VARIABLE is a PROLOG variable
Given certain operator declarations, each D&Qs formula becomes a PROLOG structure.
‘not’ must be declared as a prefix operator.
‘&’, ‘or’ must be declared as infix operators.
2. FORMALISM
This appendix gives the semantics of D&Qs.
The semantics comprises
Satisfaction of DESCRIPTIONS and QUALIFIERS
Reference of DESCRIPTIONS
Results of DESCRIPTIONS and QUALIFIERS
Before launching into the specifications of these three components of meaning, a formalism is introduced which will keep the definitions short and meaningful.
Q{ Xx,X2, . . . Xn} represents a formula whose free variables are XbX2,
.. Lxn.
Xj=Gi, X2=G2,.......,XnsGn represents an association set.
Q{G1/X1,G2/X2, . . Gn/Xn} represents the substituted formula which results from substituting the group (i.e. set, bag or list) of constants, G;, for each free occurrence of the variable, Xb in the formula Q.
X represents the group XbX2, . . , Xn with n unspecified.
Q{X} represents Q{Xi,X2,. . Xn}
X=Grepresents X^Gi, X2=G2,. . ,Xn=Gn Q{G/X} represents Q{G1/X1, G2/X2, Gn/Xn}
X=Gx and Y=Gy are ‘compatible’ if the variables which occur in both association sets have the same association in each set. The “same association” is defined by equality of groups (Chapter 4, section 2.1).
The union of two compatible association sets, X=Gx and Y=Gyis written
‘X=Gx union Y=Gy’
2]
SPECIFICATION OF D&Qs 135
3 SPECIFICATION OF SEMANTICS
3 1 Satisfaction of simple QUALIFIERS
The concept of “satisfaction” is inherited from the predicate calculus. The concept depends upon the notion of a “free” variable, which can briefly be defined.
Any variable, V, occurring in a simple QUALIFIER, Relation(., Attribute @ V,.. ,) (where is a comparison) is free.
If V is free in QUALIFIER Ql, then it is free in ‘not Ql’, ‘Q1 & Q2’, ‘Q1 or Q2\ ‘Q2&Q1’, ‘Q2 or Ql’
If V is free in DESCRIPTION Dl, then it is free in ‘D1 & D2\ ‘D1 or D2\ ‘D2 & Dl\ ‘D2 or Dl’,
If V is different from X and V is free in QUALIFIER Q, then V is free in ‘D is qual(X,Q)’ and ‘Det-N-qual(X,Q)’
Finally if V is different from X, and V is free in Dl then V is free in ‘D2 is funct(X,Dl)’.
A formula is satisfied, in general, by an “association set” which associates a group (i e, set, bag or list) with each of its free variables. If a formula has no free variables it is satisfied (by the empty association set) if it succeeds against the given database. We say, in this case, that it is “true”. If a formula with no free variables is not true it is “false”,
A simple qualifier Q with free variables Vb V2, . . . Vn is satisfied by the association set VjsGi, V2=G2, , , . Vn=Gn if the QUALIFIER, ‘Q{Gi/Vb G2/V2, . , „ Gn/Vn}’, with no free variables, which results from Q by substituting Gj for all occurrences of Vj (i=l,, .., n), is true,
rel(att! Gbatt2 @2 G2, , ,, )
is a simple QUALIFIER with no free variables.
(1) If there are no selection expressions, so the simple QUALIFIER has the form ‘iel’, then it is true if and only if the relation ‘rel’ is non-empty,
(2) If atti has ‘atom type’ (see Chapter 4, section 2.1)
(a) Gj is a set with elements cbc2, , , , cn or Gj is an atom, cb
Previous << 1 .. 42 43 44 45 46 47 < 48 > 49 50 51 52 53 54 .. 59 >> Next