summaryrefslogtreecommitdiff
path: root/examples/query
diff options
context:
space:
mode:
authoraarne <aarne@chalmers.se>2012-06-21 06:06:05 +0000
committeraarne <aarne@chalmers.se>2012-06-21 06:06:05 +0000
commitf8e74c50e277b06964f2d820da109197ecde5711 (patch)
treebc87de828ed3aaf2bb6fbf5315016894b75644fd /examples/query
parent18c08fdac1b981b85b15a9f28584b0def9aa45a2 (diff)
factored Query by taking our Proton parts and introducing an interface
Diffstat (limited to 'examples/query')
-rw-r--r--examples/query/small/patentsQuery/LexQuery.gf22
-rw-r--r--examples/query/small/patentsQuery/LexQueryEng.gf26
-rw-r--r--examples/query/small/patentsQuery/Query.gf50
-rw-r--r--examples/query/small/patentsQuery/QueryEng.gf4
-rw-r--r--examples/query/small/patentsQuery/QueryProton.gf59
5 files changed, 161 insertions, 0 deletions
diff --git a/examples/query/small/patentsQuery/LexQuery.gf b/examples/query/small/patentsQuery/LexQuery.gf
new file mode 100644
index 000000000..dbe077a55
--- /dev/null
+++ b/examples/query/small/patentsQuery/LexQuery.gf
@@ -0,0 +1,22 @@
+interface LexQuery = open Syntax in {
+
+oper
+-- structural words
+ about_Prep : Prep ;
+ all_NP : NP ;
+ also_AdV : AdV ;
+ as_Prep : Prep ;
+ at_Prep : Prep ;
+ called_A : A ;
+ give_V3 : V3 ;
+ information_N : N ;
+ other_A : A ;
+ name_N : N ;
+
+ mkName : Str -> NP ;
+
+oper
+ mkRelation : Str -> {cn : CN ; prep : Prep} ;
+ that_RP : RP ;
+
+} \ No newline at end of file
diff --git a/examples/query/small/patentsQuery/LexQueryEng.gf b/examples/query/small/patentsQuery/LexQueryEng.gf
new file mode 100644
index 000000000..5e543aabb
--- /dev/null
+++ b/examples/query/small/patentsQuery/LexQueryEng.gf
@@ -0,0 +1,26 @@
+instance LexQueryEng of LexQuery = open ParadigmsEng, SyntaxEng, ExtraEng, IrregEng in {
+
+oper
+-- structural words
+ about_Prep = mkPrep "about" ;
+ all_NP = mkNP (mkPN "all") ; ---
+ also_AdV = mkAdV "also" | mkAdV "otherwise" ;
+ as_Prep = mkPrep "as" ;
+ at_Prep = mkPrep "at" ;
+ called_A = mkA "called" | mkA "named" ;
+ give_V3 = mkV3 give_V ;
+ information_N = mkN "information" ;
+ other_A = mkA "other" ;
+ name_N = mkN "name" ;
+
+-- lexical constructors
+ mkName : Str -> NP =
+ \s -> mkNP (mkPN s) ;
+
+oper
+ mkRelation : Str -> {cn : CN ; prep : Prep} =
+ \s -> {cn = mkCN (mkN s) ; prep = possess_Prep} ;
+
+ that_RP = ExtraEng.that_RP ;
+
+} \ No newline at end of file
diff --git a/examples/query/small/patentsQuery/Query.gf b/examples/query/small/patentsQuery/Query.gf
new file mode 100644
index 000000000..83eb87892
--- /dev/null
+++ b/examples/query/small/patentsQuery/Query.gf
@@ -0,0 +1,50 @@
+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"
+ 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
+ QInfo : Set -> Query ; -- (give me | ) (information about | all about) S
+
+ 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
+ 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 ---??
+}
diff --git a/examples/query/small/patentsQuery/QueryEng.gf b/examples/query/small/patentsQuery/QueryEng.gf
new file mode 100644
index 000000000..994600fdf
--- /dev/null
+++ b/examples/query/small/patentsQuery/QueryEng.gf
@@ -0,0 +1,4 @@
+concrete QueryEng of Query = QueryI with
+ (LexQuery = LexQueryEng),
+ (Syntax = SyntaxEng),
+ (Lang = LangEng) ;
diff --git a/examples/query/small/patentsQuery/QueryProton.gf b/examples/query/small/patentsQuery/QueryProton.gf
new file mode 100644
index 000000000..4c1bd7237
--- /dev/null
+++ b/examples/query/small/patentsQuery/QueryProton.gf
@@ -0,0 +1,59 @@
+abstract QueryProton = Query ** {
+
+fun
+ QCalled : Individual -> Query ; -- how is X (also | otherwise) (called | named | known) ;
+
+ NLoc : Loc -> Name ;
+ NOrg : Org -> Name ;
+ NPers : Pers -> Name ;
+
+ IName : Name -> Individual ;
+ ACalled : [Individual] -> Activity ;
+
+-- the test lexicon
+
+cat
+ JobTitle ;
+fun
+ Located : Loc -> Property ;
+ Employed : Org -> Property ;
+
+ Work : Org -> Activity ;
+ HaveTitle : JobTitle -> Activity ;
+ HaveTitleOrg : JobTitle -> Org -> Activity ;
+
+ Organization : Kind ;
+ Place : Kind ;
+ Person : Kind ;
+
+ Location : Relation ;
+ Region : Relation ;
+ Subregion : Relation ;
+
+ RName : Relation ;
+ RNickname : Relation ;
+
+-- 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 ;
+} \ No newline at end of file