Object-Oriented Programming with Recursive Queries Tomasz Pieciukiewicz 1 , Krzysztof Stencel 2 , Kazimierz Subieta 1,3 1 Polish-Japanese Institute of Information Technology, Warsaw, Poland {pietia, subieta}@pjwstk.edu.pl 2 Institute of Informatics, Warsaw University, Warsaw, Poland stencel@mimuw.edu.pl 3 Institute of Computer Science PAS, Warsaw, Poland Abstract. Recursive queries are required in many object-oriented database ap- plications. 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 and lacks theoretical foundations. In this pa- per we present recursive query processing capabilities for object-oriented envi- ronments. They are part of Stack-Based Query Language (SBQL). SBQL offers powerful and flexible recursive querying capabilities due to the fact that recur- sive processing operators are fully orthogonal to other features of this language. This paper discusses corresponding SBQL constructs: variants of transitive clo- sures, fixed point equations and recursive procedures/views. The paper is aug- mented by discussion concerning the state-of-the-art of current recursive query- ing capabilities. 1 Introduction Recursion in traditional programming languages like C or Java is natural and obvious for all the programmers. Database programmers and users, however, usually do not have the possibility of utilizing recursion, despite frequent needs to use it in database applications. The most widely known task requiring recursive processing 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 traditional programming language. However, users frequently 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, electric- ity, gas, water, and so on), processing metadata such as CORBA Interface Repository, etc. In traditional programming languages in many cases recursion can be substituted by iteration. This, however, implies much lower abstraction level and less elegant prob- lem specification. The iteration may also cause higher cost of program maintenance,