Exercise 21: Query transformations

Summary

In language, we often qualify an ambiguous noun with an attribute that resolves that ambiguity. For example, since I have two sisters, I can't just refer to my older sister by saying:

"My sister"

I need to say either:

"My older sister"

or

"My sister Rebekah"

In the first case, "older" is a qualifier. In the second case, the name "Rebekah" resolves the ambiguity.

What we need is a transformation such as:

my sister {first_name}
-> $x: speaker sister $x, $x.first_name = $1

In other words, we're not just transforming a fragment into a literal entity, we're transforming it into an entity that needs to be determined by resolving a set of conditions.

For the other example, we could use:

my older sister
-> $x: speaker sister $x, speaker sister $y, $x.age > $y.age

Solution

Click here

Web UI

Click here