UBC Theses and Dissertations

UBC Theses Logo

UBC Theses and Dissertations

Query languages for relational data base management systems Jervis, Brian 1974-12-31

You don't seem to have a PDF reader installed, try download the pdf

Item Metadata

Download

Media
UBC_1974_A6_7 J47.pdf [ 7.22MB ]
[if-you-see-this-DO-NOT-CLICK]
Metadata
JSON: 1.0051770.json
JSON-LD: 1.0051770+ld.json
RDF/XML (Pretty): 1.0051770.xml
RDF/JSON: 1.0051770+rdf.json
Turtle: 1.0051770+rdf-turtle.txt
N-Triples: 1.0051770+rdf-ntriples.txt
Original Record: 1.0051770 +original-record.json
Full Text
1.0051770.txt
Citation
1.0051770.ris

Full Text

QUERY LANGUAGES  FOR RELATIONAL DATA BASE  MANAGEMENT SYSTEMS  by Brian B.Sc,  University  M.  Jervis  of B r i t i s h  Columbia,  1972  A THESIS SUBMITTED IN PARTIAL FULFILMENT OF THE  REQUIREMENTS MASTER in  FOR THE DEGREE OF OF SCIENCE  the  Department of  COMPUTER SCIENCE  We a c c e p t t h i s  t h e s i s a s conforming  to the reguired  The  University  standard.  of B r i t i s h  May  1971*  Columbia  In  presenting  an  advanced  the I  Library  further  for  of  this  written  thesis  degree shall  agree  scholarly  by h i s  this  at  the U n i v e r s i t y  make that  it  may  representatives. for  is  financial  May  23,  1974.  of  Columbia,  British  by  for  gain  shall  Columbia  the  that  not  requirements I  agree  r e f e r e n c e and copying  t h e Head o f  understood  Computer S c i e n c e  The U n i v e r s i t y o f B r i t i s h V a n c o u v e r 8, Canada  of  for extensive  be g r a n t e d  It  fulfilment  available  permission.  Department o f  Date  freely  permission  purposes  thesis  in p a r t i a l  of  this  be a l l o w e d  or  that  study. thesis  my D e p a r t m e n t  copying  for  or  publication  without  my  ii  ABSTRACT  A new systems  d a t a base i n d e p e n d e n t query language  is  presented.  Queries  p r o p e r t i e s o f the d a t a which for  reducing  reduction relations  i s t o be r e t r i e v e d .  relational  specify An  only  algorithm  i s described.  makes use o f M i c r o - P l a n n e r t o  decide  This which  i n the d a t a b a s e a r e a p p l i c a b l e t o t h e q u e r y , and  t h e s e r e l a t i o n s s h o u l d be as t h e b a s i s compared  i n t h i s language  queries to a response r e l a t i o n  algorithm  for  for  this  with e x i s t i n g  manipulated. work.  languages.  This  how  A s e m a n t i c model i s used query  language  is  also  iii  Table of Contents  INTRODUCTION  1  THE RELATIONAL APPROACH TO DATA BASE MANAGEMENT The  Relational  Classes  ...........3  Model Of D a t a  3  Of R e l a t i o n s  5  A d v a n t a g e s Of R e l a t i o n a l  Systems  .7  P r e v i o u s Research RELATIONAL  8  ALGEBRA  .................11  Sample R e l a t i o n s  12  O p e r a t i o n s On R e l a t i o n s Union  ........12 .......................13  Intersection  13  Difference  .......14  Cross Product  14  Projection  15  Join  ..15  Restriction  16  Division  17  C h o i c e Of O p e r a t i o n s  I n The R e l a t i o n a l  Algebra  Implementation  Of The R e l a t i o n a l  The  A l g e b r a As A Query Language  Relational  RELATIONAL CALCULUS  Relational The  21  .22 Calculus  Alphabet  Terms  ..............19  22  Introduction The  Algebra  ..18  .23 .......23 23  iv WFFs  ..24  Range F o r m u l a e  ...................................25  P u r e Range F o r m u l a e ..............................26 Range C o u p l e d  Q u a n t i f i e r s ........................26  Q-formulae Q-expressions A Reduction  ...............27 ....................................28  Algorithm  Global  .................................28  And L o c a l Ranges  The  Join  Algorithm  The  Reduction  29  ...............................30  Algorithm  ..........................32  I m p l e m e n t a t i o n Of The R e d u c t i o n  Algorithm  .............33  R e s t r i c t i o n s on T h e R e l a t i o n a l C a l c u l u s Representation Evaluation  Of The Q u e r i e s  R e l a t i o n a l C a l c u l u s Re-Defined The  ....................35  Of The R e l a t i o n a l C a l c u l u s .................36  A QUERY LANGUAGE FOR RELATIONAL SYSTEMS The  ..........34  . . . . . . . . . . . . . . . . . . . 40 ....................40  Alphabet  ..41  Terms ............................................41 WFFs  42  Q-Expressions Range F o r m u l a e Range C o u p l e d Target  Quantifiers  44 .45  ..........................................45 Of The Q u e r i e s  Comments Use  ...................................44  List................  Queries Explanation  ....................................43  ............................47  On The R e l a t i o n a l C a l c u l u s  W i t h N a t u r a l Language  ..............48 ...........49  V  A  NEW  FRAMEWORK FOR  Reduction The The  RELATIONAL SYSTEMS  Of Q u e r i e s  - An O v e r v i e w  ..........52 . . . . . . . . . . . . . . . . . . . . 53  Use Of M i c r o - P l a n n e r  54  S e m a n t i c Model The  56  Meaning Of R e l a t i o n s  57  P r o p e r t i e s Of R e l a t i o n s  59  Optimizing  59  Active  Information  And I n a c t i v e D a t a  Generality Proving  ..........60  Of The S e m a n t i c  Model  R e l a t i o n a l Terms  Explanation Properties  .......64  Of The P r o b l e m  ..66  Of R e l a t i o n s  Proving  XRy  Proving  XRyR'Z  Usefulness  ....................67 69 ....72  Of The V a l i d  Path  74  Summary The  ..........74  Processing The  List  Of R e l a t i o n a l Terms Returned  75  By M i c r o - P l a n n e r  .....76  Proving  X  78  Proving  XRy  79  Representation Basic  Proof  Limiting  Of The G o a l s  Strategy  Unnecessary  The Proving Reduction  Effect  Of R e a l  XRyR'Z Algorithm  .79 80  Work  Remembering The P r o o f  The  63  World  .82 .......83 Knowledge ..........85 87 88  vi  The  Reduction  Justification  A l g o r i t h m - An O v e r v i e w Of The R e d u c t i o n  Algorithm  T r e a t m e n t Of C o n j u n c t i o n s Treatment  .........91  And D i s j u n c t i o n s ..91  Of N e g a t e d Terms  T r e a t m e n t Of Q u a n t i f i e r s  The  ............88  92  ...................,93  The  Allowable V a r i a b l e s In Target L i s t s  Why  The R e l a t i o n a l C a l c u l u s Of Codd I s B y p a s s e d  T r e a t m e n t Of R e a l Representation  Multiple  World  Knowledge  ..95  .........97  Of R e a l W o r l d Knowledge  Path Problems  ..........95  ..,...,.,..97 ...100  SUMMARY  ,104  BIBLIOGRAPHY  ..106  APPENDIX  1  .....110  APPENDIX  2  ....113  APPENDIX  3  ................116  APPENDIX  4  .119  APPENDIX  5  ...........................124  APPENDIX  6  ......129  APPENDIX  7  133  APPENDIX  8  .................137  APPENDIX  9  ...............141  APPENDIX  10.......................  ..............146  APPENDIX  11  ..............150  vii  ACKNOWLEDGEMENT  I for  would l i k e  the  valuable  provided  throughout  Doug S e e l e y The  t o e x p r e s s my a p p r e c i a t i o n guidance, this  for hishelpful  f i n a n c i a l support  gratefully  acknowledged.  direction,  work.  t o Dr.  and  I would a l s o  Bay R e i t e r  inspiration like  he  t o thank Dr.  suggestions. of the National  Research  Council  i s  1  INTRODUCTION Historically, individual such  base  programmers  who  new f i l e  attempted  was  performed  to design t h e i r  purpose These  application,  redundant  approach  data base systems  now  was f o u n d , t h e d a t a would  containing  Since t h i s  management s y s t e m s  permit to  a large  many  concurrently  general  systems[5]. put  As a r e s u l t ,  forward.  d a t a base a  One  of  This  thesis  relational  systems.  systems,  difficulties  different  d a t a base.  The  is  There  emerged a  number  base  proposals  relations  which  have  been  a b r o a c h to are  viewed  are operated  operations.  relational  calculus,  for a l l  critically  a r e o b s e r v e d , which  of  management  concerned with user languages  p r o p o s e d by C o d d [ 1 1 ] a s t h e b a s i s relational  a  In t h i s approach, data bases  i s primarily  general  i n widespread use.  data  a number o f new  upon by a number o f s e t t h e o r e t i c  a  i n e x i s t e n c e [ 6 ].  designing  time varying  If a  be c r e a t e d .  such p r o p o s a l i s the r e l a t i o n a l  management.  collection  programs.  with  s h a r e a dynamic  of these systems  for  files in  and i m p r a c t i c a l ,  each  number o f s u c h s y s t e m s  principles  would  a r e now  users,  by  be r e - a r r a n g e d , and  information  i s both c o s t l y  From t h e d e v e l o p m e n t  as  management  a way as t o o p t i m i z e t h e e x e c u t i o n o f t h e i r  new a p p l i c a t i o n  are  data  lead  guery  examined.  which  h a s been  languages Several  to the p r o p o s a l  for  of  for  inherent a  new  framework.  This  framework i n c l u d e s a new g u e r y l a n g u a g e  which  reguires  2 users  to  specify  retrieved. queries  are  current to  be  This  only  expressed  capable of  deciding  to the  should  manipulated  is  dimension The but to  will the  a  used  user's  current accept  the  real  and  the  i s not  deciding  which  only  adds  current retrieval  new data  they  want  and  thus  the  data  how  of  correct  the  system  base  these  are  elements response.  a completely  new  Codd. capable of  answering  knowledge which a f f e c t s  introduce  about the  This requires  to produce the  by  data  regardless  which e l e m e n t s o f t h e i  problem  world  the  base d e p e n d e n t ,  relations.  i n order  system  of  same f a s h i o n  systems proposed  queries,  to optimize  data  request,  non-trivial  to the  information  in  of the  relevant  This  properties  language i s not  organization  be  the  relations, b a s e which  process.  and is  the  gueries response  accept  new  automatically  3  Is.  THE  RELATIONAL APPROACH TO  a j j . 1« The  Relational  DATA BASE MANAGEMENT  Model  o f Data  •  "Since set theory provides a wealth of operations for dealing with relations, a set-theoretic data s t r u c t u r e a p p e a r s worth investigation." 1  In t h i s of  data  in  thesis,  we  p r e s e n t e d by Codd [ 8 ] ,  The  i t s accepted mathematical sense.  necessarily distinct, set of n-tuples, its  second R( S1  We  refer  said •  are concerned with the r e l a t i o n a l  from  S2 ... Sn  If  S1  S1  1.1  element  concisely:  x S2  x ... x  here not  i f i t is a from  S1,  above,  R is  Sn.  As d e f i n e d  n.  •  i s Project*,  location,  S2  i s Project  name,Project  Project* x Project Relations  name, and  location)  is  Project  c:  name x P r o j e c t  are r e p r e s e n t e d i n a t a b l e - l i k e  domain names a p p e a r i n g a t t h e t o p o f t h e t a b l e , the r e l a t i o n  S3  then:  R (Project,Project  in  i s used  these n sets  More  t o S j as t h e j t h domain o f R.  t o have d e g r e e  Example  <=-  on  has i t s f i r s t  S2, e t c .  )  relation  G i v e n s e t s S1,S2,.,.,Sn  R i s a relation  e a c h o f which  element  term  model  location  format, with the and  the  tuples  Data  Structure."  appearing beneath.  * C h i l d s , D.L. " D e s c r i p t i o n of a S e t - T h e o r e t i c P r o c e e d i n g s o f t h e 1968 F J C C ^ pp.557-564.  4  •  Example  1.2 B  In of  •  (PROJECT* 1 2 3 4 5 6  this  framework, t h e  time v a r y i n g  are  not  PROJECT-NAME ROYAL TOWERS BURRARD SHIPYARDS P.C.C. RAPID TRANSIT GBANVILLE MALL OLYMPIC SEAWAY data  base c o n s i s t s of a  r e l a t i o n s of a s s o r t e d  static,  but  constantly  degrees.  changing.  insertion,  d e l e t i o n , and  modification.  Since  r e l a t i o n s are  only  makes use data  of  relational select *  functions.  algebra,  data  special  set-theoretic operations  management  from  the  This  forms the data  only  collection  The  They a r e  relations subject  s e t s , the  relational  i n order  to  model  perform  s e t of o p e r a t i o n s , s e t of o p e r a t i o n s  to  the  called  which  a may  base.  Example  1.3  In  order  are  l o c a t e d i n Vancouver,  whose  PBOJECT-LOCATION) VANCODVER VANCOUVER MERRITT VICTORIA VANCOUVER VICTORIA  • t o form  value  p r o d u c e s a new R«  the  of  relation  restricts  PROJECT-LOCATION  relation  (PROJECT* 1 2 5  one  which l i s t s  R»  is  whose t u p l e s  PROJECT-NAME ROYAL TOWERS BURRARD SHIPYARDS GRANVILLE MALL  the  R to  projects those  Vancouver.  who  tuples This  are: PROJECT-LOCATION) VANCOUVER VANCOUVER VANCOUVER  5 n Relations  the other the  t  fall  compound. S i m p l e the r e l a t i o n  i 2 ^ Classes into  one  relations  i sitself  of Relations n of  another r e l a t i o n .  i s itself  classes  have t h e p r o p e r t y  hand, have t h e p r o p e r t y  relation  two  simple, or  t h a t no domain i n  Compound r e l a t i o n s , on  that at least  a relation.  -  one  domain  in  Compound r e l a t i o n s d e f i n e  hierarchies. •  Example In  R  2.1 •  this  example, R i s a compound  (PARTS PART-DESC Q-O-H ( 1 WIDGETS 47 ( 2  FIDGETS  4  (PROJECT* PROJECT-DESC NUMBER-ORDERED)) 1 HOUSING 40 2 APARTMENTS 3 ) 1 HOUSING 2 4  Codd[9,10] reduced  to  information  a  points  out  TOWN-HOUSES  that  compound  number o f c o r r e s p o n d i n g  loss.  Further,  he  shows  possible,  but d e s i r a b l e .  This process  and  new  which  the  relations  relation.  are  1 relations  simple that  can  be  r e l a t i o n s with  no  this  i scalled produced  )  i s  not  only  normalization, are  said  t o be  12£ialized« T h e r e a r e two a d v a n t a g e s t o u s i n g of  normalized  relations.  Firstly,  algebra,  since the operations  simple  relations.  consistent, dependencies.  bases  i t simplifies  on r e l a t i o n s need  Secondly,  non-redundant,  data  and  normalized free  of  which  consist  the r e l a t i o n a l  only  deal  with  data  bases  are  undesirable  update  6  •  Example 2.2 • I n example 2.1, R c a n be r e p r e s e n t e d by: P Q  (PART* PART-DESC Q-O-H) (PARTS PROJECT* PROJECT-DESC  This Notice  representation  that  system, orders  relation  i t cannot that  example  part  no  deals  recorded,  which  new  until  part  be u s i n g  to the  one p r o j e c t  which  With t h e r e p r e s e n t a t i o n true since  of  the r e l a t i o n P  a b o u t t h e p r o j e c t s which u s e t h e p a r t . only.  i sstill  inadeguate.  i t c a n n o t be p u t i n t h e d a t a  i twill  o f example 2.1.  i s added  at least  i s no l o n g e r  pjart i n f o r m a t i o n  This representation is  R, i f a  i s also recorded.  information  with  i spreferable to that  be r e c o r d e d  2.2 however, t h i s  contains It  with  NUMBER-ORDERED)  a r e known.  Therefore  I f a new  base  until  relation  project the parts  Q i s split  further. •  Example  2.3 •  PART PROJECT SUPPLY The supply  information of  relations. as  (PART* PART-DESC Q-O-H) (PROJECT* PROJECT-DESCRIPTION) (PART* PROJECT* NUMBER-ORDERED)  before For  relations  parts  dealing  to  The d a t a  with  projects  parts,  i s now r e p r e s e n t e d  base c o n t a i n s  e x a c t l y t h e same  b u t i s now f r e e o f t h e p r e v i o u s the  purposes  are normali2ed.  of  this  projects,  thesis,  update we  and t h e  by s e p a r a t e information  dependencies. assume  that a l l  7  n  i^vantages  of R e l a t i o n a l  Systems a  T h e r e a r e many p r o p e r t i e s o f r e l a t i o n a l them  more  desirable  than  traditional  s y s t e m s which  fact  retrieval  make  systems.  These c a n be summarized a s f o l l o w s : 1. They user  p r o v i d e a h i g h degree of independence  and t h e d a t a  between  base.  2. The d a t a  b a s e s a r e c o n s i s t e n t , and n o n - r e d u n d a n t .  3. The d a t a  s t r u c t u r e i s simple,  4. They  have a s u p e r i o r q u e r y  5. They  the  provide  good  yet extremely  powerful.  capability.  interactive  support  f o r the casual  user. The of  chief  user  -  virtue  data  of r e l a t i o n a l  independence they  o c c u r s a t two l e v e l s . logical its can  algebra.  and  a  influencing  systems v i o l a t e  the user  into  This i s possible  information  in  the users  independence  presented  with  since  a  from  relations  since can  factors now  view o f h i s  such  be t a k e n data.  as into  While  i n information r e t r i e v a l ,  most  it[5].  need n o t be aware o f  data  how  The i n f o r m a t i o n which  relations  the  degree  the o p e r a t i o n s o f the r e l a t i o n a l  concept  relations.  c a n be b r o k e n i n t o  is  This  high  which may w e l l d i f f e r  configuration  fundamental  Secondly, arranged  the user  h i s data  through  machine  without  is  current  accessed  provide.  This i s a valuable property,  efficiency  this  of  representation.  o n l y be  account  Firstly,  representation  physical  systems i s t h e  in  base,  any  convenient  even t h o u g h  h i s data  i s  must be s t o r e d manner,  and  i t may be i m p l i c i t  8 (i.e.  i n separate r e l a t i o n s ) ,  current  fact  conclusions  retrieval  from  Another  removed from of  to  and  data  graphs,  relational  guery  Over interest  such  drawing files. of  i n f o r m a t i o n can t e n d t o be This  be  free  process clear  and  rings,  and  trees,  versatile.  networks,  and  lend  themselves  This  point  to a variety  will  be  of  amply  i n the f o l l o w i n g c h a p t e r s .  the  first  past  P r e v i o u s Research  five  years,  an a p p r o a c h  relations.  programs approach  Users  there  approach  c o n t r i b u t i o n s were  introduced  binary  simple  relations.  systems  i n the r e l a t i o n a l  The  as  languages.  n Jk »K  similar  No  process  i n conceptually  i s both  be r e p r e s e n t e d u s i n g  demonstrated  Algol  the  dependencies.  bases  of  in separate  Thus, t h e s e systems  data  structures,  can  different  of  capable  inconsistent  the d a t a s t r u c t u r e  Finally,  They  retrievable.  through  deletion  arrange  are  i s stored  that  and  be  units.  Thirdly, Other  is  the data base.  tends  concise  systems  redundant  u n d e s i r a b l e update  also  still  i n f o r m a t i o n which  advantage  normalization,  will  has been c o n s i d e r a b l e  t o d a t a base by  Feldman  whereby d a t a can  n  access  management. and  i s stored these  means o f a t t r i b u t e - o b j e c t - v a l u e  was  taken  Levin  and  i n the  relations  by  by  Rovner[13]. form from  triples.  Maron[21].  A  Several  9  implementations  have been based  on  this  scheme, i n c l u d i n g  one  by  Gammill[ 14]. The  initial  on a r b i t r a r y theoretic  contribution  r e l a t i o n s came from  data  names, d a t a , and a r e implemented base.  towards the  This  C h i l d s [ 3 , 4 ].  structure  comprised  s e t names.  In t h i s  as  approach  is  still  in current  relational  presented  by C h i l d s .  The  on  In  data  and  bases,  this  most new  article,  he  defined.  access  of  i n f o r m a t i o n and  In the  area of  data  being  user  proposes  predicate  calculus  the  with  calculus  those was  of  upon t h a t relational  relations With  need  not  Codd[9,10]  be  deals  which this prewith  to e l i m i n a t e redundant  dependencies.  t h e main a d v a n c e s have  [11]  he  relational  n-tuple is  the  pre-defined.  degrees.  order  languages, In  from  been b a s e d  relations  in  data  s y s t e m , however,  i n favor  article,  bases  Codd[7,11,12]. and  language.  this  unwanted domain  algebra  relational  s e t s i n the  differ  work has  arbitrary  between  Supplementing  normalization  come f r o m  paths  operations  followed, although  paths  argues  based  presents a set  set  o u t l i n e s a s e t o f o p e r a t i o n s on  are a p p l i c a b l e to r e l a t i o n s of framework  on  algebras  with access  S i n c e C h i l d ' s paper,  He  system, the  being  a system  s e t o p e r a t i o n s , datum  emphasis o f t h i s  binary r e l a t i o n s ,  of Codd[8],  of  s u b r o u t i n e s which o p e r a t e  operations  still  goal of  defines  a  calculus,  variables.  DSL-ALPHA[7 ] ,  an  Based  again  relational an  applied upon  Asap-like  the query  10 The these  above  are  and B r a c c h i [ 2 ] .  originality.  the r e l a t i o n a l in  this  based  area  i s that although  c a l c u l u s with who  relational  data  As  can  performance.  to  obtained. into this inhibiting concept  works  show  implementations  many  of  research  implementations  a r e Palermo[26],  an i m p r o v e d  who i n t r o d u c e s a new  reduction file  algorithm,  and  operations i n a  base.  best  Since  one  has been no be  comprehensive  stored  in  order  to  study  would  expect  of these  t h a t such  since efficiency  little  of semi-join i s the only  system  i s  easy  r e s u l t s c o u l d be  effort  h a s been p u t  i s one o f t h e l a r g e s t  the commercial use of r e l a t i o n a l  how  algebra are  operations  some c o n c r e t e  of  optimize  the operations of the r e l a t i o n a l  I t i s surprising area,  these  h a s been done t o e x t e n d i t .  d e f i n e d , and s i n c e t h e n a t u r e observe,  are  o u t l i n e s some u n a c c e p t a b l e  of yet, there  relations  there  Among  N o t l e y [ 2 4 ], G o l d s t e i n and  n o t i c a b l e p o i n t about  little  exceptions  Heath[17],  implementations.  Unfortunately,  One v e r y  on C o d d » s work, v e r y  relational  many  They a r e a l l b a s i c a l l y  algebra.  Noticable  well  inspired  the systems o f S t r n a d [ 2 7 ] ,  Strnad[15], little  papers  systems.  a d v a n c e t h a t has been  problems Palermo's made.  11  lis.  RELATIONAL  There a r e c e r t a i n form is  primitive operations  t h e b a s i s o f any r e l a t i o n a l  r e f e r r e d t o as a r e l a t i o n a l These o p e r a t i o n s  relations  -  relations  through  algebra  on  relations  T h i s s e t of  This  chosen  query  be f o r m u l a t e d  implies  so  that  i n the system  i n the r e l a t i o n a l The  their  operations  arguments,  that  the  must a c c e s s the  relation. response  relational  selective  power which  i t  could  c a n a l s o be f o r m u l a t e d  algebra  produce a response  Accordingly,  as a  the  take  relations  which i s a l w a y s a  result  is  called  as new the  relation.  This thesis  the  algebra[4].  of the r e l a t i o n a l and  operations  ones which c a n m a n i p u l a t e t h e  p o s s e s s e s i s c o m p l e t e , i n t h e s e n s e t h a t any r e g u e s t possibly  which  algebra.  r o u t i n e s i n the system  them.  be  system.  are the only  a l l other  should  ALGEBRA  section  adopts.  Codd[ 11 ].  It  defines is  the  based  relational  upon  the  algebra  algebra  which  proposed  this by  12 n 2,1... Sample R e l a t i o n s D  The f o l l o w i n g r e l a t i o n s w i l l this  as e x a m p l e s t h r o u g h o u t  chapter. A 1  H  B 2 7  R2  SUPPLIER* 1 1 2 2 2 3  PART* 3 2 1 2 3 1  R3  PART* 1 2 3  R1  (  A  i  The  relational  relations. A. B. C. D. E. F. G. H.  aallggeebbrraa  They a r e :  Union Intersection Difference Cross product Projection Join Division Restriction  these operations,  terms of the  d i v i s i o n and  first six.  )  PART-NAME ) A B C  n 2 2_. O p e r a t i o n s  Of  be used  on R e l a t i o n s n  includes  eight  operations  on  13  2siP.fi  2.Z.2.S&  The  u n i o n o f two  r e l a t i o n s R and S i s d e f i n e d  R U S = { (r) : r€R where B and •  S a r e each  Example 2.1 The  n.  •  (  Onion  } ,  of degree  u n i o n o f H i and  RP  v r6S  t o be:  is  R2 i s :  AP 1 1 2 2 2 3  BP 2 3 1 2 3 1  4  7  typically  enumerates  the values  relations,  each  of  o f which  )  used some  to  create  domain  contains  this  a  using  relation a  set  of  which other  domain.  2.S.2..B I n t e r s e c t i o n The  i n t e r s e c t i o n o f two  R INT where R and •  Example  S = { (r) : r€R S a r e each  2.2  6 r€S  of degree  (  Intersection which  S i s defined  to  be:  } , n.  •  The i n t e r s e c t i o n o f R1 RP  r e l a t i o n s R and  AP 1 creates  and R2 i s : BP 2 a  ) relation  that contains  a r e common t o a l l t h e r e l a t i o n s b e i n g  the  intersected.  tuples  14  2.. 2..C  Difference The d i f f e r e n c e o f two r e l a t i o n s B and S i s d e f i n e d a s : H - S = { (r)  •  Example 2.3  :r€B  e r-es }  •  The d i f f e r e n c e o f B1 and R2 i s : BP  2.2.D  (  Cross  AP 1 2 2 2 3  p r o d u c t o f two r e l a t i o n s i s d e f i n e d  B X S = { (r,s) Example 2.4  : r€R 6 S6S  }  • p r o d u c t o f R1 and  RP  )  Product  The c r o s s  •  BP 3 1 2 3 1  SUPPLIER* 1 1 2 2 2 2 2 3 1 1 2 3  PABT* 3 3 1 1 2 2 3 1 2 2 3 1  B2 i s : A 1 4 1 4 1 4 1 4 1 4 4 1  B 2 7 2 7 2 7 2 7 2 7 7 2  t o be:  15  2 2 E i  i  Projection Suppose r i s a  j=1,2, ...  n,  Efojection  o f r on  to a l i s t Now,  A =  t u p l e of  an  n-ary  r [ j ] denotes the  j t h component o f  domain number  (J1»j2, ...  relation  j.  This  R.  t u p l e r , or  notation  jk) , where j i € ( 1 , 2 , ...  r [ A ] = { r [ j1 ] , r [ j 2 ] , . . . , r [ j k ] }  Then  is  for the  extended  n).  .  m Definition • The  p r o j e c t i o n R[A]  R[ A ] = { r [ A ] Thus, i f the its  first  would •  be  i  i  by:  .  relation  R  (PART* PART-NAME) were p r o j e c t e d  a relation  which c o n t a i n s  only  part  on  numbers  •  p r o j e c t i o n o f R2 (  PART* 1 2 3  on  i t s s e c o n d domain, R 2 [ 2 ] , i s :  )  Join Join  is  relational d e n o t e an form  A i s defined  formed.  SP  2 2 F  : r€R}  domain,  Example 2.5 The  o f R on  perhaps  algebra.  the It  most is  arbitrary predicate  r[i], R[6]S  s[j].  Then the e  = { ( r , s ) : r€R  powerful  defined whose o n l y join  e s€S  of  as  operation follows.  variables  R with  S e(r,s) }  S  of  the  l e t €(r,s) are  i s defined  of by:  the  16 *  Example  2.6 •  Suppose  s  respectively. RP  (  The j o i n RP  RP  2.2.G  are  Then t h e j o i n SUPPLIER* 1 1 2 2 2 3  tuples  of  relations  R2  and  R3  R2 (s[ 2 ]=p[ 1 ]) R3 i s :  PART* 3 2 1 2 3 1  PART* 3 2 1 2 3 1  PART-NAME ) C B A B C A  SUPPLIER* 1 2 2 2 3 3  PART* 2 1 1 2 1 1  PART* 3 3 2 3 3 2  PART-NAME ) C C B C C B  R2 (s[2 ]*5=r[ 1 ]) R1 i s : (  SUPPLIER* 2 3  PART* 1 1  B 7 7  A 4 4  Restriction Let  the  p  R2 (s[ 2 ]>p[ 1 ]) R3 i s : (  The j o i n  and  6 be an a r b i t r a r y  predicate  whose o n l y  form r [ j ] .  Then d e f i n e t h e r e s t r i c t i o n  R (6)  : r€R  variables  r (€)  of R  are of  by  €  to  be:  •  Example  = { (r)  2.7 •  The r e s t r i c t i o n RP  The  S e (r) } .  (  above  o f R2 , R 2 ( r [ 2 ] = 2 )  SUPPLIER* 1 2 i s  PART* 2 2  a typical  i s :  )  use o f r e s t r i c t i o n .  I f there  i sa  17  relation  that  restricting two w i l l part  that  relation  showing  supply  where which  parts,  the p a r t  then  number i s  suppliers  supply  two.  Division Division  relational  is  the  algebra.  counterpart  most  gR(x)=[y 2.8  when the  since  i t  is  the  i n the  algebraic  of the u n i v e r s a l q u a n t i f i e r .  x under R i s d e f i n e d  Example  c o u n t e r - i n t u i t i v e operation  I t i s included  Assume R i s a b i n a r y  •  who  t o the case  result in a relation  number  2,. 2.H  i n d i c a t e s the s u p p l i e r s  Then  t h e image s e t gR (x)  of  by:  : (x,y)€R) •  r= (1 tuples  The d i v i s i o n  relation.  3 ) , t h e image s e t g R ( 2 ) = ( 1 , 2 ) s i n c e (1 3) and  (2 3) a r e b o t h  r[2]=3,  and  o f A,  and  i n R.  o f R on A by S on B i s d e f i n e d  by:  R[A/B]S={r[ ABAR] : r€R 8 S[ B ]£gR (r[ ABAR ]) } ,  where gR (x)  ABAR i s t h e domain is  definition, the  the  image  list  set  we c o n s i d e r  that  which i s t h e complement  of  R i s a binary  two compound domains A and The p r o c e s s o f d i v i s i o n  tuple tuple  x under t h e r e l a t i o n relation  In  composed  this of  ABAR.  o p e r a t e s as f o l l o w s .  i n R t o c o n s i s t o f two e l e m e n t s , r 1 and r 2 . i n the quotient  R.  o f R[A/B]S i f f o r e a c h t u p l e  Consider each Then r 1 i s a r3  in  S[B],  18 there  exists a  "half"  of  •  the  Example 2.9 The  tuple i n R with  tuple  Notice  e n u m e r a t e s the  the  contained.  that  part  only  supplier  who  r3[1 ]  produces  a  i n the  authors[3,4,8,17,24] which  defined  appear  supplies relation  all which  numbers.  2 . . 3 C h o i c e of Operations  one  other  )  s u p p l i e r 2 i s the  parts.  algebras  i s always the  R2[ 2/1 ]R3[ 1 ] i s :  S# 2  Other  r1  •  (  since  •  i n which r2 i s  guotient of  RP  r 3 = r 2 and  have  t o have t h e  above, yet they  R e l a t i o n a l Algebra proposed  same s e l e c t i v e  contain  n  relational power[4],  considerably  as  different  operations. This  thesis  deals  with  queries  p r e d i c a t e c a l c u l u s n o t a t i o n , and sequence  of  operations  projection  and  existential  and  be  division  is  must e v e n t u a l l y  the  form  the  relational  fitting.  restrictions  expressed be  i n the  and  in a  reduced  algebra.  algebraic counterparts  universal quantifiers,  used t o p r o c e s s  algebra  in  which a r e  to  a  Since of  the  since r e s t r i c t i o n  can  query, the  choice  of  this  19  •  2^4^  The  operations  implemented section syntax  of the  value  •  how  Example 4.1  QUOTE  flag  N would be  The  data and  the  stored,  tuple  DATA on  have  been  LISP[31],  This  and  shows  the  gueries.  p r o p e r t i e s on  i t s £ropert_y  is  The  a  list  second  names t h i s  each t u p l e  list.  The  all  the  of  i s TUPLES, whose  relation  contains.  name i s a l i s t  which i s  relation.  (PART# PART-NAME) (T1 T2 T3) (1 A)  name  of  i n brackets, 'R  as  5,  the and  its  value  i t . ) thus,  value  relation  by  (QUOTE R).  argument  i f one  ease i n processing all  to  (QUOTE N)  both the  operations tuple, rather  quick  the  than  by  be  t o 5,  function passed  the  would be  domain.  value  N. of  tuple-wise.  relational  are  nested.  (The  retrieval  relations in  prefix  which i t was  set N egual  of  in  i t s arguments  f u n c t i o n c a l l s can  the  structure allows  written  f u n c t i o n and  i s equivalent  whereas t h e  c r u c i a l , since  access  are  that i n LISP, f u n c t i o n c a l l s are  notation  This  language  relation.  a l l the  without evaluating  is  two  «R 'DOMAINS) = 'R 'TUPLES) = 'T1 'DATA) =  returns  tuples,  algebra  algebra  c  •  form.  The  relational  relations  the  of  always enclosed  of  has  a c t u a l t u p l e i n the  normal  R e l a t i o n a l Algebra  programming  the  for  under the  Notice  the  i s DOMAINS, whose v a l u e  is a list  (GET (GET (GET  the  the  relation  names  Then,  of  relational  property  domain  the  using  explains  Each first  Implementation of  the This  algebra  20  •  Example 4.2 The  •  following  operation  commands  i n the  relational  (RINTERSECT RL1ST) (RUNION RLIST) (RCROSS RLIST) (RDIFF 'REL1 •REL2) (PROJECT 'REL1 'LIST) (JOIN • REL1 »REL2 THETA) (DIVIDE 'REL1 'LIST * REL2 (RESTRICT 'REL1 THETA) , THETA i s an domain  arbitrary  numbers  of r e l a t i o n  the  variable t o the  that  T1  points  current  third (EQ  tuple  Appendix  please  see  DLIST  relation,  the  user  to the  can  current  is  and  each  a  list  of  RLIST i s a  i n REL2.  In  3  2)  (TIMES  contains  order  algebra, listing Appendix  and  number  shows the  of the 7.  would  (ELEM T2 a  routines  always  be  list  referenced  assume  t u p l e i n REL 1,  s e c o n d domain o f REL1  (ELEM T1  complete  and  e l e m e n t s of t u p l e s can  domain o f REL2", one  relational  of  »LIST)  preceeding  specific  predicates,  which s a y s " t h e the  syntax  algebra:  LISP p r e d i c a t e ,  the  the  names.  In o r d e r within  of  illustrate  and  to express  must be  that T2  a  egual  the  points  predicate  to ten  times  write: 3)  10)) of  .  sample  output they which d e f i n e  gueries  produce. these  in For  the a  operators,  21  the  D 2^5^  The  R e l a t i o n a l Algebra  Despite  the  fact  relational  clearly  the  a l g e b r a as  their  top  use.  level  retrieve  the  Operations  such  user  master t h e i r  Queries  data", as  The  use.  are expressed  rather  division  would  Language n  query user  the c o r r e c t sequence of o p e r a t i o n s  desired data.  average  fiuerjj  t h a t most c u r r e n t r e l a t i o n a l  unsuitable f o r general  generate  as a  find  than  in  systems  language, is  will  terms  of  to  retrieve "how  to  what i s wanted.  are  a l s o c o u n t e r - i n t u i t i v e , and  i t  difficult,  i f not  i t is  required  which  i n terms of  use  impossible,  the to  22  Ills.  RELATIONAL  CALCULUS  D 3_.Introduction In an a t t e m p t for  relational  relational  directly  level  guery  systems,  by u s e r s ,  than  Codd[11]  presents  and  i t  in  relational  evaluation  calculus are They  tend  a relational  the  It  a guery i n  alqebra.  the  It  usefulness  framework f o r r e l a t i o n a l  t o be more  a  to  be  also describes a relational  systems.  a  "property  with  of the r e l a t i o n a l  on  a  that  reduction  calculus  sequence o f  concludes  using  algebra.  c a l c u l u s based  to a semantically equivalent  of  expressed  i n the r e l a t i o n a l  P a l e r m o [ 26 ].  which t a k e s  reduces the  introduced  language i s not intended  notation.  the g u e r i e s  This chapter  algorithm  Codd[11 ]  language  b u t t o be used a s t h e b a s i s f o r h i g h e r  i n the r e l a t i o n a l  calculus  defining"  query  languages.  Queries predicate  a more r e a s o n a b l e  c a l c u l u s . T h i s query  used  of  to provide  n  and  operations critical  c a l c u l u s as a  23  n 3_. 2^ The  3ils.A  The The  following  notation  variables  Range P r e d i c a t e s Individual Index  ...  P1,P2,  ...  constants  1,2,  ... ...  t y p e s of terms  t e r m s , and j o i n Range  variable  terms  any  are  monadic  used  to i d e n t i f y  elements  t h e r a n g e o f each  predicate  d e t e r m i n e s whether  P i which  i s an e l e m e n t  R i s o f d e g r e e n)  R,  are i n  there  tuple  Ri,  i f a tugle i s in a relation (where  calculus  For each r e l a t i o n  t u p l e r i n the d a t a base  tell  i n the r e l a t i o n a l  terms.  i n the query.  corresponding  •  r1,r2,  Terms  £512®  can  i s adopted:  C o n s t a n t s a,b,  T h e r e a r e two  not  n  Alphabet  Tuple  3.2.B  Relational Calculus  of R i .  exists  [Thus,  whereas R c a n t e l l  a or P  i f n  R.]  Definition « A r a n g e term  i s a monadic  predicate  followed  by  a  tuple  variable. •  how  Example 2.1  •  P3r1  i s a range  Join  terms  relations  term.  i n the r e l a t i o n a l in  the  data  c a l c u l u s are used  base  a r e t o be  to determine  joined.  They  are  24 arbitrary which •  functions,  are their  Definition An  arguments  a tuple  to  identify  •  Definition Let  variable,  how  the  tuples  a r e t o be r e l a t e d .  i s an e x p r e s s i o n  o f t h e form r [ N ] , where r  and N i s an i n d e x c o n s t a n t .  t h e Nth e l e m e n t  I t s purpose i s  of r .  •  a,b be i n d e x e d t u p l e s ,  a predicate  and c be a c o n s t a n t .  whose o n l y e l e m e n t s a r e e i t h e r  b, t h e n 6 i s a j o i n •  show  •  indexed t u p l e  is  is  whose p u r p o s e i s t o  Then  i f  e  a and c , o r a and  term.  Example 2.2 • Rl[1]=r3£2]  and  are both j o i n  ( r 1 [ 1 ] * 7 ) = 26  terms,  whereas  r 1 [ 1 ] = r 3 [ 2 ] = r 5 [ 7 ] and P1r1 are not.  3.2.C  WFFs The  w e l l formed  are defined  (WFFs) o f t h e r e l a t i o n a l  calculus  as f o l l o w s .  1. Any term 2.  formulae  i s a WFF,  I f f i s a WFF, t h e n s o i s -«f.  3. I f |1 and ?2 a r e WFFs, so a r e (ipi & $2) and (y\ v f 2 ) . 4. I f f i s a WFF i n w h i c h  r o c c u r s as a f r e e  variable,  then  i r (?) and ¥r(ip) a r e WFFs. 5. No o t h e r f o r m u l a e a r e WFFs. The  WFFs  of  the  relational  calculus  a r e n o t s u i t a b l e as  25 queries  in  the  formation  of  meaningless  e x p r e s s i o n s can allowed  3.2.D  by  the  Range  still  be  written  formulae  queries. in a  attempt  to well defined  allow  over  the  terms  i n the formulae.  was  introduced  original  more  to  meaningful  limit  relations.  allow  the  quantified  way  Definition  the  than  Hhile  ranges  i n some  by Codd  of  doing t h i s ,  is  who  tuple  they  natural  by P a l e r m o [ 2 6 ] , and i s an  formulation  must  manner.  improvement  d i d not a l l o w  join  •  i s a range formula over r i f : 1. f i s a g u a n t i f i e r 2.  r i s the only  3.  is  in  free  tuple  4. The  disjunctive  relations  same number o f Example 2.3  WFF.  variable  conjunct contains at least  •  they  Furthermore,  t h e r a n g e s t o be s p e c i f i e d  notion  9  since  HFFs.  This  •  calculus  Formulae  Range variables  relational  defined  i n fl.  normal one  form  (dnf),  and  range  term.  non-negated  by e a c h r a n g e  term i n If have  each  the  domains.  •  P1r1  r 1 comes f r o m  Plr1  I  Plr1  S r1[2]=5  P2r2  r 1 i s i n R1  R1  and i s a l s o  r1 comes f r o m R1,  and  i n R2  the  value  of  its  s e c o n d domain i s 5. In  the  definition  of  range  formulae  as  presented  by  26 Palermo, without  restriction it,  three  above  is  not  present.  However,  formulae such as:  (P3r3 v r 3 [ 2]=1) , which  clearly  acceptable.  not  Restriction  by s p e c i f y i n g one  do  that  non-negated  specify  when i n d n f , e a c h  range  term.  v  (P4r3 8 r 3 [ 2 ] = 1 )  P3r3  6  (P4r3  this  are new  valid  range  for  three d i s a l l o w s formulae of  P3r3  which  a  r3,  this  are type  c o n j u n c t must have a t l e a s t  Formulae  such a s :  , and  v r3[2]=1)  both v a l i d  range  formulae are s t i l l  acceptable using  definition.  2.S.2..E P u r e  Range  A range  Formulae  f o r m u l a which  consists  only  of range  terms  i s known  as a pure range f o r m u l a .  3._2 F A  a  Range C o u p l e d  Quantifiers  Definition a -jip and ?ro a r e c a l l e d  defined  range  coupled  quantifiers,  and  are  by t h e e q u a t i o n s :  i¥(4>) = i r ( U 8 4>) ¥ip {$) = ¥r (-iip v <t>)  Assume range  $  i s a WFF  formula over r .  h a v i n g r as a f r e e  Then  variable,  (<}>) and ? f (4>) a r e a l s o  and f i s a WFFs.  27  3.2.G  g-formulae We  the a  now  define  t h e f o r m u l a e which  can be used  in queries  in  relational calculus,  Definition • A WFF  $> i n t h e r e l a t i o n a l c a l c u l u s  conjunction <|> = 01  of the 6 02  2.  W  with  is free  S W , where  i s a range f o r m u l a over r i , i=1,2, either  null,  variables  Vp+1,Vp+2, ... 3. The  o r i s a WFF  v1,v2,  ...  i n prenex  ,vp,  and  ...  p.  normal  bound  form,  variables  ,Vp+q.  matrix of W i s i n d i s j u n c t i v e  4. T h e r e  i f i t is a  form:  6 ... S Op  1. E a c h 01  i s a Q-formula  are  no  -»  symbols  normal  form ( d n f ) .  immediately preceding a  join  term. 5.  Every v a r i a b l e i.  If a variable  variables  whose  u1,u2, ... ii.  i s coupled to a range: i s free,  i t belongs to  ranges  set  are  specified  range  coupled.  of by  ,up.  Every g u a n t i f i e r i n W  implies  the  that  any  bound  is  variable  also  has  This  i t s range  specified. 6. The 7. These  m a t r i x of W i s d e v o i d of range  terms.  p>1. Q-formulae  c o r r e s p o n d somewhat t o t h e r a n g e s e p a r a b l e  WFFs o f C o d d [ 1 1 ] and  t o the C-formulae  of Palermo[26],  of  found i n Appendix  4.  Q-formulae  c a n be  Examples  28  We  a r e now  relational  i n a position  calculus.  These  a s 2~ exp r e v i s i o n s , a r e s i m i l a r Codd[11], •  and  Definition  tn)  : Q,  in  ...  form: where:  of  ,tn  A seduction  s e c t i o n shows how reduced  to  a  reduction  construction  new  Algorithm  a guery i n the  semantically  i n the r e l a t i o n a l  produce  variables  occurring  in  i s p r e c i s e l y the s e t of f r e e v a r i a b l e s  algebra.  algorithm  eguivalent The  Instead,  method  i t works  upon t h e o p e r a t i o n s relations  algorithm  relational  calculus  seguence used  is  of  based  does n o t a c t u a l l y g e n e r a t e a  which  o f the g u e r y ' s r e s p o n s e  reduction  o  of Palermo[26],  algorithm  the r e l a t i o n a l algebra.  The  Palermo[26].  Q.  the query, c a l l i n g to  to the Simple A l p h a - e x p r e s s i o n s of  tuple  set  upon t h e r e d u c t i o n The  the  be r e f e r r e d t o  2. The  • 3^3^  operations  will  of  of the r e l a t i o n a l c a l c u l u s .  in  be  which  queries  1. Q i s a Q - f o r m u l a  t1,t2,  can  queries,  the  •  t2 ...  This  define  t h e Gamma-expressions o f  A Q - e x p r e s s i o n has t h e (tl  to  its  way  through  of the r e l a t i o n a l are  necessary  guery  algebra for  the  relation.  b e g i n s by  creating  the  relations  29  which these W.  form  the  range  relations After  appropriate  remaining  relations  repeatedly  divided  account.  the  target  each  are then j o i n e d ,  the  into  of  have  been  relation  list,  resulting  reduction  and  made,  the  new  the  algebra  response  a r e used  operates  on  in  of  terms  intersections  in  of the  relation  i n o r d e r t o t a k e the  in  algorithm  Variations  to the j o i n  i s then projected  o p e r a t i o n s of the r e l a t i o n a l  The  according  unions  or p r o j e c t e d  This  tuple variable.  is  quantifiers  t h e domains o f relation.  All  in t h i s process.  such  a  way  as  to  m i n i m i z e t h e amount o f n e c e s s a r y c o r e .  3.3.A  Global  and  Local  In a Q-formula, Q(P 1) Q(i)  conjunction Let  W has  Q(P+2) ...  +  where  Ranges  is  form:  Q(P+q) [61  a  range  of j o i n  terms.  <J> ( i k )  the  coupled  v 62  ...  v 6k] ,  quantifier,  and  be t h e s u b f o r m u l a o f 6 i c o n s i s t i n g  only  variable  f(k)  = The  range  f o r m u l a Uk,  = The  range  formula f o r the q u a n t i f i e r  0i  is  of terms  a  whose  i s r ( k ) , and l e t : i f r (k) i s a f r e e  variable.  which  b i n d s r (k)  otherwise. •  Definition The  •  local  range  L ( k i ) f o r r (k)  in  (pi  is  defined  formula: L(ki)  = { (r) : 9 (k) S $ ( i k ) } .  The g l o b a l  r a n g e G (k) f o r r ( k ) i s d e f i n e d  by:  by  the  30  G(k) The  = { (r) : ip(k) } .  local  global  ranges  of a v a r i a b l e are  domain  to  which we  be  the  reduction  the  by  As is  of  the to the  joined  union  according  of  relations  is  contain  i n the  with  variable  ( g l o b a l ) r a n g e on  these  a  query[26].  J g l o b a l j ^ range f o r a  the  algorithm,  relations  all its  that  the  taking  the  v a r i a b l e s used  in  cross  join  product  terms  of  quantifiers.  The  of  by  by  and  the  Needless to  the  result  say,  forming  local  now  produced.  t i m e and  their  to  the  cases  processed  size  of  this  large.  9 can  of  by  restricted  of  the  ranges  terms of e i , producing  function  Ci defined  e,  individual  of S d e f i n e d  the  i s then  observed, the  to the  savings  Codd[11] begins  g l o b a l ranges of a l l the  e a c h C i which was  considerable  It  is  ever  deals.  Palermo[26]  subset  It  need  referenced  i t s local  become u n b e a r a b l y  unnecessary.  The  of i t s  Algorithm  This  can  local  of  reduction  query.  relation  reduced  algorithm  product  according  the  relation  explicitly  domains.  his  defined  not  projection  l i J x S The J o i n In  a q u e r y , no  is  define  referenced  cross  restrictions  range.  When r e d u c i n g  Thus,  simply  be  cross  can the  instead  be  relations Ci.  produced  This  product  by  taking  the  results  in  to produce  the  method  space.  the  join  algorithm  corresponding  ei.  The  algorithm  31 assumes  that  the  local  range f o r each  variable  i n € i has  been  created. The STEP  join  I... a l i s t  created. coming  algorithm  This  is  first  local  ordered,  the core,  and  A list  reduced range removed  of  from  a l l terms  the core i s created,  the  follows. ranges  with  used  in  the s m a l l e s t  ei  is  relation  first.  STEP 2± in  of the reduced  list  STEP 2.. The called  proceeds as  since  the  r a n g e from  i n e i which  STEP j*^ The  which  the  involves  in  a  workspace,  list.  t h e s e terms can  c o r e w i t h some new range  i s placed  reference a be  used  domain  to  join  list. the s m a l l e s t  relation  is  chosen. STEP 5.. The term  from  c o r e i s then j o i n e d  e i as t h e j o i n  STEP 6± T h i s  term  continues with step i.  The  range  joining  is  be  is  to the core.  c o r e , and  go t o s t e p  The  providing  range no  list cores  saved, then form  using  and  the  processing  process i s repeated u n t i l not  yet  empty,  In  this  case,  either:  indicating  done, y e t t h e r e a r e no  connected  ii.  range,  removed f r o m t h e l i s t ,  This  list to  this  predicate.  is  2.  to  more  more j o i n  save  the  terms  current  1. i s empty, i n which c a s e one have  been  saved.  can  return,  I f c o r e s have  t h e c r o s s p r o d u c t o f t h e c o r e s and  been  return.  32  3_._3._C The R e d u c t i o n A l g o r i t h m The f i r s t relation taking Each  the  step i n the reduction  defined  by 6.  C i i s created  C i defined  using  reduced  the j o i n  STEP X± Form  the  query.  i s done by e x a m i n i n g  This  i s to create  Since 9 i s i n dnf, t h i s  the union of the r e l a t i o n s  relation  algorithm  global  the  c a n be done  by e a c h  ei  in  by e.  algorithm.  range f o r each  variable i n  the range f o r m u l a  of  the  variable. STEP order  2j. Form  the  relations  t o do t h i s , f i r s t  variable terms  used  in  C i which  are defined  form t h e r e d u c e d l o c a l  e i , then u t i l i z e  by e i .  range  for  the j o i n algorithm  In  each  with the  of e i t o produce C i .  STEP 3., Form  the union o f a l l  Ci,  producing  the  relation  Tp+q. Once to are  the  relation  take the e f f e c t p r o c e s s e d from  Their  of the q u a n t i f i e r s right  to l e f t  into  the next step i s  account.  - i . e . , from  Quantifiers  Q (p+q)  to  Q(p).  effect i s :  1.  If  Q(j)  relation  Tp+j on  relation  which  2.  If  is  results  an  existential  a l l domains  quantifier,  except those  project  processed  by  the the  d e f i n e s t h e range of r ( j ) .  Q(j) i s a u n i v e r s a l q u a n t i f i e r ,  Tp+j by t h e r e l a t i o n  all  Tp+q has been d e r i v e d ,  which  in a relation  defines  the  divide the r e l a t i o n  range  of  r(j).  whose t u p l e s a r e i n some s e n s e  This  "true" f o r  r (j) . The r e s u l t  o f e a c h o f the above o p e r a t i o n s i s  the  relation  33  Tp+j- 1. STEP 4.. The q u a n t i f i e r (existential) quantifier processed  and d i v i s i o n  Q(i)  STEP 5,j_ P r o j e c t  relation  in  (universal)  i n the p r e f i x  from r i g h t  specified  operations  to l e f t .  o f W, This  the r e l a t i o n  the  target  of  are  with  projection  applied  for  the q u a n t i f i e r s being  produces the r e l a t i o n  Tp  list.  on  each  The  each  of  result  the  Tp. domains  i s the response  f o r the guery.  Please  refer  to  Appendix  4  for  sample  queries  in  the  relational calculus.  n 3_. 4_. I m p l e m e n t a t i o n The  reduction  implemented  i n LISP.  was c r e a t e d  using  The  purpose  of  have been  benefit  the  represented  algorithm Appendix  as  described  4, which  above  shows sample  n has  been  reductions,  these routines.  restrictions of  o f the Reduction Algorithm  this placed  section  is  to  show  on t h e r e l a t i o n a l  i m p l e m e n t a t i o n and t o show how  i n LISP.  why  some  c a l c u l u s f o r the the g u e r i e s are  34  liliiA  S£§i£i£ii2£§ 22 ill® R e l a t i o n a l T h e r e a r e two r e s t r i c t i o n s  relational first  calculus  devoid range  o f range  of  variable  this  have  in  the  of the implementation.  The  i n a Q-formula,  terms.  for a variable,  result  which  f o r the benefit  of these i s that  Calculus  This  when c r e a t i n g  t h e m a t r i x o f W need  must be d e c l a r e d  is  that  individual  the  the  i n some O i r a t h e r  elements  independently dnf,  each  of  of  the  conjunction  ranges  can  defined  by e a c h  •  formulae  be  can  the  other will  become  formula  define  a  d e t e r m i n e d by t a k i n g  The free  t h a n i n W.  Without  this  e x t r e m e l y complex, be  relation,  and  processed  i n the f o r m u l a .  valid  be  the g l o b a l  range o f each  cannot  elements  must  n o t be e x a m i n e d .  S e c o n d l y , t h e r a n g e f o r m u l a e must be i n d n f . restriction,  made  the matrix of W  means t h a t  restriction  been  When i n and  thus  the union of the r e l a t i o n s  conjunction.  Example 4.1 • P7r1  8 [P4r1 v  (EQ (R1 1) A) v P 5 r 1 v  Notice  that  i n this  conjunction  does  not i n i t s e l f  cannot  processed  be  conjunction. conjunct  example,  the  (EQ (R1 2) B ) ] .  second  define a valid  element relation,  independently of the f i r s t  When t h i s  defines a valid  expression relation.  is  in  dnf  of  the  and t h u s  element however,  of the each  35  1-s.iJiS R e p r e s e n t a t i o n Each  guery  information 1.  VARS - a l i s t order  THETA  example, 3. ((R1  the  terms Each  list:  of t h e i r  - a list  list.  in  appearance.  of a l l e i occurring  term  t h e term.  i n the guery.  f o r the guery.  the l i s t  For  THETA h a s t h e f l a g is a list  For  example,  under  -  the f l a g  VARS, i s a l i s t  h a s on i t s p r o p e r t y either  EXISTS,  on i t s  o f t h e names o f  F o r example, t h e  (EQ (R1 2) 9 7 0 ) . On t h e  I n t h e above c a s e , t h i s l i s t  1. QUANTIFIER  TERMS  i n the p a r t i c u l a r e i .  has i t s d e f i n i t i o n a s i t s v a l u e .  variable  guantified,  list  The v a l u e o f t h i s f l a g  occurring  in  i n the  (R2 3) )  element  t h e term,  i n the guery,  (THETA1 THETA2) .  4)  of  name, and h a s t h e f o l l o w i n g  o f a l l the v a r i a b l e s  v a l u e o f TERM 1 m i g h t be  Each  a unigue  TARGET - t h e t a r g e t  Each property  i s assigned  Queries  on i t s p r o p e r t y  reverse 2.  of the  ALL,  i f the  i fthe variable  or  NONE.  2.  USED-IN-TERMS - a l i s t  list  property  list  o f a l l the v a r i a b l e s would  be ( B 1 ) .  the f l a g s :  variable  i s universally  i s existentially quantified,  o f a l l t e r m s i n which  the variable  is  used. 3. REFDOMAINS - a l i s t variable  which  o f a l l domains o f t h e g l o b a l  are referenced  4. RANGE  -  either  variable,  o r an e x p r e s s i o n  range  of the  anywhere i n t h e g u e r y .  t h e name o f t h e r e d u c e d g l o b a l which  defines  the global  range  f o r the  range.  36  The  value  of the  variable  is  its  current  reduced  local  range. In  writing  queries,  LISP p r e d i c a t e s , the  first  with the  domain  of  join list  terms are (R1  tuple  characterizes  needs  no  a d d i t i o n a l information  in  relational  • It  language, the the a  which  relational  overcome.  the  framework  for relational  language. often  parts"  the  difficult  to  calculus X",  if  represent  representation  reduction  i n order  to respond  Relational Calculus  algorithm to a  query  used  the  level  query if  as t h e  language  for  are of  target  a number o f this  relational  problems  section  is  calculus  to  as  a  systems. calculus are  very  as  i t i s possible i s true, This  relations  can  to but  about  say  "for  difficult  only  which  a  much t u p l e  express information  i s true.  a top  Further,  there  the  as  n  inadequate.  purpose of  queries  something  something  quantifier  The  relational the  relation  above  to  The  calculus i s  feasibility  Since  relational  the  query language,  evaluate  Consider  of  c a l c u l u s i s t o be  level  must be  query.  used  p o s i t i o n of t h i s t h e s i s that  relational higher  The  as a r b i t r a r y  calculus.  2L5Evaluation  i s the  being  R1.  completely  the  the  1)  expressed  be  top-level oriented, domains. all  the  i t is In  the  tuples  in  t o say  done w i t h  enumerate  query  "for a l l a  single  parts  have  37  exactly only If  t h e same number o f d o m a i n s .  i f  this  the part  difficult •  several quantifiers will  one e n t i t y .  Forming  then  i t i s  o c c u r s i n t h e same p o s i t i o n i n each  i s not t r u e ,  quantify  Even  This  queries  i s indeed  relation.  have t o be used t o  undesirable.  i n the r e l a t i o n a l  c a l c u l u s tends  to  be  a  process.  Example 5.1 • assume t h e e x i s t e n c e  Then  (SUPPLIER* SNAME SLOCATION) (PROJECT* PART-NAME)  R3  (SUPPLIER* PART* PROJECT*)  t h e guery  the f a c t  is still data  three  relations:  t h e numbers o f t h e s u p p l i e r s , e a c h o f whom  i s represented  : P3r1 S VP3r2 -}P3r3  Despite  the  "Find  a l l parts"  R1[1]  it  of the f o l l o w i n g  R1 R2  supplies  that  not p o s s i b l e  this  as:  (r1[ 2 ]=r3[ 1 ] S r 2 [ 2 ]=r3[ 2 ]) i s an a p p l i e d  f o r a user t o s t a t e  predicate the  difficult user  to  use.  Firstly,  must have a t h o r o u g h his  which  data  base,  a r e t o be used This  i s a very  i t i s very  p r o p e r t i e s of  knowledge o f t h e c u r r e n t  since  i n s t a t i n g the query,  must be e x p l i c i t l y serious  flaw,  since  a  system  the paper,  remain u n a f f e c t e d  current Codd[8]  organization states  A  organization the r e l a t i o n s  identified.  systems i s t h e independence they  and  c a l c u l u s i s so  data base o r i e n t e d .  relational  original  calculus,  he wants r e t r i e v e d .  T h e r e a r e s e v e r a l r e a s o n s why t h e r e l a t i o n a l  of  possible  of  prime  advantage  present the  between t h e  data.  "users at terminals  when t h e i n t e r n a l r e p r e s e n t a t i o n  of  of  In ... the  his  should data  38 is  changed,  and  representation used  as  a  even  when  a r e changed".  top  level  some  aspects  When t h e  query  of  the  relational  language,  this  external  calculus  is  basic principle i s  violated. Not the  o n l y does t h e f a c t  data  base  same q u e r y  will  organization  in  order  them h a r d  reference  t o w r i t e , b u t i t means t h a t t h e  have t o be e x p r e s s e d  of the data  Secondly, information  make  t h a t the queries d i r e c t l y  differently  for a  different  base.  n o t o n l y do t h e  t o use, they  also  queries  tell  t o produce t h e response  tell  t h e system  the  system  what  what t o do w i t h i t  relation.  Example: Assume  the e x i s t a n c e of the three r e l a t i o n s  Then t h e q u e r y  " F i n d t h e names o f t h e s u p p l i e r s ,  supplies a l l projects" R1[2]  use, take  o n l y does t h i s  but  i t  also  ( ( r 1 [ 1 ]=r3[ 1 ] S  query  says  a t u p l e r1 i n R1.  to  the f i r s t  Now t a k e  In  order  how t h e d a t a  I f this  the next  is  them.  Namely,  t u p l e r 2 i n R2, t h e r e  that the f i r s t  to  must  domain o f r 1 i s e q u a l  domain o f r 2 e q u a l s t h e  i s t r u e , save  the second  domain  of  t u p l e i n R1, and t r y a g a i n .  to formulate base  whom  which r e l a t i o n s  be done w i t h  domain o f r 3 , and t h e f i r s t  domain o f r 3 .  of  (r2[ 1 ]=r3[3 ]) )  t h e system  Then f o r e a c h  some t u p l e r 3 i n R3 s u c h  r1.  tell  what s h o u l d  be  third  each  i s represented as:  : P1r1 S ¥ P 2 r 2 i P 3 r 3 Not  i n example 5.1.  t h e above q u e r y ,  arranged,  which  the user  pieces  of  must know i t  he  is  39 interested and  how  in,  the system  Clearly, data should is  e x a c t l y how  any  be  can  mechanical  selected  t o do  part of  the r e a l Now  which f o r c e s t h e before  Such  he  a  can  be  the r e t r i e v a l  user  related,  to decide  even f o r m u l a t e  system  is  how  his  performing  process,  while f o r c i n g  calculus  as  his guery  only  the  the  user  work.  consider the r e l a t i o n a l  f o r a higher  information should  recover h i s data.  system  unsatisfactory.  this  level  guery  l a n g u a g e Q.  the  t a r g e t language  Then Q s h o u l d  possess  the  e x p r e s s i o n s of p r o p e r t i e s o f  what  following properties: 1. Q u e r i e s is  t o be  2.  Queries  retrieved.  reference  should  never  domains, t h u s ,  Q will  be  3.  i n Q should  Quantifiers  the r e l a t i o n a l  Queries  how  the  In  order  calculus  should  guery  to  calculus  the  reguest,  j o i n e d , and  how  the  retrieval these.  upon  the  data  been e x h i b i t e d t o  between  Q  be.  i n f o r m a t i o n about  determining i s t o be  and  arbitrary  form, i d e n t i f y i n g  to  of doing  has  restrictions  o f t a k i n g an  applicable  capable  the  interface  some p r o p e r t y d e f i n i n g  dependent  answered.  overcome  must be c a p a b l e  be  have t o c o n t a i n any  i s t o be  imposes, the  calculus  not  not  but i n s t e a d ,  domain o r i e n t e d , whereas  calculus i s tuple oriented.  4.  is  reference relations,  the r e l a t i o n a l  base, as  in  i n Q s h o u l d be  done.  the  relational  the  relational  guery  expressed  which r e l a t i o n s how No  they  should  previous  are be  system  no IV  A QUERY LANGUAGE FOR RELATIONAL  ±  This  s e c t i o n p r e s e n t s a new q u e r y l a n g u a g e  systems. reguires want  The  language  referenced  and  regardless  gueries  are  of the current  for  compiles gueries  This  This  explanation  relations  expressed  is  specifically  the  system.  by  a  they  directly data  same  designed  as  In f a c t ,  domain, h a s a l r e a d y  base  fashion  a  been  somewhat  a  target  system[16] but  which  implemented. o f the query  more  intuitive  o f t h e l a n g u a g e , and c o n c l u d e s w i t h a d i s c u s s i o n o f language  the r e l a t i o n a l  f o r a natural  calculus reference  makes  queries  need  data  n e v e r be  language  base  domains r a t h e r independent,  referenced.  system.  Re-Defined n  c a l c u l u s o f Codd, q u e r i e s  relational  relations  not  into a similar representation,  followed  data  never  is  which  o f the r e l a t i o n s .  D 4^1.^ The R e l a t i o n a l C a l c u l u s  the  calculus  begins with a formal d e f i n i t i o n  u s e as t h e t a r g e t  Unlike  in  relational  of the  are  t h e language  organization  problem  chapter  language.  the p r o p e r t i e s  a n a t u r a l language  uses a d i f f e r e n t  its  Thus,  l a n g u a g e h a s been  language which  Specific  i n the guery.  dependent,  for  i s an a p p l i e d p r e d i c a t e  users to s p e c i f y only  retrieved.  The  SYSTEMS  i n the  than t u p l e s . since  new This  specific  41  4. _UA  The  •  The A l p h a b e t  following  notation  i s adopted.  Domain v a r i a b l e s  d1,d2, ...  Diadic Predicates  r 1 , r 2 , ...  Arbitrary  F  Predicate  Example 1.1 • PAST# and SUPPLIER a r e b o t h domain If  SUPPLIES  "SUPPLIER and  4.1.B  i s  a  predicate  variables.  which  says  SUPPLIES PART*" f o r s p e c i f i c  PART*, t h e n SUPPLIES i s a d i a d i c  yes  values  of  or  no t o  SUPPLIER  predicate.  Terms There  simple  are four  t y p e s o f terms i n the r e l a t i o n a l  terms, r e l a t i o n a l  terms,  restriction  terms,  calculus and  join  terms. •  Definition  •  &  s i m p l e term i s a domain  a  relational (d1  r1  d2  term <r2  variable.  is a list  o f t h e form:  d3 ... <rn  dn»),  where <X>  o p t i o n a l o c c u r r e n c e o f X. •  Example  1.2 •  PART* and SUPPLIER a r e s i m p l e t e r m s , w h e r e a s : (SUPPLIER SUPPLIES PART*) i s a r e l a t i o n a l  term.  d e n o t e s an  42 •  Definition  •  I n s t r u c t i o n term  A  i s a term  r e p r e s e n t s an a r b i t r a r y j°i£  A  represents •  Example  1  monadic term  a  an a r b i t r a r y 1.3  diadic  the  where  F  of  the  form  F(d1,d2),  where F  predicate.  i s a r e s t r i c t i o n term,  (TIMES PRICE  whereas:  10) term.  Definition a Two  domain  •  F(d),  predicate.  (PLUS PART-PRICE 3)) i s a j o i n •  form  •  (EQ PART* 10) (EQ  S  of  terms a r e s a i d  t o be c o m p a t i b l e i f t h e y c o n t a i n a common  variable.  Example (S#  1.4  •  SUPPLIES PART*)  (PROJECT I S - I N (S*  and  PLOC) a r e n o t c o m p a t i b l e ,  SUPPLIES PART*)  whereas  and  (PART* IS-USED-IN PROJECT*) a r e .  iUliC  WFFs The  are  well  defined 1. Any  formed  as  f o r m u l a e (WFFs) o f t h e  relational  calculus  follows:  term  is a  2.  I f V i s a WFF,  3.  I f JJ1 and  4.  I f f i s a WFF  |J2 a  WFF. t h e n so i s r  e  WFFs, so a r e  i n which  -gr (V) and ¥r (JJ) a r e WFFs.  (ipi S I|f2) and  r o c c u r s as a f r e e  (If 1 v ip2).  variable,  then  43  5. No o t h e r f o r m u l a e a r e WFFs.  _U D 2 z E x p r e s s i o n s  Definition  •  A WFF Q i n t h e r e l a t i o n a l  calculus  1. Q c o n t a i n s  no  2. Q c o n t a i n s  no s i m p l e t e r m s  i s a Q-expressicn i f :  quantifiers, which  are negated.  3. Q i s i n d n f , w i t h e a c h c o n j u n c t i o n  b e i n g o f t h e form  ($ & 4>) i where: a. % is  contains  either  join  null  only  s i m p l e and r e l a t i o n a l  or i t contains  only  t e r m s , and <J)  restriction  and  terms.  b. I f % c o n t a i n s more t h a n one t e r m ,  t h e n each  term i n  % i s c o m p a t i b l e w i t h some o t h e r term i n (. c.  I f a term T i n % i s negated,  negated term 4.  There  compatible Q. Example The  is  a  which  t h e n $ c o n t a i n s a non-  i s c o m p a t i b l e w i t h T.  term  in  each  w i t h some o t h e r term  conjunct  of  i n a different  Q which i s  conjunct  1.5 • following  are a l l Q-expressicns:  (SNAME SUPPLIES PABT#) (SNAME SUPPLIES PARTS) 6  (EQ PARTS 10)  (((SNAME SUPPLIES PARTS) S (EQ PARTS 10)) v ( (PARTS USED-IN PROJECTS) & (EQ PROJECTS 4 ) ) ) . (SNAME 6 -> (SNAME I S - I N SLOC) 6  (EQ SLOC  'VANCOUVER) )  (SS SUPPLIED PARTS) v (PARTS IS-USED-IN PROJECTS)  of  44  •  Example  1.6 •  None o f t h e f o l l o w i n g  are Q-expressions:  -•SNAME (EQ PART* 10) SNAME S (PART* IS-USED-IN PROJECT*) --SNAME S -i (SNAME SUPPLIES PART*) (SNAME SUPPLIES PART*) V (EQ PART* 10)  4_,_1__E Range F o r m u l a e  •  Definition • f  i s a range 1.  3.  is  •  free  Q-expression. which h a s d a s  variable.  Each  Example  c o n j u n c t i n ip h a s d a s a s i m p l e  term.  1.7 • SUPPLIES PART*) S  a range  4.1.F  domain d i f :  ip c o n t a i n s a t l e a s t one r e l a t i o n a l term  a free  (S#  over  f i sa quantifier  2.  •  formula  formula  (EQ PART* 5)  o v e r S*.  Range C o u p l e d  Quantifiers  Definition • Let  (i lie a WFF h a v i n g  formula over quantifiers  d. over  Then  ^  d as a f r e e and  -vip  d, and a r e d e f i n e d  i f (4>) = i d (| & <J>)  variable, are  called  and tf be a r a n g e range  by t h e e q u a t i o n s :  coupled  45  ¥ip  i ? (<|>) •  ($) = ¥d  and ¥f(<t>) a r e a l s o  Example  ¥ (PARTS 6 both  4.1.G  and (PARTS IS-SUPPLIED-BY  SS) &  (GREATERP  SS 10)) a r e  range c o u p l e d q u a n t i f i e r s .  Target  List  Definition A  WFF.  1.8 •  ¥ (PARTS),  •  v <J>) .  •  target  list  T  i s a seguence  T=t1,t2,  ... , t k o f domain  variables.  4_.JkH Q u e r i e s We  a r e now  relational •  of  to define  the g u e r i e s of  the  new  calculus.  Definition A  in a position  WFF  • i n the r e l a t i o n a l  calculus  i s a query i f i t i s a  WFF  the form: T : W , where 1. T i s a t a r g e t 2. W i s a WFF  list.  i n prenex  3. A l l g u a n t i f i e r s  normal  form.  i n W a r e range coupled.  4. The m a t r i x o f W i s a Q - e x p r e s s i o n . 5. T h e r e a r e no r a n g e c o u p l e d g u a n t i f i e r s o v e r any ti  element  o f T.  6. E a c h domain v a r i a b l e  i n T i s also  i n each  disjunct  of  W.  46  •  Example The  1.9 • following  are  sample  queries  in  the  relational  calculus. 1.  List  t h e names o f t h e p a r t s  PART-NAME : 2.  List  3.  4.  5.  that  supplier  number 1 s u p p l i e s .  (EQ S# 1)  number 1 s u p p l i e s .  : (S# SUPPLIES-TO PROJECT-NAME)  Which p r o j e c t s PROJECT-NAME  supplier  (S# SUPPLIES PART-NAME) 8  the projects  PROJECT-NAME  that  use p a r t  8  (EQ S# 1)  5?  : (PROJECT-NAME USES PART*) 8 (EQ PART# 5)  Which s u p p l i e r s  supply a l l suppliers?  SNAME  : (¥ PROJECT-NAME)  Which  suppliers  (SNAME SUPPLIES  have more t h a n  PROJECT-NAME)  10 u n i t s o f p a r t  12?  SNAME : (SNAME HAS QOH OF-TYPE PART*) 8 (GREATERP QOH 9) 8 (EQ PART* 12) 6.  Which s u p p l i e r s  supply a l l  parts  that  cost  more  than  5  dollars? SNAME : (¥ PART# 8 (PART* COSTS PRICE) 8 8 (SNAME SUPPLIES PART*) A can  more  be f o u n d  (GREATERP PRICE 5 ) )  c o m p l e t e s e t o f sample q u e r i e s and t h e i r i n Appendix  4.  responses  47  o 4^2^ E x p l a n a t i o n One t e n d s t o t h i n k involved  (eg.  relational these  domains, The  such  and  rather  PART*  are  (S# SUPPLIES PART*) Restriction  terms,  and j o i n  different  than i n terms  domain  are  these  For  example,  not  define  therefore  The the  to  indicate  the  term.  to produce one  restriction  relation)  and  domains.  the values of  when  terms  For  in  such a s  the  with  example, relational  meaningful gueries.  constructs  the  WFFs  of  t o define meaningless  the  gueries.  1.6 a r e WFFs, y e t t h e y do  The  guery  involves three  defined.  These  t h e body o f t h e g u e r y .  express a  among  terms  language  must  s u b s e t o f t h e WFFs.  process  are  WFFs which  terms  same.  The t e r m s  gueries.  be a r e s t r i c t e d  can p r o c e s s .  new  The WFFs, however, a r e f a r t o o p o w e r f u l t o  meaningful  are  the  Simple  10) r e s t r i c t  t h e f o r m u l a e o f example  form  in  Relational  £§lationships  t h e y c a n be u s e d  Q-expressions  eventually  names.  really  terms,  calculus.  be o f u s e s i n c e  Queries  of the r e l a t i o n s .  s u c h a s (EQ PART*  c a l c u l u s c a n be combined  relational  o f t h e domains  r e f e r e n c e domains..  exhibit  (EQ PARTA PARTB) i s a j o i n  Using  PARTS).  terms a r e used  names  i n terms  a l l o w q u e r i e s t o be f o r m u l a t e d i n t e r m s o f  terms o f t h e language  as  domains,  o f t h e d a t a base  SUPPLIERS  calculus  of the Queries •  valid  guery  i n a form  which  (and  stages.  expressions  They thus  define  will  a c l a s s of  define  t h e new r e d u c t i o n  Q - e x p r e s s i o n s may n o t c o n t a i n  Firstly,  a  valid  algorithm  quantifiers.  48  Secondly, the range formulae are d e f i n e d . WFFs which a r e o n l y of  a  particular  capable of defining  domain.  Since  a subset of  s e t o f WFFs had t o be  users  must  want r e t r i e v e d . Having d e f i n e d  bodies list  B and  of the T  i s now  defined  be a b l e t o s p e c i f y  T h i s t h e y do the v a l i d  target  l i s t s T,  subsets  with  thereof,  t o be a WFF  whose  t h e domains  which  through the t a r g e t  quantifiers  Q,  the  list.  valid  t h e q u e r i e s can be d e f i n e d  query t o be a  form:  : W  where a l l t h e q u a n t i f i e r s W i s a valid  body B, and  i n W a r e o f t h e form Q, each e l e m e n t  Hs.2±.h Comments on t h e R e l a t i o n a l If query  deals  i s a range f o r m u l a . Finally,  they  values  isolated.  A range c o u p l e d q u a n t i f i e r range  the  the query language  q u a n t i f i e r s which e x p r e s s domains o r s p e c i f i c this  T h i s i s a s e t of  the  relational  calculus  l a n g u a g e , t h e n two Firstly,  i t would  (SNAME SUPPLIES  changes  be  nice  10)  require  and n o t , s a y , a PROJECT*.  W.  Calculus were t o be used as a t o p would  , rather  the system  of  be  level  desirable.  to say:  (SNAME SUPPLIES PARTS) & T h i s would  of T i s i n  the matrix  than  (EQ PART#  10)  to determine that  In c a s e s s u c h a s :  10 was  a  PART*  49  (WIDGETS ARE-USED-IN VANCOUVER) the  system  VANCOUVER the in  must  know  WIDGETS  are part  i s b e i n g used a s t h e l o c a t i o n  location  of a supplier.  C h a p t e r v would  this  that  , names, and t h a t  of a project  and n o t  as  The s e m a n t i c model t o be p r o p o s e d  be o f use f o r d i s a m b i g u a t i n g  information  of  type. S e c o n d l y , one would  like  the r e s t r i c t i o n  i n T must a l s o be i n W t o be removed. (SNAME SLOC : (SNAME SUPPLIES would  be v a l i d .  Currently,  this  Thus,  problem  discussed  until  understood.  variable  q u e r i e s such a s :  query i s expressed a s : (SNAME I S - I N  with h a n d l i n g q u e r i e s of t h i s  t h e mechanism by which  A solution  each  PART*))  (SNAME SLOC : (SNAME SUPPLIES PART*) S The  that  to this  queries  problem  SLOC))  t y p e c a n n o t be are  handled  is  i s presented i n Chapter  V.  n 4 _ . 3 U s e w i t h N a t u r a l Language n  The produce natural  overriding a  framework  language  can  relational  so t h a t  produce calculus  d a t a b a s e , and s i n c e about  how  which  of  for  system  is  to  the query  language  the semantics of the n a t u r a l  language  In p a r t i c u l a r ,  in  Codd  the queries  the r e t r i e v a l  suitable  this  use i n a  queries  is  of  direct  environment.  must be s t r u c t u r e d system  goal i n the design  this  language.  contains direct contain  so  Since  reference much  the to the  information  i s t o be done, t h e r e l a t i o n a l  calculus  50  is  not  suitable  independent retrieval  language  a  interrogations,  and  a  system has  Columbia.  system  in  this  context.  system  which  ft  data  base  c a n d e c i d e how t h e  p r e c e s s i s t o be done a r e n e c e s s a r y .  WALT[16],  British  f o r use  by  information  for  been  implemented  T h i s system  Woods[34], about LISP  handling  i s  The  at  natural the  modelled  program  University  after  attempts  programs a s a r e s u l t  language  the to  of natural  of  LSNLIS  retrieve language  queries. WALT  makes  grammar[35] i n linguistic parse  use  order  of  to  parse  deep s t r u c t u r e .  tree  to  build  type o f semantics  an  Augmented the  Transition  sentence  and  The s e m a n t i c component  an i n t e r p r e t a t i o n  i s based  on  the  Network  produce  then uses t h e  of the sentence.  procedural  a  This  semantics  of  Woods[33]. The  semantic  construct  produced  i s a FOB s t a t e m e n t  whose  form i s : (FOB  QUANT X CLASS R (X) P ( X ) )  where QUANT i s a q u a n t i f i e r ,  X i s the v a r i a b l e  CLASS i s t h e name o f a s e t o v e r which r a n g e , B (X) i s a r e s t r i c t i o n P (X) i s t h e p r o p o s i t i o n  which  being  guantified,  the g u a n t i f i c a t i c n  on t h e r a n g e  i s to  o f q u a n t i f i c a t i o n , and  r e p r e s e n t s an a c t i o n  t o be t a k e n .  •  Example In  3.1 • WALT,  the  MATCH c a l l s . " (FOB The same  query  would  language as  t h e f u n c t i o n s which  the r o u t i n e  have t h e i n t e r p r e t a t i o n :  (FUNCTION)  information  syntax •  EACH X  query " L i s t  (CALLS  'MATCH X)  proposed i n t h i s does  (PRINT X) ) .  chapter  contains  t h e FOR s t a t e m e n t o f WALT.  used t o e x p r e s s t h e i n f o r m a t i o n  the  Only t h e  i s different.  Example 3.2 • The  relational  c a l c u l u s guery:  SNAME : (SNAME SUPPLIES PART#) 8 is  (EQ PART# 10)  eguivalent to:  (FOR EACH X (SNAME) TRUE (FOB THE Y (PART#) (EQ PART* 10) (AND (SUPPLIES X Y) (PRINT X)) )) It soon  i s hoped  be e x t e n d e d  that t h e approach  presented  i n this  t o encompass n a t u r a l l a n g u a g e  thesis  gueries.  will  52  li.  h NEW  This chapter relational  FRAMEWORK FOR presents  systems.  Using  r e d u c e q u e r i e s i n a new semantically  tasks  and  equivalent  how  the  Codd i s n o t The which  used  of  s e m a n t i c model, and detail, prove  and  relation  is  The  prover  Instead general  of  to  Previously,  relational  of  algebra.  relevant  done.  The  sequence  the these  calculus  of  language. the  to a query.  basic  methodology  Following new  this  is  framework -  These are  a the  discussed  in  which shows when i t i s p o s s i b l e  domains a r e  related  by  some  to  arbitrary  presented. concludes  approach  techniques  be  a  relational  are  describing  result  most work i n A I ,  to  solve  a  reduction  the  theorem  relational calculus.  been t a k e n  i s somewhat  interesting  A r t i f i c i a l Intelligence(AI)  problem  information  model i s u s e d . allows  s e m a n t i c model and  of standard  representing  semantic  a d e s c r i p t i o n of a  i n the  which has  I t makes use i n order  with  of the  to respond t o q u e r i e s  itself.  i n the  theorem p r o v e r .  which makes use  The in  the  or three  chapter  algorithm  to  main components o f t h e  a general  t h a t two  by  to respond the  should  intermediate  begins  i s employed  description  an  calculus  which r e l a t i o n s  user.  with  framework, i t i s p o s s i b l e t o  operations  to the  as  chapter  this  retrieval  were a s s i g n e d  framework f o r i n t e r a c t i n g  relational  This involves determining query,  a new  RELATIONAL SYSTEMS  using  in  fact  t a b l e s or  T h i s concept,  retrieval. graphs,  which i s b a s i c  t h e most p e r t i n e n t i n f o r m a t i o n a b o u t  a to  the  53  system  to  be  relations  are  information, In  explicitly  fact,  represented.  represented  in  this  The  meaning  way.  From  o t h e r i n f o r m a t i o n i s deduced by a  queries  in  t h e o r e m s t o be p r o v e n  t h e system  true.  this  theorem  are formulated  The s t e p s o f t h e s e  of  the  basic prover.  as a s e r i e s o f  p r o o f s show  how  t h e r e t r i e v a l c a n be d o n e . This  framework  information its  both  will  be  a 5..J..  gueries,  Reduction  section and  gives  a  the  user  basic  answering  into  New  model,  and  account.  The  task.  approach  description  e n t e r s a query  flexible.  - An O v e r v i e w D  i n the reduction  b a s i c approach t o  Firstly,  the  brief  taken  a trivial  of Queries  outlines  language which i s used The  i s also  and  to the semantic  automatically  o f new r e l a t i o n s  This  incremental  c a n be c o n s t a n t l y added  effects  addition  is  to  handling  of Micro-Planner,  a  process. queries  i s  as  follows.  i n the language d e s c r i b e d i n  Chapter IV. •  Example If  1.1 •  one wanted a l i s t  one  proved.  who s u p p l y  a l l parts,  would s a y :  SNAME : (¥ PART#) This  of a l l suppliers  guery  i s then  I n Example  (SNAME SUPPLIES PART#) . formulated  1.1, an a t t e m p t  a s a s e r i e s o f t h e o r e m s t o be would  be made t o p r o v e :  54  (SNAME SUPPLIES If  this  PART*) .  i s possible,  information  in  then the system  the  data base  knows t h a t  which  there  supply part  numbers.  programs  perform t h i s  proof create i n s t r u c t i o n s  how t h e r e l a t i o n  which  I n t h e above example, SUPPLIES would  (SNAME  be c r e a t e d .  treated  in  restricted  similar  and j o i n e d  manner.  according  5«.liA  The Use o f Mi e r g - P l a n n e r reduction  that  the  using  the elements  In EliLDJlillC  1  oriented broken  8  ]  1  S  and  is  tried  and  c a n be c r e a t e d .  then  the  and  join  restriction  i s derived.  upon t h e a b i l i t y  terms  this  Micro-Planner  series  of  of the query a r e t r u e ,  task, is  sub-goals.  i f one p o s s i b l e  fails,  t o prove  axioms  of  the  t h i s procedure i n d e t a i l .  t h e accomplishment  mechanism, s o t h a t  show  are  i s based  accomplish  used.  into a  to  relational  5 outlines  towards  which  the  i n t h e query a r e  o f t h e s e m a n t i c model a s t h e  to  effect,  These, r e l a t i o n s  and a r e s p o n s e r e l a t i o n  o f a query  simple  order  information  Q u a n t i f i e r s and s i m p l e t e r m s  a  Section  side  PARTS)  i n the query,  system.  a  that  the r e l a t i o n :  terms  The  As  contains this  indeed  a l l o w s us t o c o n c l u d e  some s u p p l i e r s which  is  then  a  the language language  of goals, It  which  provides  Micro-  which  is  i n turn are a  back-up  way o f a c c o m p l i s h i n g t h e g o a l  another  possibility  will  be  tried  etc.,.  The  following  traditional  example  of  deduction  will  55 illustrate •  some e l e m e n t a r y  Example If  Micro-Planner.  1.2 • we  know  fallible,  that  then  In M i c r o - P l a n n e r , (THASSEET (THCONSE  and  Turing  is  a human, and a l l humans a r e  Turing i s f a l l i b l e .  this  i s expressed  by s a y i n g :  (HUMAN TUBING) ) (X) (FALLIBLE $?X)  (THGOAL THASSEBT  features of  (HUMAN $?X)) )  THGOAL  respectively.  The  can proof  be  abbreviated  would  to  be g e n e r a t e d  $A  and  $G  by e v a l u a t i n g t h e  goal: (THGOAL  ( F A L L I B L E TUBING)  From t h i s First,  human,  complicated  THCONSE  are facts  connectives  For  are expressed  (conseguence)  should  by  be  facts,  assertions,  is  a human  such  as T u r i n g  whereas and  more logical  In t h e above example,  shown.  T h i s theorem  a  states  i s that X i s f a l l i b l e .  a programming  f u n c t i o n s w h i c h c a n be used t o  observed.  i n one o f two ways  involve quantification  theorem  being  Simple  as theorems.  a conseguence o f X being  language,  define  provides a set  theorems  and  goals.  which a r e f a l l i b l e .  These  example: (THFIND ALL $?X  would items be  represented which may  Micro-Planner, of  points  ASSERTIONS, o r a s THEOREMS.  a  that  several  information i s stored i n Micro-Planner  as is  example,  $T)  return  a  (X) ($G ( F A L L I B L E $?X) $ T ) ) )  list  of  need n o t e x p l i c i t l y  items  which  a l l items  be s t a t e d a s b e i n g  are provably  fallible  using  fallible,  but  can  the current s e t of  56  t h e o r e m s and a s s e r t i o n s . As  w e l l a s THCONSE t h e o r e m s ,  (antecedent) •  Example  Micro-Planner  provides  THANTE  t h a t i f an a s s e r t i o n  i s made  theorems.  1.3 •  (THANTE T (X Y) (LIKES $?X $?Y) (THASSEET (HUMAN $?X)) ) In t h i s about  example, t h e theorem T s a y s X  human.  liking These  information The  Y, t h e n  we s h o u l d i m m e d i a t e l y  theorems  decrease  which i s n e c e s s a r y  following  Micro-Planner  are  chapters used  to  the  assert  amount  of  that X i s explicit  a t any one t i m e . will  form  r e v e a l how t h e f a c i l i t i e s o f a  framework  for  relational  systems.  D  Traditional of user-data need on how  not  The  relational  independence.  This i s true only  The system  they  a high  i n that the  must s t i l l  In p a r t i c u l a r ,  t h e concept  o f a semantic  model i s t h e most v i t a l  semantic  and t h e d a t a  model  serves  users  they  be aware  must know In  of  which order  model i s i n t r o d u c e d .  component o f t h e s y s t e m .  as  b a s e , and i s used  degree  are physically, stored  and what i n f o r m a t i o n each c o n t a i n s .  overcome t h i s , semantic  relations  Unforunately,  the data i s organized. exist,  Model o  s y s t e m s have c l a i m e d  be aware o f how t h e i r  a storage device.  relations to  5.2. The S e m a n t i c  an  interface  to determine  between t h e  the relations  57  which  are relevant  to a  itself.  J u s t a s t h e use o f t h e r e l a t i o n a l be  relations, the  independent  basic  information is,  conveyed  information, contain model  may  or  optimizing  5.2.A  not  relations.  impossible  to t e l l  an e v e n t X, and  real  various  possess  Without which  which  w o r l d knowledge which  and  which  do  which  information  i s also contained  which  in this  this  relations not.  The  describes  the d a t a base  properties  That  the  the  represents. relations  i s useful f o r model.  of gelations  the r e l a t i o n :  (X Y Z) i s i n R i f s u p p l i e r X s u p p l i e s  project  Z.  It  us t h a t :  1. 2. 3. 4. 5. 6.  i n the data base.  (S# PABT# PROJECT*)  where a t u p l e  tells  each r e l a t i o n  be  the r e t r i e v a l  The Meaning  R1  of h i s  the  about  describing  Consider  the  o f t h e s e m a n t i c model i s t o d e s c r i b e  s t a t e o f the environment  may  allows  of  by  contains  Information  be  base  independent  would  information  current  to the data  algebra  him t o  t h e meanings o f t h e  i t  also  reduces  of the r e l a t i o n s .  function  i t describes  and n e v e r  which  of the p h y s i c a l representation  t h e s e m a n t i c model a l l o w s  organization The  model,  process  refers  to  to this  The  queries  user  only  request.  Exactly  what i n f o r m a t i o n  does  part  this relation  S# s u p p l i e s PART* PART* i s u s e d i n PROJECT* PROJECT* u s e s PART* S* s u p p l i e s PROJECT* PART* i s s u p p l i e d by S# PROJECT* i s s u p p l i e d by s u p p l i e r SS, and  Y  to  convey?  58  7.  S# s u p p l i e s  If  q u e r i e s a r e t o be e x p r e s s e d  directly  reference  necessary reguest.  to  the r e l a t i o n s ,  identify  Therefore,  in  the  the  above r e l a t i o n  semantic  information  of t h i s  type  must  about  the  included  The e n t r i e s i n t h e s e m a n t i c  model f o r  is  at  but  easy  as a b o u t  to  also  the be  ($A  be e x p r e s s e d .  need  to  will  accept  i t as a  represent  overall  special For  know  what  primitive  information  about  parts.  topic  with  For  which t h e  example,  i f  relations  i n the data  base  meaning.  F o r example,  might:  (R2 CONCERNS CURRENT PARTS))  i s especially  have i d e n t i c a l  useful i f several  domains, but d i f f e r e n t  (PART* PRICE) ($A  no  not  expressed.  (PABT* PRICE) were p r e s e n t , we  R1))  that  need  s u p p l i e r s and  describing can  point  model  does  means, as  this  semantic  Micro-Planner  deals  to a  be  noted  e m p l o y e e s and wages  relation  be  would be:  be  Information  will  which a r e a p p l i c a b l e  should  Thus, i t  which d o e s n o t  information  It  fact.  R3  the r e l a t i o n s  model.  SUPPLIES PART*)  This  then t h i s  (S# SUPPLIES PART* R1)) (PART* IS-USED-IN PROJECT* R1)) (PROJECT* USES PART* R1)) (S# SUPPLIES-TO PROJECT* R1)) (PART* IS-SUPPLIED-BY S# R1)) (PROJECT* IS-SUPPLIED-BY-S S# R1)) (S* SUPPLIES PART* SUPPLIES-TO PROJECT*  example,  B2  i n a language  ($A ($A <$A ($A ($A ($A ($A  information  (S*  PART* t o PROJECT*  were a l s o i n c l u d e d , t h e n  (R3 CONCERNS OBSOLETE  PARTS))  we w o u l d :  i f  59 5*.2_.B P r o p e r t i e s In  the  of g e l a t i o n s  process of determining  base a r e r e l e v a n t check  for  possess.  specific  the  necessary  which a r e l a t i o n  showing t h e p r o p e r t i e s of  model  may o r may n o t also  each r e l a t i o n importance  to  contains  possesses.  are  In  T-TRANS  and  (see s e c t i o n 3.B).  Example 2.1 • In  the  supplier vice ($A ($A It  relation  R4  versa.  This  be  used  retrieve The this  is  likely  determines the s u p p l i e r  that the name  and  by:  S# and SNAME a r e T-TRANS  Information  t h e system  the data f o r a system  i n order  information  to lessen  which  t h e time r e q u i r e d  can to  request.  which i s i m p l e m e n t e d  a relation  do t h i s ,  This  IN R4)) o r  s e m a n t i c model may a l s o c o n t a i n by  i n R4.  by e i t h e r :  (S# AND SNAME ARE T-TRANS (R4 IS T-TRANS))  facility.  create  i t  would be r e p r e s e n t e d  happens t h a t  5..2..C O p t i m i z i n g The  SNAME),  (S# DETERMINES SNAME BU)) (SNAME DETERMINES S# RU)) also  ($A ($A  (S#  number u n i q u e l y  would be r e p r e s e n t e d  To  i t i s often  semantic  framework, t h e p r o p e r t i e s  DETERMINES •  request,  properties  Therefore,  information this  t o a given  which r e l a t i o n s i n t h e d a t a  Consider  a query  shows one p o s s i b l e which r e q u i r e s  of  the system to  which enumerates t h e elements o f a  one would p r o j e c t e a c h r e l a t i o n  use  domain  d,  i n t h e d a t a base on  60  d,  and t h e n  relation  take  the union  which  is  guaranteed  domain which a r e p r e s e n t If, then  process  projection  of t h i s  e n u m e r a t e d, t h e n fact.  is  to  relation  produces  enumerates t h e v a l u e s o f  d,  A l l t h a t i s needed i s a  Even i f two r e l a t i o n s  c a n be s a v e d  a  base.  i f the system  together  i s made  aware  T h e r e f o r e , one c a n add i n f o r m a t i o n o f t h e f o r m :  ($A  (RI ENUMERATES  ($A  (R1 PARTIALLY-ENUMERATES S#))  This  i s especially  since  quantification  subset  This  contain a l l the values o f a  unnecessary.  one r e l a t i o n . time  results.  i n the data  however, a s i n g l e  this  of t h i s  of these  S#))  useful  when q u a n t i f i e r s a r e b e i n g  i s always over  a  domain  or  a  processed, restricted  o f t h a t domain.  5_.2. D A c t i v e and I n a c t i v e Data  The  semantic  the c u r r e n t describes. •  Example  state  In  the  environment  t o as " r e a l  which  world"  the  reflects  data  base  knowledge.  2.2 • SUPPLIERS ARE ON STRIKE)  a typical  example.  order t o handle  the c u r r e n t l y introduced. responding present  of  T h i s we r e f e r  (VANCOUVER is  model a l s o c o n t a i n s i n f o r m a t i o n t h a t  active  a  i n the data  world  and i n a c t i v e  The a c t i v e to  real  i n f o r m a t i o n , the concepts of  p o r t i o n s o f the data  base  are  i n f o r m a t i o n i s t h a t which c a n be used i n  query.  The  base, but  inactive should  data  i s data  temporarily  be  which i s ignored.  61  The to  system a  will  n e v e r make use  of  inactive  data  when  responding  guery. The  the  e f f e c t of  part  of  the  real  knowledge i s t o  temporarily  d a t a b a s e which i s c u r r e n t l y  There are  two  cases  relations  can  be  relations  world  which  must be  inactive,  which  dealt  considered  with.  a l t e r n a t i v e l y , the  satisfy  some  criterion  alter active.  Firstly, tuples  can  in  be  whole certain  considered  inactive. In one  order to  simply ($A  to  the  the  indicate  a d d s an  ($?REL IS semantic  name o f The  the  assertion  relation  in  suitable  restrict tuple  information  the  where to  be  only  which i s of  tuples must  by  is  within  a  is  showing the  satisfy.  manner.  relation It i s  properties  Therefore,  one  most  that  each  can  add  type:  name o f  r e s t r i c t e d , and unbound  whose v a l u e  inactive.  tuples  (REST RESTRICTS DOMAIN TO REST i s t h e  inactive,  form:  a somewhat more c o m p l i c a t e d  domain i n t h e of  the  i s currently  m o d e l , where $?REL i s a v a r i a b l e  inactivation  to  of  a relation  INACTIVE))  accomplished  ($A  that  variable  the  LPRED))  r e s t r i c t i o n , DOMAIN i s t h e  LPRED i s an i s DOMAIN.  arbitrary  LISP  predicate  domain whose  62 •  Example 2.3 • The  s e m a n t i c model would c o n t a i n  ($A if  (REST*1  RESTRICTS SLOC TO  This  (NOT (EQ SLOC  t h e t u p l e s i n some r e l a t i o n  c a s e where t h e l o c a t i o n allows  relations  restrictions  the a s s e r t i o n : * VANCOUVER))))  a r e t o be r e s t r i c t e d  to the  o f t h e s u p p l i e r i s n o t VANCOUVER. t o be s p e c i f i e d  independently  of the  which a r e r e s t r i c t e d .  In o r d e r  t o make use  of  this  information,  the  semantic  model c a n a l s o c o n t a i n a s s e r t i o n s o f t h e f o r m : ($A where  (PRED IN RELATION IS-RESTRICTED-TO PRED  is  the  name  of  a  diadic  REST*)) predicate  l a n g u a g e , RELATION i s t h e name o f a r e l a t i o n , name o f t h e r e s t r i c t i o n .  F o r example,  (SUPPLIES IN R3 IS-RESTRICTED-TO This  says that  term guery, be  then only  used.  The world  a n d i f R3 i s b e i n g those  Notice  whole r e l a t i o n s  we might  this  to specific  BEST*1).  used  in a  relational  i n the reduction  i s more g e n e r a l  REST*1  than  of the should  restricting  cases.  a s s e r t i o n s a r e used  i s discussed  i s the  have:  t u p l e s o f R3 which s a t i s f y  that  way t h a t t h e s e  knowledge  and REST*  i f t h e p r e d i c a t e SUPPLIES i s s e e n  o f a guery  i n t h e guery  i n s e c t i o n 5.6.  to  represent  real  63 5,_2._E G e n e r a l i t y o f t h e S e m a n t i c It  i s  felt  that a semantic  g u e r i e s i n any l a n g u a g e the  d a t a base.  typical  model i s n e c e s s a r y  which does n o t make d i r e c t  T h i s work shows t h e t y p e  semantic  information  Model  model  describes  might the  to process  reference  to  o f i n f o r m a t i o n which a  contain.  The  leaning of  the  bulk  of  this  relations.  For  example, ($A  (PART# IS-USED-IN  The  semantic  assertions. feature;  model i s r e p r e s e n t e d by a s e t o f M i c r o - P l a n n e r  However, t h e r e p r e s e n t a t i o n  the  model  i s  manner i n which i t i s application  In  PROJECTS R5) ) .  proposed  this  thesis,  not the  can  be  determined  i t i s u s e f u l i n the context of a natural  language  For  this  to  semantic  model i s i d e a l .  commercially that  LISP  usable and  implementing efficient.  Micro-Planner  I f one were  retrieval  the In t h i s  system  attempting  system,  Micro-Planner  would  easy,  application,  The  data base,  with the arcs being  relates  the  the  system.  to  the  design  a  however, i t i s u n l i k e l y  be  but  a way  describe  used.  are  not  semantic  They  make  exceptionally  model  r e p r e s e n t e d u s i n g a more " c o n v e n t i o n a l " d a t a s t r u c t u r e network.  by  i n such  that  using  and t h e  used.  t h e framework i s f o r m u l a t e d  application,  important  as a g e n e r a l concept,  represented  i n which i t i s b e i n g  is  could such  be as a  nodes o f t h e network c o u l d be t h e domains i n t h e  t h e nodes.  labelled  F o r example,  with the p r e d i c a t e  the assertion:  (PART* IS-USED-IN PROJECT * R5)  that  64 would be  represented  by:  B4  PART* The are  PROJECTS results  applicable  represented,  which a r e p r e s e n t e d i n t h e regardless  and  are  not  of  how  the  dependent  following  semantic  upon  the  chapters  model use  of  is  Micro-  Planner.  n 5._3Proving Q u e r i e s i n the reference  to the  request,  order how  this  In  is  created.  contain  T h e r e f o r e , the system  no  direct  which  handles  o f d e c i d i n g which r e l a t i o n s a r e r e l e v a n t t o how  the  the c o r r e c t  query, The  can e x p r e s s  system,  calculus  relations response.  s h o u l d be This  manipulated  section  in  discusses  accomplished.  any  importance. they  and  t o produce  relational  data base.  them must be c a p a b l e the  new  R e l a t i o n a l Terms o  the  relational  terms  are  of  primary  u s e r s view t h e s e a s t h e mechanism t h r o u g h the p r o p e r t i e s o f  however, t h e y r e p r e s e n t  the data  new  they  relations  desire. which  which To  the  must  be  65 •  Example 3.1  •  Consider  the query:  (SNAME  : (SNAME SUPPLIES PROJECT*) S  (EQ PROJECT*  which  asks  supply project  order  for  t o answer t h i s ,  SUPPLIES  relational  (Restriction created.) this the  the  The  a query,  term  and  join  and terms  queries,  should  be  information In  suppliers  can  order to  each  be e x t r a c t e d the  T,  the f o l l o w i n g  formulated  as  a  theorem,  can  relation  can  the  when,  in  proven  be c r e a t e d .  data  answer t h e  The  be  base  corresponds  to  and  true,  created.  which term new  must be  from  created.  relations  to the system  to  be  as t o  how  to determine  how  the data base. corresponding  approach  i s taken.  an a t t e m p t  the s e m a n t i c s of t h e d a t a base  theorem  In  no i n f o r m a t i o n  relation  term  that  simple  do n o t r e q u i r e  I t i s up  create  be  the r e l a t i o n  however, c o n t a i n  done.  17.  relation:  relational  using  who  (SNAME PROJECT*) must f i r s t  When p r o c e s s i n g each  a l l  17))  as  First,  does n o t c o n t a i n  some T is  i s made t o p r o v e i t  the  axioms.  then the proof w i l l  If i t i s false,  to  t h e n we  sufficient  If  the  show how  the  can  conclude  information  to  query.  remainder general,  of t h i s  section  is  devoted  a term c a n be p r o v e n t r u e .  d i s c u s s e s the implementation.  to The  discussing next  section  66 5 .3 _A E x p l a n a t i o n o f t h e P r o b l e m i  i  In the  the f o l l o w i n g  form  relation  terms  term,  model,  then  and  information.  Example To  form  necessary.  term  axiom  proof  a  xRy.  xRy  will  single  will  If  a  single  appear  be t r i v i a l .  relation  Several relations  the  relation  will  the  I t w i l l not  contains often  in  a l l the  be needed.  then  we  3.2.1.  If  says  conclude  the following  o f t h e form  by t h e term  i n example  3.1  o f p r o v i n g xRy, when two r e l a t i o n s a r e  I f one r e l a t i o n can  defined  R3 and R5 must be u s e d .  C o n s i d e r the problem  Consider  n o t a t i o n xRy.  3.2 •  above, r e l a t i o n s  zR'y,  the  the  be t h e c a s e t h a t  desired  o f t h e form  terms of  i n t h e d a t a base c o n t a i n s t h e i n f o r m a t i o n r e q u e s t e d i n  semantic  •  relational  relational  always  we r e p r e s e n t r e l a t i o n a l  (X R Y) by t h e s t a n d a r d s e t - t h e o r e t i c  Consider  the  sections,  xRz, that  says  that  xRy, o r xR'y, o r even  xR"y?  e x a m p l e s which  xRz by showing we  a l l  another  attempt  to  prove  a  xRy and yR'z.  know  (S# SUPPLIES PROJECT),  and  (SHAME IS-NUMBERID  then  we  can  S#)  conclude  and that  (SHAME SUPPLIES PROJECT). 3.2.2.  If  we  know  (PART* IS-USED-IN P R O J E C T * ) , (S# SUPPLIES PROJECT*).  then He  (S# SUPPLIES PART*), we  can  can  (S*  R PROJECT*), where R i s some r e l a t i o n  be  "maybe  determines  supplies". PROJECT*,  not conclude  that  conclude  that  only  whose name happens  I f , however, we know t h a t then  we  can  and  to  PART* u n i q u e l y  conclude  that  67  (S#  SUPPLIES PROJECT*) .  3.2.3.  I f we know  that  (B DOUBLED-IS C ) ,  (A IS-THE-SQUARE-OF B ) , and  then  we  cannot  conclude  (A IS-THE-SQUABE-OF C) i n any c a s e , r e g a r d l e s s B  uniquely  3.2.4.  that  o f the f a c t  that  d e t e r m i n e s A. If  we  know  that  (SUB-PART# IS-PABT-OF PART*),  (PART* HAS-NAME PART-NAME) , t h e n  we  can  always  conclude  and that  (SUB-PABT* IS-PART-OF PART-NAME). T h e s e examples i l l u s t r a t e depend  upon  upon t h e i r  the properties  of the r e l a t i o n s  of  o f xRy i s g o i n g t o involved,  not just  Relations  T h e r e a r e two p r o p e r t i e s the  These p r o p e r t i e s •  the proof  content.  5_.3_.B P r o p e r t i e s  influence  that  Definition  way  which r e l a t i o n s  t h e y c a n be used  are c a l l e d  T-TRANS  may  i n creating  possess new  that  relations.  and UNIQUELY-DETERMINES.  •  Two domains a a n d y i n r e l a t i o n  R* a r e s a i d  to  be  T-TRANS  (Through T r a n s i t i v e ) i f , f o r e a c h xRa, xRa A are  6 aR'y =>  relation  pairwise  xRy.  R«  T-TRANS.  i s said  t o be T-TBANS i f a l l domains i n R*  68  •  Example 3.3 • If  (X R S#) and (S# R« SNAME) =>  and •  (X R  SHAME) ,  then  S# a r e T-TRANS i n R » .  Example 3.4 • The  relation  T-TRANS, This  R (S#  SNAME  PROJECT*  whereas R» (S# SNAME)  property  will  be used  PROJECT-NAME)  i s not  i s .  t o show t h a t t h e c o n c l u s i o n s  e x a m p l e s 3.2.1 and 3.2.4 a r e v a l i d , whereas no c o n c l u s i o n drawn and •  from  Definition  any  3.2.3, which  i s syntactically  similar  in  c a n be  t o b o t h 3.2.1  3.2.4.  A  •  SNAME  •  domain a i n R u n i q u e l y  value  d e t e r m i n e s domain b i n  o f a i n R, t h e r e e x i s t s  o n l y one v a l u e  R  i f ,  for  of b.  Example 3.5 •  R  (  S# 1 1 2 3  PART* 4 7 8 9  H e r e , PART* u n i q u e l y uniquely  determine  the proof  o f 3.2 a b o v e .  )  d e t e r m i n e s S#.  PART*.  Notice  This property  will  t h a t S* d o e s n o t be n e c e s s a r y i n  69  5•.3-.C P r o v i n g xR y_ If  t h e axiom xRy  more t h a n proof to  one  relation  i s broken  find  proof  o f aR"y  this  which  may  or  into  proves  that  xR'a.  i n the proof.  Firstly, If this  If this  R exists  point.  also  an  attempt  succeeds, y.  between a,  Further, i t w i l l will  x, and  then  The  the  we  can  validity  relationships y.  Example be t h e  specified,  T h u s , t h e p r o p e r t y T-TRANS w i l l  the  i s made  then  most o f t e n be  then  Thus,  succeeds  between x and  R which i s d e s i r e d  also  3.2 case  rather  need  to  be  i n attempting  following  1.  The  join  o f R* (A,B) The  join two  of t r y i n g  to prove  xRy,  where R  relation C,  of r e l a t i o n s  R(A,B,C),  and  relation  in third  normal  can  be  form[10],  where A d e t e r m i n e s  B,  i s the  E  and  n  R(A,B,C),  we  any  R (A,C).  i s the  results,  t o show t h a t  results:  relation  determines these  t h e problem  relation.  to a natural the  2.  stages.  not e x i s t  first  arbitrary  reduced  involved  model,  account.  Heath[17],  Using  may  this  Consider an  two  a relation  than a r b i t r a r y .  is  be  i s attempted.  the r e l a t i o n  taken  into  p r e s e n t i n the semantic  c o n c l u s i o n , however, d e p e n d s upon c e r t a i n  illustrated that  up  will  a domain a s u c h  conclude that of  i s not  where  A  j o i n o f R» (A,B)  d e f i n e the concept  determines and  R"{B,C).  of a v a l i d  result.  B  70 •  Definition If  each  •  A determines  other  relation valid  in  R" (A,C) ,  R (A,B,C),  R"(B,C),  formed  by  We  formed  the  by  valid  i f A determines  then  projection  joining  joining  R « ( A » B ) and  of the p r o o f .  Example 3.6  R(E,C)  R • (A, B)  and  of  the  R"(A,C) i s a  B i n R* (A,B)  and  B  determines  R"(B,C) i s a l s o  a valid  Any  and  path  valid  which r e q u i r e s  relations  only  C  R (A,B,C)  relation. term  as  the f o r m a t i o n of is  said  t o be  a  we  •  know  B: (PARTS  that  term  A: (PARTS  IS-OSED-IN  determines A,  SS we  i n the can  IS-SUPPLIED-BY  PROJECTS), relation  form  the  In before always  any a  p r o o f , an non-valid  example 3.6, B  rather  is  path.  Note  than  a new  "supplies".  PARTS  by  the  made  to  that  later.  uniquely relational  a  valid  a n o n - v a l i d path  the  whose name i s "maybe  T h i s concept  path i s not  determine  d e f i n e d by  i s extremely  guides the proof i n a reasonable d i r e c t i o n . illustrated  that  R (SS,PR0JECTS),  find  even i f PARTS does n o t  relation  and  "supplies-to".  the j o i n o f the r e l a t i o n s  produces  SS),  i f  valid relation  attempt  undesirable, since  then  defined  where t h e name o f R i s a c t u a l l y  be  determine  path.  If  it  C  t h e p r o j e c t i o n R(A,C) o f t h e r e l a t i o n  relations  valid  and  A nor  speak of the s t e p s of the p r o o f of a r e l a t i o n a l  the path  •  then  neither  relation.  Similarly, in  B i n R* (A,B), and  SS  in  terms  A  supplies",  valuable,  This point  as will  71  How  c o n s i d e r t h e problem o f t r y i n g  specified.  Given  r e l a t i o n s R»(X,A)  R»«(Y,A), t h e n t h e f o l l o w i n g can  be  drawn  assuming  c o n c l u s i o n s marked since  table  the  with a s t e r i s k s  |  R« R» R» R'  (A,X) (X,A) (A,X) (X,A)  R" R" R" R M  (A,Y) (A, Y) (Y,A) (Y,A)  R  f  | | | I  which  are  xRy  1. xRy  iii.  iii.  a position  and e i t h e r  Either  aR»y  aR'x  x and a a r e T-TRANS  of  The  interest,  xRy.  T-TRANS  T  |  R"  i s true  1  ii  _ .|. _ _ _ _ _ _ _ . _ „ ..,., r  I | I |  R'(I.X) R« ( X , Y ) * H'(Y,X) R» (X,Y) *  .. .„i,.,... to define  i  T-TRANS  _ _  |  I  j —  the c o n d i t i o n s  under  i f either:  or  yR'a.  i n R».  or  xR»a.  i n R«.  a d e t e r m i n e s y i n R o r a d e t e r m i n e s x i n R».  These a r e t h e o n l y xRy.  valid.  a d e t e r m i n e s x i n R o r a d e t e r m i n e s y i n R».  and e i t h e r  Either  xRy  ones  which  o f t h e system.  y and a a r e T-TRANS  3. i . aRy ii.  in  c a n be p r o v e n t r u e .  i s an axiom  2. i . xRa ii.  now  are  is  R"(A,Y) o r  conclusions  the  R"(X,Y)* R" (X , Y) * R"(Y,X) R'»(Y,X)  ...x We  the  where R  and  y  relations are  t h e y show when one c a n p r o v e  T  or R'(A X),  shows  new  t o p r o v e xRy  conditions  which a l l o w  us t o  show  that  72 •  Example 3.7 • Say  one  xRa,  t h e n one must s i m p l y  T-TRANS  is  in  determines that  attempting  R•,  and  y i n R*.  to prove  I f i t i s known  that  show t h a t aR'y where y and a  are  either  a  xBy.  determines  This i n turn could  •  R or a showing  aR"b and bR"*y, where b and y a r e T-TRANS i n R"',  Thus, t h i s just  in  be done by  where b d e t e r m i n e s a i n R" o r b d e t e r m i n e s  not  x  method a l l o w s  proofs  with  two  for  proofs  of  and  y i n R"». arbitrary  length,  steps.  Example 3.8 • The  term  (S# SUPPLIES-TO PROJECT-NAME) c a n be p r o v e n  true,  since: 1.  (S* SUPPLIES-TO  PROJECT*)  2.  (PROJECT* IS-NAMED PROJECT-NAME)  3.  The r e l a t i o n  4.  In t h e r e l a t i o n  defined  by 2 i s T-TRANS, and  defined  by  2,  PROJECT*  determines  PROJECT-NAME.  5.J^D  Proving  There true.  xR_lEl!  are  s i x c o n d i t i o n s under  which  xRyR'z c a n be  proven  xRyR'z i s t r u e i f e i t h e r :  1. xRyR'z i s an axiom  of t h e system.  2. i . aRyR'z and e i t h e r aR"x o r xR"a. ii. iii.  x and a a r e T-TRANS i n R". E i t h e r a d e t e r m i n e s x i n R" o r a d e t e r m i n e s relation  defined  by t h e t e r m .  (y z) i n t h e  73  3. i . xRaR'z and e i t h e r aR"y o r y R a . n  ii.  y and a a r e T-TRANS  i n R".  iii.  E i t h e r a determines  y in R  relation  defined  n  or a determines  (x z) i n t h e  by t h e t e r m .  4. i . xRyR'a and e i t h e r aR"z o r z R " a . ii. iii.  z and a a r e T-TRANS i n R". E i t h e r a d e t e r m i n e s z i n R" o r a d e t e r m i n e s relation  defined  (x y) i n t h e  by t h e t e r m .  5. i . xRy and xR'z ii.  x determines y i n the r e l a t i o n  defined  by  (x R y)  6. i . xRy and yR'z ii.  x determines y i n the r e l a t i o n  defined  by  (x R y)  iii.  y determines z i n the r e l a t i o n  defined  by  (x R' z)  Notice  that  i n c a s e 5, x i s r e l a t e d t o y and  c a s e 6 x i s r e l a t e d t o y and y i s r e l a t e d t o z. the  two  interpretations  this  framework, i t i s p o s s i b l e t o  xRyR'z, even  of  ternary  This  while  in  represents  semantic information.  prove  i f the semantics c o n t a i n  z,  a  only  term binary  of  the  In form  information.  • Example 3.9 • We  can  prove  (SNAME SUPPLIED PART*  SUPPLIED-TO PROJECT*),  since: 1.  (S* SUPPLIED PART* SUPPLIED-TO  PROJECT*)  2.  (S# IS-CALLED SNAME)  3.  S# and SNAME a r e T-TRANS i n t h e r e l a t i o n  4.  S* d e t e r m i n e s SNAME i n t h e r e l a t i o n  defined  defined  by 2.  by 2  74 5^3_j_E U s e f u l n e s s o f t h e V a l i d  The  concept of  mechanism  since  Consider,  for  a  Path  valid  i t  path  tends  example,  to  an  (S# SUPPLIES-TO PROJECT-NAME).  At  2.  (PROJECTS IS-NAMED  undesirable  to  be  (PARTS IS-USED-IN PROJECTS),  C.  (PROJECTS IS-NAMED appear  found  would  uniquely  be  d e t e r m i n e s SS  relation,  and  correct  determine relation  version  rejected.  SS  in  as does  prove  that  proof i s :  several other correct  but  and  PROJECT-NAME) He  would  hope  that  of the proof before the f i r s t  This i s , in fact,  the case.  i n A,  B do  therefore,  proof w i l l  paths.  and  t o be c o r r e c t .  this  "garbage"  example:  B.  also  proof  PROJECT-NAME). seem  For  the  and  (SS SUPPLIES PARTS),  system  the  proofs.  to  to  desired  A.  would  it  there  eliminate  The  (S# SUPPLIES-TO PROJECTS),  glance  crucial  attempt  1.  first  is  s t e p s A and  the system  eventually  A, t h e n t h i s  the f i r s t ,  and  be  will  abandon t h i s  proof produces  the  version,  U n l e s s PARTS  not d e f i n e  found.  i f  If  a  valid  path  PARTS  and does  t h e same r e s p o n s e  i s therefore acceptable.  5..3.F Summary, This relational  section terms  has d e m o n s t r a t e d is  not s u f f i c i e n t  has xfly that  defined and  the  conditions  xRyR'z c a n be  under  proven.  that:  the  Above a l l , i t  i n o r d e r t o p r o v e a term s u c h a s  t o show  which  xRy,  i t  75  xRa The  & aR'b  & bR"c  &  p r o p e r t i e s of the  n 5 ..4  The  cR»"y.  r e l a t i o n s must be  Processing  This section discusses which  prove  previous  the  s e c t i o n , the  i n t o account.  o f R e l a t i o n a l Terms o  the  validity  taken  implementation  of  the  conditions  of  the  relational  procedures  terms.  under which t h i s  could  In  the  be  done  data  base  which  the  were o u t l i n e d . Relational contains term  terms  of  the  d e t e r m i n e how  relation  routines are  saves  Micro-Planner  the  proof  can  be  i s constructed  how  saves the  such  x,  real  xRy, world  a  by  showing  relation.  from  these,  The we  can  constructed.  describing  intermediate  i f the  relation  "remembered", and  by  which p r o v e t h a t  d e s c r i p t i o n s of  the  are  This s e c t i o n begins Micro-Planner  true only  p o s s i b l e to c r e a t e  proof the  proven  to create  Therefore,  i t i s , in fact,  steps  be  enough i n f o r m a t i o n  defines.  that  can  steps. or  the  format  in  which  It also describes  xRyR'z a r e  true.  Included  knowledge i s h a n d l e d , and  r e l e v a n t p a r t s of the  proof.  the  how  76 5. ft.ftThe L i s t In  Returned  proving  only  that  can  be c r e a t e d .  the  to  relation"  a relational  i s  how  of  the  in a list,  result  of  a  relation  little  and g i v e n  use  proof.  relational  t e r m , and shows how  first  relational  create  The l i s t the  they  how i t  Therefore,  which  should  they  makes  This  i t  i t  is  relations  (PARTS  not  PARTS  has  which  defined  by  the  the  be used t o form i t .  term T h a s n domain v a r i a b l e s ,  together  we might  then the  of the form:  list  e n u m e r a t e t h e e l e m e n t s o f DOMAIN.  have:  (R7 R5))  was t o come f r o m  actually  SRESULTS  easy  RELS),  For example,  if  use  relations  where DOMftIN i s t h e name o f a domain i n T, and RELS i s t h e of  the  information i s  shows which  relation  n e l e m e n t s o f SRESULTS a r e l i s t s  (DOMAIN  itself.  t h e name SRESULTS s i n c e  i n order  the  in  but  s a y s " y e s , you can c r e a t e  c a n be c r e a t e d .  a r e needed  If  to  just  i t i n a fashion  relation  successful  c a n be c r e a t e d ,  t o know n o t  keep t r a c k o f t h e i n f o r m a t i o n  and o r g a n i z e  stored  term, i t i s i m p o r t a n t  A r o u t i n e which  procedures  the proof, see  Micro-Planner  the corresponding  Micro-Planner in  by  is  relations  used i n t h e c u r r e n t a list  R5 and R7.  scheme.  which shows how  The  to create  The l i s t last  RELS i s  element  of  the r e l a t i o n .  It  t h e form: (REL1  D1 REL2 <D2  of r e l a t i o n s , Using  REL3 ... <DN  R E L N » ) , where R E L i  is a  list  and D i i s a domain name.  the l i s t  SRESULTS t h e r e l a t i o n  defined  by t h e term i s  77 created 1.  as f o l l o w s :  Create a l i s t  first  n e l e m e n t s from  2.  Take  list  E.  the f i r s t  relations  3.  list  the relations  #RESUIT#.  then  go  L o f domains which them on  these  the  step  a r e common  this 3.  to a l l  Take  the  3. which  i s the t h i r d  created  i n s t e p s 2 and 3 on t h e c o n d i t i o n i s specified  by t h e s e c o n d  o f #RESULT# a r e e g u a l .  element,  from  go t o s t e p  Project  three elements step  2.  4.  o f #RESULT# w i t h  I f #RESULT# c o n t a i n s  the r e l a t i o n  which  i s the f i r s t  T.  This  •  Example  i s the relation  defined  6.  (and o n l y )  element  are i n the  by t h e r e l a t i o n a l  name  list  term.  4.1 •  The  proof  of  will  return  the l i s t :  ( (SNAME To f o r m t h i s and R7 on  the  more t h a n one  Otherwise, continue with step  #RESDLT# upon t h e domains D1,D2 ... Dn which  S#.  Call  to  domains.  of relations  v a l u e s o f t h e domain which  the relation  of  from  element,  and go t o s t e p  Replace the f i r s t  6.  o f one  i n R, and p r o j e c t  the  element  of  delete  i n #RESULT#.  Join  5.  the  of r e l a t i o n s  do t h e same f o r t h e l i s t  element  that  list  of the r e s u l t s ,  Now  4.  find  and  #RESULT#.  If B i s a list  Otherwise,  union  T o f e a c h domain i n t h e term,  the  (R3) )  relation,  (S#,PART#).  relational  (PARTt  (R5 R7) )  term  (SNAME SUPPLIES PART#)  ( (R3)  S#  (R5 R 7 ) ) ) .  t a k e t h e u n i o n U o f t h e p r o j e c t i o n s o f R5 Now  j o i n R3 and U on  the  common  domain  78  SiikS  Proving A  X  simple  occurs  as  term  the  domain  Otherwise t h e proof As which  a  by  of this  any  fail,  effect,  true relation  domain.  in  the  and t h e g u e r y c a n n o t  any s u c c e s s f u l  obtain  i f i t s domain  proof  the  relation  Proving  a simple  will  which  variable  data  base.  be a n s w e r e d . create  a  list  enumerates the  term X i s a c c o m p l i s h e d  i s s u i n g the goal: ($G  •  side  provably of  will  shows how t o  values  is  (ENUMERATE  $?X) $ T ) .  Example 4.2 • ($G  (ENUMERATE PART*) $T) r e s u l t s i n #RESULT#  being  bound  to the l i s t : ( (PART# since  (R1 R8) )  taking  relation  (R1 R8) ) ,  the  union  on t h e domain PART* r e s u l t s i n  enumerates the p a r t s The  list  showing  currently  in  semantic  model c o n t a i n s  relation  enumerates t h e term.  the  a  one o f two ways.  list  semantic  model c o u l d  certain  relations  case,  the l i s t  i s a list  which  relation  The f i r s t  an a s s e r t i o n  possibility  which s t a t e s  If this  is  are true,  contain  several  partially  r e l a t i o n s , i f any, d e a l  which  the  assertions  will  a certain list  which  state In t h i s  neither  model must be examined  with t h i s  domain.  is  Secondly,  enumerate t h e t e r m . If  be  i s that the  that  true,  of a l l such r e l a t i o n s .  then t h e semantic  this  i n the system.  o f one e l e m e n t , namely t h i s r e l a t i o n .  that  these  mentioned  a  which r e l a t i o n s enumerate t h e t e r m  derived  simply  o f R1 and R8, and p r o j e c t i n g  I f one o r  of  to see more  79 are  found,  Otherwise,  In  then  a  list  the proof  of  a l l  these  last  case, only semantic  (D P D)  or  (D)  need  relation  will  5_. Q^C  Proving Section  to  any  included  3 outlined that  must do  must a l s o c h e c k check  that  can  be  involved,  and  how  under  each  implementation  just  check  relation  form  domain i n e a c h type.  done,  but  attempted  which  is  and  first  manner, s i m p l e  process that were  Micro-Planner proofs  must  Thus, the c o n d i t i o n s  simply  Micro-Planner w i l l  It  active,  relations  Further, since  which a p r o o f i s p o s s i b l e c a n n o t  be  stated,  c o n s t r u c t the  but proof  effort.  5_.4_.Ct_1 R e p r e s e n t a t i o n o f t h e a  proof  I t must n o t o n l y show  b e f o r e complex o n e s .  w i t h a minimum o f wasted  valid  this  t o use  i t selects,  remember  t h e y were u s e d .  of  is  f o r these c o n d i t i o n s .  i t attempts  are found.  i t s p r o o f s i n a depth  Proving  the  of t h i s  The  upon t h e t u p l e s  must be e x p r e s s e d s o t h a t  the  term  of  t h e c o n d i t i o n s u n d e r which i t  which  the proof  be  s i n c e each  i n a semantic  more t h a n  restrictions  always  examined,  xRy.  for restrictions  performs  be  information  xRy  conclude  procedure  is built.  fails.  this  be  relations  relational  Goals term  xRy  i s accomplished  by  issuing  goal: ($G  ($?X  where X and  $?R  $?¥  $?REL) $?T) ,  Y a r e domains, R i s a d i a d i c  p r e d i c a t e , and  fill  is  80 the  name o f a v i r t u a l  show t h a t •  ($G  goal i s :  (PART* IS-USED-IN PROJECT-NAME $?REL) $ T ) .  None o f t h e Therefore,  The  variables  in  the  goal  need  be  specified.  the g o a l :  (PART* $?R PROJECT-NAME $?REL)  perfectly  contain  i f i t were c r e a t e d , would  •  A typical  is  which,  xRy.  Example 4.3  ($G  relation  valid.  If this  proof i s s u c c e s s f u l ,  t h e name o f t h e r e l a t i o n  possible  uses o f t h i s  $T) t h e n $?R  will  between PART* and PROJECT-NAME.  feature are discussed i n section  6.  5. j U C . 2 B a s i c P r o o f S t r a t e g y Omitting  the c o n d i t i o n s that  specify  be T-TRANS and DETERMINE one a n o t h e r , R Y REL) i f we c a n p r o v e (XRA  2.  (A R Y REL1) and e i t h e r  true  model,  where  succeeds, attempt  was  begins  i n the semantic  see i f e i t h e r  R')  and e i t h e r  program  then  1  the  If  (X  (A R' Y REL2) (A R» X  REL2).  I f i t i s , then t h e system  succeeds. that  that this  REL1) i s looks  to  (Y R' A REL2) a r e i n t h e s e m a n t i c  an a r b i t r a r y  proof  i n t h e same manner  A REL2) o r  (X R' A REL2) o r  model.  i s now  t o prove  by c h e c k i n g t o s e e i f ( X R A  i s made t o p r o v e  attempted.  (Y R*  (A R» Y REL2) o r R  i t i s possible  must  either:  1.  The  REL1)  when X, Y, and A  (A R*  relation. If  Y REL2)  the o r i g i n a l fails,  both  then  fail,  ( f o r some  proof of we  I f one o f t h e s e  (X R  attempt  then  an  arbitrary A  REL1)  to  prove  81 (Y R« A  REL2).  If  this  also  (A R Y REL1) system (A  i s  X REL2).  succeeds.  prove  in  then  the  that By  either  model.  to  see i f  I f i t i s , then the (X R» A  of these succeed,  fail,  in  this  REL2)  or  then t h e p r o o f  t h e n an a t t e m p t  manner, t h e s y s t e m  proofs quickly.  general  the data base, time.  looks  model f o r e i t h e r  I f they both  checking  in  system  is  made  to  one o f them i s t r u e .  with t r i v i a l REL1)  Should  the  semantic  l o o k s i n the semantic  R*  also  fails,  I f i t attempted  t o come up  to prove  (X  R  A  b e f o r e c h e c k i n g t o s e e i f (A R Y REL1) i s i n  proofs could often  Checking  tends  t a k e an  t h e d a t a base f i r s t  saves  excessive  amount  of  a g r e a t d e a l o f wasted  effort. If  the  proof  succeeds  this  f a r , then  T-TRANS and DETERMINES must be c h e c k e d . must a p p l y a r e s t a t e d If  these  i n section  S i n c e we now know t h a t  relation  which  semantic  model.  is,  a  relation  present.  3.C o f t h i s  p r o p e r t i e s a r e both  succeed.  shows  that  In f a c t ,  conditions  p r e s e n t , then  i t i s  which  chapter.  possible  xRy, we add t h i s  we c r e a t e a v i r t u a l  which i s f u l l y  The r e l a t i o n  The  the properties of  the proof to  will  create  a  i n f o r m a t i o n to the relation  -  that  s e m a n t i c i z e d , but not p h y s i c a l l y  i s g i v e n some a r b i t r a r y  name N,  and  the  assertion: (X R Y N) is  placed  i n the semantic  model.  Further, the p r o p e r t i e s of N  82 a r e a l s o added. determines The  The that  It  relation  only  i n order  $?Y  explicitly  proof  considerably  If  are  several facts  to r e s t r i c t we  are  attempting  since  this  unbound, t h e r e  i s no  Secondly,  of  seldom  at  this  generated  Thus, immediate  more  relations  efficient  again.  will  A  X in  N. and  point  is  immediately. generation  of  would o f t e n  be  to  create  t h a t i t must be  i n the  Therefore,  duration of the  extra effort,  proof  to prove  ($?X  the  done.  mechanism  always  the  especially  $?Y  $?BEL) where  semantic  from  proof  in xBa  i f $?X  is  method.  T h i s saves  i f the  is  model has  same a s s e r t i o n s h o u l d  i t i s removed proof.  work which  Likewise,  aBy  a s s e r t i o n i n the proof,  use  to prove i t v i a the  fail. the  $?R  makes  s u c c e e d s u s i n g an axiom  point trying  point trying  once an  as a s t e p  that the  u n l e s s the proof  method,  the  and  bound t o N,  t h e amount o f u n n e c e s s a r y  b a s e , t h e r e i s no  for  created  when i t i s known f o r s u r e  the data  used  is  o f t e n taken.  i s unbound, t h e n  used  B,  Y determines  g o a l i s now  mean t h a t u n n e c e s s a r y  is  in  L i m i t i n g U n n e c e s s a r y Work  There  done.  are  would  created.  of  N i s not  paths  Y and  X  "returns".  correct  relations  X determines  $?BEL i n t h e o r i g i n a l  reason  the  StiiiCil  then  procedure  Incorrect  example, i f A d e t e r m i n e s  ¥ i n B«,  variable  the proof  For  the  been  never  semantic  a considerable  i s doomed t o  be  model amount  fail.  83  Sii-C^U  Remembering t h e P r o o f  In  order  relational of  the  proof.  of  This  the  is  the  saved.  i s kept  which  name o f t h e r e l a t i o n  i n the l i s t s  which  to the  are r e l e v a n t  part  #RESOLT#, are  the  a r e u s e d , and t h e names o f t h e  i n the r e l a t i o n a l  term  of  which  a r e used  semantic  i n the  information  which c o n t a i n s  i f the information  i n the o r i g i n a l  corresponding  keeps t r a c k of the r e l e v a n t  any t i m e a p i e c e  Further,  referenced  relation  The f a c t s  relations  In f a c t ,  used,  the  information  and #EXTRA*.  domains not p r e s e n t proof.  create  term, M i c r o - P l a n n e r  #RESTRICT#, names  to  this  involves  a  is  information domain  not  t e r m , t h e name o f t h e domain i s a l s o  saved.  Consider,  a s an example, a  proof  of  xRy  which  goes  as  follows: (XRA  REL1)  (A R« Y REL2) Then since REL1  Micro-Planner  the r e l a t i o n  will  s a v e REL1, A, and REL2 i n #RESULT#,  which d e f i n e s  xRy c a n be c r e a t e d  t o REL2 on t h e common domain A.  The v a l u e  by  joining  o f #RESULT#  will  be: ((X REL1) In that  (Y REL2)  general,  (XRA  #RESULT#. also  added  fail,  then  RELS) When  (REL1 A R E L 2 ) ) .  #RESULT# i s c o n s t r u c t e d succeeds,  the  (A R' Y RELX) o r  t o t h e end. Micro-Planner  I f both  list  as f o l l o w s .  (RELN A)  is  Any t i m e added  to  (Y R» A RELX) s u c c e e d s , RELX i s (A R  1  Y RELX) and  backup a u t o m a t i c a l l y  (Y R' A RELX)  erases  the  list  84  (RELN  A) from The  succeeds. is  #RESULT*, ana a new c h o i c e o f A i s t r i e d .  same  basic  Care  i s always  processed  the j o i n s Any the  will  axiom  sufficient  The  reason  used  •  when t h e  (A R Y RELN) list  #RESULT#  RELN) i s made by  for  doing  which  done w i t h a THFIND  this  is  that  which s a y s  i t  ALL  i s not  that  xRy  i n f o r m a t i o n must be e x a m i n e d .  t o prove  that:  $?REL),  R5 and R7 c o n t a i n t h i s i n constructing  than s i n g l e  finding  model, t h e n a l l r e l a t i o n s  This i s easily  i f we a t t e m p t  T h i s i s why #RESULT# rather  (XRY  which c o n t a i n t h i s  SUPPLIES PART#  be  when  a l l t h e domains n e c e s s a r y f o r  t o examine o n l y one r e l a t i o n  s i n c e both  both  to right,  xRy a r e f o u n d .  example,  then  so t h a t  i n the semantic  relations  (S#  taken  applied  be p r e s e n t .  xRy  statement.  For  left  i s  t i m e a p r o o f o f a term  show t h a t  all  from  method  the r e l a t i o n  i s composed  relation  information,  of  lists  they  must  d e f i n e d by t h e term. of  relation  names,  names.  Example 4.4 • Consider  this  t h e term  term,  we  (SNAME SUPPLIES PART*). would  first  check  (SNAME SUPPLIES $?A $?REL) i s an a x i o m . with  $?A b e i n g bound  search  for  a l l  t o S#, and $?REL relations  (S# SUPPLIES PART*) p r o d u c e s set  to  ((R5 R7) S#).  to  bound  containing (R5 R7) .  next  (SNAME $?R« S# $?HEL2) i s an axiom.  see  This goal w i l l being  the l i s t The  I n order t o prove  goal  This i t  the  to  i f  succeed, R5.  A  information  #RESULT#  is  is  see i f  to  i s , and  $?R'  now  is  85  bound the  t o IS-NUMBERED, and  only  relation  which  ( (R5 R7)  S#  (R3)),  defined  by  the  since  SNAME and  The In influence  restrict Each to  •  S#  can  t i m e a new  SNAME and to  #RESULT* i s s e t t o  term.  S i n c e SNAME d e t e r m i n e s  of  t a k e on one relations,  the  relation S*,  and  succeeds.  Knowledge  the  of  basic  two  i s used  proof  was  strategy,  ignored.  forms.  or s p e c i f i c  They  tuples  the  Real world can  within  either  relations.  i n t h e p r o o f , a check  active.  I f not, then the goal  create  the proof  world r e s t r i c t i o n s  see i f i t i s c u r r e n t l y  S#,  Since this i s  how  o f R e a l World  relation  t o R3.  shows  a r e T-TRANS i n R3,  real  whole  be u s e d . to  which  description  of  restrictions  relates  original  Effect  the  $?BEL2 i s bound  is  made  I f so, then the r e l a t i o n  which  just  succeeded  is  can  forced  fail. Example 4.5  •  If  we a t t e m p t  is  returned  relation. implies  to prove bound  I f n o t , we that  when  (S* SUPPLIES PART* $ ? R E L ) ,  to  R5,  then  t r y f o r a new the  list  SUPPLIES PART*) i s formed,  only  R5  must  be  an  relation.  of r e l a t i o n s  and  $?REL active  This  which  active relations  also  show  (S#  should  be  included. Each  time  that  Micro-Planner attempts  the  form  (X R Y RELN) , a c h e c k  in  RELN.  to  s e e i f SUPPLIES i s r e s t r i c t e d  For example, i n  to prove  a term  of  i s made t o see i f R i s r e s t r i c t e d  (S# SUPPLIES PART* R5), i n R5.  we  would  If a supplier  check  were  on  86 strike,  then then t h i s  If  a  would be  restriction  noted.  Using  this  domain  i s being  i s found,  restricted,  however, t h a t t h e  relation  which  is  relation  defined  by  term  were  on in  (S#  not  domain  domain  D being  domains i n t h e  term),  the  D,  to  D.  created  can  being  Y  domain b e i n g  Any of  joined to a  are  placed  1.  The  restriction.  2.  The  domain b e i n g  3.  The  relation  4.  The  domain JD  When  is.  It i s  restricted  is  example,  Nowhere i s by  T.  to r e l a t e  which  a the  if  the  r e s t r i c t i o n could  i s neither X  relation  in  c o n s t r u c t i o n of  be  R3  used  For  this  nor  Y  either X  method whereby t h e  i n the  the  f r o n t of  (the to  relation  contains  the  f o l l o w i n g four  pieces  #RESTRICT#:  restricted.  R which c o n t a i n s which  can  be  this used  domain. to  join  R  to  the  i s complete,  each  relation. processing  of  which i s r e s t r i c t e d  contains  restriction  defined  system attempts in a  find  For  R3.  restricted  time a r e s t r i c t i o n i s found,  original  the  be  which  then the  relation  This results  out  i n the  term.  number i s  restricted.  information  domain  used  the  to  being  in relation  i f the  or  what t h e  SUPPLIES P A R T t ) ,  of  restriction  possible  the r e l a t i o n a l  construction  reason,  and  being  SLOC which a p p e a r s o n l y the  then the  number, i t i s  possible,  T  true.  the  domain b e i n g  domain i s s i m p l y  the  relational  i s compared restricted,  added t o t h e  end  term  t o #RESULT#. then of  the the  I f #RESULT#  restriction  query.  I t can  on now  87  be t r e a t e d  as i f the user  not  used  the  relation  common  had s p e c i f i e d  i n the construction defined  domain  JD.  i t .  If  of the r e l a t i o n ,  by t h e term  with  Thus, t h e l i s t  the  the  domain  t h e n we must  relation  (JB B) i s added  B  is join  on  the  t o t h e end o f  #RESULT#. T h i s approach presents a domains domain  to  the  i s t o be  Examples  5. ff.D P r o v i n g  query  section terms is  been  very  For section,  for  relating how t h e  related.  of this  c a n be f o u n d i n A p p e n d i x 5 and Appendix  6.  xRjH^z  implemented.  3.D, which of  mechanism  when t h e u s e r h a s n o t s p e c i f i e d  A procedure f o r proving has a l s o  general  this  similar  It  utilizes  t e r m s o f t h e form the  shows when i t i s p o s s i b l e  type. to that  This  see A p p e n d i x  result  t o prove  xByB'z  given  f o r i t s binary  o f the r o u t i n e s 9.  in  relational  p r o c e d u r e o p e r a t e s i n a manner  described  a complete l i s t i n g please  relational  which  counterpart.  described  in  this  88  n 5_.5.. The R e d u c t i o n In  Chapter  desirable  the  a new q u e r y  proposed  possess,  of  the  and c o n t a i n s  the a p p l i c a b i l i t y also  The p r e c e e d i n g  sections  to a request.  relations  This  model  describes  as w e l l as the p r o p e r t i e s  c e r t a i n other  information  which  o f the r e l a t i o n s t o the q u e r i e s .  This section  could  construct a l i s t  showing  how  relations  corresponds  a  world  relational  information  could  This section u t i l i z e s sections  to define  relational operations to  5.5.A  queries to  section  the  q u e r y , and t a k e relations. target taking  a  list. the  This  the  Further, i n this  the r e s u l t s which  which  i t was shown how  i n the previous  reduces a  algebra.  be used t o  process.  presented  semantically  query  equivalent  This process  i n the  sequence o f i s referred  algorijU^^  Algorithm  - An O v e r v i e w  presents  a reduction  i n t h e new r e l a t i o n a l  create  term.  process to  create  be used  i n the r e l a t i o n a l  The R e d u c t i o n This  a  calculus  as t h e r e d u c t i o n  to  they  affects  whereby M i c r o - P l a n n e r  to  of  t o determine  a method  real  presented  p o s s e s s e s many  a s e m a n t i c model t h a t i s u s e d  r e l a t i o n s are r e l e v a n t meaning  n  l a n g u a g e which  p r o p e r t i e s was p r e s e n t e d .  t h i s chapter which  IV,  Algorithm  relation the  union  result  The r e l a t i o n intersection  calculus.  defined of i s  the  The b a s i c  common  approach  is  o f the dnf  domains  of  these  upon t h e domains o f t h e  by a c o n j u n c t  the  f o r reducing  each c o n j u n c t  projected  defined of  by  algorithm  relations  i s  created  defined  by  by the  89 relational  terms  Notice  that  independently processed  i n the conjunct. the  of  relational  each  other.  terms  can  Further,  independently of the r e s t  be  processed  the g u a n t i f i e r s  o f the guery.  c a n be  The a l g o r i t h m  proceeds as f o l l o w s : STEP Since  This step  the  guery  disjunction is  to  is  all,  been  returned,  and p r o j e c t  relations, STEP 2  dnf,  will  pass  be r e t u r n e d .  find  each  element  the r e s u l t  This step  on D. 8.  i s referred  Take  the  t o a s t h e CONJUNCT  t h e t e r m c a n be p r o v e n  true, then create  Otherwise, the guery  Call  the  term  s e t of relations  which  defined  this  relations t o them  of  these  Go t o s t e p 7.  If  remember i f t h e r e l a t i o n a l  time  union  t o prove each r e l a t i o n a l  term.  of the  a r e common  t h r o u g h C, and a t t e m p t  the  C  such  Go  by  processor.  Each  When a l l  t h e domains D which  each r e l a t i o n  and c a l l ±  in  t o a s t h e DISJUNCT  STEP 2, t h e CONJUNCT p r o c e s s o r .  done, a r e l a t i o n  have  i s referred  processor.  term  therein.  the r e l a t i o n  fails.  F o r each  defined  relation,  i t is  by t h e r e l a t i o n a l  defined  negated.  terms o f C  RC. STEP 3.. the  r e s t r i c t i o n s t o each  mentioned  Pass through the j o i n  relations  C,  and  apply  i n HC which c o n t a i n s a domain  t e r m s J o f C,  i n RC u s i n g J a s t h e p r e d i c a t e  of relations  relation  relation  in  i n the r e s t r i c t i o n .  STEP  set  Go t h r o u g h e a c h r e s t r i c t i o n term  which  STEP 5.  which  this  Create  were n o t u s e d i n  and  of the j o i n . this  process  join a l l C a l l the and  the  p r o c e s s c r e a t e d RCJ. a  list  I of a l l the r e l a t i o n s  i n RCJ whose  90  defining  relational  relation  from  relation  t e r m s were  L,  and  the  start  again  at  the  Find  front a  L of  Form  relation  a  new  projected with  RS.  on  R.  This  Continue  term  was  by  account.  relation  Do  If  the  result the  relation  target  produces a  If  the  the  is ^  r  RP  term  to  step of  defined  the  then  RN  join  the  and  RP.  was  negated.  RN  and  RP.  between  RP  join  of  between RP  and  the  whose  defining  the  relation  RC, 1.  the  quantifiers  into  by  the  most  the  right  quantifier  i s ¥,  and  domain which RQ The  the the  Then d i v i d e  R w i t h RQ  query.  to  then c r e a t e  quantifier.  except the in  be  difference  passing  r a n g e of  relation  difference  Set  quantifier  the  common t o  the  effect  by  each q u a n t i f i e r  This  projecting list.  Print  although will  list,  Return to  done  this  Remove R f r o m  a relation  RQ  Join  criterion  L.  in  first  R i n L u n d e r the  each r e l a t i o n  relation  is  the  the  R  project contains.  result  is  a  response r e l a t i o n .  This  is  on  the  in  assumed  to  R.  STEP 8.. done by  list.  takes the  t a k e s the  a l l domains  same f o r  on  results  quantifier  on  from  is  process for  step  by  Take  whose d e f i n i n g  projected  processor.  defined  RN  which  conjunction.  This  DISJUNCTION  RQ.  R  Determine the  quantifier.  This  negated.  domains which a r e  This  This  equal. L.  ,in effect, this  the  STEP 2 t  the  RN  negated.  defined  by  the  L and  of  relation  Create a l i s t  it  relation  common domains a r e  STEP 6..  RP  remove  w i t h some j o i n a b l e  that  not  consist  step the  c r e a t e s the relation  this  queries of  a single  R  domains  given  the  relation. are  disjunct.  be  in  dnf,  Therefore,  most  the  queries  reduction  91 algorithm  checks the  the  target  list  the  g u e r y i s assumed t o c o n s i s t o f  or  guantifiers).  Justification  of the  5 5.J3 1 Treatment of A  cbnjuncts.  considering If  two  D,  then the  reduction  is  the  of  join  defined For  by  the  relation  B under  example,  algorithm  the  i f a conjunct  then  the  used  by  relation the  relations any  second  will  In  project  defined  since  desired  by  and  states that  that  supplied two  first  not  a p p e a r i n the  join  the  the  e l e m e n t s i n the  the  by  A  with  the  values  the  in  variable  relation  shows t h e  by  the  terms  number i n t h e  is  terms  defined relation  of D are  egual.  terms:  that  part  processing  of r e l a t i o n a l  (S* SUPPLIED PART*),  i s one  these  then  terms.  B have a common domain  contains  (PROJECT* USED PART#) S  V symbol,  Disjunctions  defined  criterion  an  including  Algorithm  treatment  t e r m s A and  (not  a s e t of conjoined  Reduction  the  guery  I f i t i s not  C o n j u n c t i o n s and  A  B e g i n by  second element of the  supplier.  produces  relation and  vice  a d i s j u n c t i o n , however,  union of c e r t a i n p r o j e c t i o n s disjunction.  parts  of  For  which  were  Joining  this  the  relation,  which i s not  in  the  versa. the  the  relation  relation  example,  if  defined  defined the  by  guery  contains: (SUPPLIES SUPPLIES PART*) V taking  the  PART* w i t h  union the  of  the  projection  (PROJECT* USES PAST*)  p r o j e c t i o n of the of  the  second  first  relation  relation on  on  PART*  92 produces the c o r r e s p o n d i n g Notice  t h a t the q u e r y  relational can  relation. l a n g u a g e has  terms a r e compatible,  a l w a y s be  carried  joined, resulting negated negated must  terms term  not  are  relations  each c r e a t e d .  i n a single  must  the  and  now  relation  be  contained  taken  the  These r e l a t i o n s a r e  then  RP.  The  into  account. some  i n the response  effect  relation,  of D i s e g u a l  D i n RN.  easiest  i s to take  way  between t h e p r o j e c t i o n  then •  results  join  this  Example 5.1 If  the (S#  then R2  o f RP  in a l i s t relation  on  D and  the  Since  each  we  D  with  which  attempt  to  to a value  of  the  projection  difference o f RN  of a c c e p t a b l e v a l u e s f o r the  on  D,  domain),  RP.  guery i s : :  (S# we  SUPPLIES PART*) S create  the  (PART* P R O J E C T * ) .  enumerates  and  - t (PART* IS-DSED-IN  relations Taking  R2[PART*]  all  the predicate (S*  this  the  •  R1[PART#]  R4  t o do  of  domain  t u p l e i n R whose v a l u e  (which  process  defined  e l i m i n a t e any The  union  by  d e f i n e s a s e t of values f o r  be  join  Terms  In p r o c e s s i n g a c o n j u n c t , terms  the  the  out.  T r e a t m e n t o f Negated  non-negated  and  been d e f i n e d so t h a t  the  produces  allowable parts.  (EQ  (R1  2)  (R2  R1  1))  (S#  PROJECT*))  PARTS),  difference a  relation  Joining results  R3 in  between R3  w i t h R1 a  and  which using  relation  PART*), where t h e s u p p l i e r s u p p l i e s a p a r t which i s  93  not  used  i n the  project.  5.5.B.3 T r e a t m e n t o f Q u a n t i f i e r s The  query  s u c h a way ,  the  specified. one  created  returns is •  to  allowable  Therefore,  by  calling  the  the  f o r the  be  over  in  a s i n g l e domain  domain  can  i n dnf,  the  relation  they  d i s j u n c t i o n processor.  name o f t h e  easily  be  which  relation  define  This  can  processor  o v e r which t h e q u a n t i f i c a t i o n  range.  Calling  • the  (PABT# S results  d i s j u n c t i o n processor  If the  the  in a r e l a t i o n  value  since only are  Example 5.3 If R  the (  whose t u p l e s a r e  q u a n t i f i e r i s u n i v e r s a l , then  o f RQ  the (EQ the  d i v i d e d by the  the  the  relation  parts  RQ  t u p l e s i n R which a r e  •  S* 1 1 3  PROJECT*  relation  desired.  relation  quantifier: 7))  which  are  7.  q u e r y must be  quantifier,  with  (PART* IS-DSED-IN PROJECT*) S  used i n p r o j e c t  •  only  quantifiers  each q u a n t i f i e r d e f i n e s a r e l a t i o n  q u a n t i f i e r s are  Example 5.2  by  values  coupled  domain.  Since be  range  t h a t q u a n t i f i c a t i o n can  although  has  language d e f i n e s  R defined PART* 1 2 1  by  the )  query i s :  R  defined  defined by  the  " t r u e " f o r each  94  and  the r e l a t i o n  BQ  (  PARTt 1 2  If  (  by  projected so  that  value •  S# 1  the  by t h e q u a n t i f e r  ) is  query  existential,  must  be j o i n e d  then with  the BQ,  on a l l domains b u t t h e domain D o f BQ. the only  tuples  If  5.4  (  and  the r e l a t i o n  {  Projecting RR  This  and t h e r e s u l t This  is  done  exists a  BQ.  BQ  defined  B with  RQ  by t h e q u a n t i f i e r :  yields:  PARTt 7 8  this  relation  St 1 3  )  relation  )  )  S# 1 3  (  of the query i s :  (S# SUPPLIES PARTt) ) i s :  PARTt 7 8  (  by t h e m a t r i x  PARTt 7 6 8 4  then the j o i n RP  B defined  S# 1 2 3 4  i(PABT# & BQ  B  •  the r e l a t i o n  B  relation  o f B a r e t h o s e f o r which t h e r e  o f D i n B which a l s o e x i s t s i n a t u p l e o f  Example  (¥ PARTt) i s :  R (PARTt/PABTt)BQ i s :  the q u a n t i f i e r  defined  defined  )  Then t h e q u o t i e n t BP  BQ  lists  PARTt 7 8  )  on S t p r o d u c e s :  a l l s u p p l i e r s f o r which t h e r e  exists  a  95 part  with  the  5..5..C The  Allowable  The any  desired  current  of the  (SNAME SLOC  version  not  :  relate This  the  could  world  never  be  is  the  used  explicit  5i5iP  the way  the  eliminates  a new  Relational Calculus of  reducing  the  the  relational  request,  of  the  c a l c u l u s proposed  gueries  in  this  by  to  response way  the  try  to  relation. that  real  used i n t h e  guery  as:  be  done. the  Should  user  to  t o make t h e s e  SNAME  make  be  such  decisions.  Codd i s B y p a s s e d in this  language  r e l a t i o n s which  then t r a n s l a t e the  of  system, a f t e r  have  the  the  PROJECT*))  need  gueries  to  to  Forcing the  the  would  such  i s that  construction  domains n o t  should  PROJECT*?  as:  restriction  Therefore,  (PART* IS-USED-IN  Micro-Planner to i d e n t i f y  how  in  thus c r e a t e  use  known  this  guery.  what  such  PART*))  response r e l a t i o n ,  unclear  relations  One  appear i n each  must a l s o  Thus, g u e r i e s  which r e f e r e n c e  t o PART*, o r  Why  list  However, w i t h g u e r i e s  still  related  s p e c i f i e s that  done i n a manner s i m i l a r  restrictions  handled.  be  Lists  guery language  reason f o r  t o SLOC, and  (SNAME SLOC : it  by  initial  SNAME  i n a target  The  defined  creating  the  (SNAME SUPPLIES  acceptable.  relation  i n Target  of  guery body.  domain SLOC may  are  Variables  variable occurring  disjunct  are  condition.  are  g u e r y i n t o an Codd.  l a n g u a g e can  Since be  would be  relevant  expression  i t  to  is  r e d u c e d , and  in  already since  96 this  reduction  appear  t o be  algorithm  a logical  However, relational  the  has  process  Firstly,  of  translating  old relational  one  Chapter  III  showed,  becomes  complicated.  are unaffected  by  Micro-Planner the r e t r i e v a l it  is a trivial  query is  as  simply  complexity  be  task  awkward t o  to create  would  Dsing  the  a  i n the  new  extremely  representation  tuple  variables.  t u p l e v a r i a b l e s can when  data  complete  the  data  be  base  base.  information only  relation.  old r e l a t i o n a l  practical.  this  to  how  information,  Re-expressing  c a l c u l u s while  Codd's r e l a t i o n a l  as  this  possible,  calculus i s just  too  use.  Further, efficient  it  domain v a r i a b l e s , however,  of the  accomplished.  a q u e r y i n the not  using  also provides  can  using  especially  Queries  the  from  which u s e s  gueries  e x t r e m e l y awkward t o e x p r e s s ,  gueries  calculus i s  i s translating  w h i c h u s e s domain v a r i a b l e s t o one As  been i m p l e m e n t e d ,  approach.  c a l c u l u s to the  difficult.  already  the  than  new  reduction  Codd*s.  algorithm  Consider,  is  f o r example,  often  more  the q u a n t i f i e d  expression: ¥ (P2r2 S In  the  new  relational  ¥ (PABT# & using  (r1[1]=10 v  (OB  (EQ  Codd»s r e d u c t i o n  (P2r2 & r2[ 1 ]=10) ,  r1[1]=12))  calculus, this PARTt  10)  (EQ  algorithm,  query i s represented PABT*  the  two  as:  12))) r e l a t i o n s defined  by:  and  (P2r2 S r 2 [ 1 ]=12) are created,  and  their  union  i s taken.  This  process  requires  97  four  passes  relations these  through  d e f i n e d a b o v e , and  relations.  p a s s o f one which  With  relation  enumerate  which  is  current  new  reduction  simply  system, input  allows  to g i v e the  users  a  r e l e v a n t , and  processing  guery  the  a guery.  has  the  algorithm,  t u p l e s of  subjected  the  to the  the  new  union  of  only  one  relation  restriction  When a u s e r immediately  good,  affects  each  of  type  Micro-Planner  the  real  he  which  semantic  has  World  semantic  there data  world  system  the  cannot model.  This  which t h e y  think  information  when  impression  said.  be  One  that  the  such c l a s s  of  information.  is  Knowledge  no  information,  This  in  of  be  how  this  by  facilities  to  entered  whose p u r p o s e i s t o  must p r o v i d e  does  corresponding  which might  base i s a f f e c t e d  i t is  itself  indication  Therefore,  knowledge  data  world  model.  base.  ANTECEDENT t h e o r e m ,  The  user  a piece of r e a l  which p a r t o f t h e  information.  what  i n the  since  information  a user  information  gives the  of Real  enters  placed  Knowledge n  system i n t u r n uses t h i s  world  Representation  from  s y s t e m any  This  i s real  World  i s added t o t h e  "understood"  information  system  are  creating  for constructing  Treatment of Real  as  little  for  i s made, s i n c e t h e  interpreted  5. 6..A  the  PART*  5..6.. The  In t h e  system  two  two  given.  •  is  relations:  this  is a  notify  the  type  of  to allow  these  98 theorems  t o be e x p r e s s e d .  writing  theorems  relation  i n the data base.  "This  the  information  Of  particular  user  need  is  never e x p l i c i t l y  Instead,  affects  concern  he s h o u l d  a l l relations  in  reference  be a b l e  which  that  to  a  say,  satisfy  this  criterion."  This  i s i n keeping  organization changed  the  accordingly,  unaffected The the  of  effect  data  i s changed  and  the  user  his  o f any r e a l  portion  discussed  above  relations  are  and  i f  the  t h e s e m a n t i c model i s programs  of the data  inactive  a r e t o be  handled.  world i n f o r m a t i o n base.  will  Therefore,  must make use o f t h e a s s e r t i o n s  The c u r r e n t is  p r i n c i p l e that  should  be  by t h e c h a n g e .  active  relations  with the general  and  that the usable  be t o  the  alter  theorems  which s t a t e tuples  that  of c e r t a i n  restricted.  s y s t e m d e m o n s t r a t e s how  F o r example,  real  world  information  we c a n s a y :  (CURREST PARTS ARE NOT AVAILABLE) o r (OBSOLETE PARTS ARE NOT AVAILABLE). The c o r r e s p o n d i n g  M i c r o - P l a n n e r theorem i s :  (TBANTE NOT-AVAILABLE (X RELS) ($?X ARE NOT AVAILABLE) (THSETQ $?RELS (THFIND ALL ($?REL) (REL) ($G ($?REL CONCERNS $?X)) (THMAPC •ASSERTFUN $?RELS) ) (THCONSE ASSERTFUN This not  theorem  (X)  ($?X)  states  that  a v a i l a b l e i s to a s s e r t  X that  REL  i s inactive.  ($A  ($?X IS  INACTIVE)))  the r e s u l t of a s s e r t i n g t h a t  f o r each r e l a t i o n  Thus  ))  i f we:  REL  which  X is  CONCERNS  99  ($A the  (OBSOLETE PARTS ARE NOT  assertion: ($A  will  (R8 IS NOT  AVAILABLE))  automatically The  system  suppliers parts,  who  be added t o t h e s e m a n t i c m o d e l .  a l s o handles r e a l go on s t r i k e . .  when someone  certain  part,  clearly  concerned  the supplying  there  affect  suppliers  who  dealing  can  who  i s on s t r i k e  semantic  information  of a part  should  parts.  they  On  the  we r e a l l y  other  hand,  supply should which  be " n o t i f i e d "  i f we ask f o r a l i s t  want a l l s u p p l i e r s r e g a r d l e s s  a r e on s t r i k e .  This  i s the reason  with  the supply  i s a r e s t r i c t i o n on t h e s u p p l i e r s who c a n c u r r e n t l y  suppliers, not  any  information  strikes  any s u p p l i e r  Therefore,  with  world  Since  asks f o r the  be i n c l u d e d .  the  AVAILABLE) $ T ) ,  why  of a not is that  supply of a l l  o f whether o r  restrictions  are  stated as: (SUPPLIES IN R3 IS-RESTRICTED-TO (R3  IS-RESTRICTED-TO  If  this  SUPPLIERS  were a s s e r t e d ,  immediately know t h a t  be  ARE ON  STRIKE).  This  Assert  2.  Find  that  (REST*1 RESTRICTS  thereom  general  X s u p p l i e r s a r e on s t r i k e ,  1.  A supplies  b.  A supplies*  ON-STRIKE  theorem  says t h a t  would i f we  then:  SLOC TO  a l l r e l a t i o n s R which s a y t h a t  a.  than  the statement:  the antecedent  invoked.  rather  REST#1).  As an example, c o n s i d e r (VANCOUVER  REST#1)  (NOT  (EQ SLOC X ) ) )  either:  B B, where s u p p l i e s *  is  "supplies  number  of  100 parts" c. and  A is-supplied-by  then a s s e r t  (SUPPLIES IN  b.  (SUPPLIES* IN  C.  (IS-SUPPLIED-BY IN other  suppliers before  one  use  be  which  this  R IS-RESTRICTED-TO REST#N)  notify  type  a l l relevant  of  necessary to  takes the  w h i c h does n o t . the  system  or  predicates certain  that  the  criterion  used.  of  i t i s not  or  R IS-RESTRICTED-TO R E S T t N ) ,  words,  t h e y can  occurs,  R IS-RESTRICTED-TO REST#N),  t h e y have as a r g u m e n t s must s a t i s f y  The  and  that  a.  In  one  B,  system  keep two  a f f e c t s of  Instead,  makes s u r e  the  the  data  that  means t h a t  if a  copies  of  strike  i n t o account,  base  each  strike  relation  remains  i t uses only  and  constant,  active  tuples  and  when  trying  to  relations.  n 5_.7j_ M u l t i p l e P a t h  One resolve that  of  the  same  of  the  a  query i n a language which i s r e l a t i o n  multiple  proofs. sometimes  same  paths.  query, Sometimes all  where m u l t i p l e the  serious  Problems n  are  and any  p r o b l e m s which  There are thus one  required.  p a t h s o c c u r due  information,  one  often  there of  arises  several  are  often  these Three  where  ways t o  several  proofs cases are  to s e v e r a l  independent  is  are  answer  "correct"  sufficient;  examined -  relations  queries  is  one  containing  ambiguous  and  101 several and  paths are found,  finally  one  each  o f which  where s e v e r a l  has  a different  paths e x i s t  but each  meaning,  has t h e same  meaning.  Consider a semantic  model  which  contains  the  following  information: a.  (S* IS-NAMED SHAME  B3)  b.  (S# SUPPLIES  PART*  R5)  C.  (S#  SUPPLIES PART*  R7)  In  this  can  case,  be  t h e r e a r e two  related,  and  thus  (SHAME SUPPLIES PART* $?REL) c o u l d a  and  b  or  importance,  a  and  since  before  system  automatically  contain  any  relations Multiple  c.  The the  is  t a k e n , and  p a t h s due  information  to  Consider  now  for  a l l  used  a semantic  is  the The  of either  i s of  computed,  no the  relations  which  union  these  of  i n further processing.  relations  with i n t h i s  using  i s selected  result  PART*  proof  accomplished  p r o o f which  the r e s u l t  SHAME and  the  i n the proof.  several  are a l l d e a l t  be  final  searches  i n f o r m a t i o n used  ways i n which  containing  the  same  manner.  model which  c o n t a i n s the  following  information: a.  (EMPLOYEE IS-PAID SALARY WORKS-SHIFT SHIFT*  b.  (SHIFT*  C.  (FOREMAN  The to  request  foremen  does  not  IS-SUPERVISED-BY FOREMAH IS-PAID SALARY (EMPLOYEE $?R  by some a r b i t r a r y  R1)  B2)  R3) FOREMAN $?REL) t o r e l a t e  relation  i s ambiguous;  employees  the  system  know whether t h e u s e r wants t h e e m p l o y e e s and  foremen  102 who  a r e working  In  a n y c a s e where t h e q u e r y c o n t a i n s a p r e d i c a t e  unspecified, several of  t h e same s h i f t ,  the query  may  "correct" proofs.  o r who  be  receive  ambiguous  The c u r r e n t  system  one  i s working  i n a natural  was  there  left  will  be  simply chooses  one  language environment,  q u e r y i s e n c o u n t e r e d which c o m p i l e s i n t o query  which  asked  system  has an u n s p e c i f i e d to  clarify  a  predicate,  relational  calculus  the user s h o u l d  h i s r e q u e s t , o r be t o l d  which  i fa  either  meaning t h e  has assumed.  Finally, following  consider  a  semantic  model  which  contains  the  information:  a.  (S# SUPPLIES  b.  (PART* IS-CALLED PART-NAME  C.  (S* SUPPLIES PROJECT  d.  (PROJECT USES PART-NAME  If  a  PART*  relational  term  R1)  R4)  (S* SUPPLIES PART-NAME  assuming  conditions  the following  hold,  R2)  R3)  be p r o v e n , t h e n  1.  and  which  salary.  them.  If  be  t h e same  the  proper  T-TRANS  $?REL) and  were t o  EITERMINES  two p r o o f s a r e p o s s i b l e :  (S# SUPPLIES PART* R1) and (PART* IS-CALLED PART-NAME R 2 ) , o r  2.  (S* SUPPLIES PROJECT  R3) and  (PROJECT USES PART-NAME R4). This of  example i l l u s t r a t e s  which  £2£§istent  have  the  i t does  same  t h e c a s e where two p a t h s e x i s t meaning.  not matter  which  Providing proof i s  each  t h e d a t a base i s  chosen  since  the  103  result not  of each  consistent  files) the  then  (ie.  one  i s the  same.  However, i f t h e  some i n f o r m a t i o n i s m i s s i n g  must p e r f o r m  both  p r o o f s and  data  from  take  base i s  one  the  of  the  union  of  results. In  general  current  system  Attempting explosive of  proof  does not  to  find  path.  this  proving  this;  cycles.  is  a l l valid  proofs.  i t f i n d s o n l y one proofs  i s no a p r i o r i  i n the  problem  to find  possible  In e f f e c t ,  t r u n c a t i o n on  theorem  do  all  since there  a valid  with  i t i s necessary  is  bound on  such  proof.  combinatorially  the  length  first  search  must do  The  c u r r e n t system e s s e n t i a l l y  decidable.  a breadth  maximum  one  propositional  calculus,  However,  The  and  the  does  therefore  solution  is  impractical. It data  bases are  which  a partial  return the  f o l l o w s that the  certain  values.  the data  not  consistent.  solution values This  online  update.  presented  in  The  system  which a r e c o r r e c t , b u t problem  only  bases are  incomplete  That i s , there e x i s t  i s returned.  base i s i n c o m p l e t e .  even c o n s i s t e n t data of  system  arises  T h i s case  not  gueries  will  for  sometimes  necessarily a l l  when t h e must be  when  information  considered  often i n c o n s i s t e n t during  in  since  periods  104  VI. Current has  research  resulted  languages.  in  SUMMARY  in relational  the  proposal  d a t a base  management  systems  several  different  query  of  Each o f t h e s e r e q u i r e  t h e u s e r t o d e t e r m i n e how  retrieval  i s t o be  done, and  to specify  relevant  to  request.  T h i s type of language  for  the  many a p p l i c a t i o n s ,  and  i s undesirable  independent of the o r g a n i z a t i o n A need  was  queries specify This of  observed f o r  This  the r e t r i e v a l  thesis  relational  has  systems,  processing  retrieve  information,  theorems  t o be p r o v e n .  The contained the  i s unsuitable  the user i s not  language  in  o f a system  done u s i n g  a  new  each The  i s capable  to a query,  these  and  relations.  query  which  language  for  capable  of  is  l a n g u a g e i s d a t a base  the r e l a t i o n s  retrieved.  which  are relevant  which  directly.  independent In o r d e r to  q u e r y i s f o r m u l a t e d as a s e r i e s s t e p s of  the  proof  show  how  of the  done.  reduction  of  queries  i n a s e m a n t i c model.  entire  query  framework  The  system,  since  This  is  based  model f o r m s  the i n f o r m a t i o n  c h a r a c t e r i z e s the data base. is  which  a  these queries.  can be  new  presented  and q u e r i e s n e v e r r e f e r e n c e  retrieval  a  c a n be  and  are  of the data base.  the development  determining the r e l a t i o n s how  since  which  o n l y t h e p r o p e r t i e s o f t h e d a t a t o be  necessitates  deciding  the r e l a t i o n s  the  In t h i s  upon the  information basis  for  i t contains completely  work, t h e  semantic  r e p r e s e n t e d as a s e t o f M i c r o - P l a n n e r a s s e r t i o n s ,  model  although i t  105 is  shown  that  conventional will in  be  new  a natural  systems  easily  data s t r u c t u r e .  a d a t a base  query language  The  are capable of compiling which  represented using  existing  of  languages, s i n c e should  be  specifies  should  does  semantic  used  model gueries  as t h e t a r g e t  a natural  language  the p r o p e r t i e s  guery  these into  a  of the r e g u e s t .  the r e t r i e v a l  be.  T h i s means t h a t  systems  are  not  the systems  language  s e m a n t i c components o f  they  suitable  c a n n o t d e t e r m i n e how  is  to  be  the guery as  the  target  retrieval  done.  Future r e l a t i o n a l systems language  a  attempts t o handle  a r e n o t c a p a b l e o f d e t e r m i n i n g how  languages  that  a more  language.  system.  nor  i n p u t , or at l e a s t  which  hope t o make use  thesis.  will  be f o r c e d  of  p r o v i d e u s e r s with a guery  n o t r e g u i r e them t o know how  processed, this  which  l a n g u a g e c a n be  accomplished,  which  be  It i s felt  system  independent  representation They  could  n e c e s s a r y i n any  The of  i t  their  reguest  t o a d d r e s s the problems  natural language will  discussed  be in  106  BIBLIOGRAPHY  1.  A r m e n t i , A. e t a l . "LISTAR - L i n c o l n Associative Retrieval System." SJCC_, pp.313-322.  I n f o r m a t i o n S t o r a g e and £l2££edings_of_the_2970  2.  Bracchi, G. e t a l . "A Relational Data System." P r o c e e d i n g s _ o f _ t h e 1 9 7 2 Annual ACM pp.1080-1089. m  Base Management Conference of the  X  3.  Childs, David L. "Description of Structure." Proceedings_of_the_J96  4. C h i l d s , David Structure." pp.420-430. 5.  L.  a  S e t - T h e o r e t i c Data pp.557-564.  "Feasibility of a S e t - T h e o r e t i c Data P r o c e e d i n g s o f t h e 1968 I F I P C o n g r e s s ^  C o d a s y l Systems Committee. Feature Analysis.of Generalized p § ^ § - l a g g - M a g a g § i g g ^ _ § i § ^ g 5 § i . May 1971.  6. C o d a s y l S y s t e m s Committee. A Survey M a n a g e m e n t _ S y s t e m s May 1969.  o f G e n e r a l i z e d _ D a t a Base  x  7.  Codd, E.F. "A Data Relational Calculus." Workshop^ pp.35-67.  Base Sublanguage Founded on t h e P r o c e e d i n g s o f the_1971_ACM_SIGFIDET  8. Codd, E . F . "A R e l a t i o n a l Model o f Data Banks." Communicatigns_o^  f o r L a r g e Shared Data pp.337-387.  9. Codd, E . F . F u r t h e r _ H o r m a l i z a t i o n o f t h e Data Base R e l a t i o n a l Model. I.B.M. Research Report RJ909, Yorktown Heights,  N.Y.7~1971.  10. C o d d , Tutorial.  E.F. I.B.M.  NTY.7 1971.  Normalized.Data B a s e _ S t r u c t u r e : _ A ^ B r i e f R e s e a r c h R e p o r t RJ935, Yorktown H e i g h t s ,  11. C o d d , E.F. SufilasguageSt I.B.M.  Heights7~N.Y*7, 1972.  B  g^a^i9Sal_Cpmpleteness_of_Data_Base Research Report RJ987, Yorktown  107  12. F e l d m a n , J . and P. Rovner. "An Algol-Based Associative Language." Commujicatigns_of_the_^ pp.439-458. 13. Codd, E . E . Seygn S t g p s t o ^ R g n d e z y o u s ^ g i t f a _ t h e _ C a s u a l t y s e r . I.B.M. R e s e a r c h R e p o r t RJ1333, Yorktown Heights, N.Y., 1974. 14. G a m m i l l , R.C. "Applications o f R e l a t i o n a l Data S t r u c t u r e M o d e l s i n Man-Machine Systems." Proceedings., o f _ t h e _ 1972 ^JllSl2_£2IllSI§ii£S_of_the_ACM pp.460-468. i  15. G o l d s t e i n , Robert C. and A l o i s S t r n a d . "The MacAIMS D a t a Management System." P r o c e e d i n g s o f _ t h e 1970 ACM S I G F i p i T W o r k s h o p pp.200-228. x  16. H a l l . W., B. J e r v i s , and J . J e r v i s . WALT.. Department o f Computer S c i e n c e , U n i v e r s i t y o f B r i t i s h C o l u m b i a , 1973. 17. H e a t h , I.J. "Unacceptable F i l e Operations i n a R e l a t i o n a l Data B a s e . " P r o c e e d i n g s _ o f _ t h g 1971_ ACM S Iff F I PET Workshop^, pp.19-33. 18. H e w i t t , Carl. Description_and_Theoretic Schemal_of:_Plann^ 9 PJ£ l§!:iSg-Mpfl§il§-iP- -gOfiOt. Cambridge, Massachusetts I n s t u t u t e of Technology, Revised D i s s e r t a t i o n , AI T e c h n i c a l R e p o r t no 258, 1972. a  u  a  JUsing Mass: Ph.D.  19. J e r v i s , B. And J . L . P a r k e r . "An A p p r o a c h f o r a Working Relational Data System." P r o c e e d i n g s . o f . t h e 1972 ACM S I G F I £ E T _ W o r k s h g £ pp.125-145. A  20. Kuhns, J . L . " Q u a n t i f i c a t i o n i n Query S y s t e m s . " Proceedings of_£i?g_l§Z.l^,ACM^Symposium on I n f o ^ J a t i o . n _ S ^ o r ^ g e _ a n a ReIJLigy.aI pp.81-92. t  21.  L e v i e n , R.E. a n d M.E. Maron. "A Computer System f o r I n f e r e n c e E x e c u t i o n and Data R e t r i e v a l . " Communications of t h e ACH_I1J196 7 1 pp.715-721. X  22.  M e a l y , G.H. J967_FJCC  X  "Another Look pp.525-534.  at  Data."  Proceedings_of the  108  23.  Minker, J . and S. Rosenfeld. "Introduction and P e r s p e c t i v e s f o r t h e 1971 ACM I n f o r m a t i o n S t o r a g e and Retrieval Symposium." £rp^eedings_of_the_J97^_ACM Symposium_on_Information^ pp.1-37"  24. N o t l e y , M. G. The P E T g R L E E I S y i System. S c i e n t i f i c Report7~Peterlee7~u7K.7"* 1972? 25.  I.B.M.  DK  Pacak, Milos and A. P r a t t . "The F u n c t i o n o f S e m a n t i c s i n Automated Language Processing." £locee3inss_of_the_J972 1CM S y m p o s i u m , o n _ I n f o r m a t i o n ^ S t o r a g e ^ a n d _ R e t r i e y a l 7 ~ pp.5-17.  26. P a l e r m o , Frank P. &_Data^Base_Search Problgm. I. E. M. R e s e a r c h R e p o r t RJ107 2, Yorktown~HeIghts, H7Y77~1972. 27.  S t r n a d , A . J . "The R e l a t i o n a l A p p r o a c h t o t h e Management o f Data B a s e s . " P r o c e e d i n g s _ o f _ t h e 1971_ I F I P ^ C o n g r e s s August 1971. Pp.91-957 fj  28. Symonds, A . J . and R. Lorie. Relational Data Base." S I G F I D E ^ W o r k s h o p ^ pp. 230-244. 29.  "A Schema f o r D e s c r i b i n g a P r o c e e d i n g s o f _ t h e _ 1 9 7 0 ACM  Thompson, F. e t a l . "REL - A R a p i d l y E x t e n s i b l e L a n g u a g e System." Proceedings o f the_24th_ACM_National_Conference^ 1969. pp.399-4177  30. T s i c h r i t z i s , D. e t a l . "The Case f o r Relational Bases." CIPS_Com£uter_Magazine_2_Q 9 7 4 ] ^ pp.21-28. 31. W i l c o x , B. and C. H a f n e r . Health aesearch I n s t i t u t e ,  Data  LISP/MT^_0ser2s_Guide Mental Ann Arbor7"*Michigan7~^973. i  32. W i n o g r a d , T e r r y . Procedures as a Representation f o r D a t a i n S_£oi£uter_Program_for_Dnd^ Cambridge, Mass.: Massachusetts I n s t i t u t e of Technology, R e v i s e d Ph.D. D i s s e r t a t i o n , MAC TR-84,1971.  33. Woods, W. Machine."  " P r o c e d u r a l Semantics f o r a Proceedings_of_the_J968_FJ  Question Answering pp.457-471.  109  Hoods, W. The_Lunar_Scienc I n f o r m a t i o n System: F i n a l Report. Bolt, Newman~Tnc.~ BBN~Report No7~ 2378, 1972.  Beranek,  and  Woods, W. " T r a n s i t i o n Network Grammars f o r N a t u r a l L a n g u a g e Analysis." C o m m u n i c a t i o n s o f t h e ACM 1 0 ( 1 9 7 0 ) , pp.591-606.  110  APPENDIX The  R2  (  PROJECT* 1 2 3 4 5 6  R3  (  SNAME APPOLLO SHEET METAL VALLEY STEEL PEARSON IRON WORKS COAST STEEL  S* 1 1 1 1 2 2 2 2 2 2 2 3 3 3 4 4 4 4 4 4 4 4 4  PART* 7 3 7 2 1 1 5 3 7 7 7 4 4 2 1 2 3 4 5 6 7 8 9  Data_Base  PROJECT-NAME ROYAL TOWERS BURRARD SHIPYARDS P.C.C. RAPID TRANSIT GRANVILLE MALL OLYMPIC SEAWAY  SPARTS 4 1000 25 40 400 800 50 1000 12 15 26 80 80 200 400 20 1000 40 25 1 23 500 10  S# 1 2 3 4  1.  PLOC ) VANCODVER VANCOUVER MERRIT VICTORIA VANCOUVER VICTORIA  SLOC ) MONTREAL TORONTO MONTREAL VANCOUVER  PROJECT* 2 3 3 6 4 5 5 1 3 2 6 2 2 2 1 1 2 1 4 5 5 3 3  DATE-RECEIVED SEPT 15 SEPT 19 SEPT 19 OCT 1 AUG 21 AUG 24 AUG 24 SEPT 7 SEPT 15 SEPT 17 SEPT 19 MAR 14 MAR 27 APRIL 17 SEPT 6 SEPT 6 SEPT 9 SEPT 6 OCT 12 OCT 17 OCT 17 NOV 3 NOV 3  The  Data Base  111  E1  (  PART* 1 8 3 9 5 6 7  R5 (  R10  PRICE 20 25 2 40 45 98 74  ECT# 1 1 1 1 1 1 1 1 2 2 3 3 3 3 4 4 4 4 4 4 4 5 5 6 6 (  ORDER* 1 2 3 4 5  PURCHASE-UNITS 400 500 1000 10 25 1 1  PART# 1 7 1 3 8 1 7 1 4 3 3 4 9 6 6 9 5 6 4 5 8 3 9 5 7  #PARTS 400 14 800 1000 25 400 15 400 40 1000 1000 80 10 1 4 100 50 3 40 25 500 1000 10 50 2  )  S# 4 4 1 2 2 2 2 3 1 4 1 2 4 4 3 3 3 1 4 4 4 1 4 1 4  SALESMAN* 17 27 32 4 27  The  Data  Ease  112 R6 (  PROJECT# 1 1 1 2 2 2 2 3 4 4 5 5 5 6  R7 (  s# 1 1 1 2 2 3 3 3 4 4 4 4 4 4 4  R8  PART* 2 4  (  R9 (  PART* 1 7 3 3 4 1 5 4 6 5 9 3 1 5  PART* 1 4 3 2 4 1 6 9 1 2 3 8 5 6 9  ORDER* 1 2 3 4  QOH 14 6 754 201 1 207 13 1 2 140 47 28 101 24  QOH 1600 40 4000 20 41 1200 40 3 800 3 2000 500 50 3 20  PRICE 36 48  PURCHASE-UNITS 10 40  SOURCE ) MONTREAL MONTREAL TORONTO VANCOUVER  The  Data  Ease  113 APPENDIX  2.  ($A ($A ($A ($A  (PART* COSTS PRICE R1)) (PART# COMES-IN PURCHASE-UNITS (R1 P-ENUHERATES PART*)) (R1 CONCERNS CURRENT-PARTS))  ($A ($A ($A ($A ($A ($A ($A ($A ($A ($A ($A  (PROJECT* IS-CALLED PROJECT-NAME R2)) (PROJECT-NAME IS-NUMBERED PROJECT* R2)) (PROJECT* IS-IN PLOC R2) ) (PROJECT* DETERMINES PLOC R2) ) (PROJECT* DETER MIMES PROJECT-NAME R2)) (PROJECT-NAME DETERMINES PROJECT* R2)) (PROJECT-NAME DETERMINES PLOC R2) ) (R2 ENUMERATES PROJECT*)) (R2 ENUMERATES PLOC)) (R2 ENUMERATES PROJECT-NAME)) (R2 IS T-TRANS) )  ($A ($A ($A ($A ($A ($A ($A ($A ($A ($A ($A  (S# IS-CALLED SNAME R3) ) (SNAME IS-NUMBERED S# R3) ) (S# IS-IN SLOC R3)) ( S * DETERMINES SLOC R3)) (S# DETERMINES SNAME R3) ) (SNAME DETERMINES S# R3) ) (SNAME DETERMINES SLOC R3)) (R3 ENUMERATES S») ) (R3 ENUMERATES SNAME)) (R3 ENUMERATES SLOC)) (R3 IS T-TRANS) )  ($A ($A ($A ($A ($A ($A ($A ($A ($A ($A ($A ($A  (S# SUPPLIED PART* R4) ) ( S * SUPPLIED-TO PROJECT* RH)) (PROJECT* ORDERED-FROM S# R4) ) (S# SUPPLIED-* #PARTS RH) ) (PROJECT* USES PART* R&) ) (PART* IS-USED-IN PROJECT* R4) ) (PROJECT* ORDERED PART* RI)) (PROJECT* RECEIVED-OH DATE-RECEIVED EH) ) (PROJECT* RECEIVED-* *PARTS RECEIVED-ON DATE-RECEIVED R4)) (PROJECT* RECEIVED PART* RECEIVED-ON DATE-RECEIVED R4)) ( S * SUPPLIED-* #PARTS SUPPLIED-TO PROJECT* R4)) ( S * SUPPLIED PART* SUPPLIED-TO PROJECT* R4))  R1))  The  Semantic  Model  114 ($A ($A ($A ($A ($A ($A ($A ($A ($A ($A ($A  ( S t SUPPLIES-TO PROJECTt R5) ) ( S t SUPPLIES PARTt R5) ) (St SUPPLIES-t tPARTS R5) ) (PROJECTt ORDERED-FROM St R5) ) (PROJECTt ORDERED-t tPARTS R5)) (PROJECTt ORDERED PARTt R5) ) (PROJECTt USES PARTt R5) ) (PARTt IS-USED-IN PROJECTt R5) ) (PARTt IS-SUPPLIED-BY S t R5) ) ( S t SUPPLIES PARTt SUPPLIES-TO PROJECTt R5)) ( S t S U P P L I E S - t tPARTS SUPPLIES-TO PROJECTt R5) )  ($A ($A ($A  (PROJECTt USES PARTt R6)) (PROJECTt HAS QOH OF-TYPE PARTt (PARTt IS-USED-IN PROJECTt R6) )  ($A ($A  (St (St  ($A ($A ($A ($A  (PARTt COSTS PRICE R8) ) (PARTt COMES-IN PURCHASE-UNITS (R8 P-ENUMERATES PARTt)) (R8 CONCERNS OBSOLETE-PARTS))  ($A ($A  (ORDERt COMES-FROM SOURCE R9) ) (R9 P-ENUMERATES ORDERt))  ($A ($A ($A ($A  (ORDERt WAS-SOLD-BY SALESMANt (SALESMANt SOLD ORDERt R10)) (R10 ENUMERATES SALESMAN*)) (R10 P-ENUMERATES ORDERt))  SUPPLIES HAS QOH  PARTt OF-TYPE  R7) ) PARTt  R6))  R7))  R8))  R10))  The S e m a n t i c M o d e l  115  ($A ($A ($A ($A ($A ($A ($A ($A ($A  (EXTRA DETERMINES)) (EXTRA ENUMERATES)) (EXTRA I S ) ) (EXTRA CONCERNS)) (EXTRA P-ENUMERATES)) (EXTRA RESTRICTS)) (EXTRA TO)) (EXTRA IN) ) (EXTRA IS-RESTRICTED-TO))  The S e m a n t i c  Model  116 APPENDIX_3 Sample_Quer/ies i n t h e -  This  appendix  algebra. a  There  relation  request. queries,  shows  are f i v e  fielati  some s a m p l e q u e r i e s sets of queries,  that contains The r e q u e s t s  i  the information  e a c h o f which which  a r e shown a t t h e s t a r t  and i n t e r m e d i a t e  relations  i n the r e l a t i o n a l  which  produces  answers a c e r t a i n of  each  a r e formed  set  of  are usually  printed. 1. L i s t  a l l t h e p a r t numbers.  (RUNION » (R1 R8) ) REL1 (PRINTREL * REL1) REL1 ( PART* PRICE 7 74 6 98 5 45 9 40 3 2 8 25 1 20 4 48 2 36 REL1  PURCHASE-UNITS 1 1 25 10 1000 500 400 40 10  )  (PROJECT * REL1 • (1) ) REL2 (PRINTREL *REL2) REL2 ( PART* ) 7 6 5 9 3 8 1 4 2 EEL 2  Sample Q u e r i e s i n t h e R e l a t i o n a l  Algebra  117 2. F i n d  the parts  w h i c h no s u p p l i e r  has i n stock.  {RDIFF • REL2 (PROJECT »R7 ' ( 2 ) ) ) REL4 (PRINTREL »REL4) REL4 ( PARTt ) 7 REL 4  3. L i s t  t h e names o f t h e p r o j e c t s  which a r e i n V a n c o u v e r .  (PROJECT (RESTRICT «R2 •(EQ (ELEM T1 3) •VANCOUVER)) ' ( 2 ) ) REL 13 (PRINTREL »REL13) REL13 ( PROJECT-NAME ) ROYAL TOWERS BURRARD SHIPYARDS GRANVILLE MALL REL13  4. F i n d  the suppliers  who s u p p l i e d  (PROJECT »R5 • (1 4) ) REL5 (PROJECT «R2 • (1) ) REL6 (RDIVIDE ' REL5 • REL6 «(1) REL 8 (PRINTREL R E L 8 ) REL8 ( S t ) 4 1 REL8  EACH  project.  '(1))  1  Sample Q u e r i e s i n t h e R e l a t i o n a l  Algebra  118  5. F i n d than  t h e names o f t h e s u p p l i e r s who s u p p l i e d 25 u n i t s o f p a r t 4 t o some p r o j e c t .  (RESTRICT REL 10 (PRINTREL  »R4 '(AND  more  (EQ (ELEM T1 2) 4) (GREATERP (ELEM T1 3) 2 5 ) ) )  * REL10) S# PART# 4 4 3 4 3 4  *PARTS 40 80 80  PROJECT* 1 2 2  REL 10 (JOIN »REL10 «R3 * (EQ (ELEM T1 1) REL 11 (PROJECT * REL1 1 • (6)) REL 1 2 (PRINTREL »REL12) REL12 ( SNAME ) COAST STEEL PEARSON IRON WORKS REL 12  Sample  DATE-RECEIVED SEPT 6 MAR 27 MAR 14  (ELEM T2 2 ) ) )  Queries i n the R e l a t i o n a l  Algebra  119 APPENDIX 4. Sample In  this  Q u e r i e s , i n Codd_s R e l a t i o n a l C a l c u l u s  appendix,  the following r e l a t i o n s  211 325 237  s#  SLOC: NY SF LA  J# 970 971 972  JLOC POK SJ SJ  P# 31 32 33 S# 211 325 211 211 237 237 237 237 237 237 1. r 1 [ 3 ] , r 1 [ 2 ]  SNAHE AA XX YY JNAME A X Y  PTYPE A A B P# 31 32 33 31 31 32 33 32 31 31  a r e used:  )  J# 971 971 970 972 970 970 970 971 971 972  DR 11 31 55 66 75 91 101 121 121 125  : P 1 r 1 5 -](P2r2 S r 2 [ 2 ] = S J ) V (P3r3 S r 3 [ 2 ]=A) i(pur4) ((r4[1]=r1[1]) 8 (r4[3]=r2[1j) 8 ( r 4 [ 2 ] = r 3 [ 1 ]))  Sample Q u e r i e s  i n Codd's R e l a t i o n a l C a l c u l u s  120 (REDUCE »Q1) THE REDUCED REL1 ( S# 237 237 237 237 237 237 211 211 325 211 THE REDUCED REL3 ( P# 31 32 THE REDUCED REL5 ( J# 971 972 THE REDUCED REL6 ( S# 237 325 211 THE REDUCED REL1 ( S# 237 237 237 237 237 237 211 211 325 211 THE REDUCED REL3 ( P# 31 32 THE REDUCED REL5 ( J# 971 972 THE REDUCED REL6 ( S# 237 325 211  GLOBAL RANGE FOR P# J# ) 31 972 31 971 971 32 970 33 32 970 31 970 31 972 970 33 971 32 971 31 GLOBAL RANGE FOR )  RU I S :  RANGE FOR  R2 I S :  GLOBAL )  R3 I S :  GLOBAL RANGE FOR R1 I S : SLOC SNAME ) LA YY SF XX NY AA LOCAL RANGE FOR R4 IN THETA1 P# J# ) 31 972 971 31 971 32 33 970 970 32 31 970 31 972 33 970 971 32 971 31 LOCAL RANGE FOR R3 IN THETA1 ) LOCAL )  RANGE FOR  R2 IN  THETA1  LOCAL SLOC LA SF NY  RANGE FOR R1 IN SNAME ) YY XX AA  THETA1  Sample Q u e r i e s i n Codd*s R e l a t i o n a l  Calculus  121  THE FIRST ELEMENT IN THE CORE OF THETA1 I S : REL3 ( P# ) 31 32 JOINING CORE WITH[ RU YIELDS: J# REL7 ( P# S# P# ) 325 32 971 32 970 237 32 32 237 32 971 32 971 31 211 31 31 972 31 211 237 970 31 31 31 237 31 971 237 31 972 31 JOINING CORE WITH[ R2 YIELDS: J# REL8 ( P# S# P# J# ) 31 237 31 972 972 971 971 31 237 31 31 31 972 972 211 971 971 31 31 211 971 971 237 32 32 971 971 32 325 32 JOINING CORE WITEI R1 YIELDS: SLOC SNAME S# P# J# J# REL9 ( P# S# SF XX 971 325 325 32 971 32 237 971 971 LA YY 237 32 32 NY AA 971 31 971 211 31 211 NY AA 31 972 972 211 31 211 237 LA YY 31 971 971 31 237 237 LA YY 237 31 972 972 31 PROJECTING OFF R4 YIELDS: REL10 ( P# J# S# SLOC SNAME ) 31 972 237 LA YY 31 971 237 LA YY 31 972 211 NY AA 31 971 211 NY AA 32 971 237 LA YY 32 971 325 SF XX DIVISION BY R3 YIELDS: REL12 { J# S# SLOC SNAME ) 971 237 LA YY PROJECTING OFF R2 YIELDS: REL13 ( S# SLOC SHAME ) 237 LA YY THE RESPONSE RELATION I S : REL14 ( SNAME SLOC ) YY LA REL14  Sample Q u e r i e s i n Codd's R e l a t i o n a l  Calculus  122  2. r 1 [ 3 ] :  P1r1 S P4r2 & ( ( r 2 [ 2 ] = 3 2 5 r 1[ 1 ]=r2[ 1 ]) V (r2[3]=970 & r 1 [ 1 ] = r 2 [ 1 ] 8  (r1[ 1 ]=237)) )  (REDUCE »Q1) THE REDUCED GLOBAL RANGE FOR R2 I S : P# J# S# ) 237 31 972 971 237 31 237 971 32 970 237 33 970 237 32 970 237 31 31 972 211 970 33 211 971 325 32 971 211 31 THE REDUCED GLOBAL RANGE FOR R1 I S : REL16 ( S# SLOC SNAME ) 237 LA YY 325 SF XX 211 NY AA THE REDUCED LOCAL RANGE FOR R2 IN THETA1 IS REL17 ( S# P# J# ) 325 32 971 237 32 970 237 32 971 THE REDUCED LOCAL RANGE FOR R1 IN THETA1 I S REL16 ( S# SLOC SNAME ) 237 LA YY 325 SF XX 211 NY AA THE FIRST ELEMENT IN THE CORE OF THETA1 I S : SNAME SLOC S# REL16 ( ) LA YY 237 XX SF 325 NY AA 211 JOINING CORE WITH R2 YIELDS • P# J# SLOC SNAME S# REL18 ( S# 971 XX 325 32 SF 325 971 237 32 YY 237 LA 237 970 237 YY 32 LA THE REDUCED LOCAL RANGE FOR R2 IN THETA2 IS s# P# J# )  211 237 237 237  33 31 32 33  970 970 970 970  Sample Q u e r i e s i n Codd's R e l a t i o n a l  Calculus  123  THE REDUCED LOCAL RANGE FOR R1 IN THETA2 IS REL20 ( S# SLOC SNAME ) 211 NY AA 325 SF XX THE FIRST ELEMENT IN THE CORE OF THETA2 I S : REL20 ( S# SLOC SNAME ) 211 NY AA 325 SF XX JOINING CORE WITH R2 YIELDS: REL21 ( S# SLOC SNAME S# P# J# ) 211 NY AA 211 33 970 PROJECTING OFF R2 YIELDS: REL23 ( S# SLOC SNAME ) 325 SF XX 237 LA YY 211 NY AA THE RESPONSE RELATION I S : REL24 ( SNAME ) AA YY XX REL2U  Sample Q u e r i e s i n C o d d « s R e l a t i o n a l  Calculus  124  APPENDIX_5  i  ($G  (PROVE* SNAME SUPPLIES PART*) $T) ATTEMPT TO PROVE SNAME SUPPLIES PART* (R7 SAYS S# SUPPLIES PART*) (TRY TO RELATE SNAME AND S*) (R3 SAYS S# IS-CALLED SNAME) DONE. *RESULT* ((SNAME (R3)) (PART* (R5 R7)) ( (R3) S# SRESTRICT* NIL  (R5 R 7 ) ) )  ($G  (PROVE* SNAME SUPPLIES-TO PROJECT-NAME) $T) ATTEMPT TO PROVE SNAME SUPPLIES-TO PROJECT-NAME (R5 SAYS S# SUPPLIES-TO PROJECT*) (TRY TO RELATE SNAME AND S#) (R3 SAYS S# IS-CALLED SNAME) (G2 SAYS SNAME SUPPLIES-TO PROJECT*) (TRY TO RELATE PROJECT* AND PROJECT-NAME) (R2 SAYS PROJECT* IS-CALLED PROJECT-NAME) DONE. #RESULT* {(SNAME (R3)) (PROJECT-NAME (R2)) { (R3) S# (R5) PROJECT* (R2) ) ) ($G  (PROVE* PROJECT-NAME USES PART*) $T) ATTEMPT TO PROVE PROJECT—NAME USES PART* (R6 SAYS PROJECT* USES PART*) (TRY TO RELATE PROJECT-NAME AND PROJECT*) (R2 SAYS PROJECT* IS-CALLED PROJECT-NAME) DONE. #RESULT* ((PROJECT-NAME (R2)) (PART* (R4 R5 R6) ) ((R2) PROJECT* (R4 R5 R6) ) ) ($G  (PROVE* PROJECT-NAME ORDERED PART*) $T) ATTEMPT TO PROVE PROJECT-NAME ORDERED PART* (R5 SAYS PROJECT* ORDERED PART*) (TRY TO RELATE PROJECT-NAME AND PROJECT*) (R2 SAYS PROJECT* IS-CALLED PROJECT-NAME) DONE. #RESULT* ((PROJECT-NAME (R2)) (PART* (R4 R5)) ((R2) PROJECT* (R4 R 5 ) ) )  Sample M i c r o - P l a n n e r  Runs  125  ($G  (PROVE* PROJECT-NAME ORDERED-FROM S#) $T) ATTEMPT TO PROVE PROJECT-NAME ORDERED-FROM S# (R5 SAYS PROJECT* ORDERED-FROM S») (TRY TO RELATE PROJECT-NAME AND PROJECT*) (R2 SAYS PROJECT* IS-CALLED PROJECT-NAME) DONE. •RESULT* ((PROJECT-NAME (R2)) (S* (R4 R5)) ( (R2) PROJECT* (PROVE* S# SUPPLIES-TO PROJECT-NAME) $T) ATTEMPT TO PROVE S# SUPPLIES-TO PROJECT-NAME (R5 SAYS S* SUPPLIES-TO PROJECT*) (TRY TO RELATE PROJECT* AND PROJECT-NAME) (R2 SAYS PROJECT* IS-CALLED PROJECT-NAME) DONE. •RESULT* ( ( S * (R5)) (PROJECT-NAME (R2) ) ( (R5) PROJECT*  (RU R 5 ) ) )  ($G  (R2) ) )  ($G  (PROVE* PART* COMES-IN PURCHASE-UNITS) $T) ATTEMPT TO PROVE PART* COMES-IN PURCHASE-UNITS DONE. •RESULT* ((PART* (R1 R8) ) (PURCHASE-UNITS (R1 R8)) { (R1 R 8 ) ) ) ($G  (PROVE* SNAME SUPPLIED-TO PLOC) $T) ATTEMPT TO PROVE SNAME SUPPLIED-TO PLOC (RU SAYS S* SUPPLIED-TO PROJECT*) (TRY TO RELATE SNAME AND S#) (R3 SAYS S# IS-CALLED SNAME) (G8 SAYS SNAME SUPPLIED-TO PROJECT*) (TRY TO RELATE PROJECT* AND PLOC) (R2 SAYS PROJECT* I S - I N PLOC) DONE. •RESULT* ( (SNAME (S3)) -(PLOC (R2) ) ( (R3) S# (R4) PROJECT*  (R2) ) )  ($G  (PROVE* S* SUPPLIES PART* SUPPLIES-TO PROJECT-NAME) $T) ATTEMPT TO PROVE S* SUPPLIES PART* SUPPLIES-TO PROJECT-NAME DONE. •RESULT* ( (S* (R5) ) (PART* (S5)) (PROJECT-NAME (R2) ) ( (R5) PROJECT* (R2) ) ) ($G  (PROVE* SNAME SUPPLIES PART* SUPPLIES-TO PROJECT-NAME) $T) ATTEMPT TO PROVE SNAME SUPPLIES PART* SUPPLIES-TO PROJECT-NAME DONE. *RESULT# ( (SNAME (R3) ) (PART* (R5) ) (PROJECT-NAME (R2)) ((R5) PROJECT* (R2) S# (R3) ) ) Sample  Micro-Planner  Runs  126  ($G  (ENUMERATE S#) $T) (ENUMERATE S t ) #RESULT# ((S# (R3)) ( ( R 3 ) ) ) ($G  (ENUMERATE PART*) $T) (ENUMERATE PART*) #RESULT* ( (PART* (R1 R8) ) ((R1 R 8 ) ) ) ($G  (ENUMERATE PLOC) $T) (ENUMERATE PLOC) *RESULT# ((PLOC (R2)) ( ( R 2 ) ) ) ($G  (ENUMERATE PURCHASE-UNITS) $T) (ENUMERATE PURCHASE-UNITS) #RESULT* ((PURCHASE-UNITS (R8 R1)) ( (R8 R 1 ) ) ) ($A  (OBSOLETE-PARTS ARE NOT AVAILABLE) $T) {(OBSOLETE-PARTS ARE NOT AVAILABLE))  ($G  (ENUMERATE PART*) $T) (ENUMERATE PART*) *RESULT# ((PART* (HI).) ( ( R 1 ) ) ) ($A  (R7 IS INACTIVE)) ( (R7 IS INACTIVE))  ($G  (PROVE* SNAME SUPPLIES PART*) $T) ATTEMPT TO PROVE SNAME SUPPLIES PART* (R5 SAYS S# SUPPLIES PART*) (TRY TO RELATE SNAME AND S«) (R3 SAYS S# IS-CALLED SNAME) DONE. #RESULT# ((SNAME (R3)) (PART* (R5)) ((R3) S* (R5))) (THERASE (R7 IS INACTIVE)) ((R7 IS INACTIVE))  Sample M i c r o - P l a n n e r  Runs  127  ($A  (VANCOUVER SUPPLIERS ARE ON STRIKE) $T) ((VANCOUVER SUPPLIERS ARE ON STRIKE))  ($G  (PROVE* SNAME SUPPLIES PART*) $T) ATTEMPT TO PROVE SNAME SUPPLIES PARTS MAKING NOTE OF RESTRICTION ON SUPPLIES IN R5 (R5 SAYS S# SUPPLIES PARTS) (TRY TO RELATE SNAME AND SS) (R3 SAYS SS IS-CALLED SNAME) DONE. SRESULTS ((SLOC) (SNAME (R3) ) (PARTS (R7 R5) ) ( (R3) SS SRESTRICTS ((NOT (EQ SLOC (QUOTE VANCOUVER)))) (PROVE* SS SUPPLIES PARTS) $T) ATTEMPT TO PROVE SS SUPPLIES PARTS MAKING NOTE OF RESTRICTION ON SUPPLIES IN R7 DONE. SRESULTS ((SLOC) (SS (R5 R7)) (PARTS (R3) ) ( (R5 R7) SS SRESTRICTS ( (NOT (EQ SLOC (QUOTE VANCOUVER) ) ) )  (R7 R5) ) )  ($G  (R3) ) )  ($G  (PROVE* SNAME SUPPLIES PART* SUPPLIES-TO PROJECT-NAME) $T) ATTEMPT TO PROVE SNAME SUPPLIES PART* SUPPLIES-TO PROJECT-NAME MAKING NOTE OF RESTRICTION ON SUPPLIES IN R5 DONE. •RESULTS ((SNAME (R3)) (PARTS (R5)) (PROJECT-NAME (R2)) ((R5) PROJECTS (R2) SS (R3) ) ) •RESTRICT* ((NOT (EQ SLOC (QUOTE VANCOUVER)))) ($A  (MERRIT SUPPLIERS ARE ON ((MERRIT SUPPLIERS ARE ON  STRIKE) $T) STRIKE))  ($G  (PROVE* SNAME SUPPLIES PART*) $T) ATTEMPT TO PROVE SNAME SUPPLIES PART* MAKING NOTE OF RESTRICTION ON SUPPLIES IN R5 (R5 SAYS S# SUPPLIES PART*) (TRY TO RELATE SNAME AND SS) (R3 SAYS S# IS-CALLED SNAME) DONE. *RESULT* ((SLOC) (SNAME (R3)) (PART* (R7 R5)) ( (R3) S# •RESTRICT* ((NOT (EQ SLOC (QUOTE VANCOUVER))) (NOT (EQ SLOC (QUOTE MERRIT))) )  Sample  (R7 R5) ) )  Micro-Planner  Runs  128  (THFIND 1 ($?X $?R) (X B) ($G (PROVE SALESMAN* $?R DESTINATION $?X) $ T ) ) ) (RIO SAYS SALESMAN* SOLD ORDER*) (TRY TO RELATE ORDER* AND DESTINATION) (R9 SAYS ORDER* COMES-FROM DESTINATION) (R9 SAYS ORDER* COMES-FROM DESTINATION) (TRY TO RELATE SALESMAN* AND ORDER*) (R10 SAYS ORDER* WAS-SOLD-BY SALESMAN*) ABOUT TO TRY FOR A NON-VALID PATH (R10 SAYS SALESMAN* SOLD ORDER*) (TRY TO RELATE ORDER* AND DESTINATION) (R9 SAYS ORDER* COMES-FROM DESTINATION) DONE. #RESULT# ((SALESMAN* (R10)) (DESTINATION (R9)) ((R10) ORDER* (R9))) SRESTRICT* NIL  Sample  Micro-Planner  Runs  129 APPENDIX 6. j  S g i p l g ^ Queries^!!} .I^g„J!lgH^ R e l a t i o n a l  C a  ^-9 ^ U  U S  1. L i s t t h e s u p p l i e r s who s u p p l y any p a r t . (SNAME : (SNAME SUPPLIES PARTS)) REL6 ( SNAME ) COAST STEEL PEARSON IRON WORKS VALLEY STEEL APPOLLO SHEET METAL 2. L i s t t h e s u p p l i e r s who s u p p l y a p a r t whose number i s g r e a t e r t h a n 20. (SNAME : (SNAME SUPPLIES PART*) 6 (GREATERP PART* 20)) NONE. 3. L i s t t h e s u p p l i e r s who s u p p l y a p a r t whose number i s g r e a t e r t h a n 8. (SNAME : (SNAME SUPPLIES PART*) S (GREATERP PART* 8 ) ) REL33 ( SNAME ) PEARSON IRON WORKS COAST STEEL 4. L i s t t h e p r o j e c t s who a r e s u p p l i e d by s u p p l i e r number 1. (PROJECT-NAME : (S# SUPPLIES-TO PROJECT-NAME) 6 (EQ S* 1)) REL37 ( PROJECT-NAME ) ROYAL TOWERS BURRARD SHIPYARDS P.C.C. RAPID TRANSIT GRANVILLE MALL OLYMPIC SEAWAY 5. L i s t t h e s u p p l i e r s who s u p p l y e a c h p r o j e c t . (SNAME : (V PROJECT*) (SNAME SUPPLIES-TG PROJECT*) ) REL44 ( SNAME ) APPOLLO SHEET METAL COAST STEEL 6. L i s t t h e s u p p l i e r s who s u p p l y e a c h p a r t . (SNAME : (V PART*) (SNAME SUPPLIES PART*)) REL65 ( SNAME ) COAST STEEL  Sample Q u e r i e s i n t h e New R e l a t i o n a l  Calculus  130  7. L i s t t h e p a r t s w h i c h a r e used by p r o j e c t 2. (PART* : (PROJECT* OSES PART*) S (EQ PROJECT* 2 ) ) REL8 ( PART* ) 5 1 7 4 2 3 8. L i s t t h e p a r t s w h i c h a r e e i t h e r used by p r o j e c t 2 o r a r e s u p p l i e d by a V a n c o u v e r s u p p l i e r . (PART* : ( (PROJECT* USES PART*) S (EQ PROJECT* 2)) V {(SLOC SUPPLIES PART*) G (EQ SLOC 'VANCOUVER))) REL25 ( PART* ) 1 3 6 4 5 8 9 7 2 9. L i s t t h e s u p p l i e r s who s u p p l y e a c h p a r t which i s used by p r o j e c t 2. (SNAME : (V PART* S (PROJECT* USES PART*) & (EQ PROJECT* 2 ) ) (SNAME SUPPLIES PART*)) REL54 ( S NAME ) COAST STEEL 10.  L i s t t h e Vancouver s u p p l i e r s . (SNAME : (SNAME I S - I N SLOC) & (EQ SLOC REL58 ( S NAME ) COAST STEEL  'VANCOUVER))  11.  L i s t t h e s u p p l i e r s who a r e n o t l o c a t e d i n V a n c o u v e r . (SNAME : SNAME & -» (SNAME I S - I N SLOC) S (EQ SLOC 'VANCOUVER)) REL67 ( SNAME ) PEARSON IROU WORKS VALLEY STEEL APPOLLO SHEET METAL  12.  L i s t a l l the s u p p l i e r s . (SNAME : SNAME) REL69 ( SNAME ) APPOLLO SHEET METAL VALLEY STEEL PEARSON IRON WORKS COAST STEEL Sample Q u e r i e s i n t h e New R e l a t i o n a l  Calculus  131  13.  L i s t t h e s u p p l i e r s who s u p p l y p a r t 3 t o a V a n c o u v e r (SHAME : (SNAME SUPPLIES PARTt SUPPLIES-TO PLOC) 8 (EQ PARTt 3) & (EQ PLOC 'VANCOUVER)) REL6 { SNAME ) VALLEY STEEL COAST STEEL APPOLLO SHEET METAL  14.  L i s t t h e p a r t s t h a t a r e s u p p l i e d t o e a c h p r o j e c t by a Vancouver s u p p l i e r . (PARTt : (SLOC SUPPLIED PARTt SUPPLIED-TO PROJECTt) S (EQ SLOC 'VANCOUVER)) NONE.  15.  L i s t t h e s u p p l i e r s who have more t h a n 10 u n i t s o f p a r t 8 in stock. (SNAME : (SNAME HAS QOH OF-TYPE PARTt) S (GREATERP QOH 10) S (EQ PARTt 8) ) REL90 ( SNAME ) COAST STEEL  16.  L i s t t h e s u p p l i e r s a n d t h e p r o j e c t s where t h e s u p p l i e r s u p p l i e s a p a r t which i s u s e d i n t h e p r o j e c t . (SNAME PROJECTt : (SNAME SUPPLIES PARTt) 6 (PROJECTt USES PARTt)) REL82 ( SNAME PROJECTt ) APPOLLO SHEET METAL 4 APPOLLO SHEET METAL 1 APPOLLO SHEET METAL 2 APPOLLO SHEET METAL 5 APPOLLO SHEET METAL 3 APPOLLO SHEET METAL 6 VALLEY STEEL 1 VALLEY STEEL 2 VALLEY STEEL 5 VALLEY STEEL 3 VALLEY STEEL 4 VALLEY STEEL 6 PEARSON IRON WORKS 4 PEARSON IRON WORKS 1 PEARSON IRON WORKS 2 PEARSON IRON WORKS 5 PEARSON IRON WORKS 3 PEARSON IRON WORKS 6 COAST STEEL 4 COAST STEEL 1 COAST STEEL 2 COAST STEEL 5 COAST STEEL 3 COAST STEEL 6 Sample Q u e r i e s i n t h e New R e l a t i o n a l  project.  Calculus  132  17.  L i s t t h e s u p p l i e r s a n d t h e p r o j e c t s where t h e s u p p l i e r supplies a part to the project. (SNAME PROJECT* : (SNAME SUPPLIES PART* SUPPLIES-TO PROJECT*)) REL85 ( SNAME PROJECT* ) COAST STEEL 6 APPOLLO SHEET METAL 6 COAST STEEL 5 APPOLLO SHEET METAL 5 COAST STEEL 4 APPOLLO SHEET METAL 4 PEARSON IRON WORKS 4 COAST STEEL 3 VALLEY STEEL 3 APPOLLO SHEET METAL 3 COAST STEEL 2 APPOLLO SHEET METAL 2 PEARSON IRON WORKS 1 VALLEY STEEL 1 APPOLLO SHEET METAL 1 COAST STEEL 1  18.  L i s t t h e s u p p l i e r s who do n o t s u p p l y p a r t 3. (SNAME : SNAME & -(SNAME SUPPLIES PART*) 6 (EQ PART* 3 ) ) REL102 ( SNAME ) PEARSON IRON WORKS  19.  Inform t h e system t h a t a l l Vancouver s u p p l i e r s (VANCOUVER SUPPLIERS ARE ON STRIKE) O.K.  a r e on s t r i k e .  20.  L i s t t h e s u p p l i e r s who a r e c u r r e n t l y (SNAME : (SNAME SUPPLIES PART*)) REL7 ( SNAME ) APPOLLO SHEET METAL VALLEY STEEL PEARSON IRON WORKS  parts.  21.  L i s t t h e s u p p l i e r s who do n o t s u p p l y p a r t 3. (SNAME : SNAME 6 - (SNAME SUPPLIES PART*) S (EQ PART* 3 ) ) REL20 ( SNAME ) COAST STEEL PEARSON IRON WORKS  supplying  Sample Q u e r i e s i n t h e New R e l a t i o n a l  Calculus  AEEEflULX I 1 2 3 . S 6 7 6 9 10 11 12 13 1* 15 16 17 18 19 20 21 22 23 2* 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 .51 52 S3' 54 55 56 57 58 59 60 61 •' 62 63 64 .65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 BO 81 82 83 .84 85 86 87 eC 89 90 91 92 93 94 95 96 97 98 99 100  -  RELATIONAL  ALGEBRA  I PROJECT .; RETURNS THE PROJECTION OF THE RELATION ON THE DOMTTi? ; POSITIONS ARE GIVEN IN THE LIST A.  :  (DEFUN PROJECT (RELATION A) IPROG l.-iEWREL DOMAINS NEWDOMA1N5 TNAME NEWUATA PROJECT!!*) ISETQ NEWRF.L ICEHSYMl ' R E D I (PUT NEWREL -ITUPLES 0) (SETO DOHA]NS (GET RELATION -DOMAINS!) , (PUT NEWREL -DOMAINS (CHOOSE DOMAINS 4)1 C A P C • ILAMROA ITUPLEI (SETO TUPLE (GET TUPLE •OATAII (SETO. NEKDATA (CHOOSE TUPLE A l ) (CONO ( (NOT (MEMBER NEWDATA PROJECTION)) (AOOTUPLE NEWDATA NEWREL) (SETO PROJECTION (CONS NEKDATA PROJECTION)) II I (GET RELATION "TUPLES) ) (RETURN NEWREL) ) >  ; ; ; ;  JOIN RETURNS THE THETA-JOIN OF RI WITH R2. THETA IS EXPRESSED BY PREDICATE, AN «•ARB ITRARY»» LISP EXPRESSION WHICH HUST BE SATISFIED BEFORE TKD TUPLES CAN BECOME PART OF THE JOIN.  (DEFUN JOIN ( R I R2 PREDICATE) . I PROG INEWREL TNAMEI ' (SETC NEWREL (GENSYHI 'RED) I PUT NEWREL 'KTUPLES 0) (PUT NEWREL -OOMAINS (APPEND (GET RI -DOMAINS) (GET RZ -DOMAINS))) IMAPC •(LAMBDA f T I ) (SETO T l (GET T l -DATAH (KAPC '(LAMBDA (T2) (SETO T2 (GET T2 'DATA)I (CONO ( (EVAL PREDICATE) (ADDTUPLE (APPEND T l T2) NEWREL) ) ) ) (GET R2 -TUPLES)) ) (GET RI 'TUPLES)) (RETURN NEWREL) I )  • .  ; RESTRICT ; RESTRICT RETURNS A NEW RELATION WHICH CONSISTS OF THOSE ! TUPLES IN "RELATION" WHICH SATISFY THE PREDICATE. • '< (OEFUN RESTRICT (RECAT/ON PREOICATEI (PROG INEWREL T l ) (SETO NEWREL (GENSYMl -RELII I PUT NEWREL 'HTUPLES 0) . (PUT NEWREL 'OOMAINS (GET RELATI ON 'DOMAINS)) ' . . ' (KAPC (LAHOOA (THAMEl t SETO. T l (GET TNAME 'DATA)) (CONO I IEVAL PREDICATE I (PUT NEWREL 'TUPLES (CONS TNAME (GET NEWREL 'TUPLES))I II I (GET RELATION 'TUPLES!) (PUT NEWREL 'HTUPLES (LENGTH (GET NEWREL 'TUPLES)!I ' (RETURN NEWREL) ) ) . 1  ; ; ; 5 J  0(VICE A IS A LIST OF THE DOMAIN NUMBERS OF RELATION RI TO BE DIVICED BY DOMAIN NUMBERS B OF R2.  OIVICE WORKS AS FOLLOWS. FOR EACH ROW R IN R I , IF EACH TUPLE IN THE PROJECTION OF R2 ON B IS A P.EHBER OF THE; IMAGE SEI OF THE PROJECTION OF ABAR ON R, UNDER R I . THEN ; KEEP THE PROJECTION 0£ ABAR ON R. (DEFUN RDIVIOE ( R I K? A B) l?«CG IREL SONS ISET ABAR ALL USED ABAROATA) (SEIO S0N8 (PROJECT «2 6)1 (SEIO ABAR ISETOIF (CENLIST (GET RI -DOMAINS)) A M (SETQ REL (GENSYHl -RELIt I PUT REL •» TUPLES 01 (PUI >>EL -DOMAINS (CHOOSE (GET RI -DOMAINS) ABAR)) (MAPC -(LAHBDA ( I I ) (SETO I I (GET T l -DATA)) (SETO ABAROATA (CHOOSE T l ABAR)) (CCNO ( (NO! (MEMBER A3 ARO AT A USF.DII (SITO ISET (IMAGE5ET I CHOOSE T l ABAR) RI  •  1  . . .  .133  101 IC2 IOJ 104' 1C5 1C6 1C7 ICS 1C9 1 10 111 112 113 11* 115 116 117 lie 119 120 121 122 123 124 125 126 127 123 129 130 131 132 133 13* 135 lib 138 137 139 138 140 141 142 1*3 14* 1*5 14* 1*7 148 1*9 150 151 152 153 15* 155 156 157 158 159 160 161 162 163 16* 165 166 167 168 169 170 171 172 173 17* 175 176 177 178 179 1R0 181 U2 183 IS* 185 186 187 183 189 190 191 192 193 19* 195 196 197 193 199 200  A8AR All  I  (SETS A L L ri ISETO USED (CONS A3AHDATA USED)! (MAPC MLAKBDA 1121 (SEIO 72 (GET T2 'DATA!) (COND ( (NOT [MEMBER 12 (SET)) ISEIO AIL NIL) t UNEVAL 'MAPC NIL)> I I IGET SCNE •TUPLES 1 I ( A W ALL (ADDTUPLE ABAROATA R E D ) I) I (CET R l •TUPLES I 1 (RETURN R E D I  (DEFUN RUNION ( L ) ; THIS PROCEDURE WILL RETURN A RELATION WHICH IS THE UNION ; OF ALL THE RELATIONS IN L. [PRCG (RELI ISETO REL (CAR 111 [MAPC •(LAMBDA ( R l ICONO I (NULL R l (RETURN R E L I ) ( T (SETO REL (RUNICN« REL Rl>» I I (CDR LI I (RETURN RELI) I ; THIS PROCEDURE WILL RETURN A RELATION WHICH IS THE UNION IDEFUN RUN I ON* ( R l R2) ( OF RI AND R2. THE NEW DOMAIN NAMES ARE THOSE OF R l . " (PROG (REL UNION TUPLE) (CCND ( (NOT (EO (LENGTH (GET RI •DDHAINS1I (LENGTH (GET R2 -DOMAINS!) I I (RETURN N I L ) I I (SETQ REL (GENSVH1 <REL)I I PUT REL "DOMAINS (CET R l 'D0NA1NSII (PUT REL 'ITUPLES 0) (MAPC '(LAMBDA (X) (SETQ TUPLE (GET X 'DATA)) (CONO ( (NOT (MEM8ER TUPLE UNIONII (ADDTUPLE TUPLE RELI ISETO UNION (CONS TUPLE UNION)1) ) I (APPENO (GET R l 'TUPLES) (GET R2 •TUPLES)) ) (RETURN REL) ) )  t  IDEFUN RCROSS ( I I : THIS PROCEDURE WILL RETURN A NEW RELATION WHICH I S THE I CROSS PRODUCT OF ALL THE RELATIONS IN L. (PROG (RELI (SETS REL (CAR L l l (MAPC •(LAMBDA IR> (COND I (NULL R l (RETURN R E D ) I T (SETO REL IRCROSS" REL R l ) > ) ) ICDR D l (RETURN R E D I I  (DEFUN RCRQSS» IR1 R2I * ; THIS PROCEDURE WILL RETURN A NEW RELATION WHICH I S THE ; CRDSS PRODUCT OF R l AND R2. (PROG (RELI ISETO REL (GENSYM1 'RELII (PUT REL 'DOMAINS IAPPEN0 (GET R l 'DOMAINS) (GET R2 'DOMAINS)I) (PUT REL '«TUPLES 01 (MAPC ' (LAMBDA ( T H 1MAPC •ILAMtfOA [T2I (AOUTUPLE (APPEND (GET T l '0ATA1 IGET T2 >OArA)l R E D ) (GET R2 'TUPLES!! ) (GET R l 'TUPLES)) (RETURN RELI I ) IDEFUN RINIERSECT ( L I ; I H I S RfiuTlNE WILL RETURN THE INTERSECTION OF ALL RELATIONS 1 (PRCG ( R E D (SETQ REL (CAR D l (MAPC •(LAMBDA 1RI ISETO MEL (PROJECT (JOIN REL R '(ECUAL T l T2>)  201 202 203 20* 205 206 207 208 209 210 211 212 213 21* 215 216 217 218 219 2 20 221 222 223 22* 225 226 227 228 229 230 231 232 233 2 3* 235 236 237 238 239 2*0 2*1 2*2 2*3 24* 2*5 2*6 247 2*8 249 250 251 252 253 25* 255 256 257 258 259 260 261 26? 263 26* 265 266 267 268 269 2 70 271 2 72 273 27* 275 . 2 76 277 2 78 279 280 281 282 283 284 285 2fl6 287 268 289 290 291  (GENLIST IGET REL 'DC.MA INS) 111  )  (COR L I ) (RETURN RELI)  (DEFUN RDIFF ( R l R2) ; THIS PROCEDURE RETURNS R l - R2. ISETO REL (GENSYHl 'REL)I (PUT. REL 'DOMAINS (GET R l 'DOMAINS)) (PUT REL '<IUPLES 0) (HAPC •ILAMBDA ( T l ) (OR ( I N Tl R2) (ADDTUPLE ( GET T l • DATA) R E D )  )  REL  (GET  R l 'TUPLES)I  (OEFUN IN (TUPLE R l 1 THIS PROCEDURE RETURNS T IF TUPLE IS IN THE RELATION I t . (PROG ( I (MAPC '(LAMBDA (T2) (COND ( (EQUAL (GET T2 'DATA) (GET TUPLE 'DATA)I (RETURN T I ) I  )  )  t ; ; S  )  (GET  It "TUPLES))  IHAGESET PRO/IDES THE IMAGE SET DF X UNDER THE RELATION R, WHERE A IS A LIST OF DOMAIN NUMBERS CORRESPONDING TO X, AND ABAR IS THE COMPLEMENT OF A.  (DEFUN IMAGESET ( X R A ABAR) (PROG I (sen (MAPC' •( LAMBDA*-1 TUPLE I' ISETO TUPLE (GET TUPLE 'DATAII (COND I (ECUAL (CHOOSE TUPLE A l X) (SETO ISET ICONS (CHOOSE TUPLE A8ARI 1SETI) I I  )  )  (GET R 'TUPLES)I (RETURN ISET) >  1 SETDIF ; RETURNS SETI-SET2. (DEFUN SETDIF ISET1 SET2) ; (REVERSE (EXCLUOE SET2 S E T U I .(PROG (DIFF) • (MAPC • (LAMBDA (E) (OR (MEMBER E SET2I (SETO DIFF (CONS E D I F F ) ) )  ) (RETURN  SET1I (REVERSE OIFFII  ; ADCTUPLE ; ADOS THE TUPLE TO THE RELATION, AND RETURNS THE NAME OF THE TU>L« (DEFUN ADDTUPLE (TUPLE RELATION) (PROG (TNAME) IPUT RELATION 'TUPLES (CONS (SETQ TNAME (GENSYMl ' T ) J (GET RELATION 'TUPLES))) (PUT REL A r[ON 'HTUPLES (AODl (GET RELATION " I T U P L E S I l l IPUT (NAME 'DATA.TUPLE) (RETURN INANE) )  )  302 303 304 ; CHOOSE 305 ; RETURNS THE PROJECTION OF THE TUPLE ON THE 00"AINS WHOSE 306 ; POSITIONS ARE GIVEN 6Y THE LIST A. 307 308 309 IOEFUN CHOOSE (TUPLE A l 310 (HAPCAR • (i.AM80k (DOMAIN) (ELEM TUPLE DOMAIN!) 311 A) 312 1 313 31* 315 316 I ELEM 317 : RETURNS THE NTH ELEMENT OF A LIST. 318 ; IF POSITION IS A LIST OF DOMAIN NUMBERS, ALL CORRESPONDING ELEMENTS 319 ; WILL BE RETURNED. 320 321 322 (DEFUN ELEM (LIST POSITION) 323 (CONO ( INUMSEHP POSITION) 324 (CAR (NTH LIST POSITION)) ) 325 ( T (MAPCAR ' (LAMBDA (N) 326 (CAR (NTH LIST N ) I 327 I . 32B POSITION! I ) 329 I 330 331 ' 332 333 ; GENL1ST 334 ; GENERATES A LIST OF NUMBERS FROM 1 TO THE NUMBER OF OOMAINS 335 336 337 (DEFUN GENLIST IDOMAINS) 338 (PROG I INC) ' 339 (SETQ INC 0 ) 340 (MAPCAR • (LAMBDA IX) (SETQ INC (A001 I N C H ) DOMAINS) 341 I 342 I 343 i44 345 (OPEN I IMPLODEBUFFER 100)) END OF F I L E  APPEND I X 8 J. Z 3 • * 5 6 7 B 9 10 11 12 13 1*.. 15 16 IT IB 19 20 21 22 23 2* 25 2* 27 28 29 30 31 32 33 3* 35 36 37 38 39 «0 Al 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 ,62 63 64 65 66 67 68 69 70 71 72 73 7* 75 76 77 78 79 80 81 82 S3 84 85 86 87 SB •89 90 91 92 93 94 95 96 97 98 99 I CO  RE I-AT I ON A t  CALCULUS  1DEFUN REDUCE (QUERY) i I M S ROUTINE W i l l TAKE A OUERY IN THE RELATIONAL C i U t t . C S * ! AND REDUCE I I TO. A SEOUENCE OF OPERATIONS IN THE R E l i T l ^ i i i ; ALGEBRA. IT IS HOOELLED ON THE IMPROVED REDUCTION ALiOM"-!M S OF PALERMO. IPROG (RESULT GLOBAL.RANGEI i FORM THE GLOBAL RANGE FOR EACH VARIABLE IN THE CUc'RY. (MAPC *(LAMBDA (VARI (PUT VAR *RANGE (SETQ GLOBAL.RANGE (RANGE VAR)1) (CONO ( (NULL IGET GL03AI RANGE T U P L E S ! ) .. (PR1N1 "'THE GLOBAL RANGE FOR"! (PRIN1 VARI . . . (PRIN1 '"IS EMPTY"! (TERPRII (RETURN N I L ) ) I I AND TRACE IPRINI '"THE REDUCED GLOBAL RANGE FOR**) (PRINl VARI 1PR1N1 MS:! (PR1 NTREL GLOBAL.RANGEI ) ) (GET QUERY •VARS)) ; CONSTRUCT THE COMPONENTS C I I l , EACH DEFINED BY THETA(J) (MAPC '(LAMBDA (THETAII ' (SETQ RESULT (RUNION (LIST (FORH_CI THETAII RESULT.) I ) ) (GET QUERY 'THETAII ; APPLY THE OPERATIONS OF DIVISION AND PROJECTION TO THE RESULT ; TO OBTAIN THE RELATION TP. (MAPC •1 LAMBDA (VAR! ) • (SET VAR (GET VAR 'RANGED (CONO ( (GET VAR -QUANTIFIER) (SETO RESULT (PORD RESULT VAR)) . . . (AND TRACE (PRINTREL RESULT)) (NAPC •ILAHBOA (VI . ' / ' • • . (CONO ( (GREATERP (GET V •STARTS) (GET VAR 'STARTS!) (PUT V 'STARTS (SUB (GET V • STARTS) (LENGTH (GET (EVAL VAR) 'DOMAINS)) 1) I I 1 (GET QUERY 'VARSII > (T (UNEVAL 'MAPC N I L ) ) I ) • (GET QUERY 'VAR5II 8 PROJECT TP ONTO THE DESIRED OUTPUT OOMAINS ( P R I M • "THE RE5POHSE RELATION I S : - J (RETURN (PRINTREL (PROJECT RESULT (GENTARGET (GET QUERY 'TARGET! I D ) )I :  (DEFUN FORM CI (THETAII • " ; THIS ROUTINE HILL FORM THE SUBSET CI DEFINED BY THETAI I IT USES IHE GOLBAL VARIABLE RANGE_L1ST (PRCG (L.OF_CDRES POSS_IERHS USEDVARS CORE J0IN_TERM POSITION CORE.RANGE STARTS RANGE LIST V INO) (SETQ STARTS 1) ) FORM THE REDUCED LOCAL RANGE FROM THE REDUCED GLOBAL RANGE. IKAPC '(LAMBDA (VARI (SET VAR (GET VAR 'RANGE 11 (FDRM_RR VAR THETAII (AND'TRACE ' ( P R I N l •"THE REDUCED LOCAL RANGE FOR"l IPRINI VARI IPRINI • I N ! [ P R I N l THETAI! ( P R I N l M S ) (PRINTREL IEVAL VARI) ) 1 . IGET QUERY •VARSI I ; CREATE A LIST OF THE RANGES USED IN THETAI, KITH THOSE HAVING. I THE SMALLEST NUMBER OF TUPLES COMING FIRST. (SETO RANGE.LIST (RANGES THETAII! LOCP (SETQ POSS_TERMS N I L ! ISEIQ CORE (EVAL (CAR RANGE_LIST)11 (AND TRACE ( P R I N l •"THE FIRST ELEMENT IN THE CORE OF»l IPRINI THETAII (PRINl "IS:I (PRINTREL CORE) ) . (PUT (CAR RANGE.LIST! 'STARTS STARTS) (SETO STARTS (ADO STARTS (LENGTH (GET (EVAL (CAR RANGE_LIST)I 'DOMAINS)))) (SETO USEDVARS (CONS IUNCENS RANGE.LIST RAMGE.LIST1 M L l ) I CONSTRUCT A LIST OF TERMS WHICH CAN BE USED TO JOIN THE : CORE H U H A NEW RANGE. L0CP2 ISEIQ POSS.TERHS (UNION 11NIERSECT (GET (CAR USEDVARS) •USEO.IN.TERNSI (GET THETAI •TERMS 1) POSS.TERHS!! ; IF THERE ARE NO MORE JOIN TERMS CONNECTED TO THE CORE, S START AGAIN. " (CONO ( (NULL POSS.TERHS! ISEIQ L_OF_CORES (CONS CORE L.CF.CORESII (CO LOOP I! I I NOW THAT WE KNOW WHICH JOIN TERMS CAN BE USED, CHOOSE THE ONE WHICH . : INVOLVES THE SMALLEST RELATION (MAPC •(LAMBDA (VARI (CONO ( (SETQ JOIN TERM (INTERSECT POSS.TERHS (GET VAR 'USEO.IN.TERMSII! (SETO JOIN_TERM (CAR JOIN.TER»ll (SETQ RANGE.LIST (DELETE VAR RAKGE_LISTM ISETO POSS.URMS (DELETE JOIN.TERH POSS.TERMS11 . • • (SETQ HEW.RA.'JGE VAR I I FIND ALL OTHER IEHMS WHICH INVOLVE ONLY THESE TWO RELATIONS. (MAPC ' I LAME10A (TERM! ICONO ( (EQUAL IGET TERM 'VARS! (GET JOIN.TERM 'VARS!I ISEIQ POSS_T£KMS (0CLET5 TERM pnSS.TERNSII ISETtJ JDIN.IERH (LIST ' ANO JO I N.TERM TERM) ) ) ) I POSS TERMS I  137  101 102 103 10* 105 10b 107 108 1G9 110 111 112 113 11* 115 116 11? 118 119 120 121 122 123 12* 125 126 127 128 129 130 131 132 133 13* 135 136 137 138 139 1*0 1*1 1*2 1*3 1** 1*5 1*6 1*7 1*8 1*9 150 151 152 153 15* 155 156 157 158 159 160 161 162 163 16* 165 166 167 168 169 170 171 172 173 17* 17S 176 177 178 179 180 181 182 183 18* 185 186 187 168 1B9 190 191 192 193 19* 195 196 197  •  ))  (COND ( IEQ (CAR ICET JCIN.TERH 'VARS!) NEW.RANGE) (SETO CORE.RANGE ICACR (GET JOIN.TERM ' V M S ) ) ) I ( T (SETO CORE.RANGE (CAR (GET JOIN.TERM ' V A R S I I M » IPUT VAR 'STARTS STARTS) (SETQ. STARTS (ADD STARTS (LENGTH IGET (EVA'. VAR) 'DOMAINS)))) (SETQ USEDVARS ICONS VAR USEDVARSII (UNEVAL "MAPC N I D I )  I RANGE.LISTI I JOIN THE CCRE TO THE NEW RANGE (SETO CORE (JOIN CORE (EVAL KEW.RANGEI ( F I X * (EVAL JOIN.TERM! CORE.RANGE ' T l NEW_RANGE 'T2»)l (AND TRACE IPR1N1 '"JOINING CCRE WITH") (PRIN1 NEW.RANGEl (PRIN1 'YIELDS:! (PRINTREL COREI I ; SEE I F WE ARE DONE (CCNO I RANGE_L1ST (GO L0OP2II ( L.OF.CORES (RETURN (RCROSS (REVERSE L_OF_CORES)))) ( T (RETURN CCREI)I  (DEFUN FIX» IJOIN_TERN CORE.RANGE T l OTHER.RANCE T2I ; THIS ROUTINE WILL CHANGE ALL OCCURRENCES OF (OTHER.RANGE N l ; IN JOIN.TERM (0 (ELEM T2 N ) , AND ALL OCCURRENCES OF : (CORE_RANCE N l TO (ELEM T l CORE-NI. (COND I (NULL JOIN_TERHI N I L ! ( (ATOM (CAR JOIN.TERM)) ( F I X * (CDR JOIN.TERM) CORE_RANGE T l OTHER.RANGE T 2 ) ) I (EO (CAAR JOIN.TERM) OTHER.RANGE! 1RPLACA JOIN.TERM (LIST •ELEM T2 (NEWDCMAIN OTHER.RANGE (CADAR JOIN.TERM))I) ( F I X * (CDR JOIN.TERM) CCRE.RANGE T l OTHER.RANGE 12)1 .1 (EO (CAAR JOIN.TERM! CORE.RANGEl (RPLACA JOIN.TERM (LIST 'ELEM T l ISUB1 (ADD (GET CCRE.RANGE •STARTS) (NEWDOMAIN CORE.RANGE (CADAR JOIN.TERMII ) ) ) ) ( F I X * (CDR JOIN.TERMI CORE.RANGE T l OTHER.RANGE T 2 ) I ( T I F I X * ICAR JOIN.TERM) CORE.RANGE T l OTHER.RANGE T2) ( F I X * (CDR JOIN.TERM) CORE.RANGE T l CTHER.RANGE T2) )) JOIN_TE»M _ )  IDEFUN PORD (REL VAR) ; THIS ROUTINE WILL EITHER PROJECT REL ON ALL ITS DOMAINS. 1 EXCEPT THE ONES CONTAINED IN THE RELATION SPECIFIED BY VAR, ; OR IT WILL DIVIDE REL BY THE RELATION SPECIFIED BY VAR. IPRGG (DO«»S POOMKS OOMAIN*S) (SETQ DOHA I MAS (GENLIST IGET REL 'DOHAINSlll ISETO COM»S (MAPCAR •ILAMBDA (D») (ADO ISUB1 D l ) (GET VAR •STARTS)) ) (GENLIST I GET (EVAL VAR) 'OOHAINSI! ) ) . (COND ( (EC (GET VAR •QUANTIFIER) 'EXISTS) (MAPC •ILAMBDA (X) (CR (MEMO X DONAS) (SETO POOHJS (CONS X PDOMISIII ) OOMAIN«S) (AND TRACE (PRINI '"PROJECTING OFF"! ( P R I N l VAR) ( P R I N l 'YIELDS:!) (RETURN (PROJECT REL (REVERSE POOM»S))l ) . I T (AND TRACE (PRINl " D I V I S I O N BY"! ( P R I N l VAR) ( P R I N l 'YIELDS!)) . (RETURN IRDIV1DE REL • (EVAL VARI DONAS (GENLIST IGET (EVAL VAR * -DOMAINS!) I I ) ) ) )  IDEFUN FORM.RR (VAR THETA I) ; THIS ROUTINE FORMS THE REDUCED LOCAL RANGE FOR VAR IN ! THETA!. THIS AMOUNTS (0 RESTRICTING VAR TO THOSE CASES I OEFINEO BY TERMS IN T H E U I WHICH CONTAIN ONLY 1 TUPLE : VAR1ABLE. IPRCG (V) IMAPC •ILAMBDA (TERMI (CC.ND ( IANO (EO (LENGTH (GET TERM 'VARS) I I ) (EQ (CAR (GET TERM 'VARSII VAR)) (SETQ V (CAR (GET TERM 'VARSDI (SET V (RESTRICT (EVAL V) ( F I X * (EVAL TERM) NIL NIL V ' T i l l ) (PUT THETAI 'TERMS (DELETE TERM (GET THETAl 'TERMS))! )) ) (GET THETAI •TERMS)) ) I  139 198 199  220C10 "2 20, 20* 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 ' 223 22* 225 226 227 228 229 2 30 231 232 233 23* 235 236 237 238 239 2*0 2*1 2*2 2*3 2** 2*5 2*6 247 2*8 249 250 251 252 253 25* 255 • 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 27* 275 276 277 278 279 280 281 282 .' 283  ,„ 285 287  (DEFUN GENTARCET ITARGET.L1ST) ! UPON W»?CH°T»- »!Io " * ° DOMAIN NUMBERS JNA^VM'^MB™: nt^,* " ™ - "«(LIST (AOO (NEHDOMAIN (CAR ELEMENT > (CADR ELEMENT)) RN  11  S  1  L U T  shdulu  fT H E  be  roje  (SUBl (CET ICAR ELEMENT) •STARTSI11 I ) TAROET_LISTI )  J  . . (DEFUN CRDER (VARS) ! THIS ROUTINE TAKES A LIST OF VARIABLES. AND ORDERS THEM ; WITH THE ONES WHICH HAVE THE SMALLEST RANGES COMING FIRST. IPROC (ANS LEN L) , [SETO ANS (LIST (CAR VARS))) ' (MAPC '(LAMBDA (V) (SETO LEN (GET (EVAL V) ••TUPLESI) (COND ( (NOI (GREATERP LEN (CET (EVAL (CAR ANS)) 'STUPLES) ) l (SETQ ANS (CONS V ANSI) ) f (NOT (LESS? LEN IGET (EVAL (CAR (LAST ANS))) '(TUPLES) ) ) (SETQ ANS IAPPENO ANS (LIST V I ) ) 1 . I T (SETO L ICONS NIL ANSI) IMAPC •I LAMBDA IELT) (C.ONO ( (LESSP LEN (GET (EVAl.ELT) 'ITUPLES)) IRPLACD L ICONS V (CDR D l ) IUNEVAL 'MAPC N I L ) ) ( T (SETQ L (CDR D l ) ) I ANSI I I I (COR VARS)) (RETURN ANS)) *  .  -  . (DEFUN NEWDOMAIN (VAR OLDf) ; GIVEN A VARIABLE. AND A DOMAIN NUMBER IN THE GLOBAL RANGE : FCR THAT VARIABLE, THIS ROUTINE WILL RETURN THE DOMAIN NUMBER I OF THE SAME DOMAIN IN THE GLOBAL OR LOCAL RECUCEO RANGE. (COND I (NUHBERP OLD«l (SUB (LENGTH I GET VAR 'REFOOHAINSI I (LENGTH ICDR (MEMO CLC» (GET VAR 'REFOOHAINS)11 111 ( T (MAPCAR 'ILAMBDA (N) (SUB (LENGTH (GET VAR 'REFOOHAINS)) (LENGTH (COR (MEMO N (GET VAR 'REFD0MAINS11 111 . I OLDAll I ) . ' • 1 (DEFUN RANGES (THETAII -, THIS ROUTINE WILL RETURN A LIST OF THOSE RANGES USED IN ; THETAI. WITH THOSE HAVING THE SMALLEST NUMBER OF TUPLES ; APPEARING FIRST. (PRCG (RANGE.L1ST) (MAPC '(LAMBDA IT) (SETQ RANGE.LI ST (UNION IGE7 T •VARS) RANGE.LISTI) > [CET THETAI 'TERMS)) (RETURN (ORDER RANGE.LISTI) I )  (OEFUN RANGE (VAR) ; THIS ROUTINE WILL CREATE THE REDUCED GLOBAL RANGE FOR VAR. (PRCG (FORM UN) (SETQ FORM (GET VAR 'RANGE 11 (COND ( (ATOM FORM.) (SETQ UN FORM)) ( (EQ (CAR FORM) -AND) (SETO UN (EVAL (PRCCESS.ANO (CDR FORM) VAR))) ) ( IEO (CAR FORM! 'OR) (MAPC '(LAMBDA ICONJI (COND JIATCM COHJI (SETO CONJ I L I S I CONJI)) I T ISETO CONJ ICDR CONJI11 ) ISETO UN (RUNIGN IL[ST (EVAL (PROCESS.AND CG.U VAR)) 11 P UNDI )  (COR FORM)) ) TJECT '"IL MMUALIAN"S) ^ ,„„ (RETURN<R(' P" RO ULNEGA(LGETRA VN ARGE•RF EO FR DO 11) I I)  ZB8 290 10EFUN PROCESS_AND (ARCS VAR) 291 ; THIS ROUTINE KILL PROCESS THE ELEMENTS OF A CONJUNCTION IN 292 I THE RANGE FORMULA OF VAR. 293 IPRCG IFOSM INT_TERM.S 01 FF_T ERHS REST_TERMS SAVE ) 294 IMAPC * I LAMBDA IELTI 2V5 ICOND t (ATOM 6LTI 296 ISETO INT_TERMS (CONS ELT INT_TERNS)) ) 29T ( {AND (EO (CAR ELTI 'NOTI 298 (ATOM (CAOR E L T ) ) ) J99 (SETO OIFF.TERMS ICONS (CAOR ELT) DIFF_TERMS)) ) 3C0 ( T (SETO REST.TERMS (CONS ELT REST TERMS))) I 301 ) 302 ARGS) 3C3 (SETO SAVE (CET VAR 'REFOOMAINS)) 304 (PUT VAR • REF DOHA INS (GENLIST (GET (CAR INT_TERMS1 'DOMAINS))) 305 (CONO I (GREATERP I LENGTH INT_TERMS) 1) 3C6 ISETQ FORM (LIST 'RINTERSECT (LIST 'QUOTE INT TERMS))) ) 30T ( I (SETO FORM (LIST 'QUOTE (CAR INT.TERMSI)>) ) 3C8 IMAPC '(LAMBDA (T) 309 (SETQ FORM ( L I S T 'RDIFF FORM ( L I S T 'UUOTE T M I 310 I 311 DIFF.TERMS) 312 (COND ( (GREATERP (LENGTH REST TERMSI 0) 313 (SETO FORM ( L I S r 'RESTRICT FORM (LIST •QUOTE ( F I X * (CONS 'AND REST_TERMSI 314 NIL NIL 315 VAR ' T l l ) l ) 316 IPUT VAR 'REFDOMAINS SAVE) ) ) 317 IRETURM FORM)) 318 ) END OE FILE  APPENDIX 1 2 3 * 5 6 6 7 9  10 11 12 13 I* 15 16 IT 18 19 20 21 22 23 2* 25 26 27 28 29 3 30 32 »• 33  37 38 39 AO Al 42 43 4* 45 46 47 48 49 50 51 52 53 54 55 56 57 5S 59 60 •6t 62 63 64 65 66 6T 68 69 70 ?l T2 73 74 75. 76 77 T8 79 60 81 81 83 •4 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ICO  9 -  MICRO-PLANNED  (IHCON5E L I S P ! I X R Y l (PROVE* J7X J7R J7Y) . (THOO (THANU TRACE IPRINI* '"ATTEMPT 10' PROVE"! (THCOND ( ITHASVAL J7X) ( P R I N l * (THCONO ( (THASVAL J?RI ( P R I N l * (THCOND I IThASVAL IVY! (PR(N1* (TERPRIII I (THOO ITHFINO 1 J7REL ( R E D (JO (PROVE J7X  ROUTINES  . • 141  J7XI) (T ( P R I N l * ' - ^ X l l I J7R1I (T IPRINI* ";7R)> I J7Y)) IT ( P R I N l * "$JYI» J J7R J7Y J7REL1 ITHUSE PRCVE-X-R-VJ) I  (THCONSE PROVE-X-R-Y ( X R Y REL VALIO RESULT USED) t PROVE S?X J7R 17Y J7REL) (TMSETQ J7USED (LIST N I L I I (THCO (SETO (RESTRICT* NIL HEXTRA! N I L ) ) (THCONO ( (THANO ( J G (J7X J7R J7Y J 7 R E D I I « (ACTIVE »7REL) I T ) ) [JG (UPOATE-REST 5?X J7R t 7 Y J7RELI J T ) (THSETO J7RESULT IJG IF-ALL J7X *7R »7Y> (THUSE FINO-RELS))) (SETQ IRESULTI J7RESULT) ) I ISO ( J 7 X »7R J7Y J7REL) IT) (SETQ »RESULT» THVALUE) ) I (THANO (THSETQ J7VALID T l IPRINT* '"ABOUT TO TRY FOR A NON-VALID PATH") ITHSETO 57USEO ILIST N I L ) I (THOO (SETQ ((RESTRICT* N I D I (JG ( t ? X J7R $7Y J7RELI *T) (SETQ IRESULT* THVALUE) ) >) (UPDATE-RESULT) (SETO f RESULT A (LIST (LIST »7X (CAR I R E 5 U L T O ) (LIST J7Y (CAR (LAST ARE5ULTJ)I I »RESULT«!> (THCOND ( fEXTRA! (SETQ KRESULTI (APPEND 4EXTRA8 »RESULT«UI ITHFAIL ThioREM) ( (THSUCCEED)) (  (THCONSE RELATE-X-Y (X Y R R2 RP A REL REL2 REL3 VAR A2 RELATION RES) (J7X J7R $7Y J7RELATI0NI (THPROG (LHS RHSI (THCONO ( (THAND (THASVAL J7XI ITHASVAL J7V) > (THCONO ( (MEMBER (LIST J7X J 7 Y ) J7USE0) ITHFAIL THEOREM)) I ITHVSETO J7USEP ICONS ILIST J7X J7YI S7USE0I) I I I t (THSUCCEED)I ) (THCOND ( (THNOT (THASVAL «?R)I ITHSETO J7VAR T>) ( (THSETQ J7R2 J7R>) ) (THCR (THAND (THASVAL *7YI (THOR (THAND IJG (S7X J7R J7A J7REL)) IJG (OX J7R) JTI (JG (ACTIVE J7REL) »T) . ' (JG (UPDATE-REST S7X J7R J7A J7RELI I T ) ' (JG (F-ALL J7X J7R J?A> ITHUSE FINO-RELS)) (SETO «RESULI» THVALUE) (THSETQ J7LHS J R E S U L T t ) ) (THANO ITHNOT ITHAND t JG [J7A2 J7R2 J7Y J7REL3I) ( J 6 (OX J7R2I ATI I) ( J G (J7X J7R J7A J7REL) *T) (SETO HRESULT* THVALUE) 'ITHSETO J7LHS IRESULTO ( I G IACTIVE i 7 R 6 L ) JT) (SG (OX J7R) I T ) ) ) •' (THSETQ J.7LHS (APPEND t?LHS (LIST t ? A ) ) ) (PRINT* (LIST J7REL 'SAYS J7X J7R J7A>> ITHCCNO ( (THASVAL !?YI (NOT (EO J7Y J7A1I (PRINT* (LIST '"TRY TO RELATE" J7A 'AND J7Y)> I) (THCOND I (THAND (SG (J7A J?«P J7Y J7REL2)) I t G ( 0 K J 7 R P ) J T ) (JG (ACTIVE S7REL2) t i l l ( t G (UPPATE-REST J7A »?RP J7Y J7REL2) ST) ( J G (F-ALL J7A J7KP J7YI (THUSE FIND-RELS>1 • (SETQ "RESULT* THVALUE) (THSETQ *7RH5 (RESULTH (PRINT* ILIST J7REL2 'SACS 17A J7RP t 7 Y I I I I (THANO IJG (J7Y J7P.P J7A J7REL2II l!C (OK S7RP) J T ) ( I G (ACTIVE J7REL2) J T I ) IJG (UPOATE-REST J7Y J7RP J7A A7REL2) I t ) (*G (F-ALL J7Y I2RP J7A) (THUSE FINO-RELS)) (SETQ 4RESULTJ THVALUE) (THSETC J7RHS IRESULTA) (PRINT* (LIST J7REL2 'SAYS J7Y J7RP J ? A ) I 1 ( (IH4N0 (JG (J7A J7KP J7Y J7REL2) JT) (JG (OK S7RP) JT) ( J G (ACTIVE J7REL2) t i l l (SETQ IRESULTI THVALUE) . ( ThSETO J7RHS «RESULUI (PRINT* (LIST J7RFL2 'SAYS »?A J7RP J 7 Y I ) ) ( (THA-JO I I C («?Y J 7 R P S 7 A J7REL2) JT) I JG (OK J7RPI JT) ( J G (ACTtVE J7REL2I JT)I (SETO *RESULTI IHVALUE) (IHSEIQ JTRHS ARESULTJI (PRINT* ILIST J7REL2 'SAYS J?Y S7RP J7AI) ) ) (THOR (»G (»7A AND S7Y ARE T-TRANS IN J7REL2I) IJG IJ2REL2 IS T-TRANSI) (THANO (TITASVAL J7VARI (THSETQ J7R (GENSYM M S R I ) ) » . (THOR (JG (J7A DETERMINES S7X J7REL) ) '• I J G (J7A DETERMINES J7Y J7REL2)) (THASVAL J7VALI0) ) ITHSETO J7VAR (GENSYM)| (JA [ J ? X J?R I7Y S7VAPI) (THCOND ( (THAND IJG IJ7A OETERMIKES J7X J7R.ELII IJG IJ7A OETERMINES »7Y J7REL2II ) (JA (J7X DETERMINES J7Y J7VARI) ( J A (J 7Y OE fERMINES J7X J 7 V ^ R I l ) ^ ( (THSUCCEEOl) I (THSETQ J7RELATI0N J7VAR) ) ITHANO (IHASVAL S7XI (THCONO ( ( THAND ( JG (J7A J7R J7Y J 7 R E D I ( IC (ACTIVE J7REL) J T ) ) (JG (UPOATE-REST J7A J7R J7Y J7RELI J11 (JG (F-ALL J7A »7S J7YI (THUSE FINO-RELSII I SETQ »RESULT» THVALUE I (THSETQ J7RHS (itESULTII)  1U2 101 102 103 104 ICS IC6 107 IOB 109 110 111 112 113 114 115 116 117 IIS 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 1*0 1*1 1*2 1*3 1** 1*5 1*6 1*7 1*8 1*9 150 151 152 153 15* 155 156 157 159 158 160 161  .  >  (THCONSE LISP3 [X RI Y R2 2) IPROVE* *7X »7Ri t ? Y t?R2 (THCO ITHAND TRACE ( P R I N l * '-ATTEMPT TO PROVE") (THCONO ( (THASVAL J7XI ( P R I N l * 57X11 I ITHCCND I (THASVAL t ? R l ) ( P R I N l * t 7 R l l l (THCONO I (THASVAL i ? Y ) ( P R I N l * »7Y)I [ (THCOND I (THASVAL 17R2I ( P R I N l * t?R2>> (THCCNO ( (THASVAL 172) ( P R I N l * »?Z)> ( (TERPRI) II ITHCO ITHF1ND 1 »?R IR ! (SO IPROVE »7X t ? R l $7Y 17R2 I) 1  162 163 16* 165 166 167 168 169 170 IT' IT2 173 IT* 175 176 177 178 179 180 181 182 183 18*  III  187 III 189 *!?  I (THANO (SG (S7A 17R 17V 17RELI I T ) ( i t (ACTIVE S7REL) IT11 (SETO 'RESULT! THVALUEI (THSETO S7RHS IRESULTf) ) ) (THSETQ 17RHS ICONS »7A »7RHSII ( t G (OK S7RI tT) (PRINT* 1L(ST 17REL 'SAYS VTA 17R 1 7 Y ) J (THCOND ( (THASVAL 17X1 (NOT (EO S7X »?AI) (PRINT* H I S T '"TRY TO RELATE* S7X • AND S?A>) 1) ITHCONO ( (THANO (tG [ 17A l?RP t7X J7REL2II («C (OK S7RP1 IT 1 U G (ACTIVE 17REL21 J T I 1 " [ I G l UPDATE-REST S7A 17RP i ? X S7REL2) ATI (*C (F-ALL 17A 17RP 17X) (1HUSE FIND-RELS>) (SETO 'RESULT! THVALUE I (THSETO »?LHS 'RESULT*) (PRINT* (LIST J7REL2 'SAYS t7A S7RP J7XII I ( IThAHD I t G 1111 17RP »?A 17KEL2I1 ( t G (OX 17RP) I T ) (*G (ACTIVE J7RE12) ATI) (JG I UPDATE-REST 17X *7RP 17A 17REL2) IT) (>G (F-ALL S 7X t ? R P S?A) ITHUSE FINO-RELS)) (SETQ »RESULT» THVALUE) (TWSeTQ S7LHS SRESULT*) (PRINT* (LI ST t?REL2 'SAYS t?X 17RP I7A1I ) ( (THAND U G (S1A 17RP 17X J7REL2) *T> I t G (OK *7RP> »T> U G (ACTIVE 17REL2) »T)> (SETO 'RESULT* THVALUEI (THSETO 17LHS IRESULT*I (PRINT* (LIST t?REL2 'SAYS 17A S7RP »7XII. I I (THAND U G U 7 X S7RP *7A S7REL2I JT) (IG (OX 17RP) ATI I I G I ACTIVE 17REL2) $ T I I ISETO 'RESULT*.THVALUE) (THSETO t?LHS 'RESULT*) (PRINT* (LIST S7REL2 •SAYS 17X *7RP $ 7 A ) ) ) I ITHOR ISG (S7A AND t 7 X ARE T-TRANS IN S7REL2M (SG (S7REL2 IS T-TRANS)I (THAND (IHASVAL J 7 VAR) I THSETO *7« (CENSYN 'ISR>)> I (THOR ISG (S7A DETERMINES S7Y S7RELI) (SG (S?A DETERMINES >?X S7REL2I) (THASVAL S7VAL1D) ) (THSETQ S7VAR ICENSYMI) l * A (S7X t?R 17Y S7VARI) ITHCONO I (THAND I IG U 7 A DETERMINES 17Y »7RELII ( t G (S7A DETERMINES t?X S7REL2I) ) (*A ( t 7 X DETERMINES t7Y S7VAR1) (SA ( t 7 Y DETERMINES l ? X t 7 V A R l l I I (THSUCCEEO)) I (THSETO «7R A7R2I (THSE70 17RELATI ON t7VAR) ) ) (THSETO 17RES (APPEND 17LHS t7RHS>) ) (THRETURN A7RES)  ,  ~x l7R r;7 Y ,7R2 J2 ,7REL A r,^," R  A  X  0  Y  X  i  R  Z  '  E L 2  ( THCR [THNOT ITHASVAL 17R1II (THSETO t7VARl T i l ' TH SE TO , 7 v " 2 H (THOR (THANO l»C U 7 A 17R1 17Y t7R2 t;Z 17REL 1»C (ACTIVE 17RELI t i l  (PRINl* '*7X)I ) T ( P R I N l * «17R1)) f ( P R I N l * '17YH ) T ( P R I N l * '»7K2>) ) (PRINl* •*7ZI) )  I  0  I T M  '  0 T  "« """°»  »».  '50 172VAR. t ? Z ) l (THSETO 172VAR (CAR  ! ^ . r a ' t ( t G [ACTIVE 17RELI ST) l  ;  .  %  '  ;  :  r  •  17Z »7R) (THUSE PROVE-X-R-Y- R2-2>)>.  » » « RP,  I T H 4 S V 1 1  (THAND 0  T ( T ( T  (THCONSE PR0VE-X-R-Y-R2-Z (X R l Y R2 2 REL XVAR WAR ZVAR VALID RESULT USED) (PROVE S7x A7R1 »7Y 17R2 t 7 Z S7RELI (THOO (SETC (SESTR1CI* NIL SEXTRAA N I L ) ) ITHCK (THNOT (THASVAL 17X1) (THSETO 17XVAR 17X1) (THCR (THNOT ITHASVAL 17YI I (THSETO 17YVAR t 7 Y ) ) (THOR (THNOT (THASVAL 17211 [THSETO 17ZVAR S7Z)> (THCOND I (THAND (SG l t ? X 17R1 t7Y t?R2 172 17RELII I tG (ACTIVE 17REL1 1TI) ITHSETO 17RESULT IJG IF-ALL 3 t7X 17RI »?Y J7R2 17ZI (THUSE F3RELS1II I THSETO S7YV.AR (CAR S7RESULT)) (SETO fRESULTi 17RESULT) ) ( ( I S (17X S7R1 S?Y 17R2 172 S7REL) (THUSE KELATE-X-Y-2)) (PRINT* (SETO JRESULT* THVALUE)I) I (SETO »RE5ULT* (REVERSE *RESULT*>I (UPDATE—RESULT) (SETQ iRESULTf (LIST (LIST 17X S7XVAR) (LIST «7Y 17YVAR) ( t I S T 172 S7ZYAR) »RESULT»I> (THFAIL THEOREM) )  19R 2  1721  .  ,  Ham T  i  ^  "  »  201  !' « , I "" RLE S.U L T:*! :T H. V' A' L U E I  202. ,  ,  G  S  201 0  205 206 206 207 207 208 206 209 210 211 212 213 21* ?15 216 217 218 219 220  T  ,  0  TE  1  r i  !  M  IT  ™ « »-«-»» t ? L H S fRESULT*I  ITHSETO  ITHSETQ t7IIEM 21 ITHSETO 1 7 R H 5 ( J G IF-ALL3 J7>r »7R1 J7A J7R2 J72I ITHUSE F 3 S E L S D I I THOR ITHfiOT I f O S7XVAR 47X11 ITHSETO 17XVAR (CAR 17RKSI1I ITHCR HHrtDT tEC J77VAR 172)1 tThSETC J77.VAR (CAR J J R H S 1 I ) I (THAND (SO (5?X 17R1 J7Y J7R2 J7A J 7 K E L I ) I t G IIC11VE J7REL) J T ) IJG (RP.! AiE-X-A t7Z 17AI ITHUSE R-K-All (SETO <s?SULTf THVALUE 1 (THSETQ J7LHS (RESULT*! (»G (UPCATE-REST3 171 J7RI S?Y J7R2 J7« 17REII *TI (THSETQ «711EH 31 ITHSETO S7RHS I t G (F-ALL3 S7X J7R1 t7V J7R2 t 7 A l (THUSE *3R£LS))I (THOR (THNOT (EQ 17XVAR A7X)>' <TNSETC J7XVAR (JAR ( 7 R H S I I I (THOR (T HNOT IEO 172VAR I'/l i ) (THSETQ I77VAR (CAR S71HSIII (THOR 1THNOT SEO 17YVAk J7YT) (THSETQ J7VVAR (CAR J 7 R H S I I I I (THAND ( t G IRELATE-X-A i 7 X I7«l (tMUSE R-X-A)I (SETO "RESULT* THVALUE) (THSETC S7LHS "RESULT*) "  ^ : ~  •  221 222 223 22* 275 226  .  227 228 229 Z3Q 231 • Z32 233 23* 235 . 236 23T . 238 239 2*0 2*1 2*2 2*J 24* 2*5 2*6 2*7' >«8 2*9 250 251 252 253 75* 255 256 257 258 259 760 261 J6Z 263 26* 265 266 267 268 269 270 271 272 273 27* 275 276 277 278 279 2P,0 281 282 2E3 28* 285 236 237 268 2S9 290 291 •292 293 2V* 2'!5 7/96 297 298 299  E  I  .  t?XI!  (THOR (TM»DT (EQ J7XVAR ITHSETO »7XVA« (CAR J 7 L H S I I I I t G IRELATE-X-Y-A. t7A t 7 R l t?Y t7R2 *72) [THUSE R-X-T-AII (SETQ "RESULT* THVALUE) (THSETQ 17RHS "RESULT*) (THSETQ S71TEM 1) ) ITHANO ( t G (RELATE-X-A t7Y t?A> ITHUSE R-X-A)) (SETO "RESULT! THVALUE) (THSETQ A7LHS 6RESULT0I . .  .  .  •  (THOR I THNOT (EQ I7YVAR J 7 Y I I (THSETO tTYVAA (CAR J 7 L H S H I ( t G 1 RELATE—X-Y-A J7X t7Rl. J7A i7R2 t ? Z ) ITHUSE R-X-V-AII (SETQ "RESULT* THVALUE) (THSETQ t7RHS "RESULT*I .(THSETQ J7ITEM 21 > ITHANO I t G IRELATE-X-A J72 J7AI (THUSE R-X-All (SETQ "RESULT* THVALUE) (THSETQ A7LHS fRESULT*) (THOR [THNOT (EQ J7ZVAR S?7.11 [THSETC J7Z-VAR (CAR J 7 L M S I I I ( t G IRELATE-X-Y-A t7X J7R1 t7Y t7R? J7A) (THUSE R-X-r-AII (SETC "RESULT* THVALUE) (THSETQ S7RH&' (RESULT*,) ITHSETO J7!tEM 3) ) (THAND ( t G "(t?X I7RI t7Y A7REL) *I» :(SETO "RESULT* THVALUE) (THSETQ tJLHS *RESULT») ITHSETO S70SFQ (LIST WILII I»G ['UPDATE-REST J7X S7RI S7V »7*ELI ATI (AG [ACTIVE 17RELI «TI . ( t G 1J7X S7R2 J7Z J7REL2) ATI , (THSETO t7USE0. ILIST NILII . (SETQ "RESULT* THVALUE) ( t G (UPCAIE-REST I7X S7R2 J7Z J7REL21 t f l [ I G IACTIVE 47HEL2) t i l ITHSETQ J7RHS (LIST J7X *RESUIT«)I (THOR ItG IJ7X DETERMINES t7T S7REL)I . ( t G ( t 7 X DETERMINES J7Z S7RELZII (THASVAL. t 7 V * L 1 0 l II (THANO ( t G IJ7X J7RI S?Y I7RELI *T< (THSETO J7USE0 ILIST MIDI (SETQ "RESULT* THVALUE) ( I G (UPDATE—REST f7X t 7 R l STY S7REL) *t» I t G l A C T t v f J7REL) AT) (THSETC I71.HS ".RESULT*! (THOR (SG (S?X DETERMINES t7Y t?REL)) (THASVAL tlVALIBM I t G l t ? Y t?R2 172 I7RLL2I » U ITHSETQ 17USED (LIST N I L ) ) ISETO "RESULT* THVALUE) I t G (UPDATE-REST t7Y t7R2 J72 S7REL2) ATI ( t G (ACTIVE J7REL2) t f l (THSETO 17RH5 ILIST t7Y «R£SULT*)I (THOR I t G II7Y DETERMINES J7Z J?XEL2(1 (THASVAL »?VAL10I» ITHSETC 17YVAR IAPPEND (CAR S7LNSI (COR (LAST J7RHSI111 I  I (THCOND ( (THNOT (THASVAL S7ITEM)) ITHSuCCEEDII [ (EQ 171 TEH 1) (THOR ( t G (S7A DETERMINES V7X 17REL2)) [THANO I t G (i?A DETERMINES t7Y 17RELII ( I G ( J 7 A DETERMINES 172 17REL)1 I I (THOR I t G U 7 R E L 2 IS T-TRANS)I (THANO (THASVAL I7VAR1I (THSETQ S ? R l (GENSYM "ISRIl I I C II7A DETERMINES J7Y J7P.F.LII [THASVAL t7VAR2l (THSETQ 17R2 (GENSYM "VSR 11 I I ) ( (EO t 7 I I E M 2) (THOR ( I G I57A DETERMINES t7Y J7RFL2II (THANO (IG II7A CETERHINES 17). S7RELI1 I J G l t 7 A DETERMINES 172 S7RELII I I  '  •  .  (THOR ( t G IS7REL2 IS T-IRANSII [THAND [ THASVAL >7Y.\R1> ITHSETO S ? S l (GENSYM MSRII I t G (17A 0ET6RMINES l?l tTRElll (THASVAL A7VAR2I ITHSETO t?R2 (GENSYM M S R I I I ) I ( (EQ 17IIEM 31 . (THOR IIG U 7 A DETERMINES t?l S7P.H2II (IHANO (IG ( t 7 A CClERMlNfS t ? X i??.£LU l»G 117 4 DETERMINES t7Y 57RCLH ) I (THOR ItG I17REL2 IS T-TRAWSII ITHAND (THASVAL I7VAR2I ITHSETO t?REL2 IGENSYK 1 SRI) I I I  I (THSETO t7A (GENSYHl) (SA (S7X 17R1 t7Y 47R2 S7Z t 7 A I ) (THSETQ ITRELAIION t7A» (IHSUCCEED THEOREM (APPCNO A7LHS t?RHS) I  1  '  .  300 301 302 303 304  ITHCONSE ENUMERATE-DOMAIN (X RESULT RI 1 ENUMERATE J7XI (THCONO 1 I t G l t ? R ENUMERATES t 7 X I ) ItG I A C H V E t?RI »TI ITHSETO 17RESULT (LIST 1 7 R U ) I ($G ( t ? R P-ENUHERATES J7X)> (THSETQ t 7RESULT (THE I NO ALL J7RELS (RELSI ITHANO I t C (»7RELS P-ENUMERATES »7X)I (»G (ACTIVE J7RELS) *T11) I) ( ITHSETO J7RESULT (THF[ND ALL S7RELS (RELS A) ITHAND (THOR ( t G (»7X t7R J7A S7RELSI) (tG IJ7A t?R S7X S?REL51>> (tG (ACTIVE J7RSLS) tT>>) ) ) (SETQ "RESULT! (LIST (LIST t ? X J7RESULT) (LIST S7RESULT)))  jos  306 307 308 309 310 311 312 313 31* 315 316 317 318 319 320 321 ITHCONSE VAL10-PRE0ICATE IR) ICX J7R) 322 (ThNOT ( t G (EXTRA t7R>)) 323 I 32* 325 326 (THCONSE ACTIVE-RELATION (RI (ACTIVE *?RI 327 (THNOT ( t G (J7R I S INACTIVE))) 32S 329 . 330 331 332 ITHCONSE CHECK-RESTRICTIONS IX Y R REL NOS» • (UPOATE-KEST t7X t7R t7Y t7REL) 333 33* (THCOND ( (IHSETQ t7N0S [THF1 NO ALL ( t 7 X STY J7N0I (NO) (SG (J7K I N &7REL IS RESTRICTED TO t 7 N 0 ) ) l 335 I (THSUCCEED THEOREM)) 1 ~ • 336 . (THCO (THANO TRACE (PRIN1» '"MAKING NOTE OF RESTRICTION ON") 3 37 (PRIN1« !?«) (PRIN1» ' I K I ( P R I N l * »7REL) (TERPRIII I 338 (THMAPC "UPDATE 17M0S) 339 3*0 3*1 3*2 3*3 (THCONSE UPDATE (X Y NO R2 REL2 DOMAIN A REST) !*?X J7Y *7N0) 3«* (IG (J7.NC RESTRICTS 1700MAIN TO tTRESTI) 3*5 (THCONO I ( t G l t 7 X t7R2 S7D0MAIN t?REL2)> 3*6 (tG IOK t7R2) ST) : 3*7 I THSETQ t7A t ? X ! '.THSETQ J7REL2 ( L I S " i 7 R S L 2 ) ) ) 3*8 ( ( t G ( t 7 Y t7R2 t?OOHAIN t?REL2)) 3*9 (tG (OK 17R2) t T | 350 (THSETQ t7A A7Y) (THSETQ J7REL2 (LIST J7REL2)) ) 351 I (tG ( t 7 X S7R2 t700MA!H J7REL2) JT) 352 (SETQ -.RESULTS THVALUE) (THSETQ J7REL2 "RESULTS) 353 (THSETQ J7A J7X!) 35* ( ( J G (J7Y J7R2 J700MAIN J7REL2) I T ) 355 (SETQ HRESULT* THVALUE] (THSETQ J7REL2 IRESULTO 356 ITHSETQ J7A J 7 Y I ) ) 357 (SETQ ARESTRICTI (APPEND (LIST J7REST »7A J7REL2 $700HA1N) 358 •RESTRICT!)) 359 I 360 361 362 363 (THCONSE CHECK-3RESTRICTI0NS (X RI Y R2 Z R E l l 36* (UP0ATE-REST3 J7X t ? R l J7Y J7R2 177. J7REL) 365 (JG (UPDATE-REST J7X J7RI J7Y J7REL) JT) 366 (THOR (THAND ( t G (J7X J7R2 J72 J 7REL)) 367 368 (tG (UPOATE-REST t7X J7R2 J77. J7REL) »TI) 369 (JG (UPOATE-REST 17Y J7R2 J 7 I J 7 R L D J T I | 370 371 ' 372 3 73 3 7* Y = U 7 375 376 ITHFIND ALL J7RELS IRELS) (THAND ( J G (J7X J7R J7Y 17 RE I SI I 377 ( t G (ACTIVE J7RELSI JT) 378 379 I " (THERASE (J7X f?R t7Y J7RELS)! ) l 380 ^ (THSUCCEED THEOREM ILIST J7RESI) 381 382 383 36* 385 3t6 387 ( THFINO ALL I7RELS (RELS) I THANO K G I t7X t 7 R l J7Y 17R2 J72 J 7 R E L S U 3«8 389 , I »C IACHVE 17RELS) I T ) ) | 370 ^ (THSUCCEED THEOREM (LIST t?R£S)| 391  )  )  j  "UH'SITYJT'R'ET" *  "-*  ** *»"  I)  Ih5  3 9 2 39 94 3 3 395  I THCONSE R-x-A |x A RP RE12 LHS! (RELATE-X-A S7X 17A1  306  ,I l  *0L 403 404  *1* 4 15 416 417 418 419 420 421 422 423 424 425 426 *2T 428 429 430 431 4.32 •33 434 435 436 437 438 439 440 441 442 443 444 445 446 447 4*8 449 450 451 452 453 454 455 456 457 .458 459 460 461 462 463 46* *65 466 *6T 468 469 470 471 472 473  HSETQ  t  7  L  H  S  <* = I F - A U S?X MRP  S7A)  (THSUCCEEo'r^ORV^E^.rHS^tls ? I ^ . ' J " 7  I  (THUSE F I S M P , , , , , ,  ' ™ » » - « "  ISG (ACTIVE S7RELI ST) (THSETO S7RHS ARESULT*!! ) (THSUCCEED THEOREM A7RHS)  ; START OF ANTECEDENT THEOREMS " "•' " (THANTE NOT-AVAILABLE IX RELS) (S7X ARE NOT AVAILABLE! (THSETO S7RELS ITHFIND ALL IS7REL) (REL) (SG (S7REL CONCERNS 57X1) ) ) ITHHAPC 'ASSERTFUN S7RELS) )  (THCONSE ASSERTFUN  (XI (S?X) (SA IS7X I S INACTIVE)))  ITHANTE ON-STRIKE IX REST* RELS LIST) (S7X SUPPLIERS ARE ON STRIKE) (THSETO S7REST* (GEN5YH •REST*)) (THSETQ S7LIST (LIST 'NOT (LIST •EO •SLOC ILIST "OUOTE 5 7 X ) ) ) ) ISA (S7REST* RESTRICTS SLOC TO S7L1ST)I (THSETO S7RELS (ThFINC ALL (SUPPLIES S7R S7AESTI) (R A 8 ) (SG IS7A SUPPLIES S7B S7RI) )) .(THMAPC 'ASSERT-RESTRICTION S7RELS) (THSETO S7RELS (TnFINO ALL (SUPPLIES-* »7R 57MEST*) (R A B) ISC (S 7 A SUPPLIES-." S7B S7RII II (THMAPC 'ASSERT-RESTRICTION S7RELS) (THSETO S7RELS (THFIND ALL [IS-SUPPLIEO-BV 57R 57REST*) (R A B> ISG (S7A IS-SUPPLIED-3Y S7B S7R1I ) ) ITHMAPC 'ASSERT-RESTRICTION S7RELS) I  (THCONSE ASSERT-RESTRICTION (RELSHIP REL* REST*) IS7RELSHIP 57REL* S7RESTO (SA (S7RELSH1P IN S7REL* IS_RESIRICTED.TO J7REST*)) )  (DEFUN UPDATE-RESULT ( 1 (PRCG (REST TEMP) (CCND ( (NULL (SETQ REST «RESTRICTJ)I (RETURN T ) ) ) LOOP (SETO TEMP (CCNS (CAR REST) IEMP)) (OR (ASSO (CACDDR REST) "RESULT*) ISETO *EXTRAi (APPEND (LIST ILIST ICAOOOR REST))I «EXTRA«)I ) (COND I (NOT I MEMBER ICAOOR RESTI «RESULT*I1 (SETQ 'RESULT* I APPEND iRESULT* ILIST ICACR REST) (CAODR REST))) ) ) ) (COND ( I NULL (SETQ*REST (CCOOGR REST))) ISETO ARESTRICT* TEMP) (RETURN T ) ) ( T (GO LOOP 1) I ) )  -  APPENDIX 1 2 3 4 5 6 7 8 9  10. - NEW R E D U C T I O N  (DEFUN REDUCE (QUERY! ; THIS HILL REDUCE A t N THE RELATIONAL CALCULUS TO S A RESPONSE RELATION. IT DOES SO DY USING THE RELATIONAL ALCEBft*. (PROG (TARG£T_L1ST JR£S1HICTOI (AND TRACE (PRINT '"ABOUT TO REDUCE THE CU£RV")I (SETO TAHGET.LIST ICREATE.IARGEt OUERY1) OUfcRY (MEMO •: (MAPC * 1 LAMBDA (OUANT) (COND ( (MEMO (CAR CUANTI ' I E V I I  ROUTINE  (SETO  CUERY RESPONSE OUANTS "RESULT* (EXTRA! (COR CUERY111 OUERY  ICOR  QUERY!)  10  (SETQ  11  ISETO OUANTS ICONS ICENSYN1 'QUAND OUANTSII  12 13 1* 15 16  (SET (CAR GUANTSI ICADR OUANT!I IPUT (CAR OUANTSl 'REL (CREATE.OUANT ( (UNEVAL •MAPC N I L ! , I I ' •, OUERYJ " '• .  17 18 19 20 21 2? 21 24 25 26 27  II  (COND ( (EO ELT *I) (UNEVAL "MAPC f U l l ! I T (SETQ RESULT (CONS ELT RESULT!)) > 1 QUERY) (RETURN (REVERSE RESULT!!  (DEFUN CREATE_QUANT (QUANTI ; THIS ROUTINE TAKES A QUANTIFIER FROM THE QUERY, AND CREATES THE ; CCRRESPONDIUG RELATION. (PRCG (RESULT) (AND TRACE ( P R I M '"DETERMINE THE RELATION WHICH QUANTIFIES"! ( P R I N l (CAR (IERPAI1I ! (SETO RESULT (DISJUNCT QUANT)) (PROJECT RESULT (DOMAIN!S RESULT (CAR CUANTI)) )) ' •  OUANT1)  (OEFUN CREATE.RELATITN I P L I S T )  ; THIS ROUTINE TAKES THE LIST THAT PLANNER RETURNS. AND CREATES ;PRCT FINESIL2A1 . ( GHE(MR EE TL HA OT DIONRESW UH LI TCHJ1IETRHDE«L1I ISETO METHOD (CAM (LAST P L I S T I I I TSETC PLIST (DELETE HETHOD P L I S T I )  0EF_8Y (UNCONS  55  ISETC RESULT IREI  56 57 58 59 60 61  (MAPC '(LAMBDA (MED (COND ( (ATOM REL) (SETO JTERM R E L ) ! ( T (REL_DEF_BY R E D ) (SETQ #L1* RESULT JTERM) «L2« REL JTERKI1 (SETQ RESULT (JOIN RESULT  ••  METHOD KETHCODl  (SETQ REL (OOMAINIS (00«AIN«5  REL  62 }  74  *  ROUTINE HILL  53 54  73  t  (OEFUN CREATE.TARGET (OUERY) ; THIS CREATE A LIST OF THOSE OOMAINS WHICH ARE TO ; 6E PRESENT IN THE RESPONSE RELATION. (PRCG (RESULT) (MAPC 'ILAMBDA I E L T )  50 51 52  64 65 66 67 68 69 70 71 72  (COR O U A W I M  r~- (SETO RESPONSE IDIVIOE_OR_PROJECT ID[5JUNCT CUERYI OUANTSII (RETURN (PROJECT RESPONSE (DOHA!HfS RESPONSE TAR&ET_L1ST)II I) . . „ . - •  28 29 JO 31 32 33 3* ..35 36 37 38 39 40 41 42 •43 . 44 45 46 47 48 49  6  ALGORITHM  ))  '(EQUAL IELEM T l l l l f l (ELEM T2 I L 2 I 1 I I I I I ) METHOD) ISETO DOMAINS IHAPCAR 'CAR P L l S T I J (RETURN (PROJECT RESULT (DOMAIN»S RESULT DOMAINS))1  (OEFUN  REL_OEF_BY  (RELS)  ; THIS ROUTINE TAKES A LIST OF" RELATION NAMES, AND RETURNS THE RELAtlC*)  ! WHOSE DOMAINS COMMON 10 ALL (SETOARERESTHOSE ULT ( RUNION. RESURELATICNS LT (PROJEINCTRELS. REL (OOMAINIS REL DOMAINS)!) ) (PRCG (DOMAINS (CDR RELRESULT S!I I i ( R E T U R N R E S U L T 1 CCND ( IEQ (LENGTH RELS! 11 (RETURN (CAR RELS!I I I 90 )); ICREATE A LIST OF T HE DOMAINS WHICH ALL THE RELATIONS HAVE IN COMMOM. 9 2 79 ( S E T O D O M A I N S ( G E T I CAR RELS) 'DOMAINS)); VJ 94 80 9 5 • (MAPC •(LAMBDA - IREL) . 9816 (SETO DOMAINS (INTERSECT OOMAINS (GET REL 'DOMAINS)11 982 7 (DEFUN DI(CCR S)JUNCRELS)) T (QUERY! 83 S4 . . ISETO RESULT (PROJECT (CAR OOMAINS))) ; This ILULS D PROCESSRELS) *-=<.•?(OOMAINIS .*•' •.•K;C(CAR H RELS1 IN O. N F IT rflFt ES (MAPC '(LAMBDAW 86 75  (  88  76 17 78 91  R0U1INE  98  iS  87  . I T HE=T?HESI B  tui.  IS  ™  -  101 102 IC3 104 105 106 107 108 109 110  ))  112 113 114 115 .116 117 118 119 120 121 122 123 124 125 126 127 12B 129 130 111 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146. 147 148 149 150 151 152 153 154 155 156 157 158 159 160 . 161 V62 163' 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 lfiO 181 182 183 184 185 1B6 187 188 189 190 191 192 193 194 195 196 197 198 199 200  .' (DEFUN CONJUNCT (QUERY) ; THIS ROUTINE WILL RETURN THE RELATION DEFINED BY A CONJUNCTION I IN THE CUERY. ALL RELATIONAL TERMS ARE PASSED TO PLANNER AS 1 THG01LS, AND THE CORRESPONDING RELATIONS ARE CREUEO. ; THESE ARE THEN SUBJECTED TO THE RESTRICTIONS IN THE CONJUNCTION, ; WITH THE FINAL RESULTS BEING JOINED TOGETHER ON EITHER COMMON ; OOMAINS, OR AS SPECIFIED BY THE JOIN TERMS. ' IPRCG (FNR KELS JTERMS'R FLAG RELSP RELSN OOMAINS) (MAPC ' I LAMBDA IKELTERNI . • ICOND I IEO RELTERM •£) NIL) j I (EQ RELTERH •-.) (SETO FLAG T)> ( (ATOM RELTERM) (THVAL ILIST •$G ILIST 'ENUMERATE RELTERM) •»!) [LIST NIL N I L ) ) ) , ( (FUNCTIONP ICAR RELTERM!) (UNEVAL 'MAPC N I D I I T IIHVAL (LIST •IG ICONS 'PROVE* RELTERM) 'AT) ILIST NIL N I L ) ) I I (OR (NULL (RESTRICT*) [SETQ QUERY (APPEND CUERY (RESTRICT*)I) (SETQ QUERY (CDR QUERY)!. (OR (CO RELTERM • C! (EC RELTERM •-.) (SETQ RELS (CONS ICRcATE.REL AT I ON (RESULT*) RELS)) I (CONO ( (AND FLAG (NOT (EQ RELTERM '-111 (PUT (CAR RELS) 'NEGATED Tl (SETQ FLAG N I L ) ) ) . (SETQ (RESTRICT* NIL (EXTRA* NIL) ) OUERY) I GO THROUGH ALL THE RESTRICTION AND JOIN TERMS, APPLYING THE RESTRICTIONS I TO THE APPROPRIATE RELATIONS, AND SAVING THE JCIN TERMS, ALONG WITH ; THE NAMES OF THE DOMAINS THEY CONTAIN. IMAPC 'I LAMBDA I TERM I ICCNO ( (EO TERM 'CI NIL) ( (ATOM (SETQ DOHAINS (DCMAINS.IN TERM))) (MAPC • (LAMBDA [RED I AND IMEHQ DOMAINS IGET REL 'DOMAINS!I (SETO R (RESTRICT REL (FIXPRED DOMAINS TERM REL ' T l l l l IPUT REL 'TUPLES (GET R •TUPLES I 1 (PUT REL '(TUPLES (GET R '(TUPLES11 (AND TRACE ( P R I N l 'MESTRICT! ( P R I N l REL) ( P R I N l "TO) IPRINI TERN) IIERPRI)) ) ) RELS) ) ( T (SETO JTERMS (CONS (LIST TERM DOMAINS) JTERMS)) II ) QUERY) ' I GLUE ALL THE RESULTS TOGETHER - JOIN ALL RELATIONS WHICH MUST BE I JOINEO USING JOIN TERMS. ISETC RELS (JOIN.WJT RELS JTERMS)) ; TAKE THE UNION OF ALL NON-NEGATEO RELATIONS IMAPC '(LAHfaOA (R! (CONO ( IGET R 'NEGATED! (SETQ RELSN ICONS R RELSN)) ) I T (SETQ RELSP (CONS R RELSP)) ) ) ) RELSI (AND TRACE ( P R I N l "TAKE THE UNION OF RELATIONS"! ( P R I N l REL5PI (TERPR11> (SETQ RELSP (JOIN.RELS RELSP!I I TAKE THE DIFFERENCE BETWEEN THIS RELATION AND EACH OF THE NEGATED ; RELATIONS. IMAPC '(LAH8DA 1RNI (AND TRACE ( P R I N l '"THE DIFFERENCE BETWEEN"! ( P R I N l RELSP) ( P R I N l 'ANDI (PRINl RN! ( T E R P R l ) l (SETQ DOMAINS (INTERSECT (GET RELSP 'DOMAINS) (GET RN 'DOMAINS))) (SETQ RELS (ROIfF (PROJECT RELSP (DOMAIN»S RELSP DOMAINS)) (PROJECT RN (DOMAIN'S RN DOMAINS)) ) ) (SETQ RELSP (JOIN RELS (LIST RELS? RELS)!) ) RELSN) (RETURN RELSP) )) '" . [DEFUN DIVICE.OR.PROJECT (REL CUANTS) I THIS ROUTINE WILL PROCESS THE QUANTIFIERS FRCH RIGHT TO LEFT, ; DIVIDING OR PROJECTING THE CURRENT RELATION 8Y THE QUANIIFIEO I VARIABLE. • J (PRCG IVAR OOMAINS) IHAPC •I LAMBDA ( Q l ISETQ VAR I GET 0 'REL1 I ISETQ DOMAINS (GET VAR 'DOMAINS!) '[CONO ( (EQ 0 *E) (CONO ( TRACE (PRINl •"PROJECT THE RESPONSE RELATION ON ALL FIELDS EXCEPf IPRINI (EVAL O i l ( T E R P R l l l I T Tl! ISETO REL (PROJECT REL (DOMAINIS REL (SET01F (CET REL 'OOMAINSI (CEI VAR 'COMAINS))) ) l I ( T ISETQ REL (ROIVIOE REL VAR (DOMAINtS REL OOMAINS] [GENLIST DOMAINS!I I  111  (PROG (RELS) (CO.ND ( (OR (NULL (COR QUERY)) (EQ (C»0» QUERY) ' t l ) (RETURN (CONJUNCT QUERY)J I I (MAPC '(LAMBDA (C) . . (OR (EQ C 'VI (SETO RELS (CONS (CONJUNCT C). RELS)) ) I . QUERY) (R£L_D£F_BY RELS)  .  201 2C2 20J 20* 205 20!> 207 208 209 210 211 212 213 21* 215 216 217 21B 219 220 221 222 223  (AND TRACE IPRIN1 '-DIVIDE THE RESPONSE RELATION BY") ( P R I N l (EVAL C I ) ( I E R P R I I ) ) )  II  | OUANTS) IRETURN RELI  (DEFUN JOIN_WJT (RELS JTERMS) : THIS ROUTINE WILL JOIN ALL RELATICNS IN RELS WHICH CAN BE JOINED ; UNDER CRITERION SPECIFIED BY JTERMS. ; IT RETURNS A NEW LIST OF THE CURRENT RELATICNS IPRCG (RI R2 R) IMAPC '(LAMBDA (JTERMI (MAPC •I LAMBDA ( R l ICOND I (GET R 'NEGATED) (UNEVAL 'MAPC N I L I I ( (MEMO (CAADR JTERMI (GET R 'OUMAINS)) (SETO R l R l ) 1 (MEMO (CADADR J TERM) (GET It 'DOMAINS)) (SETO R2 «|| ) ) RELS)  22* (SETQ JTERH (FIXPREO ICAR DOMAINS) IF1XPRED ICADR DOMAINS) JTERM R2 -T2) R l «Tl)) 225 ISETO R (JOIN R l R2 JTERM)) 226 (SETQ RELS (DELETE R l (DELETE R2 RELS)) 22? RELS (CONS R RELS)) 228 ) 229 JTERMS) 230 (RETURN RELS) 231 I) 232 233 23* 235 (DEFUN JOIN.RELS (RELS) 236 ! THIS ROUTINE WILL TAKE A LIST OF RELATICNS AND JOIN THEN 237 ; ON COMMON DDMAINS. 238 IPRCG (REL DOMAINS A L U »L2»1 239 (SETQ REL (UNCONS RELS RELS)) 2*0 (AND I NULL RELS) (RETURN R E D ) 2*1 (MAPC •(LAMBDA IR) 2*2 (AND (SETQ DOMAINS (INTERSECT IGET R 'DOMAINS) (GET REL 'OOMAINS!)) 2*3 (SETO A L U IDOMAIN»S REL DOMAINS)! 2** (SETQ AL21 (OOMAINIS R DOMAINS!) 2*5 (SETQ REL (JOIN REL R • 1ECUAL (ELEM T l I ELEM 12 A L 2 0 I I I 2*6 I NULL ISETO RELS (DELETE R RELS)I I (RETURN REL) 2*7 I) 2*8 RELS! 2*9 IJOIN_RELS (CONS REL RELS)) 250 )) 251 252 253 25* IDEFUN OOMAINIS (RELATION L_OF_00NAINSI 255 : THIS ROUTINE WILL RETURN/THE POSITIONS EACH OF THE DOMAINS IN L_OF_C0MAIN5 256 ; OCCUPIES IN RELATION. 25? IPRCG (DOMAINS! 258 (AND (ATCM L OF DOMAINS! (SETO L OF.DOMAINS (LIST l_OF.DOMAINS))) 259 ISETO DOMAINS (GET RELATION 'DOMAINS!) 260 (MAPCAR MLAHBOA I DOMAIN! 261 . IAD01 (SUB (LENGTH OOMAINS) 262 (LENGTH (MEMO DOMAIN DOMAINS)) I I 263 > 26* l_OF_D0MAINSI 265 >I 266 267 268 269 (OEFUN INTERSECT 1L1 L 2 ) 270 J THIS PROCEDURE RETURNS THE INTERSECTION OF LISTS 11 ANO L 2 . 271 IPRCG (RESULT) 272 (MAPC '(LAMBOA ( E l ) 273 (AND I MEMBER E l L2) INOT I MEMBER E l RESULT)) 27* ISETO RESULT ICONS E l RESULT!I ) 275 ) 276 111 277 (RETURN RESULT! 278 I! 279 280 281 282 (DEFUN FIXPREO (DOMAIN JTERM REU TX) 263 1 THIS ROUTINE WILL CHANGE ALL OCCURRENCES OF DOMAIN IN JTERM ZE* ; 10 (ELEM TX N) , WHERE OOMAIN IS IN THE NTH POSITION OF REL. 283 256 I (COPY JTERM OCMAIN (LIST 'ELEM TX (CAR (DOMAINAS REL O D M A I N l l l l 2E7 288 289 .290 (DEFUN 0OMAINS.1N IFUN) 291 I THIS ROUTINE WILL RETURN EITHER A LIST OF ALL COMA IN VARIABLES 292 -, IN THE FUNCIION. CR THE NAME OF THE VARIABLE IN THE FUNCTION 293 I IF THERE IS ONLY ONE. 29* (PRCG (ANSI • 295 (OCMAINS_IN» FUN) 296 (CCND I (EQ (LENGTH ANSI I I (RETURN ICAR AN5)I) 297 ( T (RETURN A N S ! I I 298 II 299  IUII  14 9  300 301 302 (CEFUN C0HAINS_1N» (FUN) 303 (PRCG I ) 304 (COND ( (OR I NULL FUN) (EC (CAR FUN) "QUOTE)) 305 (RETURN N I L ) ) 306 ( IATOM (CAR FUN)) 307 (OR I NUMB ERR (CAR FUN)) IFUNCTICNP (CAR FUN)) JOB (SETO ANS (CONS (CAR FUN) ANSI) ) ) 30") ( T I DOHA INS.IN» (CAR FUN))) ) \ 310 (DDHAINS_IN» (COR FUND 311 )) 312 ! 313 314 315 (DEFUN FUNCTIONP (FUN) 316 ; THIS ROUTINE RETURNS T I F FUN IS A L I S P FUNCTION. 317 (OR (GET FUN "EXPRI 318 (GET FUN 'SUBRI 319 (GET FUN "FSUBR)) 320 ) END OF F I L E  APPEND I X 1 1 -  AUXILIARY  ROUTINES  ; CUERY ; THIS ROUTINE WILL ACCEPT INPUT FROM THE USER. THE INPUT CAN EITHER ; BE A CUERY, OR A PIECE OF INFORMATION TO BE ACOEO TO THE SEMANTIC MODEL. (OEFUN CUERY I ) ; READ - REPLY LOOP (PRCG IRR TRACE I (PRINT '-TRACE ON, OR OFF7") (OR 1EOUAL (READ) 'OFF) ISETO TRACE T ) ) RO (SETO RR (READ)) ICONO ( (EO RR • -END) (RETURN 'THANKS)) ( (NOT (MEMO RR|| (THVAL (LIST '»A RR 'AT) ( L I S T M i l N I L ) ) (PRINT I GO ROD ( T ISETO RR (REDUCE R R ) ) ) I (COND ( [2EROP (GET RR »9 TUPLES)) (PRINT •"NONE.")) ( T (PRINTREL RR)> ) (CO RO) I)  '"O.K.-)  OEFRELS (DEFINE RELATIONS) DEFRELS READS IN RELATIONS FROM THE F I L E " F I L E " , ANO STORES THEM IN INTERNAL FORMAT: THE RELATION NAME HAS 3 PROPERTIES ON ITS P-LIST: DOMAINS- A LIST OF THE DOMAIN NAMES UPON ViHICH THE RELATION IS DEFINED. TUPLES - A LIST OF THE TUPLE NAMES WHICH OCCUR IN THE RELATION. •TUPLES - THE NUMBER OF TUPLES CURRENTLY IN THE RELATION. ON THE P-LIST OF A TUPLE NAME, UNDER THE FLAG "OATA", IS THE . ACTUAL TUPLE. (OEFUN CEFRELS FEXPR ( F I L E ) ( A P P L Y l 'OPEN (LIST 'RELINPUT 255 (CAR F I L E D ) (OPEN (BUFFER 255)) (PRCG (RELATION RNAME TNAME) RD ICONO ( IEO (SETO RELATION IREAD RELINPUT]) •»ENO) (RETURN N I L ) I ) ISETO RNAME (UNCONS RELATION RELATION)) I PUT RNAME •'TUPLES 0 ) [PUT RNAME 'DOMAINS (CAR RELATION]I [MAPC • i LAMBDA (TUPLE) IACOTUPLE TUPLE RNAME) ) (COR RELATION)) (GO RO)  )  ; PRINTREL I PRINTS A GIVEN RELATION (OEFUN PRINTREL (RELATION). (PROG (SPACES CENTRES) (TERPRl) (CONO I [NULL (SETO CENTRES (GET RELATION 'CENTRES))) (SETQ CENTRES IFIND.CEKIRES RELATION)) ) ) ( P R I N l RELATION) ( P R I N l ' " [ " I (PRINT_TUPLE (GET RELATION 'DOMAINS) CENTRES) IPRINI •« l " l (TERPRl) (MAPC '(LAMBOA ITUPLE) IPR]NT_TUPL£ (GET TUPLE 'DATA) CENTRES) (TERPR1I! (REVERSE (GET RELATION 'TUPLES!') (RETURN RELATION))  (OEFUN PRINT_TUPLE (TUPLE CENTRES) (MAPC •(LAMBDA (NAME POS) " (COND(I IS(ENTUQMBELREP O) LE)N (NLEN NAMED! N IN PA LM ENE)NAI MSEE!T! .'PR?N!NAMET ' *»'» T  ))  S  3  )  TUPLE CENTRES)  L M X  D M C EL E N  87 88 69 90 91 92 93 94 95 96 97 99 98 ICO 101 102 103 104 105 ICS  ic?  IDEFUN FIND.CENTHES (RELATION) I THIS ROUTINE WILL CREATE A LIST WHICH CONTAINS THE PRINT POSITION i WHERE EACH CO"AIN IN THE RELATION SHOULD EE CENTRED. (PRCC (TEMP LEN CENTRE) . (COND ( I NULL IGET RELATION 'CENTRES)) (PUT KELATICN 'CENTRES C.APCAR '(LAMBDA (XI 01 (CET RELATION * DOMAINS)!) )> (SETQ CENTRE (CET RELATION 'CENTRES!) (MAPC MLAMSOA (TUPLE) (OR (LISTP TUPLE) ISETO TUPLE (CET TUPLE 'DATA))) ISETO TEMP CENTRE) (MAPC •(LAMBDA (ELT) (CONO ( (NUM3ERP ELT I (SETQ LEN (NLEN E L T ) ) ) r ( ISETO LEN (PLEN ELT))1 I • ' (AND (GREATERP LEN I CAR TEMPI) (RPLACA TEMP LEH)) (SETQ TEMP (CDR TEMPI 1 I ; TUPLE) I (APPEND (LIST IGET RELATION -DOMAINS)> IGET RELATION 'TUPLES!) ) (PUT RELATION 'CENTRES (UPDATE.CENTRES RELATION CENTRE)I  i!  ;  108 IC9 110 111 IDEFUN UPDATE.CENTRES (RELATICN CENTRES) 112 ; THIS ROUTINE WILL CHANGE THE LIST OF MAXIMUM DOMAIN SIZES 113 1 TO A LIST OF CENTRES FOR EACH DOMAIN 114 IPRCG I SUM L I S T ) ' 115 (SETO SUM (ADO 4 (PLEN RELATION)!) 116 (MAPC •(LAMBDA ICI 117 (SETQ LIST ICONS (ADD ( F I X (DIVIDE C 2!) 1 SUM) L I S T ) ) 118 (SETC SUM (ADD SUM C 2)1 119 ) 120 CENTRES) 121 (RETURN (REVERSE L I S T ) ) 122 )) 123 124 12S 126 IDEFUN NLEN (NO) 127 I THIS ROUTINE RETURNS THE PRINT LENGTH OF A NUMBER 128 (TAB 1 BUFFER I 129 IPRINI NO BUFFER 21 130 (PLEN BUFFER) ~ 131 ) 132 133 134 135 ; GENSYH1 136 ; LIKE GENSYM, EXCEPT THA'T NUMBERING STARTS AT 1 FOR EACH OIFFERENT 137 ; CHARACTER STRING C. 138 139 140 IDEFUN CENSYMl (CI 141 (CONC ( (NULL (GET C 'GSM! (PUT C «CS» 01 ) > . 142 (IMPL00E1 C (PUT C 'GSA (ADD1 (GET C "GSAII) I 143 ) 144 • 145 • 146 147 I 1MPLCDE1 148 ; GIVEN TWO ATOMS A AND B, RETURNS THE ATOM AS. 149 150 151 IDEFUN IMPLCDE1 (A 81 152 (TAB 1 IMPL00E3UFFERI 153 IPRINI A IMPL0UE3UFFER 2) 154 ( P R I M 8 IMPLOOEBUFFER 2) 155 (READ IMPLGDEBUFFER) 156 I 157 158 159 160 161 162 S PRINT* 163 I THIS ROUTINE WILL PRINT THE^ ARGUMENT *ONLY* IF TRACE IS ON. 164 165 (CEFUh PRINT* (EXPI 166 (CR (NOT IRACEI [PR[NT EXPI1 167 ) 168 169 170 171 ! PRIM* 172 ; THIS ROUTINE WILL CALL P R I N l ONLY IF TRACE IS N I L . 173 174 IDEFUN P R I N l * IEXP) 175 ICR. INOT TRACE! ( P R I N l EXP)) 176 ) END OF FILE  "  

Cite

Citation Scheme:

        

Citations by CSL (citeproc-js)

Usage Statistics

Country Views Downloads
United States 16 0
China 11 10
Japan 6 0
Russia 2 0
Myanmar [Burma] 2 1
France 1 0
Iraq 1 1
City Views Downloads
Beijing 8 0
Ashburn 6 0
Tokyo 6 0
Mountain View 5 0
Unknown 3 8
Shenzhen 3 10
Menlo Park 3 0
Saint Petersburg 2 0
Buffalo 1 0
Erbil 1 1
Redmond 1 0

{[{ mDataHeader[type] }]} {[{ month[type] }]} {[{ tData[type] }]}
Download Stats

Share

Embed

Customize your widget with the following options, then copy and paste the code below into the HTML of your page to embed this item in your website.
                        
                            <div id="ubcOpenCollectionsWidgetDisplay">
                            <script id="ubcOpenCollectionsWidget"
                            src="{[{embed.src}]}"
                            data-item="{[{embed.item}]}"
                            data-collection="{[{embed.collection}]}"
                            data-metadata="{[{embed.showMetadata}]}"
                            data-width="{[{embed.width}]}"
                            async >
                            </script>
                            </div>
                        
                    
IIIF logo Our image viewer uses the IIIF 2.0 standard. To load this item in other compatible viewers, use this url:
http://iiif.library.ubc.ca/presentation/dsp.831.1-0051770/manifest

Comment

Related Items