summaryrefslogtreecommitdiff
path: root/examples/query/Query.gf
blob: 6f6dab6bc2223fa183badde7468a3590d689e006 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
53
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
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
162
163
164
165
166
abstract Query = {

flags
  startcat = Move ;

-- general query language, which can be specialized with any lexicon

cat
  Move ;     -- top-level utterance,    e.g. "give me all Bulgarian persons that work at Google"
  Query ;   
  Answer ;
  Set ;           -- the set requested,      e.g. "all persons"
  Interrogative ; -- interrog. pron.         e.g. "who" 
  Function ;      -- something of something, e.g. "subregion of Bulgaria"
  Kind ;          -- type of things,         e.g. "person"
  Relation ;      -- relation between things,e.g. "employed at"
  Property ;      -- property of things,     e.g. "employed at Google"
  Individual ;    -- one entity,             e.g. "Google"
--  Activity ;      -- action property,        e.g. "work at Google"
  Name ;          -- person, company...      e.g. "Eric Schmidt"
  Loc ;
  Org ;
  Pers ;
  [Individual] {2} ; -- list of entities, e.g. "Larry Page, Sergey Brin"

fun
  MQuery  : Query -> Move ;
  MAnswer : Answer -> Move ;
 
  QSet    : Set  -> Query ;  -- (give me | what are | which are | ) (S | the names of S | S's names)
  QWhere     : Set  -> Query ;  -- where are S
  QWhat      : Interrogative -> Property -> Query ; -- who P
  QWhatWhat  : Interrogative -> Interrogative -> Relation -> Query ; -- who R what
  QWhatWhere : Interrogative -> Relation -> Query ; -- who R where --- overgenerating
  QRelWhere  : Set -> Relation -> Query ; -- where does S R --- overgenerating
  QFun       : Function -> Set -> Query ; -- what R does S have
  QFunPair   : Set -> Function -> Query ; -- S and their R's
  QInfo      : Set  -> Query ;  -- (give me | ) (information about | all about) S
  QCalled    : Individual -> Query ; -- how is X (also | otherwise) (called | named | known) ;
  QWhether   : Answer -> Query ; -- is S P --- not in the corpus, but should be ??

  AKind  : Set  -> Kind     -> Answer ; -- S is a K
  AInd   : Set  -> Individual -> Answer ; -- S is I
  AName  : Set  -> Name     -> Answer ; -- N is the name of S
  AProp  : Set  -> Property -> Answer ; -- S is P
--  AAct   : Set  -> Activity -> Answer ; -- S As --+

  SAll   : Kind -> Set ;  -- all Ks | the Ks
  SFun   : Set  -> Function -> Set ;  -- S's Rs
  SOne   : Kind -> Set ;  -- one K
  SIndef : Kind -> Set ;  -- a K
  SDef   : Kind -> Set ;  -- the K
  SPlural : Kind -> Set ;  -- Ks
  SOther : Kind -> Set ;  -- other Ks
  SInd   : Individual  -> Set ;  -- X
  SInds  : [Individual] -> Set ; -- X and Y

  IWho   : Interrogative ; -- who
  IWhat  : Interrogative ; -- what
  IWhich : Kind -> Interrogative ; -- which K | what K | which Ks | what Ks

  KFunSet  : Function -> Set -> Kind ; -- R of S | S's R
  KFunsSet : Function -> Function -> Set -> Kind ; -- R and Q of S
  KFunKind : Kind -> Function -> Set -> Kind ; -- K that is R of S
  KFunPair : Kind -> Function -> Kind ; -- S's with their R's
  KProp    : Property -> Kind -> Kind ; -- P K | K that is P
--  KAct     : Activity -> Kind -> Kind ; -- K that Ps
  KFun     : Function -> Kind ; -- R ---??

  IName    : Name -> Individual ;

  NLoc : Loc -> Name ;
  NOrg : Org -> Name ;
  NPers : Pers -> Name ;

  PCalled  : Individual   -> Property ;  -- also called I
  PCalleds : [Individual] -> Property ;  -- also called I or J

  PIs      : Individual -> Property ;

  PRelation : Relation -> Set -> Property ;

-- the test lexicon

cat
  Country ;
  JobTitle ;
fun
  NCountry : Country -> Name ;
  PCountry : Country -> Property ;

  Located : Relation ;

  In : Relation ;
  HaveTitleAt : JobTitle -> Relation ;
  EmployedAt : Set -> Relation ;
  HaveTitle : Relation ;
  Employed : Relation ;

  Named : Name -> Property ;

  Start : Name -> Property ;

  Organization : Kind ;
  Company : Kind ;
  Place : Kind ;
  Person : Kind ;

  Location : Function ;
  Region : Function ;
  Subregion : Function ;

--  USA : Country ;
--  California : Country ;
--  Bulgaria : Country ;
--  OblastSofiya : Name ;

  FName     : Function ;
  FNickname : Function ;
  FJobTitle : Function ;

  SJobTitle : JobTitle -> Set ; -- a programmer

-- JobTitles
   JobTitle1 : JobTitle ;
   JobTitle2 : JobTitle ;
   JobTitle3 : JobTitle ;
   JobTitle4 : JobTitle ;

-- Locations
   Location1 : Loc ;
   Location2 : Loc ;
   Location3 : Loc ;
   Location4 : Loc ;

-- Organizations
   Organization1 : Org ;
   Organization2 : Org ;
   Organization3 : Org ;
   Organization4 : Org ;

-- Persons
   Person1 : Pers ;
   Person2 : Pers ;
   Person3 : Pers ;
   Person4 : Pers ;

--  CEO : JobTitle ;
--  ChiefInformationOfficer : JobTitle ;
  
--  Microsoft : Name ;
--  Google : Name ;

--  SergeyBrin : Name ;
--  LarryPage : Name ;
--  EricSchmidt : Name ;
--  MarissaMayer : Name ;
--  UdiManber : Name ;
--  CarlGustavJung : Name ;
--  Jung : Name ;
--  BenFried : Name ;


}