summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authoraarne <aarne@chalmers.se>2012-06-21 06:22:47 +0000
committeraarne <aarne@chalmers.se>2012-06-21 06:22:47 +0000
commit92a106339f5948e30119664dfe9dce1b66afe81b (patch)
treee31ee63adace64e1f6f92e0b662a341c1b67abda /examples
parentf8e74c50e277b06964f2d820da109197ecde5711 (diff)
QueryFre instances, don't compile yet because of type discrepancies
Diffstat (limited to 'examples')
-rw-r--r--examples/query/small/patentsQuery/LexPatsQueryFre.gf36
-rw-r--r--examples/query/small/patentsQuery/LexQueryFre.gf25
-rw-r--r--examples/query/small/patentsQuery/QueryFre.gf4
-rw-r--r--examples/query/small/patentsQuery/QueryPatFre.gf254
4 files changed, 301 insertions, 18 deletions
diff --git a/examples/query/small/patentsQuery/LexPatsQueryFre.gf b/examples/query/small/patentsQuery/LexPatsQueryFre.gf
index dd87e21e2..8df4f6b38 100644
--- a/examples/query/small/patentsQuery/LexPatsQueryFre.gf
+++ b/examples/query/small/patentsQuery/LexPatsQueryFre.gf
@@ -1,4 +1,4 @@
-instance LexPatsQueryFre of LexPatsQuery =
+instance LexPatsQueryFre of LexPatsQuery = QueryFre **
open SyntaxFre, ParadigmsFre, ExtraFre, IrregFre, StructuralFre, DiffFre, (CR=CommonRomance), ParamX, Prelude in {
flags
@@ -19,32 +19,32 @@ oper
vpAP vp = variants {} ;
- active_ingredient_CN : CN = mkCN (mkA "actif") (mkN "ingrédient") ;
- dosage_form_CN : CN = mkCN (mkA "posologique") (mkN "forme") ;
- route_of_administration_CN : CN = mkCN (mkCN (mkN "voie")) (SyntaxFre.mkAdv possess_Prep (mkNP (mkN "administration"))) ;
- patent_number_CN : CN = mkCN (mkCN (mkN "numéro")) (SyntaxFre.mkAdv possess_Prep (mkNP (mkN "brevet"))) ;
- patent_N : N = mkN "brevet" ;
- expiration_date_CN : CN = mkCN (mkCN (mkN "date")) (SyntaxFre.mkAdv possess_Prep (mkNP (mkN "expiration")));
+ active_ingredient_CN = mkCN (mkA "actif") (mkN "ingrédient") ;
+ dosage_form_CN = mkCN (mkA "posologique") (mkN "forme") ;
+ route_of_administration_CN = mkCN (mkCN (mkN "voie")) (SyntaxFre.mkAdv possess_Prep (mkNP (mkN "administration"))) ;
+ patent_number_CN : Kind = mkCN (mkCN (mkN "numéro")) (SyntaxFre.mkAdv possess_Prep (mkNP (mkN "brevet"))) ;
+ patent_N = mkCN (mkN "brevet") ;
+ expiration_date_CN = mkCN (mkCN (mkN "date")) (SyntaxFre.mkAdv possess_Prep (mkNP (mkN "expiration")));
expire_V : V = regV "expirer" ;
- use_code_CN : CN = mkCN (mkCN (mkN "code")) (SyntaxFre.mkAdv possess_Prep (mkNP (mkN "utilisation"))) ;
- application_number_CN : CN = mkCN (mkCN (mkN "numéro")) (SyntaxFre.mkAdv possess_Prep (mkNP (mkN "demande"))) ;
+ use_code_CN = mkCN (mkCN (mkN "code")) (SyntaxFre.mkAdv possess_Prep (mkNP (mkN "utilisation"))) ;
+ application_number_CN = mkCN (mkCN (mkN "numéro")) (SyntaxFre.mkAdv possess_Prep (mkNP (mkN "demande"))) ;
apply_V : V = regV "appliquer" ;
- applicant_CN : CN = mkCN (mkN "demandeur") ;
- approval_date_CN : CN = mkCN (mkCN (mkN "date")) (SyntaxFre.mkAdv possess_Prep (mkNP (mkN "approbation"))) ;
- chemical_composition_CN : CN = mkCN (mkA "chemique") (mkN "composition") ;
- chemical_substance_CN : CN = mkCN (mkA "chimique") (mkN "substance") ;
+ applicant_CN = mkCN (mkN "demandeur") ;
+ approval_date_CN = mkCN (mkCN (mkN "date")) (SyntaxFre.mkAdv possess_Prep (mkNP (mkN "approbation"))) ;
+ chemical_composition_CN = mkCN (mkA "chemique") (mkN "composition") ;
+ chemical_substance_CN = mkCN (mkA "chimique") (mkN "substance") ;
drug_N : N = mkN "médicament" ;
- use_N : N = mkN "utilisation" ;
- compound_CN : CN = mkCN (mkN "composé") ;
+ use_N = mkCN (mkN "utilisation") ;
+ compound_CN = mkCN (mkN "composé") ;
method_N : N = mkN "méthode" ;
- strength_N : N = mkN "dosage" ;
- drug_preparation_CN : CN = mkCN (mkN "préparation") ;
+ strength_N = mkCN (mkN "dosage") ;
+ drug_preparation_CN = mkCN (mkN "préparation") ;
claim_N : N = mkN "revendication" ;
mention_V2 : V2 = dirV2 (regV "mentionner") ;
use_V2 : V2 = dirV2 (regV "utiliser") ;
approve_V2 : V2 = dirV2 (regV "approuver") ;
contain_V2 : V2 = IrregFre.contenir_V2 ;
- usage_form_CN : CN = mkCN (mkCN (mkN "formulaire")) (SyntaxFre.mkAdv possess_Prep (mkNP (mkN "utilisation")));
+ usage_form_CN = mkCN (mkCN (mkN "formulaire")) (SyntaxFre.mkAdv possess_Prep (mkNP (mkN "utilisation")));
information_N : N = mkN "information" ;
diff --git a/examples/query/small/patentsQuery/LexQueryFre.gf b/examples/query/small/patentsQuery/LexQueryFre.gf
new file mode 100644
index 000000000..5fb4e603e
--- /dev/null
+++ b/examples/query/small/patentsQuery/LexQueryFre.gf
@@ -0,0 +1,25 @@
+instance LexQueryFre of LexQuery = open ParadigmsFre, SyntaxFre, ExtraFre, IrregFre, Prelude in {
+
+oper
+ about_Prep = on_Prep ;
+ also_AdV = lin AdV (ss "aussi") ;
+ as_Prep = mkPrep "comme" ;
+ at_Prep = mkPrep "chez" ;
+ called_A = mkA "appelé" ;
+ give_V3 = mkV3 (mkV "montrer") ;
+ information_N = mkN "information" ;
+ other_A = prefixA (mkA "autre") ;
+ name_N = mkN "nom" ;
+ all_NP = mkName "tout" ; ----
+
+-- 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 = which_RP ;
+
+} \ No newline at end of file
diff --git a/examples/query/small/patentsQuery/QueryFre.gf b/examples/query/small/patentsQuery/QueryFre.gf
new file mode 100644
index 000000000..9ad80329e
--- /dev/null
+++ b/examples/query/small/patentsQuery/QueryFre.gf
@@ -0,0 +1,4 @@
+concrete QueryFre of Query = QueryI with
+ (LexQuery = LexQueryFre),
+ (Syntax = SyntaxFre),
+ (Lang = LangFre) ;
diff --git a/examples/query/small/patentsQuery/QueryPatFre.gf b/examples/query/small/patentsQuery/QueryPatFre.gf
new file mode 100644
index 000000000..3196f7809
--- /dev/null
+++ b/examples/query/small/patentsQuery/QueryPatFre.gf
@@ -0,0 +1,254 @@
+--# -path=.:alltenses
+
+concrete QueryPatFre of QueryPat = QueryFre ** open
+ SyntaxFre,
+ LexPatsQueryFre,
+ LangFre,
+ ParadigmsFre
+in {
+
+
+--------------------------------------------------------
+-- additions to the original query grammar
+
+lin
+
+ SThe k = SyntaxFre.mkNP the_Det k ;
+
+ SMassSg k = SyntaxFre.mkNP k ;
+
+ QWho a = mkUtt (mkQCl whoSg_IP a) ;
+
+-- QWhen : Set -> Activity -> Query ;
+
+ QMass s = mkUtt s ;
+
+
+---------------------------------------------------------
+-- from the patent query grammar
+
+lincat
+ Drug = NP ;
+ Patent = NP ;
+ ChemicalSubstance = NP ;
+ DrugUsageForm = NP ;
+ PatentNumber = NP ;
+ Applicant = NP ;
+ ApplicationNumber = NP ;
+ PatsDate = Adv ;
+
+
+lin
+PQInfo drug = QInfo (DrugToSet drug) ;
+
+PQActive drug =
+ let
+ ai : Kind = KRelSet active_ingredient_CN (DrugToSet drug)
+ in
+ basicPlur ai ;
+
+
+PQDosage drug =
+ let
+ df : Kind = KRelSet dosage_form_CN (DrugToSet drug)
+
+ in
+ basicBoth df ;
+ -- | mkUtt (ExistIP (IdetCN (IdetQuant what_IQuant NumPl) df)) ;
+
+
+PQRoute drug =
+ let
+ df : Kind = KRelSet route_of_administration_CN (DrugToSet drug)
+ in
+ basicBoth df ;
+-- | mkUtt (ExistIP (IdetCN (IdetQuant what_IQuant NumPl) df)) ;
+
+
+PQPatentNo =
+ let bu : Query = basicPlur patent_number_CN
+ in
+ bu ;
+-- | mkUtt (ExistIP (IdetCN (IdetQuant what_IQuant NumPl) patent_number_CN)) ;
+
+
+
+PQPatentDrug drug =
+ let
+ df : Kind = KRelSet patent_number_Rel (DrugToSet drug)
+ in
+ basicSing df ;
+
+
+
+PQPatentPat patent =
+ let
+ ai : Kind = KRelSet patent_number_Rel (PatentToSet patent)
+ in
+ basicSing ai ;
+
+
+PQExpPat patent =
+ let
+ ai : Kind = KRelSet expiration_date_CN (PatentToSet patent) ;
+ bu : Query = basicSing ai
+ in
+ bu ;
+-- | mkUtt (mkQCl when_IAdv (mkCl patent (mkVP expire_V))) ;
+
+
+PQExpDrug drug =
+ let
+ ai : Kind = KRelSet expiration_date_CN (SThe (KRelSet patent_N (DrugToSet drug))) ;
+ bu : Query = basicSing ai
+ in
+ bu ;
+-- | mkUtt (mkQCl when_IAdv (mkCl (mkNP the_Art ai) (mkVP expire_V)));
+
+
+PQUseCode patent =
+ let
+ df : Kind = KRelSet use_code_CN (PatentToSet patent)
+ in
+ basicBoth df ;
+
+PQAppNumber patent =
+ let
+ df : Kind = KRelSet application_number_CN (PatentToSet patent)
+ in
+ basicSing df ;
+
+PQApplicant patent =
+ let df : Kind = KRelSet applicant_CN (PatentToSet patent) ;
+ bu : Query = basicSing df
+ in
+ bu ;
+-- | mkUtt (mkQS (mkQCl whoSg_IP (mkVP (mkVP apply_V) (SyntaxFre.mkAdv for_Prep patent))))
+-- | mkUtt (mkQS pastTense (mkQCl whoSg_IP (mkVP (mkVP apply_V) (SyntaxFre.mkAdv for_Prep patent))));
+
+PQAppDayDrug drug =
+ let
+ df : Kind = KRelSet approval_date_CN (SThe (KRelSet patent_N (DrugToSet drug)))
+ in
+ basicSing df ;
+
+
+PQAppDayPat patent =
+ let
+ df : Kind = KRelSet approval_date_CN (PatentToSet patent)
+ in
+ basicSing df ;
+
+
+--------------------------------------------------------------------------------
+ oper basicSing : CN -> Utt =
+ \df ->
+ let sg_df : NP = SThe df ;
+ massdf : NP = SMassSg df
+ in
+ QSet sg_df
+ | QMass massdf
+ | QMass sg_df ;
+
+
+oper basicPlur : CN -> Utt =
+ \df ->
+ let sg_df : NP = SAll df ;
+ massdf : NP = SPlural df
+ in
+ QInfo sg_df
+ | QMass massdf
+ | QMass sg_df ;
+
+oper basicBoth : CN -> Utt =
+ \df ->
+ let sg_df : NP = SThe df ;
+ the_df : NP = SAll df ;
+ mass_sg_df : NP = SMassSg df ;
+ mass_pl_df : NP = SPlural df
+ in
+ QInfo the_df
+ | QInfo sg_df
+ | QMass mass_sg_df
+ | QMass sg_df
+ | QMass mass_pl_df
+ | QMass the_df ;
+
+
+{- use later as more options for QInfo
+
+ | mkUtt (mkQCl (mkIP (mkIDet what_IQuant) information_N) (mkClSlash (mkNP youPl_Pron) (PatsAdvVPSlash (mkVPSlash have_V2) (SyntaxFre.mkAdv about_Prep drug))))
+ | mkUtt (mkQCl (mkIP (mkIDet what_IQuant) information_N) (mkClSlash (mkNP i_Pron) (SlashVV can_VV (PatsAdvVPSlash (mkVPSlash get_V2) (SyntaxFre.mkAdv about_Prep drug)))))
+ | mkUtt (mkNP all_Predet (massInfoSg (mkCN (mkCN information_N) (SyntaxFre.mkAdv about_Prep drug))))
+ | mkUtt (mkNP all_NP (SyntaxFre.mkAdv about_Prep drug))
+ | mkUtt drug ;
+-}
+
+--------------------------------------------------------------------------
+-- coercions
+
+lin DrugToSet d = d ;
+lin PatentToSet d = d ;
+lin ChemToSet d = d ;
+lin UsageToSet d = d ;
+lin PatNumToSet d = d ;
+lin AppToSet d = d ;
+lin AppNumToSet d = d ;
+--lin DateToSet : PatsDate -> Set ;
+
+
+
+--------------------------------------------------------------------------
+-- lexicon
+
+oper mkDrug : Str -> NP =
+ \p -> mkNP (mkPN p) ;
+
+oper mkPatents : Str -> NP =
+ \p -> mkNP (mkPN p) ;
+
+oper mkChemicalSubstance : Str -> NP =
+ \p -> mkNP (mkPN p) ;
+
+oper mkDrugUsageForm : Str -> NP =
+ \p -> mkNP (mkPN p) ;
+
+oper mkPatentNumber : Str -> NP =
+ \p -> mkNP (mkPN p) ;
+
+oper mkApplicant : Str -> NP =
+ \p -> mkNP (mkPN p) ;
+
+oper mkApplicationNumber : Str -> NP =
+ \p -> mkNP (mkPN p);
+
+
+
+
+lin
+
+Aspirin = mkDrug "DRUG" ;
+
+Pats1230 = mkPatents "PATENT" ;
+
+Hydrogen = mkChemicalSubstance "CHEMICAL_SUBSTANCE" ;
+
+Inhalation = mkDrugUsageForm "DRUG_USAGE_FORM" ;
+
+P123 = mkPatentNumber "PATENT_NUMBER" ;
+
+JohnDoe = mkApplicant "APPLICANT" ;
+
+A123 = mkApplicationNumber "APPLICATION_NUMBER" ;
+
+
+ OnDate = mkPatsDate on_Prep ;
+ BeforeDate = mkPatsDate before_Prep ;
+ AfterDate = mkPatsDate after_Prep ;
+
+oper mkPatsDate : Prep -> Adv = \prep -> SyntaxFre.mkAdv prep (mkNP (mkPN "DATE")) ;
+
+
+
+}
+