Usable Recursive Queries Tomasz Pieciukiewicz 1 , Krzysztof Stencel 2 , Kazimierz Subieta 1, 3 1 Polish-Japanese Institute of Information Technology, Warsaw, Poland 2 Institute of Informatics, Warsaw University, Warsaw, Poland 3 Institute of Computer Science PAS, Warsaw, Poland pietia@pjwstk.edu.pl, stencel@mimuw.edu.pl, subieta@ipipan.waw.pl Abstract. Recursive queries are required for many tasks of database applications. Among them we can mention Bill-Of-Material (BOM), various kinds of networks (transportation, telecommunication, etc.), processing semi- structured data (XML, RDF), and so on. The support for recursive queries in current query languages is limited. In particular, this concerns corresponding extensions of SQL in Oracle and DB2 systems. In this paper we present recursive query processing capabilities for the object-oriented Stack-Based Query Language (SBQL). SBQL offers very powerful and flexible recursive querying capabilities due to the fact that recursive processing operators are fully orthogonal to other capabilities of this language. The presented features aim at the ease of recursive programming in databases and not at building new theoretical foundations. This paper discusses novel SBQL constructs, such as transitive closures, fixed point equations and recursive procedures/views. Their main advantage is that they are seamlessly integrated with object-oriented facilities, computer environment and databases. 1. Introduction There are many important tasks which require recursive processing. The most widely known is Bill-Of-Material (BOM) which is a part of Materials Requirements Planning (MRP) systems. BOM acts on a recursive data structure representing a hierarchy of parts and subparts of some complex material products. Typical MRP software processes such structures by proprietary routines and applications implemented in a programming language. However, frequently users need to issue ad hoc queries addressing such structures. In such cases they need special recursive user-friendly facilities of a query language. Similar problems concern computations on genealogic trees, stock market dependencies, various types of networks (transportation, telecommunication, electricity, gas, water, and so on), etc. The recursion is also necessary for internal purposes of computer systems, such as processing recursive metadata structures (e.g. CORBA Interface Repository), configuration management repositories, hierarchical structures of XML or RDF files, and so on. In many cases recursion can be substituted by iteration, but this implies much lower abstraction level and less elegant problem specification. The iteration may also cause higher cost of program maintenance, since it implies a clumsy code, more difficult to debug and change.