next up previous contents
Next: Examples with the Up: Simple Queries Previous: Who works for

Which dept has an employee that is managed by Malcolm?

 

Again we have a query with many syntactic interpretations due to prepositional phrase attachment. Again, most of these interpretations can be ruled out by the domain.

In addition, the verb has is semantically underspecified, so it licenses many interpretations. However, all but one of these can be ruled out by the nature of the domain.

ENG: which dept has an employee that is managed by malcolm
SYN: (s(np(det(which))(n(n(dept))))(vp(v(has))
      (np(det(an))(n(n(n(n(employee)))
       (relcl(relpro(that))(s(np)(vp(v(is))(adj(managed))))))
        (pp(prep(by))(np(propn(malcolm))))))))
 PT: `dept:fv1 and some(a,`by:`malcolm:lambda($(1),`employee:$(1) and 
      `managed:`be:$(1)):a and `has:a:fv1)
FOL: dept(fv1)&exists(a,(by(a,`employee,`malcolm)&
      by(a,`managed:`be,`malcolm))&has(fv1,a))
CHK: Query not meaningful with respect to current database

SYN: (s(np(det(which))(n(n(dept))))
      (vp(v(has))(np(det(an))(n(n(n(n(employee)))
       (relcl(relpro(that))(s(np)(vp(v(is))(adj(managed))))))))
        (pp(prep(by))(np(propn(malcolm))))))
 PT: `dept:fv2 and some(a,(`employee:a and `managed:`be:a) and 
      `by:`malcolm:lambda(x,`has:a:x):fv2)
FOL: dept(fv2)&exists(a,(employee(a)&managed(a,`be))&
      by(fv2,`has:a,`malcolm))
CHK: Query not meaningful with respect to current database

SYN: (s(np(det(which))(n(n(dept))))
      (vp(v(has))(np(det(an))(n(n(n(n(employee)))
       (relcl(relpro(that))(s(np)(vp(v(is))(adj(managed))
        (pp(prep(by))(np(propn(malcolm))))))))))))
 PT: `dept:fv3 and some(a,(`employee:a and 
      `by:`malcolm:(`managed:`be):a) and `has:a:fv3)
FOL: dept(fv3)&exists(a,(employee(a)&by(a,`managed:`be,`malcolm))&
      has(fv3,a))
URC: {fv3;[fv3,*]:loc&exists(a,([a,*,*,*]:emp&[a,`malcolm]:boss)&
      [fv3,a,*,*]:emp)}
CHK: Query not meaningful with respect to current database

URC: {fv3;[fv3,*]:loc&exists(a,([a,*,*,*]:emp&[a,`malcolm]:boss)&
      [fv3,*,a,*]:emp)}
CHK: Query not meaningful with respect to current database

URC: {fv3;[fv3,*]:loc&exists(a,([a,*,*,*]:emp&[a,`malcolm]:boss)&
      [fv3,*,*,a]:emp)}
CHK: Query not meaningful with respect to current database

URC: {fv3;[fv3,*]:loc&exists(a,([a,*,*,*]:emp&[a,`malcolm]:boss)&
      [a,*,*,fv3]:emp)}
