summaryrefslogtreecommitdiff
path: root/examples/query/Query.gf
blob: f8da256c7ff270b76d5aa24e656774832239f618 (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
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"
  Relation ; -- something of something, e.g. "subregion of Bulgaria"
  Kind ;     -- type of things,         e.g. "person"
  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"
  [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
  QInfo   : Set  -> Query ;  -- (give me | ) (information about | all about) S
  QCalled : Individual -> Query ; -- how is X (also | otherwise) (called | named | known) ;

  AKind  : Set  -> Kind     -> Answer ; -- S is a K
  AProp  : Set  -> Property -> Answer ; -- S is P
  AAct   : Set  -> Activity -> Answer ; -- S As

  SAll   : Kind -> Set ;  -- all Ks | the Ks
  SOne   : Kind -> Set ;  -- one K
  SIndef : Kind -> Set ;  -- a K
  SPlural : Kind -> Set ;  -- Ks
  SOther : Kind -> Set ;  -- other Ks
  SInd   : Individual  -> Set ;  -- X
  SInds  : [Individual] -> Set ; -- X and Y

  KRelSet  : Relation -> Set -> Kind ; -- R of S | S's R
  KRelsSet : Relation -> Relation -> Set -> Kind ; -- R and Q of S
  KRelKind : Kind -> Relation -> Set -> Kind ; -- K that is R of S
  KRelPair : Kind -> Relation -> Kind ; -- S's with their R's
  KProp    : Property -> Kind -> Kind ; -- P K | K that is P
  KAct     : Activity -> Kind -> Kind ; -- K that Ps
  KRel     : Relation -> Kind ; -- R ---??

  IName    : Name -> Individual ;

  ACalled  : [Individual] -> Activity ;


-- the test lexicon

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

  Located : Individual -> Property ;
  Employed : Individual -> Property ;

  Work : Individual -> Activity ;
  HaveTitle : JobTitle -> Individual -> Activity ;

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

  Location : Relation ;
  Region : Relation ;
  Subregion : Relation ;

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

  RName     : Relation ;
  RNickname : Relation ;

  CEO : JobTitle ;
  
  Microsoft : Name ;
  Google : Name ;

  SergeyBrin : Name ;
  LarryPage : Name ;
  EricSchmidt : Name ;
  MarissaMayer : Name ;
  UdiManber : Name ;

}