birds3.taq

$ java -jar taq.jar birds3

Running query list_waterfowl in global scope 
bird=whistling swan, family=swan, color=white, flight=ponderous, voice=muffled musical whistle
bird=trumpeter swan, family=swan, color=white, flight=ponderous, voice=loud trumpeting
bird=snow goose, family=goose, color=white, size=plump, flight=powerful, voice=honks
bird=pintail, family=duck, flight=agile, voice=short whistle

Running query waterfowl in global scope 
waterfowl(bird=whistling swan, family=swan, color=white, flight=ponderous, voice=muffled musical whistle)
waterfowl(bird=trumpeter swan, family=swan, color=white, flight=ponderous, voice=loud trumpeting)
waterfowl(bird=snow goose, family=goose, color=white, size=plump, flight=powerful, voice=honks)
waterfowl(bird=pintail, family=duck, flight=agile, voice=short whistle)

Description

birds3.taq demonstrates a receiver attached to a function which returns a string list. The “list_non_blanks” function filters out blank bird classification categories. The function axiom parameter contains a full set of bird categories, many of which are blank. The unction returns a string list containing all the non-blank term values. This list is unified with a “list_non_blanks” cursor in the receiver.

Note the first query console result shown above is for comparison purposes only and is unrelated to the execution of the “waterfowl” query.


scope blank(provider="list_non_blanks.ListNonBlanks") {
function list<string> list_non_blanks(term item...)
}

template order
(
order,
string nostrils,
string live,
string bill,
string feet,
string eats
)

template family
(
family,
order ? order == order.order,
string size,
string wings,
string neck,
string color,
string flight,
string feed,
string head,
string feet,
string tail,
string bill,
string eats
)

template waterfowl
(
bird,
family ? family.family,
. order ? "waterfowl",
color,
size,
flight,
throat,
voice,
eats,
tail
)

flow list_waterfowl
{
export list<string> species
}
(
cursor<axiom> waterfowl_order = waterfowl(),
{
? fact waterfowl_order,
flow blank.list_non_blanks(waterfowl_order++) {
cursor<string> list_non_blanks,
string text = list_non_blanks++,
? fact text,
{ ?? (list_non_blanks) text += "," + list_non_blanks++ },
species += text
}
}
)

query list_waterfowl (list_waterfowl)

query<axiom> waterfowl (bird_order:order, bird_family:family, bird_species:waterfowl)

axiom list bird_order (order, nostrils, live, bill, feet, eats)
{"waterfowl", ?, ?, "flat", "webbed", ?}
{"tubenose", "external tubular", "at sea", "hooked", "webbed", ?}
{"falconiforms", ?, ?, "sharp hooked", "curved talons", "meat"}
{"passerformes", ?, ?, ?, "one long backward toe", ?}

axiom list bird_family (family, order, size, wings, neck, color, flight, feed, head, tail, bill, eats)
{"swan", "waterfowl", ?, ?, "long", "white", "ponderous", ?, ?, ?, ?, ?}
{"goose", "waterfowl", "plump", ?, ?, ?, "powerful", ?, ?, ?, ?, ?}
{"duck", "waterfowl", ?, ?, ?, ?, "agile", "on water surface", ?, ?, ?, ?}
{"albatross", "tubenose", "large", "long narrow", ?, ?, ?, ?, ?, ?, ?, ?}
{"procellariidae", "tubenose", ?, "long narrow", ?, ?, ?, ?, ?, ?, ?, ?}
{"vulture", "falconiforms", ?, "broad", ?, ?, ?, "scavange", ?, ?, ?, ?}
{"falcon", "falconiforms", ?, "long pointed", ?, ?, ?, ?, "large", "narrow at tip", ?, ?}
{"flycatcher", "passerformes", ?, ?, ?, ?, ?, ?, ?, ?, "flat", "flying insects"}
{"swallow", "passerformes", ?, "long pointed", ?, ?, ?, ?, ?, "forked", "short", ?}

axiom list bird_species (bird, family, color, size, flight, throat, voice, eats, tail)
{"whistling swan", "swan", ?, ?, ?, ?, "muffled musical whistle", ?, ?}
{"trumpeter swan", "swan", ?, ?, ?, ?, "loud trumpeting", ?, ?}
{"snow goose", "goose", "white", ?, ?, ?, "honks", ?, ?}
{"pintail", "duck", ?, ?, ?, ?, "short whistle", ?, ?}
{"laysan_albatross", "albatross", "white", ?, ?, ?, ?, ?, ?}
{"black footed albatross", "albatross", "dark", ?, ?, ?, ?, ?, ?}
{"fulmar", "procellariidae", ?, "medium", "flap glide", ?, ?, ?, ?}
{"turkey vulture", "vulture", ?, ?, "v shaped", ?, ?, ?, ?}
{"california condor", "vulture", ?, ?, "flat", ?, ?, ?, ?}
{"sparrow hawk", "falcon", ?, ?, ?, ?, ?, "insects", ?}
{"peregrine falcon", "falcon", ?, ?, ?, ?, ?, "birds", ?}
{"great crested flycatcher", "flycatcher", ?, ?, ?, ?, ?, ?, "long rusty"}
{"ash throated flycatcher", "flycatcher", ?, ?, ?, "white", ?, ?, ?}
{"barn swallow", "swallow", ?, ?, ?, ?, ?, ?, "forked"}
{"cliff swallow", "swallow", ?, ?, ?, ?, ?, ?, "square"}
{"purple martin", "swallow", "dark", ?, ?, ?, ?, ?, ?}