forked from GitHub/gf-core
added first draft of patents query grammar
This commit is contained in:
86
examples/query/small/patentsQuery/LexPatsQuery.gf
Normal file
86
examples/query/small/patentsQuery/LexPatsQuery.gf
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
interface LexPatsQuery = Query ** open Syntax in {
|
||||||
|
|
||||||
|
oper
|
||||||
|
giveMe : NP -> VP ;
|
||||||
|
get_V2 : V2 ;
|
||||||
|
want_V2 : V2 ;
|
||||||
|
|
||||||
|
-- structural words
|
||||||
|
|
||||||
|
about_Prep : Prep ;
|
||||||
|
|
||||||
|
all_NP : NP ;
|
||||||
|
|
||||||
|
-- basic common nouns
|
||||||
|
|
||||||
|
active_ingredient_CN : Relation ;
|
||||||
|
|
||||||
|
dosage_form_CN : Relation ;
|
||||||
|
|
||||||
|
route_of_administration_CN : Relation ;
|
||||||
|
|
||||||
|
patent_number_CN : Kind ;
|
||||||
|
|
||||||
|
patent_number_Rel : Relation ;
|
||||||
|
|
||||||
|
patent_N : Relation ;
|
||||||
|
|
||||||
|
expiration_date_CN : Relation ;
|
||||||
|
|
||||||
|
expire_V : V ;
|
||||||
|
|
||||||
|
use_code_CN : Relation ;
|
||||||
|
|
||||||
|
application_number_CN : Relation ;
|
||||||
|
|
||||||
|
apply_V : V ;
|
||||||
|
|
||||||
|
applicant_CN : Relation ;
|
||||||
|
|
||||||
|
approval_date_CN : Relation ;
|
||||||
|
|
||||||
|
chemical_composition_CN : Relation ;
|
||||||
|
|
||||||
|
chemical_substance_CN : Relation ;
|
||||||
|
|
||||||
|
drug_N : N ;
|
||||||
|
|
||||||
|
use_N : Relation ;
|
||||||
|
|
||||||
|
compound_CN : Relation ;
|
||||||
|
|
||||||
|
use_V2 : V2 ;
|
||||||
|
|
||||||
|
approve_V2 : V2 ;
|
||||||
|
|
||||||
|
method_N : N ;
|
||||||
|
|
||||||
|
usage_form_CN : Relation ;
|
||||||
|
|
||||||
|
drug_preparation_CN : Relation ;
|
||||||
|
|
||||||
|
vpAP : VP -> AP ;
|
||||||
|
|
||||||
|
information_N : N ;
|
||||||
|
|
||||||
|
strength_N : Relation ;
|
||||||
|
|
||||||
|
claim_N : N ;
|
||||||
|
|
||||||
|
mention_V2 : V2 ;
|
||||||
|
|
||||||
|
what_IQuant : IQuant ;
|
||||||
|
|
||||||
|
contain_V2 : V2 ;
|
||||||
|
|
||||||
|
massInfoSg : CN -> NP ;
|
||||||
|
|
||||||
|
massInfoPl : CN -> NP ;
|
||||||
|
|
||||||
|
that_RP : RP ;
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
}
|
||||||
BIN
examples/query/small/patentsQuery/LexPatsQuery.gfo
Normal file
BIN
examples/query/small/patentsQuery/LexPatsQuery.gfo
Normal file
Binary file not shown.
68
examples/query/small/patentsQuery/LexPatsQueryEng.gf
Normal file
68
examples/query/small/patentsQuery/LexPatsQueryEng.gf
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
instance LexPatsQueryEng of LexPatsQuery = QueryEng **
|
||||||
|
open SyntaxEng, (M = MakeStructuralEng), ParadigmsEng, (Lang=LangEng), ExtraEng, IrregEng, ResEng in {
|
||||||
|
|
||||||
|
oper
|
||||||
|
|
||||||
|
giveMe : NP -> VP = \np -> mkVP (mkV3 give_V) (SyntaxEng.mkNP i_Pron) np ;
|
||||||
|
get_V2 = mkV2 IrregEng.get_V ;
|
||||||
|
want_V2 = mkV2 (mkV "want" "wants" "wanted" "wanted" "wanting") ;
|
||||||
|
|
||||||
|
-- structural words
|
||||||
|
about_Prep : Prep = mkPrep "about" ;
|
||||||
|
all_NP : NP = SyntaxEng.mkNP (mkPN "all") ;
|
||||||
|
-- at_Prep : Prep = mkPrep "at" ;
|
||||||
|
|
||||||
|
|
||||||
|
vpAP = PartVP ;
|
||||||
|
|
||||||
|
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_CN : Kind = lin Kind (mkCN (mkN "patent" (mkN "number"))) ;
|
||||||
|
patent_number_Rel : Relation = makeRelation (mkCN (mkN "patent" (mkN "number"))) ;
|
||||||
|
patent_N : Relation = lin Relation {cn = mkCN (mkN "patent") ; prep = for_Prep } ;
|
||||||
|
expiration_date_CN : Relation = makeRelation (mkCN (mkN "expiration" (mkN "date"))) ;
|
||||||
|
expire_V : V = mkV "expire" ;
|
||||||
|
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")))) ;
|
||||||
|
apply_V : V = mkV "apply" "applies" "applied" "applied" "applying" ;
|
||||||
|
applicant_CN : Relation = lin Relation {cn = mkCN (mkN "applicant") ; prep = for_Prep } ;
|
||||||
|
approval_date_CN : Relation = makeRelation (mkCN (mkN "approval" (mkN "date"))) ;
|
||||||
|
chemical_composition_CN : Relation = makeRelation (mkCN (mkA "chemical") (mkN "composition")) ;
|
||||||
|
chemical_substance_CN : Relation = makeRelation (mkCN (mkA "chemical") (mkN "substance")) ;
|
||||||
|
drug_N : N = mkN "drug" ;
|
||||||
|
use_N : Relation = makeRelation (mkCN (mkN "use")) ;
|
||||||
|
compound_CN : Relation = makeRelation (mkCN (mkN "compound")) ;
|
||||||
|
--name_N : N = mkN "name" ;
|
||||||
|
method_N : N = mkN "method" ;
|
||||||
|
strength_N : Relation = makeRelation (mkCN (mkN "strength")) ;
|
||||||
|
drug_preparation_CN : Relation = makeRelation (mkCN (mkN "drug" (mkN "preparation"))) ;
|
||||||
|
claim_N : N = mkN "claim" ;
|
||||||
|
mention_V2 : V2 = mkV2 (mkV "mention" "mentions" "mentioned" "mentioned" "mentioning") ;
|
||||||
|
use_V2 : V2 = mkV2 (mkV "use" "uses" "used" "used" "using") ;
|
||||||
|
approve_V2 : V2 = mkV2 (mkV "approve" "approves" "approved" "approved" "approving") ;
|
||||||
|
contain_V2 : V2 = mkV2 (mkV "contain" "contains" "contained" "contained" "containing") ;
|
||||||
|
usage_form_CN : Relation = makeRelation (mkCN (mkN "usage" (mkN "form"))) ;
|
||||||
|
|
||||||
|
information_N : N = mkN "information" ;
|
||||||
|
|
||||||
|
what_IQuant : IQuant = M.mkIQuant "what" "what" ;
|
||||||
|
|
||||||
|
massInfoSg : CN -> NP = \cn -> SyntaxEng.mkNP cn ;
|
||||||
|
|
||||||
|
massInfoPl : CN -> NP = \cn -> SyntaxEng.mkNP aPl_Det cn ;
|
||||||
|
|
||||||
|
that_RP : RP = ExtraEng.that_RP ;
|
||||||
|
|
||||||
|
PatsAdvVPSlash = Lang.AdvVPSlash ;
|
||||||
|
|
||||||
|
selectIP np = case np.a of
|
||||||
|
{AgP3Sg _ => whatSg_IP ;
|
||||||
|
_ => whatPl_IP
|
||||||
|
};
|
||||||
|
|
||||||
|
oper makeRelation : CN -> Relation =
|
||||||
|
\s -> lin Relation {cn = s ; prep = possess_Prep} ;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
BIN
examples/query/small/patentsQuery/LexPatsQueryEng.gfo
Normal file
BIN
examples/query/small/patentsQuery/LexPatsQueryEng.gfo
Normal file
Binary file not shown.
81
examples/query/small/patentsQuery/LexPatsQueryFre.gf
Normal file
81
examples/query/small/patentsQuery/LexPatsQueryFre.gf
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
instance LexPatsQueryFre of LexPatsQuery =
|
||||||
|
open SyntaxFre, ParadigmsFre, ExtraFre, IrregFre, StructuralFre, DiffFre, (CR=CommonRomance), ParamX, Prelude in {
|
||||||
|
|
||||||
|
flags
|
||||||
|
coding = utf8 ;
|
||||||
|
|
||||||
|
oper
|
||||||
|
|
||||||
|
giveMe : NP -> VP = \np -> mkVP (mkV2 (mkV "montrer")) np ;
|
||||||
|
get_V2 = IrregFre.obtenir_V2 ;
|
||||||
|
want_V2 =IrregFre.vouloir_V2 ;
|
||||||
|
|
||||||
|
-- structural words
|
||||||
|
about_Prep : Prep = mkPreposition ["à propos de"] ;
|
||||||
|
all_NP : NP = mkNP (mkPN "tout") ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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")));
|
||||||
|
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"))) ;
|
||||||
|
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") ;
|
||||||
|
drug_N : N = mkN "médicament" ;
|
||||||
|
use_N : N = mkN "utilisation" ;
|
||||||
|
compound_CN : CN = mkCN (mkN "composé") ;
|
||||||
|
method_N : N = mkN "méthode" ;
|
||||||
|
strength_N : N = mkN "dosage" ;
|
||||||
|
drug_preparation_CN : 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")));
|
||||||
|
|
||||||
|
information_N : N = mkN "information" ;
|
||||||
|
|
||||||
|
|
||||||
|
what_IQuant : IQuant = which_IQuant ;
|
||||||
|
|
||||||
|
massInfoSg : CN -> NP = \cn ->
|
||||||
|
let g = cn.g ;
|
||||||
|
n = Sg
|
||||||
|
in lin NP {
|
||||||
|
s = \\c => {comp,ton = cn.s ! n ; c1,c2 = []} ;
|
||||||
|
a = CR.agrP3 g n ;
|
||||||
|
hasClit = False ;
|
||||||
|
isPol = False
|
||||||
|
} ;
|
||||||
|
|
||||||
|
massInfoPl : CN -> NP = \cn -> mkNP aPl_Det cn ;
|
||||||
|
|
||||||
|
that_RP : RP = which_RP ;
|
||||||
|
|
||||||
|
PatsAdvVPSlash vp adv = lin VPSlash
|
||||||
|
{
|
||||||
|
s = vp.s ;
|
||||||
|
agr = vp.agr ;
|
||||||
|
clit1 = vp.clit1 ;
|
||||||
|
clit2 = vp.clit2 ;
|
||||||
|
clit3 = vp.clit3 ;
|
||||||
|
neg = vp.neg ;
|
||||||
|
comp = \\a => vp.comp ! a ++ adv.s ;
|
||||||
|
ext = vp.ext ;
|
||||||
|
c2 = vp.c2 ;
|
||||||
|
} ;
|
||||||
|
|
||||||
|
}
|
||||||
104
examples/query/small/patentsQuery/QueryI.gf
Normal file
104
examples/query/small/patentsQuery/QueryI.gf
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
--# -path=.:..:alltenses
|
||||||
|
|
||||||
|
incomplete concrete QueryI of Query = open
|
||||||
|
Syntax,
|
||||||
|
Lang,
|
||||||
|
Prelude
|
||||||
|
in {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
lincat
|
||||||
|
Move = Utt ; ---- Text ;
|
||||||
|
Query = Utt ;
|
||||||
|
Answer = Utt ;
|
||||||
|
Set = NP ;
|
||||||
|
Relation = {cn : CN ; prep : Prep} ;
|
||||||
|
Kind = CN ;
|
||||||
|
Property = AP ; ---- {vp : VP ; typ : PropTyp} ;
|
||||||
|
Individual = NP ;
|
||||||
|
Activity = VP ;
|
||||||
|
Name = NP ;
|
||||||
|
Loc = NP ;
|
||||||
|
Org = NP ;
|
||||||
|
Pers = NP ;
|
||||||
|
[Individual] = [NP] ;
|
||||||
|
|
||||||
|
|
||||||
|
lin
|
||||||
|
MQuery q = q ; ---- mkText (mkPhr q) questMarkPunct ;
|
||||||
|
MAnswer a = a ; ---- mkText (mkPhr a) fullStopPunct ;
|
||||||
|
|
||||||
|
QSet s =
|
||||||
|
let
|
||||||
|
ss : NP = s
|
||||||
|
| mkNP (mkNP thePl_Det name_N) (mkAdv possess_Prep s)
|
||||||
|
---- s's names
|
||||||
|
in
|
||||||
|
mkUtt (mkImp (mkVP give_V3 (mkNP i_Pron) ss))
|
||||||
|
| mkUtt (mkQS (mkQCl (L.CompIP whatSg_IP) ss))
|
||||||
|
| mkUtt (mkQS (mkQCl (L.CompIP (L.IdetIP (mkIDet which_IQuant))) ss))
|
||||||
|
| mkUtt ss ;
|
||||||
|
|
||||||
|
QWhere s = mkUtt (mkQS (mkQCl where_IAdv s)) ;
|
||||||
|
QInfo s =
|
||||||
|
let
|
||||||
|
info : NP = mkNP all_Predet (mkNP (mkNP information_N) (mkAdv about_Prep s)) ;
|
||||||
|
in
|
||||||
|
mkUtt (mkImp (mkVP give_V3 (mkNP i_Pron) info))
|
||||||
|
| mkUtt info ;
|
||||||
|
|
||||||
|
QCalled i = mkUtt (mkQS (mkQCl how_IAdv (mkCl i (mkVP also_AdV (mkVP called_A))))) ;
|
||||||
|
|
||||||
|
AKind s k = mkUtt (mkCl s (mkNP aPl_Det k)) ; ---- a, fun of s
|
||||||
|
AProp s p = mkUtt (mkCl s p) ;
|
||||||
|
AAct s p = mkUtt (mkCl s p) ;
|
||||||
|
|
||||||
|
SAll k = mkNP all_Predet (mkNP aPl_Det k) | mkNP thePl_Det k ;
|
||||||
|
SOne k = mkNP n1_Numeral k ;
|
||||||
|
SIndef k = mkNP a_Det k ;
|
||||||
|
SPlural k = mkNP aPl_Det k ;
|
||||||
|
SOther k = mkNP aPl_Det (mkCN other_A k) ;
|
||||||
|
SInd i = i ;
|
||||||
|
SInds is = mkNP and_Conj is ;
|
||||||
|
|
||||||
|
KRelSet r s =
|
||||||
|
mkCN r.cn (mkAdv r.prep s) ;
|
||||||
|
---- | S's R
|
||||||
|
|
||||||
|
---- KRelsSet r q s =
|
||||||
|
---- mkCN r.cn (mkAdv r.prep s) ;
|
||||||
|
|
||||||
|
KRelKind k r s =
|
||||||
|
mkCN k (mkRS (mkRCl that_RP (mkVP (mkNP aPl_Det (mkCN r.cn (mkAdv r.prep s)))))) ;
|
||||||
|
|
||||||
|
KRelPair k r = mkCN k (mkAdv with_Prep (mkNP (mkQuant they_Pron) plNum r.cn)) ;
|
||||||
|
KProp p k =
|
||||||
|
mkCN p k
|
||||||
|
| mkCN k (mkRS (mkRCl that_RP (mkVP p))) ;
|
||||||
|
KAct p k =
|
||||||
|
mkCN k (mkRS (mkRCl that_RP p)) ;
|
||||||
|
KRel r = r.cn ;
|
||||||
|
|
||||||
|
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} ;
|
||||||
|
|
||||||
|
}
|
||||||
180
examples/query/small/patentsQuery/QueryPat.gf
Normal file
180
examples/query/small/patentsQuery/QueryPat.gf
Normal file
@@ -0,0 +1,180 @@
|
|||||||
|
--# -path=.:..:alltenses
|
||||||
|
abstract QueryPat = Query ** {
|
||||||
|
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------
|
||||||
|
-- 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
|
||||||
|
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------
|
||||||
|
-- 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 : Drug -> 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 : Patent -> 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
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------
|
||||||
|
-- basic sets for the patent queries
|
||||||
|
|
||||||
|
|
||||||
|
-- PQInfoSet :
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------
|
||||||
|
-- categories and example functions for the Patent Query grammar
|
||||||
|
|
||||||
|
cat
|
||||||
|
Drug ;
|
||||||
|
Patent ;
|
||||||
|
ChemicalSubstance ;
|
||||||
|
DrugUsageForm ;
|
||||||
|
PatentNumber ;
|
||||||
|
Applicant ;
|
||||||
|
ApplicationNumber ;
|
||||||
|
PatsDate ;
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
-- 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
|
||||||
|
---------------------
|
||||||
|
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 ;
|
||||||
|
-------------------
|
||||||
|
-- put all dates here (maybe use Date grammar instead)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
BIN
examples/query/small/patentsQuery/QueryPat.gfo
Normal file
BIN
examples/query/small/patentsQuery/QueryPat.gfo
Normal file
Binary file not shown.
254
examples/query/small/patentsQuery/QueryPatEng.gf
Normal file
254
examples/query/small/patentsQuery/QueryPatEng.gf
Normal file
@@ -0,0 +1,254 @@
|
|||||||
|
--# -path=.:..:alltenses
|
||||||
|
|
||||||
|
concrete QueryPatEng of QueryPat = QueryEng ** open
|
||||||
|
SyntaxEng,
|
||||||
|
LexPatsQueryEng,
|
||||||
|
LangEng,
|
||||||
|
ParadigmsEng
|
||||||
|
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 ;
|
||||||
|
|
||||||
|
|
||||||
|
---------------------------------------------------------
|
||||||
|
-- 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) (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 ;
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
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) (SyntaxEng.mkAdv about_Prep drug))))
|
||||||
|
| mkUtt (mkQCl (mkIP (mkIDet what_IQuant) information_N) (mkClSlash (mkNP i_Pron) (SlashVV can_VV (PatsAdvVPSlash (mkVPSlash get_V2) (SyntaxEng.mkAdv about_Prep drug)))))
|
||||||
|
| mkUtt (mkNP all_Predet (massInfoSg (mkCN (mkCN information_N) (SyntaxEng.mkAdv about_Prep drug))))
|
||||||
|
| mkUtt (mkNP all_NP (SyntaxEng.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 -> SyntaxEng.mkAdv prep (mkNP (mkPN "DATE")) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
BIN
examples/query/small/patentsQuery/QueryPatEng.gfo
Normal file
BIN
examples/query/small/patentsQuery/QueryPatEng.gfo
Normal file
Binary file not shown.
69
examples/query/small/patentsQuery/QueryPatEng2.gf
Normal file
69
examples/query/small/patentsQuery/QueryPatEng2.gf
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
--# -path=.:..:alltenses
|
||||||
|
|
||||||
|
concrete QueryPatEng of QueryPat = QueryPatI with
|
||||||
|
(Syntax = SyntaxEng),
|
||||||
|
(Lang = LangEng),
|
||||||
|
(LexPatsQuery = LexPatsQueryEng) **
|
||||||
|
|
||||||
|
open
|
||||||
|
LexPatsQueryEng,
|
||||||
|
ParadigmsEng,
|
||||||
|
IrregEng,
|
||||||
|
SyntaxEng,
|
||||||
|
ExtraEng,
|
||||||
|
(L = LangEng),
|
||||||
|
(M = MakeStructuralEng),
|
||||||
|
Prelude,
|
||||||
|
QueryEng
|
||||||
|
in {
|
||||||
|
|
||||||
|
-- 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 -> Syntax.mkAdv prep (mkNP (mkPN "DATE")) ;
|
||||||
|
|
||||||
|
}
|
||||||
BIN
examples/query/small/patentsQuery/QueryPatI.gfo
Normal file
BIN
examples/query/small/patentsQuery/QueryPatI.gfo
Normal file
Binary file not shown.
1057
examples/query/small/patentsQuery/ResultsFre.txt
Normal file
1057
examples/query/small/patentsQuery/ResultsFre.txt
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user