summaryrefslogtreecommitdiff
path: root/examples/query
diff options
context:
space:
mode:
authorramona.enache <ramona.enache@chalmers.se>2012-06-21 11:17:34 +0000
committerramona.enache <ramona.enache@chalmers.se>2012-06-21 11:17:34 +0000
commit5a8c8de789908bc1a7e4e5b3c647386e028c0972 (patch)
treea88480cc1b992e9629c74cfab948bd573e6193cc /examples/query
parent7af649f2784056f26fec3908f644057bd9a870be (diff)
added patents queries in new_patentsQuery
Diffstat (limited to 'examples/query')
-rw-r--r--examples/query/small/new_patentsQuery/LexQueryPats.gf111
-rw-r--r--examples/query/small/new_patentsQuery/LexQueryPatsEng.gf136
-rw-r--r--examples/query/small/new_patentsQuery/QueryPats.gf194
-rw-r--r--examples/query/small/new_patentsQuery/QueryPatsEng.gf387
-rw-r--r--examples/query/small/patentsQuery/LexQueryPats.gf111
-rw-r--r--examples/query/small/patentsQuery/LexQueryPatsEng.gf136
-rw-r--r--examples/query/small/patentsQuery/QueryPats.gf194
-rw-r--r--examples/query/small/patentsQuery/QueryPatsEng.gf387
8 files changed, 1656 insertions, 0 deletions
diff --git a/examples/query/small/new_patentsQuery/LexQueryPats.gf b/examples/query/small/new_patentsQuery/LexQueryPats.gf
new file mode 100644
index 000000000..466e924c3
--- /dev/null
+++ b/examples/query/small/new_patentsQuery/LexQueryPats.gf
@@ -0,0 +1,111 @@
+interface LexQueryPats = open Syntax, QueryPats, Query in
+{
+
+oper
+
+--------------------------------------------------------------
+-- structural words and extra grammar constructs
+
+ about_Prep : Prep ;
+
+ all_NP : NP ;
+
+ vpAP : VP -> AP ;
+
+ what_IQuant : IQuant ;
+
+ massInfoSg : CN -> NP ;
+
+ massInfoPl : CN -> NP ;
+
+ PatsAdvVPSlash : VPSlash -> Adv -> VPSlash ;
+
+ selectIP : NP -> IP ; -- selecting the right agreement : what are the ingredients ? / what is the expiration date ? (not obvious in English, but will make a difference in other languages)
+
+
+--------------------------------------------------------------
+-- kinds
+
+ patent_number_CN : Kind ;
+
+ claim_N : Kind ;
+
+
+--------------------------------------------------------------
+-- activities
+
+ expire_V : Adv -> Activity ;
+
+ simp_expire_V : Activity ;
+
+ apply_V : NP -> Activity ;
+
+ compound_CN : Activity ;
+
+ use_V2 : Set -> Activity ;
+
+ approve_V2 : Adv -> Activity ;
+
+ mention_V2 : NP -> Activity ;
+
+ contain_V2 : NP -> Activity ;
+
+
+--------------------------------------------------------------
+-- properties
+
+ approve_prop_V2 : Adv -> Property ;
+
+ use_prop_V2 : Set -> Property ;
+
+--------------------------------------------------------------
+-- relations
+
+ active_ingredient_CN : Relation ;
+
+ dosage_form_CN : Relation ;
+
+ route_of_administration_CN : Relation ;
+
+ patent_number_Rel : Relation ;
+
+ patent_N : Relation ;
+
+ patent_with_N : Relation ;
+
+ expiration_date_CN : Relation ;
+
+ use_code_CN : Relation ;
+
+ application_number_CN : Relation ;
+
+ application_number_no_CN : Relation ;
+
+ applicant_CN : Relation ;
+
+ applicant_no_CN : Relation ;
+
+ approval_date_CN : Relation ;
+
+ chemical_composition_CN : Relation ;
+
+ chemical_substance_CN : Relation ;
+
+ drug_N : Relation ;
+
+ use_N : Relation ;
+
+ method_N : Relation ;
+
+ drug_with_usage_form_CN : Relation ;
+
+ drug_preparation_CN : Relation ;
+
+ strength_N : Relation ;
+
+ name_N : Relation ;
+
+ usage_form_CN : Relation ;
+
+
+} \ No newline at end of file
diff --git a/examples/query/small/new_patentsQuery/LexQueryPatsEng.gf b/examples/query/small/new_patentsQuery/LexQueryPatsEng.gf
new file mode 100644
index 000000000..09206388e
--- /dev/null
+++ b/examples/query/small/new_patentsQuery/LexQueryPatsEng.gf
@@ -0,0 +1,136 @@
+instance LexQueryPatsEng of LexQueryPats = open
+ SyntaxEng,
+ (M=MakeStructuralEng),
+ ParadigmsEng,
+ ExtraEng,
+ IrregEng,
+ LangEng,
+ ResEng,
+ QueryEng
+ in
+{
+
+oper
+--------------------------------------------------------------
+-- structural words and extra grammar constructs
+
+ about_Prep : Prep = mkPrep "about" ;
+
+ all_NP : NP = SyntaxEng.mkNP (mkPN "all") ;
+
+ vpAP : VP -> AP = PartVP ;
+
+ what_IQuant : IQuant = M.mkIQuant "what" "what" ;
+
+ massInfoSg : CN -> NP = \cn -> SyntaxEng.mkNP cn ;
+
+ massInfoPl : CN -> NP = \cn -> SyntaxEng.mkNP aPl_Det cn ;
+
+ PatsAdvVPSlash : VPSlash -> Adv -> VPSlash = LangEng.AdvVPSlash ;
+
+ selectIP : NP -> IP = \np -> case np.a of
+ {AgP3Sg _ => whatSg_IP ;
+ _ => whatPl_IP
+ };
+
+
+--------------------------------------------------------------
+-- kinds
+
+ patent_number_CN : Kind = lin Kind (mkCN (mkN "patent" (mkN "number"))) ;
+
+ claim_N : Kind = lin Kind (mkCN (mkN "claim")) ;
+
+
+--------------------------------------------------------------
+-- activities
+
+ expire_V : Adv -> Activity = \pdate ->
+ lin Activity (mkVP (mkVP (mkV "expire")) pdate) ;
+
+ simp_expire_V : Activity =
+ lin Activity (mkVP (mkV "expire")) ;
+
+ apply_V : NP -> Activity = \pat -> lin Activity ( mkVP (mkVP (mkV "apply" "applies" "applied" "applied" "applying")) (SyntaxEng.mkAdv for_Prep pat)) ;
+
+ compound_CN : Activity = let vp : VP = mkVP (mkCN (mkN "compound"))
+ in lin Activity vp ;
+
+ use_V2 : Set -> Activity = \s -> lin Activity (mkVP (passiveVP (mkV2 (mkV "use" "uses" "used" "used" "using"))) (SyntaxEng.mkAdv in_Prep s));
+
+ approve_V2 : Adv -> Activity = \pdate -> lin Activity (mkVP (passiveVP (mkV2 (mkV "approve" "approves" "approved" "approved" "approving"))) pdate) ;
+
+ mention_V2 : NP -> Activity = \drug ->
+ lin Activity ( mkVP (mkVPSlash (mkV2 (mkV "mention" "mentions" "mentioned" "mentioned" "mentioning"))) drug) ;
+
+ contain_V2 : NP -> Activity = \chem ->
+ lin Activity (mkVP (mkVPSlash (mkV2 (mkV "contain" "contains" "contained" "contained" "containing"))) chem) ;
+
+
+--------------------------------------------------------------
+-- properties
+
+ approve_prop_V2 : Adv -> Property = \pdate -> lin Property (vpAP (mkVP (passiveVP (mkV2 (mkV "approve" "approves" "approved" "approved" "approving"))) pdate)) ;
+
+ use_prop_V2 : Set -> Property = \s -> lin Property (vpAP (mkVP (passiveVP (mkV2 (mkV "use" "uses" "used" "used" "using"))) (SyntaxEng.mkAdv in_Prep s))) ;
+
+
+
+--------------------------------------------------------------
+-- relations
+
+ active_ingredient_CN : Relation = makeRelation (mkCN (mkA "active") (mkN "ingredient")) ;
+
+ dosage_form_CN : Relation = makeRelation (mkCN (mkN "dosage" (mkN "form"))) ;
+
+ route_of_administration_CN : Relation = makeRelation (mkCN (mkN "route") (SyntaxEng.mkAdv (mkPrep "of") (SyntaxEng.mkNP (mkN "administration")))) ;
+
+ patent_number_Rel : Relation = makeRelation (mkCN (mkN "patent" (mkN "number"))) ;
+
+ patent_N : Relation = lin Relation {cn = mkCN (mkN "patent") ; prep = for_Prep } ;
+
+ patent_with_N : Relation = lin Relation {cn = mkCN (mkN "patent"); prep = with_Prep} ;
+
+ expiration_date_CN : Relation = makeRelation (mkCN (mkN "expiration" (mkN "date"))) ;
+
+ use_code_CN : Relation = makeRelation (SyntaxEng.mkCN (mkN "use" (mkN "code"))) ;
+
+ application_number_CN : Relation = makeRelation ((mkCN (mkN "application" (mkN "number"))) | (mkCN (mkN ["patent application"] (mkN "number")))) ;
+
+
+ application_number_no_CN : Relation = lin Relation {cn = ((mkCN (mkN "application" (mkN "number"))) | (mkCN (mkN ["patent application"] (mkN "number")))); prep = noPrep} ;
+
+ applicant_CN : Relation = lin Relation { cn = mkCN (mkN "applicant") ; prep = for_Prep } ;
+
+
+ applicant_no_CN : Relation = lin Relation {cn = mkCN (mkN "applicant"); prep = noPrep} ;
+
+ approval_date_CN : Relation = makeRelation (mkCN (mkN "approval" (mkN "date"))) ;
+
+
+ chemical_composition_CN : Relation = makeRelation (mkCN (mkA "chemical") (mkN "composition")) ;
+
+ chemical_substance_CN : Relation = lin Relation {cn = (mkCN (mkA "chemical") (mkN "substance")) ; prep = from_Prep | part_Prep } ;
+
+ drug_N : Relation = lin Relation {cn = mkCN (mkN "drug") ; prep = with_Prep} ;
+
+ use_N : Relation = makeRelation (mkCN (mkN "use")) ;
+
+ method_N : Relation = makeRelation (mkCN (mkN "method")) ;
+
+ drug_with_usage_form_CN : Relation = lin Relation {cn = mkCN (mkN "drug") ; prep = noPrep } ;
+
+ drug_preparation_CN : Relation = lin Relation {cn = mkCN (mkN "drug" (mkN "preparation")) ; prep = for_Prep} ;
+
+ strength_N : Relation = makeRelation (mkCN (mkN "strength")) ;
+
+ name_N : Relation = makeRelation (mkCN (mkN "name")) ;
+
+ usage_form_CN = makeRelation (mkCN (mkN "usage" (mkN "form"))) ;
+
+----------------------------------------------------------------------------
+oper makeRelation : CN -> Relation =
+ \s -> lin Relation {cn = s ; prep = possess_Prep} ;
+
+
+} \ No newline at end of file
diff --git a/examples/query/small/new_patentsQuery/QueryPats.gf b/examples/query/small/new_patentsQuery/QueryPats.gf
new file mode 100644
index 000000000..b66950d20
--- /dev/null
+++ b/examples/query/small/new_patentsQuery/QueryPats.gf
@@ -0,0 +1,194 @@
+--# -path=.:..:alltenses
+
+abstract QueryPats = Query ** open Syntax in {
+-------------------------------------------------------------------------------------
+-- additions to the general Query grammar
+
+
+fun
+
+ SThe : Kind -> Set ; -- the route of administration
+
+ SMassSg : Kind -> Set ; -- route of administration
+
+ QWho : Activity -> Query ; -- who applied for the patent ?
+
+-- QWhen : Set -> Activity -> Query ; -- when was the patent approved ?
+
+ QMass : Set -> Query ; -- expiration date of the patent
+
+ QExist : Kind -> Query ; -- what dosage forms of DRUG are there ?
+ -- maybe merge with QSet
+
+
+
+
+-------------------------------------------------------------------------------------
+-- categories and example functions for the Patent Query grammar
+
+cat
+ Drug ;
+ Patent ;
+ ChemicalSubstance ;
+ DrugUsageForm ;
+ PatentNumber ;
+ Applicant ;
+ ApplicationNumber ;
+ PatsDate ;
+ SimpDate ;
+
+--------------------------------------------------------------------------------
+-- simple coercions
+
+fun DrugToSet : Drug -> Set ;
+fun PatentToSet : Patent -> Set ;
+fun ChemToSet : ChemicalSubstance -> Set ;
+fun UsageToSet : DrugUsageForm -> Set ;
+fun PatNumToSet : PatentNumber -> Set ;
+fun AppToSet : Applicant -> Set ;
+fun AppNumToSet : ApplicationNumber -> Set ;
+--fun DateToSet : PatsDate -> Set ;
+
+
+fun
+ OnDate : SimpDate -> PatsDate ;
+ BeforeDate : SimpDate -> PatsDate ;
+ AfterDate : SimpDate -> PatsDate ;
+ FromSimpDate : SimpDate -> PatsDate ;
+
+
+-------------------------------------------------------------------------------------
+-- main functions for the Patents Query grammar
+
+fun
+
+ PQInfo : Drug -> Query ; -- what information do you have about DRUG | give me all information about DRUG ...
+
+ PQActive : Drug -> Query ; -- what active ingredients are in DRUG
+
+ PQDosage : Drug -> Query ; -- what are the dosage forms of DRUG
+
+ PQRoute : Drug -> Query ; -- what is the route of administration of DRUG
+
+ PQPatentNo : Query ; -- give me all the patent numbers
+
+ PQPatentDrug : Drug -> Query ; -- give me the patent number of DRUG
+
+ PQPatentPat : Patent -> Query ; -- give me the patent number for PATENT
+
+ PQExpPat : Patent -> Query ; -- when does PATENT expire
+
+ PQExpDrug : Drug -> Query ; -- when does the patent for DRUG expire
+
+ PQUseCode : Patent -> Query ; -- what is the use code of PATENT
+
+ PQAppNumber : Patent -> Query ; -- what is the application number for PATENT
+
+ PQApplicant : Patent -> Query ; -- who applied for PATENT
+
+ PQAppDayDrug : Drug -> Query ; -- what is the approval date of the patent for DRUG
+
+ PQAppDayPat : Patent -> Query ; -- what is the approval date of PATENT
+
+ PQAppDayPatApp : Patent -> Applicant -> Query ; -- what is the approval date of PATENT with APPLICANT
+
+ PQAppDayNo : ApplicationNumber -> Query ; -- what is the approval date for the patent with APPLICATION_NUMBER
+
+ PQChemComp : Drug -> Query ; -- what is the chemical composition of DRUG
+
+ PQCompounds : Query ; -- what are the drugs that are compounds
+
+ PQPrep : Query ; -- what drug preparations are there
+
+ PQDrugPrep : Drug -> Query ; -- the drug preparation for DRUG
+
+ PQPrepDate : Drug -> PatsDate -> Query ; -- the drug preparation for DRUG with a patent that expires after DATE
+
+ PQName : Drug -> Query ; -- the name of DRUG
+
+ PQNameDate : Drug -> PatsDate -> Query ; -- the name of drug with approval date DATE
+
+ PQNameApp : Applicant -> Query ; -- the name of drug with a patent from applicant APPLICANT
+
+ PQMethods : Patent -> Query ; -- what methods are used for PATENT
+
+ PQDateMeth : PatsDate -> Query ; -- what methods are used in patents with approval date before DATE
+
+ PQMethNo : PatentNumber -> Query ; -- what methods are used in the patent with patent number PATENT_NUMBER
+
+ PQUse : Patent -> Query ; -- what is the use of PATENT
+
+ PQUseDate : PatsDate -> Query ; -- what is the use of PATENT approved before DATE
+
+ PQUseExp : Patent -> PatsDate -> Query ; -- what is the use of PATENT that expires on DATE
+
+ PQDateUse : PatsDate -> Query ; -- give me all patents approved on DATE
+
+ PQUseDrug : Drug -> Query ; -- what is the use of DRUG
+
+ PQUseChem : ChemicalSubstance -> Query ; -- what is the use of drugs that contain CHEMICAL_SUBSTANCE
+
+ PQUseForm : DrugUsageForm -> Query ; -- what is the use of drugs with usage form DRUG_USAGE_FORM
+
+ PQStrength : Drug -> Query ; -- what is the strength of DRUG
+
+ PQStrengthChem : ChemicalSubstance -> Query ; -- what is the strenght of drugs that contain CHEMICAL_SUBSTANCE
+
+ PQClaims : Drug -> Query ; -- what are the claims that mention DRUG
+
+
+
+fun
+---------------------
+ Aspirin : Drug ;
+---------------------
+-- put all other drug names here !
+
+
+---------------------
+ Pats1230 : Patent ;
+---------------------
+-- put all other patent names here !
+
+
+---------------------
+ Hydrogen : ChemicalSubstance ;
+---------------------
+-- put all chemical substances here !
+
+
+--------------------
+ Inhalation : DrugUsageForm ;
+--------------------
+-- put all drug usage forms here !
+
+
+
+-------------------
+ P123 : PatentNumber ;
+-------------------
+-- put all patent numbers here !
+
+
+
+-------------------
+ JohnDoe : Applicant ;
+-------------------
+-- put all applicants here !
+
+
+
+-------------------
+ A123 : ApplicationNumber ;
+------------------
+-- put all application numbers here
+
+
+-------------------
+ Today : PatsDate ;
+ A20June : SimpDate ;
+-------------------
+-- put all dates here (maybe use Date grammar instead)
+
+
+} \ No newline at end of file
diff --git a/examples/query/small/new_patentsQuery/QueryPatsEng.gf b/examples/query/small/new_patentsQuery/QueryPatsEng.gf
new file mode 100644
index 000000000..f3800d9fd
--- /dev/null
+++ b/examples/query/small/new_patentsQuery/QueryPatsEng.gf
@@ -0,0 +1,387 @@
+--# -path=.:..:alltenses
+
+concrete QueryPatsEng of QueryPats = QueryEng ** open
+ LexQueryPatsEng,
+ ParadigmsEng,
+ IrregEng,
+ SyntaxEng,
+ ExtraEng,
+ (L=LangEng),
+ (M=MakeStructuralEng),
+ Prelude
+in {
+
+
+--------------------------------------------------------
+-- additions to the original query grammar
+
+lin
+
+ SThe k = SyntaxEng.mkNP the_Det k ;
+
+ SMassSg k = SyntaxEng.mkNP k ;
+
+ QWho a = mkUtt (mkQCl whoSg_IP a) ;
+
+-- QWhen : Set -> Activity -> Query ;
+
+ QMass s = mkUtt s ;
+
+ QExist s = mkUtt (L.ExistIP (L.IdetCN (L.IdetQuant what_IQuant L.NumPl) s))
+ | mkUtt (mkNP all_NP (SyntaxEng.mkAdv about_Prep (mkNP s))) ;
+
+
+---------------------------------------------------------
+-- from the patent query grammar
+
+lincat
+ Drug = NP ;
+ Patent = NP ;
+ ChemicalSubstance = NP ;
+ DrugUsageForm = NP ;
+ PatentNumber = NP ;
+ Applicant = NP ;
+ ApplicationNumber = NP ;
+ PatsDate = Adv ;
+ SimpDate = 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 | QExist df ;
+
+
+PQRoute drug =
+ let df : Kind = KRelSet route_of_administration_CN (DrugToSet drug)
+ in
+ basicBoth df | QExist df ;
+
+
+PQPatentNo =
+ let bu : Query = basicPlur patent_number_CN
+ in
+ bu | QExist 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 ;
+ -- KAct when_IAdv (mkCl patent (mkVP expire_V))) ;
+
+
+PQExpDrug drug =
+ let
+ ai : Kind = KRelSet expiration_date_CN (SThe (KRelSet patent_N (DrugToSet drug)))
+ in
+ basicSing ai ;
+-- | 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) (SyntaxEng.mkAdv for_Prep patent))))
+-- | mkUtt (mkQS pastTense (mkQCl whoSg_IP (mkVP (mkVP apply_V) (SyntaxEng.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 ;
+
+
+PQAppDayPatApp patent applicant =
+ let df : Kind = KRelSet approval_date_CN (SThe (KRelSet patent_with_N (SThe (KRelSet applicant_CN (AppToSet applicant)))))
+ in
+ basicSing df ;
+
+
+PQAppDayNo appno =
+ let df : Kind = KRelSet approval_date_CN (SThe (KRelSet patent_with_N (SThe (KRelSet application_number_CN (AppNumToSet appno)))))
+ in
+ basicSing df ;
+
+
+PQChemComp drug =
+ let
+ df : Kind = KRelSet chemical_substance_CN (DrugToSet drug) ;
+ cc : Kind = KRelSet chemical_composition_CN (DrugToSet drug)
+ in
+ basicPlur df | basicSing cc ;
+
+
+PQCompounds =
+ let cc : Kind = KAct compound_CN (KRel drug_N)
+ in
+ basicPlur cc ;
+
+
+PQPrep =
+ basicPlur (KRel drug_preparation_CN)
+ | QExist (KRel drug_preparation_CN) ;
+
+
+PQDrugPrep drug =
+ let df : Kind = KRelSet drug_preparation_CN (DrugToSet drug)
+ in
+ basicSing df ;
+
+-----
+
+PQName drug =
+ let
+ df : CN = KRelSet name_N (DrugToSet drug)
+ in
+ basicSing df ;
+
+
+PQNameApp applicant =
+ let pt2 : Set = SIndef (KRelSet patent_with_N (SThe (KRelSet applicant_CN applicant))) ;
+ df : Kind = KRelSet drug_N pt2
+ in
+ basicSing df ;
+
+----
+
+PQMethods patent =
+ let pt1 : Kind = KProp (use_prop_V2 (PatentToSet patent)) (KRel method_N) ;
+ pt2 : Kind = KRelSet method_N (PatentToSet patent) ;
+ pt : Kind = pt1 | pt2
+ in
+ basicPlur pt ;
+
+
+PQDateMeth date =
+ let pdate : Set = SAll (KAct (expire_V date) (KRel patent_N)) ;
+ pt1 : Kind = KAct (use_V2 pdate) (KRel method_N) ;
+ pt2 : Kind = KProp (use_prop_V2 pdate) (KRel method_N) ;
+ pt3 : Kind = KRelSet method_N pdate ;
+ pt : Kind = pt1 | pt2 | pt3
+ in
+ basicPlur pt ;
+
+
+PQMethNo appno =
+ let pdate : Set = SThe (KRelSet patent_with_N (SThe (KRelSet application_number_no_CN appno))) ;
+ pt1 : Kind = KProp (use_prop_V2 (SThe (KRel patent_N))) (KRel method_N) ;
+ pt2 : Kind = KRelSet method_N (SThe (KRel patent_N)) ;
+ pt : Kind = pt1 | pt2
+ in
+ basicPlur pt ;
+
+----
+
+PQUse patent =
+ let df : Kind = KRelSet use_N (PatentToSet patent)
+ in
+ basicSing df ;
+
+
+PQUseDate date =
+ let pdate : Set = SThe (KAct (approve_V2 date) (KRel patent_N)) ;
+ pt : Kind = KRelSet use_N pdate
+ in
+ basicSing pt ;
+
+PQDateUse date =
+ let patent : Kind = KRel patent_N ;
+ pdate : Set = SAll (KProp (approve_prop_V2 date) patent) ;
+ pt : Kind = KRelSet use_N pdate
+
+ in
+ basicPlur pt ;
+
+
+PQUseDrug drug =
+ let df : Kind = KRelSet use_N (DrugToSet drug)
+ in
+ basicSing df ;
+
+
+PQUseChem chem =
+ let drug : Kind = KAct (contain_V2 chem) (KRel drug_N) ;
+ drugs : Set = SAll drug ;
+ df : Kind = KRelSet use_N drugs
+ in
+ basicSing df ;
+
+
+PQUseForm uform =
+ let drug : Kind = KRelSet usage_form_CN (UsageToSet uform) ;
+ drugs : Set = SAll drug ;
+ df : Kind = KRelSet use_N drugs
+ in
+ basicSing df ;
+
+---
+
+PQStrength drug =
+ let df : Kind = KRelSet strength_N (DrugToSet drug)
+ in
+ basicSing df ;
+
+
+PQStrengthChem chem =
+ let drug : Kind = KAct (contain_V2 chem) (KRel drug_N) ;
+ drugs : Set = SAll drug ;
+ df : Kind = KRelSet strength_N (DrugToSet drugs)
+ in
+ basicSing df ;
+
+---
+
+PQClaims drug =
+ let cc : Kind = KAct (mention_V2 drug) (mkCN claim_N)
+ in
+ basicPlur cc ;
+
+
+
+--------------------------------------------------------------------------------
+ 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 ;
+
+--------------------------------------------------------------------------
+-- 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 ;
+
+
+
+ OnDate d = mkPatsDate on_Prep ;
+ BeforeDate d = mkPatsDate before_Prep ;
+ AfterDate d = mkPatsDate after_Prep ;
+
+ oper mkPatsDate : Prep -> Adv = \prep -> SyntaxEng.mkAdv prep (mkNP (mkPN "DATE")) ;
+
+
+
+
+-- lexicon
+
+oper mkDrug : Str -> NP =
+ \p -> SyntaxEng.mkNP (mkPN p) ;
+
+oper mkPatents : Str -> NP =
+ \p -> SyntaxEng.mkNP (mkPN p) ;
+
+oper mkChemicalSubstance : Str -> NP =
+ \p -> SyntaxEng.mkNP (mkPN p) ;
+
+oper mkDrugUsageForm : Str -> NP =
+ \p -> SyntaxEng.mkNP (mkPN p) ;
+
+oper mkPatentNumber : Str -> NP =
+ \p -> SyntaxEng.mkNP (mkPN p) ;
+
+oper mkApplicant : Str -> NP =
+ \p -> SyntaxEng.mkNP (mkPN p) ;
+
+oper mkApplicationNumber : Str -> NP =
+ \p -> SyntaxEng.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" ;
+
+
+} \ No newline at end of file
diff --git a/examples/query/small/patentsQuery/LexQueryPats.gf b/examples/query/small/patentsQuery/LexQueryPats.gf
new file mode 100644
index 000000000..466e924c3
--- /dev/null
+++ b/examples/query/small/patentsQuery/LexQueryPats.gf
@@ -0,0 +1,111 @@
+interface LexQueryPats = open Syntax, QueryPats, Query in
+{
+
+oper
+
+--------------------------------------------------------------
+-- structural words and extra grammar constructs
+
+ about_Prep : Prep ;
+
+ all_NP : NP ;
+
+ vpAP : VP -> AP ;
+
+ what_IQuant : IQuant ;
+
+ massInfoSg : CN -> NP ;
+
+ massInfoPl : CN -> NP ;
+
+ PatsAdvVPSlash : VPSlash -> Adv -> VPSlash ;
+
+ selectIP : NP -> IP ; -- selecting the right agreement : what are the ingredients ? / what is the expiration date ? (not obvious in English, but will make a difference in other languages)
+
+
+--------------------------------------------------------------
+-- kinds
+
+ patent_number_CN : Kind ;
+
+ claim_N : Kind ;
+
+
+--------------------------------------------------------------
+-- activities
+
+ expire_V : Adv -> Activity ;
+
+ simp_expire_V : Activity ;
+
+ apply_V : NP -> Activity ;
+
+ compound_CN : Activity ;
+
+ use_V2 : Set -> Activity ;
+
+ approve_V2 : Adv -> Activity ;
+
+ mention_V2 : NP -> Activity ;
+
+ contain_V2 : NP -> Activity ;
+
+
+--------------------------------------------------------------
+-- properties
+
+ approve_prop_V2 : Adv -> Property ;
+
+ use_prop_V2 : Set -> Property ;
+
+--------------------------------------------------------------
+-- relations
+
+ active_ingredient_CN : Relation ;
+
+ dosage_form_CN : Relation ;
+
+ route_of_administration_CN : Relation ;
+
+ patent_number_Rel : Relation ;
+
+ patent_N : Relation ;
+
+ patent_with_N : Relation ;
+
+ expiration_date_CN : Relation ;
+
+ use_code_CN : Relation ;
+
+ application_number_CN : Relation ;
+
+ application_number_no_CN : Relation ;
+
+ applicant_CN : Relation ;
+
+ applicant_no_CN : Relation ;
+
+ approval_date_CN : Relation ;
+
+ chemical_composition_CN : Relation ;
+
+ chemical_substance_CN : Relation ;
+
+ drug_N : Relation ;
+
+ use_N : Relation ;
+
+ method_N : Relation ;
+
+ drug_with_usage_form_CN : Relation ;
+
+ drug_preparation_CN : Relation ;
+
+ strength_N : Relation ;
+
+ name_N : Relation ;
+
+ usage_form_CN : Relation ;
+
+
+} \ No newline at end of file
diff --git a/examples/query/small/patentsQuery/LexQueryPatsEng.gf b/examples/query/small/patentsQuery/LexQueryPatsEng.gf
new file mode 100644
index 000000000..09206388e
--- /dev/null
+++ b/examples/query/small/patentsQuery/LexQueryPatsEng.gf
@@ -0,0 +1,136 @@
+instance LexQueryPatsEng of LexQueryPats = open
+ SyntaxEng,
+ (M=MakeStructuralEng),
+ ParadigmsEng,
+ ExtraEng,
+ IrregEng,
+ LangEng,
+ ResEng,
+ QueryEng
+ in
+{
+
+oper
+--------------------------------------------------------------
+-- structural words and extra grammar constructs
+
+ about_Prep : Prep = mkPrep "about" ;
+
+ all_NP : NP = SyntaxEng.mkNP (mkPN "all") ;
+
+ vpAP : VP -> AP = PartVP ;
+
+ what_IQuant : IQuant = M.mkIQuant "what" "what" ;
+
+ massInfoSg : CN -> NP = \cn -> SyntaxEng.mkNP cn ;
+
+ massInfoPl : CN -> NP = \cn -> SyntaxEng.mkNP aPl_Det cn ;
+
+ PatsAdvVPSlash : VPSlash -> Adv -> VPSlash = LangEng.AdvVPSlash ;
+
+ selectIP : NP -> IP = \np -> case np.a of
+ {AgP3Sg _ => whatSg_IP ;
+ _ => whatPl_IP
+ };
+
+
+--------------------------------------------------------------
+-- kinds
+
+ patent_number_CN : Kind = lin Kind (mkCN (mkN "patent" (mkN "number"))) ;
+
+ claim_N : Kind = lin Kind (mkCN (mkN "claim")) ;
+
+
+--------------------------------------------------------------
+-- activities
+
+ expire_V : Adv -> Activity = \pdate ->
+ lin Activity (mkVP (mkVP (mkV "expire")) pdate) ;
+
+ simp_expire_V : Activity =
+ lin Activity (mkVP (mkV "expire")) ;
+
+ apply_V : NP -> Activity = \pat -> lin Activity ( mkVP (mkVP (mkV "apply" "applies" "applied" "applied" "applying")) (SyntaxEng.mkAdv for_Prep pat)) ;
+
+ compound_CN : Activity = let vp : VP = mkVP (mkCN (mkN "compound"))
+ in lin Activity vp ;
+
+ use_V2 : Set -> Activity = \s -> lin Activity (mkVP (passiveVP (mkV2 (mkV "use" "uses" "used" "used" "using"))) (SyntaxEng.mkAdv in_Prep s));
+
+ approve_V2 : Adv -> Activity = \pdate -> lin Activity (mkVP (passiveVP (mkV2 (mkV "approve" "approves" "approved" "approved" "approving"))) pdate) ;
+
+ mention_V2 : NP -> Activity = \drug ->
+ lin Activity ( mkVP (mkVPSlash (mkV2 (mkV "mention" "mentions" "mentioned" "mentioned" "mentioning"))) drug) ;
+
+ contain_V2 : NP -> Activity = \chem ->
+ lin Activity (mkVP (mkVPSlash (mkV2 (mkV "contain" "contains" "contained" "contained" "containing"))) chem) ;
+
+
+--------------------------------------------------------------
+-- properties
+
+ approve_prop_V2 : Adv -> Property = \pdate -> lin Property (vpAP (mkVP (passiveVP (mkV2 (mkV "approve" "approves" "approved" "approved" "approving"))) pdate)) ;
+
+ use_prop_V2 : Set -> Property = \s -> lin Property (vpAP (mkVP (passiveVP (mkV2 (mkV "use" "uses" "used" "used" "using"))) (SyntaxEng.mkAdv in_Prep s))) ;
+
+
+
+--------------------------------------------------------------
+-- relations
+
+ active_ingredient_CN : Relation = makeRelation (mkCN (mkA "active") (mkN "ingredient")) ;
+
+ dosage_form_CN : Relation = makeRelation (mkCN (mkN "dosage" (mkN "form"))) ;
+
+ route_of_administration_CN : Relation = makeRelation (mkCN (mkN "route") (SyntaxEng.mkAdv (mkPrep "of") (SyntaxEng.mkNP (mkN "administration")))) ;
+
+ patent_number_Rel : Relation = makeRelation (mkCN (mkN "patent" (mkN "number"))) ;
+
+ patent_N : Relation = lin Relation {cn = mkCN (mkN "patent") ; prep = for_Prep } ;
+
+ patent_with_N : Relation = lin Relation {cn = mkCN (mkN "patent"); prep = with_Prep} ;
+
+ expiration_date_CN : Relation = makeRelation (mkCN (mkN "expiration" (mkN "date"))) ;
+
+ use_code_CN : Relation = makeRelation (SyntaxEng.mkCN (mkN "use" (mkN "code"))) ;
+
+ application_number_CN : Relation = makeRelation ((mkCN (mkN "application" (mkN "number"))) | (mkCN (mkN ["patent application"] (mkN "number")))) ;
+
+
+ application_number_no_CN : Relation = lin Relation {cn = ((mkCN (mkN "application" (mkN "number"))) | (mkCN (mkN ["patent application"] (mkN "number")))); prep = noPrep} ;
+
+ applicant_CN : Relation = lin Relation { cn = mkCN (mkN "applicant") ; prep = for_Prep } ;
+
+
+ applicant_no_CN : Relation = lin Relation {cn = mkCN (mkN "applicant"); prep = noPrep} ;
+
+ approval_date_CN : Relation = makeRelation (mkCN (mkN "approval" (mkN "date"))) ;
+
+
+ chemical_composition_CN : Relation = makeRelation (mkCN (mkA "chemical") (mkN "composition")) ;
+
+ chemical_substance_CN : Relation = lin Relation {cn = (mkCN (mkA "chemical") (mkN "substance")) ; prep = from_Prep | part_Prep } ;
+
+ drug_N : Relation = lin Relation {cn = mkCN (mkN "drug") ; prep = with_Prep} ;
+
+ use_N : Relation = makeRelation (mkCN (mkN "use")) ;
+
+ method_N : Relation = makeRelation (mkCN (mkN "method")) ;
+
+ drug_with_usage_form_CN : Relation = lin Relation {cn = mkCN (mkN "drug") ; prep = noPrep } ;
+
+ drug_preparation_CN : Relation = lin Relation {cn = mkCN (mkN "drug" (mkN "preparation")) ; prep = for_Prep} ;
+
+ strength_N : Relation = makeRelation (mkCN (mkN "strength")) ;
+
+ name_N : Relation = makeRelation (mkCN (mkN "name")) ;
+
+ usage_form_CN = makeRelation (mkCN (mkN "usage" (mkN "form"))) ;
+
+----------------------------------------------------------------------------
+oper makeRelation : CN -> Relation =
+ \s -> lin Relation {cn = s ; prep = possess_Prep} ;
+
+
+} \ No newline at end of file
diff --git a/examples/query/small/patentsQuery/QueryPats.gf b/examples/query/small/patentsQuery/QueryPats.gf
new file mode 100644
index 000000000..b66950d20
--- /dev/null
+++ b/examples/query/small/patentsQuery/QueryPats.gf
@@ -0,0 +1,194 @@
+--# -path=.:..:alltenses
+
+abstract QueryPats = Query ** open Syntax in {
+-------------------------------------------------------------------------------------
+-- additions to the general Query grammar
+
+
+fun
+
+ SThe : Kind -> Set ; -- the route of administration
+
+ SMassSg : Kind -> Set ; -- route of administration
+
+ QWho : Activity -> Query ; -- who applied for the patent ?
+
+-- QWhen : Set -> Activity -> Query ; -- when was the patent approved ?
+
+ QMass : Set -> Query ; -- expiration date of the patent
+
+ QExist : Kind -> Query ; -- what dosage forms of DRUG are there ?
+ -- maybe merge with QSet
+
+
+
+
+-------------------------------------------------------------------------------------
+-- categories and example functions for the Patent Query grammar
+
+cat
+ Drug ;
+ Patent ;
+ ChemicalSubstance ;
+ DrugUsageForm ;
+ PatentNumber ;
+ Applicant ;
+ ApplicationNumber ;
+ PatsDate ;
+ SimpDate ;
+
+--------------------------------------------------------------------------------
+-- simple coercions
+
+fun DrugToSet : Drug -> Set ;
+fun PatentToSet : Patent -> Set ;
+fun ChemToSet : ChemicalSubstance -> Set ;
+fun UsageToSet : DrugUsageForm -> Set ;
+fun PatNumToSet : PatentNumber -> Set ;
+fun AppToSet : Applicant -> Set ;
+fun AppNumToSet : ApplicationNumber -> Set ;
+--fun DateToSet : PatsDate -> Set ;
+
+
+fun
+ OnDate : SimpDate -> PatsDate ;
+ BeforeDate : SimpDate -> PatsDate ;
+ AfterDate : SimpDate -> PatsDate ;
+ FromSimpDate : SimpDate -> PatsDate ;
+
+
+-------------------------------------------------------------------------------------
+-- main functions for the Patents Query grammar
+
+fun
+
+ PQInfo : Drug -> Query ; -- what information do you have about DRUG | give me all information about DRUG ...
+
+ PQActive : Drug -> Query ; -- what active ingredients are in DRUG
+
+ PQDosage : Drug -> Query ; -- what are the dosage forms of DRUG
+
+ PQRoute : Drug -> Query ; -- what is the route of administration of DRUG
+
+ PQPatentNo : Query ; -- give me all the patent numbers
+
+ PQPatentDrug : Drug -> Query ; -- give me the patent number of DRUG
+
+ PQPatentPat : Patent -> Query ; -- give me the patent number for PATENT
+
+ PQExpPat : Patent -> Query ; -- when does PATENT expire
+
+ PQExpDrug : Drug -> Query ; -- when does the patent for DRUG expire
+
+ PQUseCode : Patent -> Query ; -- what is the use code of PATENT
+
+ PQAppNumber : Patent -> Query ; -- what is the application number for PATENT
+
+ PQApplicant : Patent -> Query ; -- who applied for PATENT
+
+ PQAppDayDrug : Drug -> Query ; -- what is the approval date of the patent for DRUG
+
+ PQAppDayPat : Patent -> Query ; -- what is the approval date of PATENT
+
+ PQAppDayPatApp : Patent -> Applicant -> Query ; -- what is the approval date of PATENT with APPLICANT
+
+ PQAppDayNo : ApplicationNumber -> Query ; -- what is the approval date for the patent with APPLICATION_NUMBER
+
+ PQChemComp : Drug -> Query ; -- what is the chemical composition of DRUG
+
+ PQCompounds : Query ; -- what are the drugs that are compounds
+
+ PQPrep : Query ; -- what drug preparations are there
+
+ PQDrugPrep : Drug -> Query ; -- the drug preparation for DRUG
+
+ PQPrepDate : Drug -> PatsDate -> Query ; -- the drug preparation for DRUG with a patent that expires after DATE
+
+ PQName : Drug -> Query ; -- the name of DRUG
+
+ PQNameDate : Drug -> PatsDate -> Query ; -- the name of drug with approval date DATE
+
+ PQNameApp : Applicant -> Query ; -- the name of drug with a patent from applicant APPLICANT
+
+ PQMethods : Patent -> Query ; -- what methods are used for PATENT
+
+ PQDateMeth : PatsDate -> Query ; -- what methods are used in patents with approval date before DATE
+
+ PQMethNo : PatentNumber -> Query ; -- what methods are used in the patent with patent number PATENT_NUMBER
+
+ PQUse : Patent -> Query ; -- what is the use of PATENT
+
+ PQUseDate : PatsDate -> Query ; -- what is the use of PATENT approved before DATE
+
+ PQUseExp : Patent -> PatsDate -> Query ; -- what is the use of PATENT that expires on DATE
+
+ PQDateUse : PatsDate -> Query ; -- give me all patents approved on DATE
+
+ PQUseDrug : Drug -> Query ; -- what is the use of DRUG
+
+ PQUseChem : ChemicalSubstance -> Query ; -- what is the use of drugs that contain CHEMICAL_SUBSTANCE
+
+ PQUseForm : DrugUsageForm -> Query ; -- what is the use of drugs with usage form DRUG_USAGE_FORM
+
+ PQStrength : Drug -> Query ; -- what is the strength of DRUG
+
+ PQStrengthChem : ChemicalSubstance -> Query ; -- what is the strenght of drugs that contain CHEMICAL_SUBSTANCE
+
+ PQClaims : Drug -> Query ; -- what are the claims that mention DRUG
+
+
+
+fun
+---------------------
+ Aspirin : Drug ;
+---------------------
+-- put all other drug names here !
+
+
+---------------------
+ Pats1230 : Patent ;
+---------------------
+-- put all other patent names here !
+
+
+---------------------
+ Hydrogen : ChemicalSubstance ;
+---------------------
+-- put all chemical substances here !
+
+
+--------------------
+ Inhalation : DrugUsageForm ;
+--------------------
+-- put all drug usage forms here !
+
+
+
+-------------------
+ P123 : PatentNumber ;
+-------------------
+-- put all patent numbers here !
+
+
+
+-------------------
+ JohnDoe : Applicant ;
+-------------------
+-- put all applicants here !
+
+
+
+-------------------
+ A123 : ApplicationNumber ;
+------------------
+-- put all application numbers here
+
+
+-------------------
+ Today : PatsDate ;
+ A20June : SimpDate ;
+-------------------
+-- put all dates here (maybe use Date grammar instead)
+
+
+} \ No newline at end of file
diff --git a/examples/query/small/patentsQuery/QueryPatsEng.gf b/examples/query/small/patentsQuery/QueryPatsEng.gf
new file mode 100644
index 000000000..f3800d9fd
--- /dev/null
+++ b/examples/query/small/patentsQuery/QueryPatsEng.gf
@@ -0,0 +1,387 @@
+--# -path=.:..:alltenses
+
+concrete QueryPatsEng of QueryPats = QueryEng ** open
+ LexQueryPatsEng,
+ ParadigmsEng,
+ IrregEng,
+ SyntaxEng,
+ ExtraEng,
+ (L=LangEng),
+ (M=MakeStructuralEng),
+ Prelude
+in {
+
+
+--------------------------------------------------------
+-- additions to the original query grammar
+
+lin
+
+ SThe k = SyntaxEng.mkNP the_Det k ;
+
+ SMassSg k = SyntaxEng.mkNP k ;
+
+ QWho a = mkUtt (mkQCl whoSg_IP a) ;
+
+-- QWhen : Set -> Activity -> Query ;
+
+ QMass s = mkUtt s ;
+
+ QExist s = mkUtt (L.ExistIP (L.IdetCN (L.IdetQuant what_IQuant L.NumPl) s))
+ | mkUtt (mkNP all_NP (SyntaxEng.mkAdv about_Prep (mkNP s))) ;
+
+
+---------------------------------------------------------
+-- from the patent query grammar
+
+lincat
+ Drug = NP ;
+ Patent = NP ;
+ ChemicalSubstance = NP ;
+ DrugUsageForm = NP ;
+ PatentNumber = NP ;
+ Applicant = NP ;
+ ApplicationNumber = NP ;
+ PatsDate = Adv ;
+ SimpDate = 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 | QExist df ;
+
+
+PQRoute drug =
+ let df : Kind = KRelSet route_of_administration_CN (DrugToSet drug)
+ in
+ basicBoth df | QExist df ;
+
+
+PQPatentNo =
+ let bu : Query = basicPlur patent_number_CN
+ in
+ bu | QExist 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 ;
+ -- KAct when_IAdv (mkCl patent (mkVP expire_V))) ;
+
+
+PQExpDrug drug =
+ let
+ ai : Kind = KRelSet expiration_date_CN (SThe (KRelSet patent_N (DrugToSet drug)))
+ in
+ basicSing ai ;
+-- | 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) (SyntaxEng.mkAdv for_Prep patent))))
+-- | mkUtt (mkQS pastTense (mkQCl whoSg_IP (mkVP (mkVP apply_V) (SyntaxEng.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 ;
+
+
+PQAppDayPatApp patent applicant =
+ let df : Kind = KRelSet approval_date_CN (SThe (KRelSet patent_with_N (SThe (KRelSet applicant_CN (AppToSet applicant)))))
+ in
+ basicSing df ;
+
+
+PQAppDayNo appno =
+ let df : Kind = KRelSet approval_date_CN (SThe (KRelSet patent_with_N (SThe (KRelSet application_number_CN (AppNumToSet appno)))))
+ in
+ basicSing df ;
+
+
+PQChemComp drug =
+ let
+ df : Kind = KRelSet chemical_substance_CN (DrugToSet drug) ;
+ cc : Kind = KRelSet chemical_composition_CN (DrugToSet drug)
+ in
+ basicPlur df | basicSing cc ;
+
+
+PQCompounds =
+ let cc : Kind = KAct compound_CN (KRel drug_N)
+ in
+ basicPlur cc ;
+
+
+PQPrep =
+ basicPlur (KRel drug_preparation_CN)
+ | QExist (KRel drug_preparation_CN) ;
+
+
+PQDrugPrep drug =
+ let df : Kind = KRelSet drug_preparation_CN (DrugToSet drug)
+ in
+ basicSing df ;
+
+-----
+
+PQName drug =
+ let
+ df : CN = KRelSet name_N (DrugToSet drug)
+ in
+ basicSing df ;
+
+
+PQNameApp applicant =
+ let pt2 : Set = SIndef (KRelSet patent_with_N (SThe (KRelSet applicant_CN applicant))) ;
+ df : Kind = KRelSet drug_N pt2
+ in
+ basicSing df ;
+
+----
+
+PQMethods patent =
+ let pt1 : Kind = KProp (use_prop_V2 (PatentToSet patent)) (KRel method_N) ;
+ pt2 : Kind = KRelSet method_N (PatentToSet patent) ;
+ pt : Kind = pt1 | pt2
+ in
+ basicPlur pt ;
+
+
+PQDateMeth date =
+ let pdate : Set = SAll (KAct (expire_V date) (KRel patent_N)) ;
+ pt1 : Kind = KAct (use_V2 pdate) (KRel method_N) ;
+ pt2 : Kind = KProp (use_prop_V2 pdate) (KRel method_N) ;
+ pt3 : Kind = KRelSet method_N pdate ;
+ pt : Kind = pt1 | pt2 | pt3
+ in
+ basicPlur pt ;
+
+
+PQMethNo appno =
+ let pdate : Set = SThe (KRelSet patent_with_N (SThe (KRelSet application_number_no_CN appno))) ;
+ pt1 : Kind = KProp (use_prop_V2 (SThe (KRel patent_N))) (KRel method_N) ;
+ pt2 : Kind = KRelSet method_N (SThe (KRel patent_N)) ;
+ pt : Kind = pt1 | pt2
+ in
+ basicPlur pt ;
+
+----
+
+PQUse patent =
+ let df : Kind = KRelSet use_N (PatentToSet patent)
+ in
+ basicSing df ;
+
+
+PQUseDate date =
+ let pdate : Set = SThe (KAct (approve_V2 date) (KRel patent_N)) ;
+ pt : Kind = KRelSet use_N pdate
+ in
+ basicSing pt ;
+
+PQDateUse date =
+ let patent : Kind = KRel patent_N ;
+ pdate : Set = SAll (KProp (approve_prop_V2 date) patent) ;
+ pt : Kind = KRelSet use_N pdate
+
+ in
+ basicPlur pt ;
+
+
+PQUseDrug drug =
+ let df : Kind = KRelSet use_N (DrugToSet drug)
+ in
+ basicSing df ;
+
+
+PQUseChem chem =
+ let drug : Kind = KAct (contain_V2 chem) (KRel drug_N) ;
+ drugs : Set = SAll drug ;
+ df : Kind = KRelSet use_N drugs
+ in
+ basicSing df ;
+
+
+PQUseForm uform =
+ let drug : Kind = KRelSet usage_form_CN (UsageToSet uform) ;
+ drugs : Set = SAll drug ;
+ df : Kind = KRelSet use_N drugs
+ in
+ basicSing df ;
+
+---
+
+PQStrength drug =
+ let df : Kind = KRelSet strength_N (DrugToSet drug)
+ in
+ basicSing df ;
+
+
+PQStrengthChem chem =
+ let drug : Kind = KAct (contain_V2 chem) (KRel drug_N) ;
+ drugs : Set = SAll drug ;
+ df : Kind = KRelSet strength_N (DrugToSet drugs)
+ in
+ basicSing df ;
+
+---
+
+PQClaims drug =
+ let cc : Kind = KAct (mention_V2 drug) (mkCN claim_N)
+ in
+ basicPlur cc ;
+
+
+
+--------------------------------------------------------------------------------
+ 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 ;
+
+--------------------------------------------------------------------------
+-- 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 ;
+
+
+
+ OnDate d = mkPatsDate on_Prep ;
+ BeforeDate d = mkPatsDate before_Prep ;
+ AfterDate d = mkPatsDate after_Prep ;
+
+ oper mkPatsDate : Prep -> Adv = \prep -> SyntaxEng.mkAdv prep (mkNP (mkPN "DATE")) ;
+
+
+
+
+-- lexicon
+
+oper mkDrug : Str -> NP =
+ \p -> SyntaxEng.mkNP (mkPN p) ;
+
+oper mkPatents : Str -> NP =
+ \p -> SyntaxEng.mkNP (mkPN p) ;
+
+oper mkChemicalSubstance : Str -> NP =
+ \p -> SyntaxEng.mkNP (mkPN p) ;
+
+oper mkDrugUsageForm : Str -> NP =
+ \p -> SyntaxEng.mkNP (mkPN p) ;
+
+oper mkPatentNumber : Str -> NP =
+ \p -> SyntaxEng.mkNP (mkPN p) ;
+
+oper mkApplicant : Str -> NP =
+ \p -> SyntaxEng.mkNP (mkPN p) ;
+
+oper mkApplicationNumber : Str -> NP =
+ \p -> SyntaxEng.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" ;
+
+
+} \ No newline at end of file