Queries are declared in eXPL and are executed by Java programs to find solutions expressed in eXPL.
Here is example of a simple eXPL query:
{"Athens", 23 ),
{"Sparta", 13 ),
{"Milos", 17);
axiom customer()
{"Marathon Marble", "Sparta"}
{"Acropolis Construction", "Athens"}
{"Agora Imports", "Sparta"}
{"Spiros Theodolites", "Milos"};
template freight(city, charge);
template customer_freight(
name,
city ? city == freight.city,
charge
);
query customer_charge(charge:freight, customer:customer_freight);
The tutorial2 GreekConstruction is a code example runs this query. When the query is run, the console output* is:
freight(city = Athens, charge = 23) customer_freight(name = Acropolis., city = Athens, charge = 23) freight(city = Sparta, charge = 13) customer_freight(name = Marathon., city = Sparta, charge = 13) freight(city = Sparta, charge = 13) customer_freight(name = Agora., city = Sparta, charge = 13) freight(city = Milos, charge = 17) customer_freight(name = Spiros., city = Milos, charge = 17)
* customer names shown truncated
The "customer_charge" query is declared having 2 unify/evaluate steps which are described as axiom/template pairs:
Axiom "charge" is paired to template "freight" and then axiom "customer" is paired to template "customer_freight". The query attempts unification exhaustively until all possible pairing combinations are tested. However, the results of a unification+evaluation step are preserved only if all templates in the query contain a complete solution. We see that the final solution consists of axioms, with each axiom a snapshot of a template captured after successful unification+evaluation.
