Skip to content

The WeSearh Query Language

Yuri Faria edited this page Oct 19, 2021 · 8 revisions

Following W3C's EBNF notation, our take on the grammar of the language is

WQLExpr     := Space? PredExp Space? HconsList? Space?
PredExpr    := Predication
               | PredExpr Space? "|" Space? PredExpr
               | PredExpr Space PredExpr
               | "(" Space? PredExpr Space? ")"
               | "!" Space? PredExpr
Predication := "^"? (Var ":")? PredPat ArgList?
               | "^"? (Var ":")? ArgList
PredPat     := Predicate | LemmaPat | POSPat | SensePat
Predicate   := "_"? Lemma ("_" POS)? ("_" Sense)? "_rel"?
LemmaPat    := "+" Lemma
POSPat      := "/" POS
SensePat    := "=" Sense
Lemma       := [^\s_\[\](){}!]+
POS         := [nvajrscpqxud]
Sense       := [^\s_\[\](){}!]+
ArgList     := "[" Space? Arguments? Space? "]"
Arguments   := Argument | Argument Space? "," Space? Arguments
Argument    := RolePat (Space Var)?
HconsList   := "{" Space? HConsts? Space? "}"
HConsts     := HCons | HCons Space? "," Space? HConsts
HCons       := Hole Space? HconsOp Space? Var
Var         := [a-zA-Z] [a-zA-Z0-9]*
Hole        := [a-zA-Z] [a-zA-Z0-9]*
RolePat     := [a-zA-Z0-9*]+
HconsOp     := "=q"
Space       := [\s]+

It was written based on http://moin.delph-in.net/wiki/MrsRfc#Simple, https://github.com/delph-in/pydelphin/blob/develop/delphin/predicate.py and http://moin.delph-in.net/wiki/PredicateRfc. Both lemma and senses were changed to avoid conflict with specific characters of the language. Eventually, we would like to add individual constraints and other types of handle constrains (like lheq and outscopes). The idea of the language is born from the idea of semantic fingerprints found here; the language is basically an skeleton of an MRS and it server to filter MRSs in a database that matches the patterns of the language.

Clone this wiki locally