Query variables

From OpenCog
Jump to: navigation, search

RelEx uses query variables to help identify the subject or object of a query. For example, the parse of "Who invented baseball?" generates:

_subj(invent, _$qVar)
_obj(invent, baseball)
QUERY-TYPE(_$qVar, who)
tense(invent, past)
noun_number(baseball, uncountable)

In this example, _$qVar identifies the uncertain thing being queried for. It should be viewed as a "blank slot" that, when filled out, provides the right answer. In other words, the output of RelEx can be understood to be a predicate (in the mathematical logic sense) that evaluates to true when the slot is filled with the correct answer.

Note that associated with the query variable is a word property, the QUERY-TYPE, which identifies the basic type of the query. There are seven types: who, what,where, when, how, which, why.

Copula variable

Also used in query formulation is _%copula, for example: Where is the ball? results in

_atLocation(_%copula, _$qVar)
_subj(_%copula, ball)

which is answered by The ball is under the couch:

 under(be, couch)
_subj(be, ball)

In this example, the variable _%copula is grounded by the verb "be" (and _atLocation is grounded by "under", while _$qVar is grounded by "couch").

See also

See also comparison variables.