DRC: {fv3:loc![dept];[fv3,*]:loc&exists(a:emp![name],
      ([a,*,*,*]:emp&[a,`malcolm]:boss)&[a,*,*,fv3]:emp)}
OP1: {fv3:loc![dept];exists(skf1:emp![name],[skf1,`malcolm]:boss&
      [skf1,*,*,fv3]:emp)}
TRC: {fv3!dept;fv3:loc;exists(skf1:emp,
      exists(tuple1:boss,tuple1!name=skf1!name&tuple1!mgr=malcolm)&
       exists(tuple2:emp,tuple2!name=skf1!name&tuple2!dept=fv3!dept))}
OP2: {fv3!dept;fv3:loc;exists(sk2:boss,exists(sk3:emp,
      sk2!mgr=malcolm&sk3!dept=fv3!dept&sk3!name=sk2!name))}
OP3: {fv3!dept;fv3:loc;exists(sk2:boss,exists(sk3:emp,
      sk2!mgr=malcolm&sk3!dept=fv3!dept&sk3!name=sk2!name))}
SQL: SELECT DISTINCT fv3.dept FROM loc fv3 
      WHERE EXISTS(SELECT * FROM boss sk2 
       WHERE EXISTS(SELECT * FROM emp sk3 
        WHERE (sk2.mgr='malcolm' 
        AND (sk3.dept=fv3.dept AND sk3.name=sk2.name))));

|dept      |
|----------|
|food      |
|shoe      |
|toy       |
|----------|
(3 rows)


URC: {fv3;[fv3,*]:loc&exists(a,([a,*,*,*]:emp&[a,`malcolm]:boss)&
      [fv3,a]:boss)}
CHK: Query not meaningful with respect to current database

URC: {fv3;[fv3,*]:loc&exists(a,([a,*,*,*]:emp&[a,`malcolm]:boss)&
      [a,fv3]:boss)}
CHK: Query not meaningful with respect to current database

URC: {fv3;[fv3,*]:loc&exists(a,([a,*,*,*]:emp&[a,`malcolm]:boss)&
      [fv3,a]:loc)}
CHK: Query not meaningful with respect to current database

URC: {fv3;[fv3,*]:loc&exists(a,([a,*,*,*]:emp&[a,`malcolm]:boss)&
      [a,fv3]:loc)}
CHK: Query not meaningful with respect to current database

URC: {fv3;[fv3,*]:loc&exists(a,([a,*,*,*]:emp&[a,`malcolm]:boss)&
      [fv3,a,*,*,*]:supply)}
CHK: Query not meaningful with respect to current database

URC: {fv3;[fv3,*]:loc&exists(a,([a,*,*,*]:emp&[a,`malcolm]:boss)&
      [a,fv3,*,*,*]:supply)}
CHK: Query not meaningful with respect to current database

URC: {fv3;[fv3,*]:loc&exists(a,([a,*,*,*]:emp&[a,`malcolm]:boss)&
      [fv3,*,a,*,*]:supply)}
CHK: Query not meaningful with respect to current database

URC: {fv3;[fv3,*]:loc&exists(a,([a,*,*,*]:emp&[a,`malcolm]:boss)&
      [a,*,fv3,*,*]:supply)}
CHK: Query not meaningful with respect to current database

URC: {fv3;[fv3,*]:loc&exists(a,([a,*,*,*]:emp&[a,`malcolm]:boss)&
      [fv3,*,*,a,*]:supply)}
CHK: Query not meaningful with respect to current database

URC: {fv3;[fv3,*]:loc&exists(a,([a,*,*,*]:emp&[a,`malcolm]:boss)&
      [fv3,*,*,*,a]:supply)}
CHK: Query not meaningful with respect to current database

URC: {fv3;[fv3,*]:loc&exists(a,([a,*,*,*]:emp&[a,`malcolm]:boss)&
      [fv3,a,*,*]:sales)}
CHK: Query not meaningful with respect to current database

URC: {fv3;[fv3,*]:loc&exists(a,([a,*,*,*]:emp&[a,`malcolm]:boss)&
      [a,fv3,*,*]:sales)}
CHK: Query not meaningful with respect to current database

URC: {fv3;[fv3,*]:loc&exists(a,([a,*,*,*]:emp&[a,`malcolm]:boss)&
      [fv3,*,a,*]:sales)}
CHK: Query not meaningful with respect to current database

URC: {fv3;[fv3,*]:loc&exists(a,([a,*,*,*]:emp&[a,`malcolm]:boss)&
      [a,*,fv3,*]:sales)}
CHK: Query not meaningful with respect to current database

URC: {fv3;[fv3,*]:loc&exists(a,([a,*,*,*]:emp&[a,`malcolm]:boss)&
      [fv3,*,*,a]:sales)}
CHK: Query not meaningful with respect to current database

URC: {fv3;[fv3,*]:loc&exists(a,([a,*,*,*]:emp&[a,`malcolm]:boss)&
      [fv3,a,*,*,*]:stock)}
CHK: Query not meaningful with respect to current database

URC: {fv3;[fv3,*]:loc&exists(a,([a,*,*,*]:emp&[a,`malcolm]:boss)&
      [fv3,*,a,*,*]:stock)}
CHK: Query not meaningful with respect to current database

URC: {fv3;[fv3,*]:loc&exists(a,([a,*,*,*]:emp&[a,`malcolm]:boss)&
      [fv3,*,*,a,*]:stock)}
CHK: Query not meaningful with respect to current database

URC: {fv3;[fv3,*]:loc&exists(a,([a,*,*,*]:emp&[a,`malcolm]:boss)&
      [fv3,a,*]:customer)}
CHK: Query not meaningful with respect to current database

URC: {fv3;[fv3,*]:loc&exists(a,([a,*,*,*]:emp&[a,`malcolm]:boss)&
      [fv3,*,a]:customer)}
CHK: Query not meaningful with respect to current database

URC: {fv3;[fv3,*]:loc&exists(a,([a,*,*,*]:emp&[a,`malcolm]:boss)&
      [fv3,a]:supplier)}
CHK: Query not meaningful with respect to current database



Chris Fox, September 1995