Architecture & Flow

K2 runs under a client/server model. A multithreaded server listens for connections through a socket, or through Java™ RMI. K2 comes with some simple clients which can be used to process queries from the World Wide Web, interactively submit queries through a text-based interface, or make an administrative connection. Other clients can be (and have been) developed, separate from K2, that provide a more sophisticated user interface. K2 can also accept connections from other K2 servers.

Queries can be sent to the server in either OQL or CPL (Kleisli's query language). Any references to objects specified in a K2MDL mediator are first converted to pure OQL. Then the query (OQL or CPL) is translated into K2's powerful, flexible internal representation.

Next, the query is optimized. This entails rewriting the query into one or more minimal forms, then choosing among these forms using a cost model. When optimization is complete, the query is executed, invoking the data drivers where necessary. The drivers are responsible for communicating with the data sources.

The final query result can be returned to the client in several forms. Clients connecting over a socket will receive either formatted text or HTML. RMI clients receive Java™ objects, which can be processed further as the client sees fit. You can even design your own custom formatter, to return your results in whatever way you need.

[K2 Front Page]