KR100989453B1 - Method and computer system for publishing relational data to recursively structured XMLs by using new SQL functions and an SQL operator for recursive queries, and computer-readable recording medium having programs for performing the method - Google Patents

Method and computer system for publishing relational data to recursively structured XMLs by using new SQL functions and an SQL operator for recursive queries, and computer-readable recording medium having programs for performing the method Download PDF

Info

Publication number
KR100989453B1
KR100989453B1 KR1020080125993A KR20080125993A KR100989453B1 KR 100989453 B1 KR100989453 B1 KR 100989453B1 KR 1020080125993 A KR1020080125993 A KR 1020080125993A KR 20080125993 A KR20080125993 A KR 20080125993A KR 100989453 B1 KR100989453 B1 KR 100989453B1
Authority
KR
South Korea
Prior art keywords
recursive
tuples
result
tuple
sql
Prior art date
Application number
KR1020080125993A
Other languages
Korean (ko)
Other versions
KR20100067425A (en
Inventor
박영철
박성철
엄진아
Original Assignee
주식회사 퓨전소프트
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 주식회사 퓨전소프트 filed Critical 주식회사 퓨전소프트
Priority to KR1020080125993A priority Critical patent/KR100989453B1/en
Publication of KR20100067425A publication Critical patent/KR20100067425A/en
Application granted granted Critical
Publication of KR100989453B1 publication Critical patent/KR100989453B1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/40Data acquisition and logging

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

재귀적 질의에 적용되어 그 질의들의 재귀적 결과투플들에 해당하는 노드들이 형성하는 각 재귀적 결과투플 트리에 대해 하나의 재귀적 구조의 XML 값을 생성하는 새로운 SQL 함수 XMLNEST를 제공한다. 또한, 이 XMLNEST의 직간접 인자로만 사용되며 재귀적 결과투플 트리의 노드들 각각에 대해 그 노드를 루트로 가지는 서브트리(sub-tree)의 모든 노드들에 해당하는 재귀적 결과투플들을 하나의 집단으로 처리함으로써 그들 각 집단에 대해 하나의 값을 계산하여 그 값을 그 집단을 대표하는 루트 노드에 해당하는 재귀적 결과투플에게 반환하는 NEST_SUM, NEST_COUNT, NEST_AVG, NEST_MIN, NEST_MAX을 XMLNEST의 관련 SQL 함수들로서 제공한다. 나아가, 재귀적 결과투플들을 그들의 기원 투플들에 해당하는 노드들이 소속된 재귀적 임시 결과투플 트리별로 분류하고 하나 이상의 재귀적 결과투플을 구성원으로 가진 각 분류의 모든 재귀적 결과투플들을 하나의 집단으로 처리함으로써 그들 각 집단에 대해 하나의 값을 반환하는 새로운 SQL 연산자 tc_root도 제공한다. 이들 새로운 SQL 함수와 연산자는 재귀적 질의를 지원하는 DBMS에 적용될 수 있다.Provides a new SQL function XMLNEST that is applied to a recursive query and generates one recursive XML value for each recursive result tuple tree formed by nodes corresponding to the recursive result tuples of the queries. In addition, for each node of the recursive result tuple tree, which is used as a direct and indirect argument of this XMLNEST, recursive result tuples corresponding to all nodes of the sub-tree whose root is the node are grouped. Provide NEST_SUM, NEST_COUNT, NEST_AVG, NEST_MIN, and NEST_MAX as relevant SQL functions of XMLNEST by calculating one value for each group and returning that value to the recursive result tuple corresponding to the root node representing that group. do. Furthermore, the recursive result tuples are classified by the recursive temporary result tuple tree to which the nodes corresponding to their origin tuples belong, and all the recursive result tuples of each classification having one or more recursive result tuples as members. It also provides a new SQL operator, tc_root, which returns a value for each of those groups. These new SQL functions and operators can be applied to DBMSs that support recursive queries.

데이터베이스, DB, 함수, 계층집단, 재귀적 질의, SQL, 연산자 Database, DB, Function, Hierarchy, Recursive Query, SQL, Operator

Description

새로운 에스큐엘 함수와 연산자를 재귀적 질의에 사용하여 관계 데이터로부터 재귀적 구조의 엑스엠엘을 생성하는 방법과 컴퓨터 시스템, 그리고 그 방법을 구현한 프로그램을 기록한 컴퓨터-가독형 기록 매체{Method and computer system for publishing relational data to recursively structured XMLs by using new SQL functions and an SQL operator for recursive queries, and computer-readable recording medium having programs for performing the method}A method and computer system for generating a recursive XML from a relational data using new escuel functions and operators in a recursive query, and a computer-readable recording medium recording a program implementing the method {Method and computer system for publishing relational data to recursively structured XMLs by using new SQL functions and an SQL operator for recursive queries, and computer-readable recording medium having programs for performing the method}

본 발명은 SQL 질의를 통해 관계 투플들을 XML 값으로 생성하는 방법에 관련된 것으로서, 보다 상세하게는 재귀적 질의에 의해 식별된 투플들의 내용과 그 투플들 간의 연결 관계를 XML 값으로 생성하는 방법, 연산처리방법, 이 방법들을 수행하기 위한 프로그램이 기록된 컴퓨터로 읽을 수 있는 매체와 이를 이용한 데이터베이스 시스템에 관한 것이다.The present invention relates to a method for generating relation tuples as XML values through an SQL query, and more particularly, to a method for generating contents of tuples identified by a recursive query and a linkage relationship between the tuples as an XML value. The present invention relates to a processing method, a computer-readable medium having recorded thereon a program for performing the methods, and a database system using the same.

IBM의 DB2와 Oracle의 Oracle 10g는 XML 데이터 유형을 지원하고 SQL:2003 표준의 다음 SQL 표준에 포함될 것으로 예상되는 XMLQUERY, XMLTABLE, XMLEXISTS 등의 XQuery 함수들을 이미 제공함으로써 데이터베이스에 저장된 XML 값에 대한 XQuery 질의를 지원하며, 관계 투플들로부터 XML 값을 생성하기 위한 방법으로 SQL:2003 표준의 SQL/XML 출판 함수들을 select 절(節, clause)에 포함한 SQL 질의를 지원한다. Microsoft의 SQL Server 2005는 XML 데이터 유형을 지원하지만 데이터베이스에 저장된 XML 값에 대한 XQuery 질의와 관계 투플들로부터 XML 값을 생성하기 위한 SQL 표준의 함수들을 지원하지 않고 있다.IBM's DB2 and Oracle's Oracle 10g support XML data types and already provide XQuery functions such as XMLQUERY, XMLTABLE, and XMLEXISTS that are expected to be included in the next SQL standard of the SQL: 2003 standard. As a method for generating XML values from relational tuples, it supports SQL queries including SQL / XML publishing functions of the SQL: 2003 standard in select clauses. Microsoft's SQL Server 2005 supports XML data types but does not support the SQL standard functions for generating XML values from XQuery queries and relational tuples on XML values stored in the database.

SQL/XML 출판 함수들을 이용하여 관계 투플들로부터 XML 값을 생성하기 위해서는 생성하고자 하는 XML 값의 내용과 구조에 따라 SQL/XML 출판 함수들을 select 절에 포함한 SQL 질의를 작성하면 된다. 예를 들어, 테이블 employees(employee_id, first_name, last_name, birthdate, salary, supervisor_id, department_id)와 테이블 departments(department_id, department_name, manager_id)의 투플들로부터 XML 값을 생성하는 경우를 고려해 보자. 테이블 employees에서 사원번호를 나타내는 칼럼 employee_id는 주 키(primary key)이며 상사의 사원번호를 나타내는 supervisor_id는 그 테이블의 주 키를 참조하는 외래 키(foreign key)이고 사원이 소속된 부서번호를 나타내는 칼럼 department_id는 테이블 departments의 주 키인 칼럼 department_id를 참조하는 외래 키이다. 테이블 departments에서 그 부서의 관리자의 사원번호를 나타내는 칼럼 manager_id는 테이블 employees의 주 키를 참조하는 외래 키이다. 본 문서의 나머지 부분에서 참조되는 테이블 employees와 테이블 departments의 투플들은 도 1과 같다.To generate XML values from relational tuples using SQL / XML publishing functions, you can write an SQL query that includes SQL / XML publishing functions in the select clause according to the content and structure of the XML value to be created. For example, consider creating an XML value from the tuples of the table employees (employee_id, first_name, last_name, birthdate, salary, supervisor_id, department_id) and the table departments (department_id, department_name, manager_id). The column employee_id representing the employee number in the table employees is the primary key and the supervisor_id representing the employee's employee number is the foreign key referring to the primary key of the table and the column department_id represents the department number to which the employee belongs. Is a foreign key that references the column department_id, which is the primary key of the table departments. In the table departments, the column manager_id representing the employee number of the manager of that department is a foreign key that refers to the primary key of the table employees. The tuples of table employees and table departments referenced in the rest of this document are shown in FIG.

SQL/XML 출판 함수들을 이용하여 부서번호가 1인 부서에 해당하는 테이블 departments의 투플과 그 부서의 관리자에 해당하는 테이블 employees의 투플로부 터 하나의 XML 값을 생성하는 경우를 고려해 보자.Consider using a SQL / XML publishing function to create an XML value from a tuple of table departments corresponding to a department whose department number is 1 and a tuple of table employees corresponding to a manager of that department.

예제 1. 테이블 employees와 테이블 departments를 대상으로 부서번호가 1인 부서에 대해 XML 엘리먼트 "DEPARTMENT"를 생성하시오. 단, XML 엘리먼트 "DEPARTMENT"는 XML 엘리먼트 "NAME"과 "MANAGER"를 자식으로 가지며 XML 엘리먼트 "MANAGER"는 XML 엘리먼트 "FIRST_NAME"과 "LAST_NAME"을 자식으로 가진다. XML 엘리먼트 "DEPARTMENT"는 부서번호를 속성 "id"의 값으로 가지며, XML 엘리먼트 "NAME"은 그 부서의 부서명을 그 엘리먼트의 텍스트 값으로 가지며, XML 엘리먼트 "MANAGER"는 그 부서의 관리자의 사원번호를 속성 "eno"의 값으로 가지며, XML 엘리먼트 "FIRST_NAME"은 그 부서의 관리자의 이름을 그 엘리먼트의 텍스트 값으로 가지며, XML 엘리먼트 "LAST_NAME"은 그 부서의 관리자의 성을 그 엘리먼트의 텍스트 값으로 가진다. Example 1. Create an XML element "DEPARTMENT" for a department with department number 1 targeting table employees and table departments. However, the XML element "DEPARTMENT" has the XML elements "NAME" and "MANAGER" as children, and the XML element "MANAGER" has the XML elements "FIRST_NAME" and "LAST_NAME" as children. The XML element "DEPARTMENT" has the department number as the value of the attribute "id", the XML element "NAME" has the department name of the department as the text value of the element, and the XML element "MANAGER" the employee number of the manager of that department. With the value of the attribute "eno", the XML element "FIRST_NAME" has the name of the manager of that department as the text value of that element, and the XML element "LAST_NAME" the last name of the manager of the department as the text value of that element. Have

예제 1을 위해 SQL/XML 출판 함수들을 이용하여 작성한 질의와 그 질의를 도 1의 테이블 employees와 테이블 departments를 대상으로 평가한 결과는 각각 도 2(a) 그리고 도 2(b)와 같다. 도 2(a)에서 SQL/XML 출판 함수 XMLELEMENT는 XML 엘리먼트 "DEPARTMENT", "NAME", 그리고 "MANAGER"를 생성하며, SQL/XML 출판 함수 XMLATTRIBUTES는 XML 엘리먼트 "DEPARTMENT"의 속성인 "id"와 XML 엘리먼트 "MANAGER"의 속성인 "eno"를 생성한다. 도 2(a)에서 SQL/XML 출판 함수 XMLFOREST는 XML 엘리먼트 "MANAGER"의 자식 엘리먼트들인 "FIRST_NAME"과 "LAST_NAME"을 생성한다. 도 2(b)의 XML은 가독성을 위해 임의로 들여쓰기(indentation)를 수행한 결과이다.The result of evaluating the query created using the SQL / XML publishing functions for Example 1 and the query for the table employees and table departments of FIG. 1 is shown in FIGS. 2 (a) and 2 (b), respectively. In FIG. 2 (a), the SQL / XML publishing function XMLELEMENT creates the XML elements "DEPARTMENT", "NAME", and "MANAGER", and the SQL / XML publishing function XMLATTRIBUTES is the attribute "id" of the XML element "DEPARTMENT". Create the "eno" attribute of the XML element "MANAGER". In FIG. 2 (a), the SQL / XML publishing function XMLFOREST creates "FIRST_NAME" and "LAST_NAME" which are child elements of the XML element "MANAGER". The XML of FIG. 2 (b) is the result of random indentation for readability.

SQL/XML 출판 함수들을 이용하여 상사와 부하의 관계로 연결된 테이블 employees의 투플들로부터 XML 값을 생성하는 경우를 고려해 보자.Consider a case where you use SQL / XML publishing functions to generate XML values from tuples of table employees connected in a boss-to-load relationship.

예제 2. 테이블 employees를 대상으로 사원 번호가 10인 사원과 그 사원의 두 단계 아래까지의 부하사원들 즉, 그 사원의 부하사원들 그리고 그 부하사원들의 부하사원들을 대상으로 각 사원에 대해 하나의 XML 엘리먼트 "EMPLOYEE"를 생성하시오. 단, XML 엘리먼트 "EMPLOYEE"는 해당 사원의 employee_id의 값을 그 엘리먼트의 속성 "id"의 값으로 가지며 그 엘리먼트의 자식 엘리먼트들로 "FIRSTNAME", "LASTNAME", "SALARY", "MANAGER", 그리고 "SUBORDINATES"를 각각 하나씩 그 순서로 가진다. XML 엘리먼트 "FIRSTNAME", "LASTNAME", "SALARY", 그리고 "MANANAGER"는 그 사원에 해당하는 투플의 칼럼 first_name, last_name, salary, 그리고 supervisor_id의 값을 각각 그 엘리먼트의 텍스트 값으로 가진다. XML 엘리먼트 "SUBORDINATES"는 그 사원의 부하사원들로부터 생성한 "EMPLOYEE" 엘리먼트들을 자식 엘리먼트들로 가진다. Example 2. A table with employees with employee number 10 and subordinates up to two levels below the employee, that person's subordinates and their subordinates, one for each employee. Create the XML element "EMPLOYEE". Provided that the XML element "EMPLOYEE" has the value of the employee_id of the employee as the value of the attribute "id" of the element and the child elements of the element "FIRSTNAME", "LASTNAME", "SALARY", "MANAGER", and Each has "SUBORDINATES" in that order. The XML elements "FIRSTNAME", "LASTNAME", "SALARY", and "MANANAGER" have the value of the element's tuple column first_name, last_name, salary, and supervisor_id, respectively, as the text values of the element. The XML element "SUBORDINATES" has "EMPLOYEE" elements created from its employees' subordinates as child elements.

예제 2를 위해 SQL/XML 출판 함수들을 이용하여 작성한 질의는 도 3과 같다. 도 3의 질의에서 가장 바깥의 select 부질의(subquery)는 사원번호가 10인 사원을 인출하며 그 select 부질의에 중첩된 select 부질의들은 각각 그 사원의 부하사원들 그리고 그 부하사원들의 부하사원들을 인출한다.The query created using SQL / XML publishing functions for Example 2 is shown in FIG. In the query of FIG. 3, the outermost select subquery retrieves the employee whose employee number is 10, and the select subqueries superimposed on the select subquery respectively select subordinates of the employee and subordinates of the subordinates. Withdraw.

도 3의 질의는 그 질의의 select 절에 명시된 SQL/XML 출판 함수들을 칼럼 employee_id의 값이 10인 투플과 그 투플을 칼럼 supervisor_id의 값으로 참조하는 투플들, 그리고 그 투플들을 또다시 칼럼 supervisor_id의 값으로 참조하는 투플들 을 대상으로 적용하여 하나의 XML 값으로 구성된 하나의 결과투플을 생성한다. 그 결과투플은 도 4와 같다.The query of FIG. 3 includes the SQL / XML publishing functions specified in the select clause of the query, a tuple with a column employee_id of 10, tuples referencing the tuple with the value of the column supervisor_id, and the tuples again with the value of the column supervisor_id. Create a result tuple consisting of one XML value by applying tuples referred to as targets. The result is a tuple as shown in FIG.

하나의 속성 "id"를 가지며 "FIRSTNAME", "LASTNAME", "SALARY", "MANAGER", 그리고 "SUBORDINATES"의 자식 엘리먼트들을 가지는 도 4의 XML 엘리먼트 "EMPLOYEE"의 구조를 XML 스키마 그래프로 표현하면 도 5와 같다.The structure of the XML element "EMPLOYEE" of Figure 4, with one attribute "id" and child elements of "FIRSTNAME", "LASTNAME", "SALARY", "MANAGER", and "SUBORDINATES", is expressed as an XML schema graph. Same as FIG. 5.

정의 1. 특정 XML 값의 구조를 XML 스키마 그래프로 표현한 경우, 그 그래프의 노드(node)들과 그들을 연결하는 에지(edge)들이 사이클(cycle)을 형성한다면, 그 그래프는 재귀적 구조의 XML 값을 표현하며 그 그래프로 표현된 그 XML 값을 재귀적 구조의 XML 값이라 한다. Definition 1. When a structure of a particular XML value is represented as an XML schema graph, if the nodes of the graph and the edges connecting them form a cycle, the graph is a recursive XML value. The XML value represented by the graph is called a recursive XML value.

도 5의 노드 "EMPLOYEE"와 노드 "SUBORDINATES", 그리고 그들을 연결하는 에지들은 사이클을 형성하므로 도 5의 XML 스키마 그래프는 재귀적 구조의 XML 값을 표현하며 도 4의 XML 값은 재귀적 구조의 XML 값이다.Node "EMPLOYEE" and node "SUBORDINATES" in Figure 5, and the edges connecting them form a cycle, so the XML schema graph of Figure 5 represents the XML value of the recursive structure and the XML value of Figure 4 represents the XML of the recursive structure. Value.

정의 2. XML 스키마 그래프에서 사이클에 참여하는 노드들 중, 그 사이클의 시작이 되는 노드를 NEST_ROOT 노드라 하며 그 NEST_ROOT 노드의 자식 노드로서 NEST_ROOT 노드와 사이클을 형성하며 NEST_ROOT 노드를 제외한 어떠한 자식 노드도 가지지 않는 노드를 NEST_SUBORDINATE 노드라 한다. Definition 2. Among the nodes participating in the cycle in the XML schema graph, the node that starts the cycle is called the NEST_ROOT node and forms a cycle with the NEST_ROOT node as a child node of the NEST_ROOT node and has no child nodes except the NEST_ROOT node. Nodes that do not are called NEST_SUBORDINATE nodes.

도 5의 경우, 노드 "EMPLOYEE"는 NEST_ROOT 노드이며 노드 "SUBORDINATES"는 NEST_SUBORDINATE 노드이다. 본 문서는 사이클을 가진 XML 스키마 그래프에서 NEST_ROOT 노드를 그 그래프의 시작 노드라는 의미로 특별히 이중 타원으로 표현한다.In the case of FIG. 5, node "EMPLOYEE" is a NEST_ROOT node and node "SUBORDINATES" is a NEST_SUBORDINATE node. In this document, an NEST_ROOT node in a cycled XML Schema graph is specifically represented as a double ellipse, meaning that it is the starting node of the graph.

정의 3. XML 스키마 그래프에서 NEST_ROOT 노드가 나타내는 XML 엘리먼트를 NEST_ROOT 엘리먼트라 하고, NEST_SUBORDINATE 노드가 나타내는 XML 엘리먼트를 NEST_SUBORDINATE 엘리먼트라 한다. Definition 3. The XML element represented by the NEST_ROOT node in the XML schema graph is called the NEST_ROOT element, and the XML element represented by the NEST_SUBORDINATE node is called the NEST_SUBORDINATE element.

도 3의 질의는 사원번호가 10인 사원과 그 사원의 두 단계 아래까지의 부하사원들에 대한 투플들만으로 XML 값을 생성하는 질의이다. 그러나 그 사원과 그 사원의 10 단계 아래까지의 부하사원들 또는 그 깊이를 예측할 수 없는 그 사원의 말단 부하사원들까지의 사원들에 대한 투플들로써 도 4의 XML 값을 생성하고자 하는 경우, 그러한 질의를 도 3과 같이 중첩 SQL 질의로 작성하는 것은 전자의 경우는 쉽지 않으며 후자의 경우는 불가능하다.The query of FIG. 3 is a query that generates an XML value using only tuples for an employee having employee number 10 and subordinates up to two levels below the employee. However, if you want to generate the XML value of FIG. 4 as tuples for the employee and subordinates up to 10 levels below the employee, or for the terminal subordinates of the employee whose depth cannot be predicted, such a query may be used. To create a nested SQL query as shown in Figure 3 is not easy in the former case, the latter is impossible.

본 발명자들은 기존 SQL/XML 출판 함수들을 포함한 SQL 질의로는 주어진 조건에 의해 직간접으로 연결된 투플들로부터 그 투플들의 내용과 그 투플들 간의 연결 관계를 반영하는 재귀적 구조의 XML 값을 생성하는 것이 쉽지 않거나 불가능하다는 문제점들을 인식하였다. 나아가 이러한 문제를 해결하기 위해서는 재귀적 구조의 XML 값을 효과적으로 생성하는 새로운 SQL 함수와 연산자가 제공될 필요가 있다는 점도 인식하였다. It is easy for the inventors to generate an XML value of a recursive structure that reflects the contents of the tuples and the connection relationship between the tuples from the tuples connected directly or indirectly by a given condition with the SQL query including the existing SQL / XML publishing functions. Recognize problems that are or are not possible. Furthermore, we recognized that to solve this problem, new SQL functions and operators need to be provided to effectively generate recursive XML values.

이러한 인식에 기초하여, 본 발명은 (1) 재귀적 질의의 select 절에 사용되어 그 질의에 의해 식별된 투플들을 그들 간의 연결 관계에 따라 하나의 재귀적 구조의 XML 값으로 생성하는 새로운 SQL 함수 XMLNEST를 제시하고 그 SQL 함수의 구 문과 의미를 명세하며, (2) XMLNEST와 SQL의 기존 집단(集團, group)함수들의 관계를 정의하며, (3) XMLNEST와 SQL/XML 출판 함수들의 관계를 정의하며, (4) XMLNEST와 관련된 새로운 SQL 함수들로서 NEST_SUM, NEST_COUNT, NEST_AVG, NEST_MIN, NEST_MAX를 그리고 XMLNEST와 관련된 SQL 연산자로서 tc_root를 제공하는 데 있다.Based on this recognition, the present invention provides a new SQL function XMLNEST that is used in the select clause of a recursive query to generate tuples identified by the query as XML values of one recursive structure according to the linkage relationship between them. (2) define the relationship between XMLNEST and existing group functions of SQL, (3) define the relationship between XMLNEST and SQL / XML publishing functions, , (4) provide new SQL functions related to XMLNEST, NEST_SUM, NEST_COUNT, NEST_AVG, NEST_MIN, NEST_MAX, and tc_root as the SQLNEST-related SQL operator.

또한 본 발명은 상기 새로운 SQL 함수들과 연산자들을 이용하여 데이터베이스에 대한 재귀적 질의를 수행함으로써 그 데이터베이스에 대한 재귀적 구조의 XML 값을 생성하는 방법을 제공하는 것을 다른 목적으로 한다.Another object of the present invention is to provide a method for generating an XML value of a recursive structure for a database by performing a recursive query for a database using the new SQL functions and operators.

나아가 본 발명은 상기 SQL 연산자를 이용하여 재귀적 결과 투플들을 하나의 집단으로 처리함으로써 그 집단에 대해 하나의 값을 반환하는 방법을 제공하는 것을 또 다른 목적으로 한다.Furthermore, another object of the present invention is to provide a method of returning a value for a group by treating the recursive result tuples into a group using the SQL operator.

그리고, 본 발명은 상기 방법들을 실시하기 위한 컴퓨터 장치와 위와 같은 방법을 컴퓨터 장치에 실현하기 위한 프로그램을 기록한 컴퓨터 가독형 기록매체를 제공하는 것을 또 다른 목적으로 한다.Another object of the present invention is to provide a computer readable recording medium having recorded thereon a computer device for performing the above methods and a program for realizing the above method on the computer device.

상기와 같은 목적을 달성하기 위한 본 발명에 따르면, 컴퓨팅 시스템의 프로세서에서 데이터베이스 관리 시스템(DBMS)의 프로세스를 그 컴퓨팅 시스템의 메모리에 로드하여 데이터베이스에 대한 질의의 처리를 수행하는 방법에 있어서, 상기 데이터베이스에 대하여 재귀적 질의를 수행하여 재귀적 임시 결과투플들과 재귀적 결과투플들을 생성하는 단계; 상기 재귀적 결과 투플들에 해당하는 노드들이 형성하는 재귀적 결과투플 트리들 각각에 대하여 재귀적 임시 결과투플 트리들 각각이 하나의 재귀적 결과투플 트리만을 생성하는지를 판단하는 제1판단단계; 상기 재귀적 결과투플 트리의 루트 노드에 해당하는 재귀적 결과투플이 상기 재귀적 임시 결과투플 트리의 루트 노드에 해당하는 재귀적 임시 결과투플을 기원 투플로 가지는지 판단하는 제2판단단계; 및 상기 제1판단단계와 제2판단단계 중 어느 하나라도 만족하지 않는 경우 오류신호를 생성하고, 상기 제1판단단계와 제2판단단계 모두를 만족하는 경우 상기 재귀적 결과투플 트리들 각각에 대하여 그 트리를 구성하는 노드들을 탐색하여 그 트리에 속하는 노드들에 해당하는 투플들로 하나의 재귀적 구조의 XML 값을 생성하는 단계를 수행하는 것을 특징으로 하는 데이터베이스에 대한 재귀적 구조의 XML 값을 생성하는 방법이 제공된다.According to the present invention for achieving the above object, a method of loading a process of a database management system (DBMS) in the processor of the computing system into the memory of the computing system to perform a query for the database, the database Performing a recursive query on to generate recursive temporary result tuples and recursive result tuples; A first determination step of determining whether each of the recursive temporary result tuple trees generates only one recursive result tuple tree for each of the recursive result tuple trees formed by the nodes corresponding to the recursive result tuples; A second judging step of determining whether a recursive result tuple corresponding to a root node of the recursive result tuple tree has a recursive temporary result tuple corresponding to a root node of the recursive temporary result tuple tree as an origin tuple; And generating an error signal when any one of the first determination step and the second determination step is not satisfied, and for each of the recursive result tuple trees when both the first determination step and the second determination step are satisfied. Searching for nodes constituting the tree and generating XML values of a recursive structure with tuples corresponding to the nodes belonging to the tree. A method of generating is provided.

여기서, 상기 재귀적 임시 결과투플 트리는 상기 데이터베이스에 대한 재귀적 질의를 수행하는 과정에서 생성되는 재귀적 임시 테이블의 재귀적 임시 결과 투플들을 대상으로, 그 투플들을 노드들로 표현하고, 부모-자식 관계의 투플들에 해당하는 노드들을 부모 노드로부터 자식 노드로 향하는 방향 에지로 연결하여 표현함으로써 형성되는 트리들이다. 그리고 상기 재귀적 결과투플 트리는 상기 재귀적 결과투플들을 대상으로, 상기 재귀적 결과투플들 모두가 상기 재귀적 임시 결과투플들의 단수 복제에 의해 생성된 경우에 한하여, 상기 재귀적 결과투플들을 노드들로 표현하고 부모-자식 관계의 투플들에 해당하는 노드들을 부모 노드로부터 자식 노드로 향하는 방향 에지로 연결하여 표현함으로써 형성되는 트리들이다. Here, the recursive temporary result tuple tree expresses the tuples as nodes for the recursive temporary result tuples of the recursive temporary table generated in the process of performing the recursive query on the database, and the parent-child relationship Trees formed by connecting and representing nodes corresponding to tuples of a parent node from a direction edge toward a child node. And the recursive result tuple tree targets the recursive result tuples, and only if all of the recursive result tuples are generated by a singular copy of the recursive temporary result tuples. Trees formed by representing and representing nodes corresponding to tuples of a parent-child relationship with a direction edge from a parent node to a child node.

바람직하게는, 상기 방법은 SQL:1999 표준의 재귀적 질의 양식을 따르는 DBMS 또는 자신만의 독자적인 재귀적 질의 양식을 제공하는 DBMS의 재귀적 질의의 SELECT 절에 사용되어 그 질의의 재귀적 결과투플들을 대상으로 재귀적 구조의 XML 값을 생성하는 기능을 갖는 특정 이름(XMLNEST)의 SQL 함수로 구현되어 상기 DBMS의 일부로서 포함된다. 여기서, 자신만의 독자적인 재귀적 질의 양식을 제공하는 DBMS의 대표적인 예는 오라클(Oracle) 11g 또는 이것의 상위버전의 DBMS이다. Preferably, the method is used in a SELECT clause of a recursive query of a DBMS that provides a recursive query form of its own or a DBMS that conforms to the recursive query form of the SQL: 1999 standard to retrieve recursive result tuples of that query. It is implemented as a SQL function of a specific name (XMLNEST) having the function of generating XML values of a recursive structure to be included as a part of the DBMS. Here, a representative example of a DBMS that provides its own recursive query form is Oracle 11g or higher.

이 방법은 상기 재귀적 임시 결과투플의 생성 시에, 재귀적 임시 결과투플들 각각에게는 자기의 루트 투플의 투플 식별자(root_tid), 자기의 투플 식별자(tid), 그리고 자기의 부모 투플의 투플 식별자(parent_tid)를 부여하고, 이 식별자 정보 <root_tid, tid, parent_tid>를 이용하여 상기 재귀적 임시 결과투플들과 상기 재귀적 결과투플들에 대하여 재귀적 임시 결과투플 트리들과 재귀적 결과투플 트리들을 각각 구성하는 것이 바람직하다. In this method, upon generation of the recursive temporary result tuple, each of the recursive temporary result tuples has a tuple identifier root_tid of its root tuple, its tuple identifier tid, and a tuple identifier of its parent tuple ( parent_tid) and recursive temporary result tuple trees and recursive result tuple trees for the recursive temporary result tuples and the recursive result tuples using this identifier information <root_tid, tid, parent_tid>, respectively. It is preferable to construct.

상기 SQL 함수 XMLNEST는 계층집단(hierarchy group)만을 대상으로 삼는 계층집단함수이다. 그리고 상기 계층집단은 재귀적 질의의 재귀적 임시 결과투플들 또는 재귀적 결과투플들에 의해 형성되는 집단으로서 하나의 투플과 그 투플을 조상 투플로 가지는 모든 투플들의 모음으로 정의된다. The SQL function XMLNEST is a hierarchical group function that targets only a hierarchy group. The hierarchical group is a group formed by recursive temporary result tuples or recursive result tuples of a recursive query, and is defined as a collection of tuples having one tuple and an ancestor tuple of the tuple.

상기 방법에 있어서, 상기 재귀적 결과투플 트리별로 생성된 상기 재귀적 구조의 XML 값들을 XML 스키마 그래프로 표현할 때, 그 XML 스키마 그래프는 (1)정확히 하나의 사이클을 가지고, (2) NEST_ROOT 노드를 반드시 가지며 NEST_SUBORDINATE 노드를 선택적으로 가질 수 있으며, (3) NEST_SUBORDINATE 노드는 NEST_ROOT 노드 이외의 자식 노드들을 가지지 않는 조건을 만족한다. 여기서, NEST_ROOT 노드는 XML 스키마 그래프에서 사이클에 참여하는 노드들 중 그 사이클 의 시작이 되는 노드를 의미하며, NEST_SUBORDINATE 노드는 그 NEST_ROOT 노드의 자식 노드로서 NEST_ROOT 노드와 사이클을 형성하며 NEST_ROOT 노드를 제외한 어떠한 자식 노드도 가지지 않는 노드를 의미한다. In the method, when the XML values of the recursive structure generated by the recursive result tuple tree are represented by an XML schema graph, the XML schema graph has (1) exactly one cycle, and (2) a NEST_ROOT node. Must have and can optionally have NEST_SUBORDINATE node, and (3) NEST_SUBORDINATE node satisfies condition that it has no child nodes other than NEST_ROOT node. Here, the NEST_ROOT node means the node that starts the cycle among the nodes participating in the cycle in the XML schema graph, and the NEST_SUBORDINATE node forms a cycle with the NEST_ROOT node as a child node of the NEST_ROOT node, and any child except the NEST_ROOT node. A node that does not have a node.

또한, 상기 SQL 함수 XMLNEST는 (1) NEST_ROOT 엘리먼트의 이름과 그 XML 엘리먼트의 XML 속성들, (2) NEST_SUBORDINATE 엘리먼트의 이름과 그 XML 엘리먼트의 XML 속성들, (3) NEST_ROOT 엘리먼트의 자식 엘리먼트들에 대한 명세, 그리고 (4) 형제 NEST_ROOT 엘리먼트들 간의 정렬을 명시할 수 있는 명세를 가진다. 여기서, 상기 재귀적 결과투플 트리별로 생성된 상기 재귀적 구조의 XML 값들을 XML 스키마 그래프로 표현할 때, NEST_ROOT 엘리먼트는 XML 스키마 그래프에서 사이클에 참여하는 노드들 중 그 사이클의 시작이 되는 노드인 NEST_ROOT 노드가 나타내는 XML 엘리먼트를 의미하며, NEST_SUBORDINATE 엘리먼트는 그 NEST_ROOT 노드의 자식 노드로서 NEST_ROOT 노드와 사이클을 형성하며 NEST_ROOT 노드를 제외한 어떠한 자식 노드도 가지지 않는 노드인 NEST_SUBORDINATE 노드가 나타내는 XML 엘리먼트를 의미한다. In addition, the SQL function XMLNEST can be used for (1) the name of the NEST_ROOT element and the XML attributes of the XML element, (2) the name of the NEST_SUBORDINATE element and the XML attributes of the XML element, and (3) the child elements of the NEST_ROOT element. Specification, and (4) a specification that specifies the alignment between sibling NEST_ROOT elements. Here, when expressing the XML values of the recursive structure generated by the recursive result tuple tree in an XML schema graph, a NEST_ROOT element is a NEST_ROOT node that is a node that starts the cycle among the nodes participating in the cycle in the XML schema graph. The NEST_SUBORDINATE element refers to the XML element represented by the NEST_SUBORDINATE node, which is a child node of the NEST_ROOT node, forms a cycle with the NEST_ROOT node, and has no child nodes except the NEST_ROOT node.

상기 SQL 함수 XMLNEST는 SQL:2003 표준의 SQL/XML 출판 함수들인 XMLELEMENT, XMLCONCAT, XMLFOREST, 그리고 XMLATTRIBUTES를 자신의 입력 인자로 가질 수 있다. The SQL function XMLNEST may have the SQL / XML publishing functions XMLELEMENT, XMLCONCAT, XMLFOREST, and XMLATTRIBUTES as its input parameters.

또한, 상기 SQL 함수 XMLNEST는 SQL:2003 표준의 SQL/XML 출판 함수들인 XMLELEMENT, XMLCONCAT, 그리고 XMLFOREST의 입력 인자로 사용될 수 있다. In addition, the SQL function XMLNEST may be used as an input argument of XMLELEMENT, XMLCONCAT, and XMLFOREST, which are SQL / XML publishing functions of the SQL: 2003 standard.

상기 재귀적 질의의 상기 SELECT 절에 상기 SQL 함수 XMLNEST와 함께 포함된 SQL의 기존 집단함수들인 SUM, COUNT, AVG, MIN, MAX, XMLAGG는 상기 재귀적 질의의 재귀적 결과투플들을 그들의 기원 투플들에 해당하는 노드들이 소속된 재귀적 임시 결과투플 트리별로 분류하여 하나 이상의 재귀적 결과투플을 구성원으로 가지는 각 분류의 모든 재귀적 결과투플들을 하나의 계층집단으로 처리해야 하는 제한을 갖는다.SUM, COUNT, AVG, MIN, MAX, XMLAGG, the existing aggregate functions of SQL included with the SQL function XMLNEST in the SELECT clause of the recursive query, add the recursive result tuples of the recursive query to their origin tuples. There is a restriction that all recursive result tuples of each classification that have one or more recursive result tuples as members are classified by recursive temporary result tuple tree to which corresponding nodes belong.

상기 방법은, 상기 SQL 함수 XMLNEST의 직간접 인자로만 사용되며 재귀적 결과투플 트리의 노드들 각각에 대해 그 노드를 루트로 가지는 서브트리의 모든 노드들에 해당하는 재귀적 결과투플들을 하나의 집단으로 보고 그들 각 집단에 대해 하나의 값을 계산하여 그 값을 그 집단을 대표하는 루트 노드에 해당하는 재귀적 결과투플에게 반환하는 'XMLNEST 관련 SQL 함수'들을 더 포함하는 것이 바람직하다. The method reports the recursive result tuples corresponding to all nodes of the subtree whose root is the node for each node of the recursive result tuple tree, which is used only as a direct and indirect argument of the SQL function XMLNEST. It is preferable to further include 'XMLNEST related SQL functions' that calculate a value for each group and return the value to the recursive result tuple corresponding to the root node representing the group.

상기 XMLNEST 관련 SQL 함수들은 상기 각 집단의 재귀적 결과투플들에 대하여 함수 인자로 명시된 값 표현식을 적용하여 상기 하나의 값을 계산하는 함수들인 NEST_SUM, NEST_AVG, NEST_MIN, NEST_MAX 그리고 NEST_COUNT 중 적어도 어느 하나를 포함한다. 이들 함수 NEST_SUM, NEST_AVG, NEST_MIN, NEST_MAX 그리고 NEST_COUNT는 그의 값 표현식을 해당 집단의 재귀적 결과투플들 각각에게 적용하여 구한 값들의 합, 평균값, 최소값, 최대값, 그리고 상기 구한 값이 NULL이 아닌 투플의 수를 각각 계산하여 그 집단을 대표하는 루트 노드에 해당하는 재귀적 결과투플에게 반환함으로써 재귀적 결과투플들 각각에게 하나의 집단값을 반환하는 SQL 집단함수이다. 이들 함수 NEST_SUM, NEST_AVG, NEST_MIN, NEST_MAX 그리고 NEST_COUNT는 SQL의 기존 집단함수 SUM, AVG, MIN, MAX 그리고 COUNT와 각각 동일 한 명세를 가진다. The XMLNEST related SQL functions include at least one of functions NEST_SUM, NEST_AVG, NEST_MIN, NEST_MAX and NEST_COUNT, which are functions of calculating a single value by applying a value expression specified as a function argument to each group of recursive result tuples. do. These functions NEST_SUM, NEST_AVG, NEST_MIN, NEST_MAX and NEST_COUNT apply their value expressions to each of the group's recursive result tuples, the sum, average, minimum, maximum, and value of the tuple whose values are not NULL. It is an SQL group function that returns a group value to each of the recursive result tuples by calculating each number and returning it to the recursive result tuple corresponding to the root node representing the group. These functions NEST_SUM, NEST_AVG, NEST_MIN, NEST_MAX and NEST_COUNT have the same specifications as SUM, AVG, MIN, MAX and COUNT, respectively.

상기 SQL 함수 XMLNEST는 하나의 재귀적 결과투플 트리를 하나의 집단으로 처리하는 집단함수의 특징을 가짐으로써 재귀적 질의에서 XMLNEST를 포함한 부질의는 group by 절을 포함할 수 없다는 제약을 갖는다. The SQL function XMLNEST has a feature of a group function that processes one recursive result tuple tree into one group, so that a subquery including XMLNEST in a recursive query cannot include a group by clause.

상기 방법이 적용되는 상기 DBMS는 재귀적 질의와 SQL:2003 표준의 SQL/XML 출판함수들을 지원하는 DBMS인 것이 바람직하다. 좀 더 구체적으로는, 상기 DBMS는 오브젝트 관계형(Object-Relational) DBMS 또는 관계형 DBMS인 것이 바람직하다. The DBMS to which the method is applied is preferably a DBMS supporting recursive queries and SQL / XML publishing functions of the SQL: 2003 standard. More specifically, the DBMS is preferably an object-relational DBMS or a relational DBMS.

상기 방법에 있어서, 상기 재귀적 결과투플 트리들 각각에 대하여 그 트리를 구성하는 노드들을 탐색하는 방법은 그 노드들에 대한 깊이우선탐색(depth-first search) 방법으로 수행되는 것이 바람직하다. In the above method, for each of the recursive result tuple trees, the method for searching for nodes constituting the tree is preferably performed by a depth-first search method for the nodes.

상기와 같은 목적을 달성하기 위한 본 발명의 다른 측면에 따르면, 컴퓨팅 시스템의 프로세서에서 데이터베이스 관리 시스템(DBMS)의 프로세스를 그 컴퓨팅 시스템의 메모리에 로드하여 데이터베이스에 대한 질의의 처리를 수행함에 있어서, 상기 데이터베이스에 대하여 재귀적 질의를 수행하여 생성된 재귀적 임시 결과투플들과 재귀적 결과투플들에 대한 연산처리를 특정 이름(tc_root)의 SQL 계층집단연산자를 실행하여 수행하는 방법으로서, 상기 SQL 계층집단연산자 tc_root는, 재귀적 질의 양식을 제공하는 DBMS의 재귀적 질의에 사용되어 그 질의의 모든 재귀적 결과투플들이 재귀적 임시 결과투플들의 단수 복제에 의해 생성된 경우에 한하여 그 재귀적 결과투플들을 그들의 기원 투플들에 해당하는 노드들이 소속된 재귀적 임시 결과투플 트리별로 분류하여 하나 이상의 재귀적 결과투플을 구성원으로 가지 는 각 분류의 모든 재귀적 결과투플들을 하나의 집단으로 처리함으로써 그들 각 집단에 대해 하나의 값을 반환하는 기능을 갖는 것을 특징으로 하는 데이터베이스의 데이터를 연산처리 하는 방법이 제공된다.According to another aspect of the present invention for achieving the above object, in the processor of the computing system to load a process of the database management system (DBMS) into the memory of the computing system to perform a query for the database, A method for performing recursive temporary result tuples and recursive result tuples generated by performing a recursive query on a database by executing an SQL hierarchical group operator of a specific name (tc_root). The operator tc_root is used for a recursive query in a DBMS that provides a recursive query form so that all recursive result tuples of that query are generated by singular copies of recursive temporary result tuples. Recursive interim result tuple tree to which nodes corresponding to origin tuples belong Computes data in a database, which has a function of returning one value for each group by treating all the recursive result tuples of each classification having one or more recursive result tuples as members. A method of processing is provided.

상기 SQL 계층집단연산자 tc_root의 기능은, 바람직하게는, 상기 재귀적 결과투플들이 상기 재귀적 임시 결과투플들의 단수 복제에 의해 생성되었는지를 판단하는 단계; 상기 단수복제 판단단계의 판단결과가 거짓(false)이면 오류신호를 생성하는 단계; 및 상기 단수복제 판단단계의 판단결과가 참(true)이면, (i)상기 재귀적 결과투플들을 그들의 기원 투플들에 해당하는 노드들이 소속된 재귀적 임시 결과투플 트리별로 분류하는단계와, (ii) 분류된 각 재귀적 결과투플들의 집단에 대해 그 집단에 해당하는 재귀적 임시 결과투플 트리의 루트 노드에 해당하는 재귀적 임시 결과투플의 칼럼값들을 이용하여 상기 연산자 tc_root의 인자로 명시된 값 표현식의 값을 계산하여 반환하는 반환단계를 수행하는 기능들을 포함할 수 있다. The function of the SQL hierarchical group operator tc_root preferably comprises: determining whether the recursive result tuples were generated by singular copy of the recursive temporary result tuples; Generating an error signal if the determination result of the singular replication determination step is false; And (i) classifying the recursive result tuples by the recursive temporary result tuple tree to which nodes corresponding to their origin tuples belong, if the judgment result of the singular replication judgment step is true, and (ii) For each group of recursive result tuples classified, the value expression specified as the argument of the operator tc_root using the column values of the recursive temporary result tuple corresponding to the root node of the recursive temporary result tuple tree corresponding to the group. It may include functions to perform a return step of calculating and returning a value.

상기 SQL 계층집단연산자 tc_root는 SQL:2003 표준의 임의의 값 표현식을 인자로 가짐으로써 재귀적 임시 결과투플 트리의 루트 노드에 해당하는 재귀적 임시 결과투플의 칼럼값들을 이용하여 그 값 표현식의 값을 생성하는 명세를 포함한다. The SQL hierarchical group operator tc_root takes an arbitrary value expression of the SQL: 2003 standard as an argument and uses the column values of the recursive temporary result tuple corresponding to the root node of the recursive temporary result tuple tree to obtain the value of the value expression. Contains the specifications that are generated.

또한, 상기 SQL 계층집단연산자 tc_root는 집단연산자의 특징을 가지지만 tc_root가 대상으로 하는 집단들은 재귀적 임시 결과투플 트리들을 기준으로 형성되므로 재귀적 질의에서 tc_root를 포함한 부질의는 group by 절을 포함할 수 없다는 제약을 갖는다. In addition, the SQL hierarchical group operator tc_root has the characteristics of a group operator, but the groups targeted by tc_root are formed based on recursive temporary result tuple trees, so a subquery including tc_root in a recursive query may include a group by clause. There is a constraint that it can not.

상기 SQL 계층집단연산자 tc_root와 함께 재귀적 질의의 동일 부질의에 포함된 SQL의 기존 집단함수들인 SUM, COUNT, AVG, MIN, MAX, XMLAGG각각은 그 질의의 재귀적 결과투플들을 그들의 기원 투플들에 해당하는 노드들이 소속된 재귀적 임시 결과투플 트리별로 분류하여 하나 이상의 재귀적 결과투플을 구성원으로 가지는 각 분류의 모든 재귀적 결과투플들을 하나의 집단으로 처리해야 한다. SUM, COUNT, AVG, MIN, MAX, and XMLAGG, the existing aggregate functions of SQL included in the same subquery of the recursive query with the SQL hierarchical operator tc_root, respectively, add the recursive result tuples of the query to their origin tuples. All recursive result tuples of each classification that have one or more recursive result tuples as members are classified by each recursive temporary result tuple tree to which the corresponding nodes belong.

상기 SQL 계층집단연산자 tc_root는 SQL:1999 표준의 재귀적 질의 양식을 따르는 DBMS 또는 자신만의 독자적인 재귀적 질의 양식을 제공하는 DBMS의 재귀적 질의에 사용되는 연산자이다. The SQL hierarchical group operator tc_root is an operator used for a recursive query of a DBMS that follows a recursive query form of the SQL: 1999 standard or a DBMS that provides its own recursive query form.

본 발명의 목적을 달성하기 위한 본 발명의 다른 측면에 따르면, 이상에서 언급한 각 방법을 실행시키기 위한 프로그램을 기록한 컴퓨터-가독형 기록매체가 제공된다. According to another aspect of the present invention for achieving the object of the present invention, there is provided a computer-readable recording medium having recorded thereon a program for executing each of the above-mentioned methods.

또한 본 발명의 또 다른 측면에 따르면, 이상에서 언급한 각 방법을 실행시키기 위한 프로그램을 기록한 컴퓨터로 읽을 수 있는 매체와, 상기 매체로부터 상기 프로그램을 로드하기 위한 메모리와, 상기 메모리에 로드된 프로그램을 실행하는 중앙처리장치를 포함하는 것을 특징으로 하는 컴퓨터 시스템이 제공된다.According to still another aspect of the present invention, there is provided a computer-readable medium having recorded thereon a program for executing each of the above-mentioned methods, a memory for loading the program from the medium, and a program loaded in the memory. A computer system comprising a central processing unit for executing is provided.

한편, 본 발명의 또 다른 측면에 따르면, 컴퓨터에, 재귀적 질의 양식을 지원하는 데이터베이스 관리 시스템(DBMS)의 데이터베이스에 재귀적 질의를 하였을 때 생성되는 그 질의들의 재귀적 결과투플들에 해당하는 노드들로써 재귀적 결과투플 트리들을 구성하는 제1기능과, 각 재귀적 결과투플 트리를 하나의 집단으로 처리하여 그 트리에 대해 하나의 재귀적 구조의 XML 값을 생성하는 제2기능을 실현하 기 위한 프로그램이 기록된 컴퓨터-가독형 기록 매체가 제공된다. Meanwhile, according to another aspect of the present invention, a node corresponding to the recursive result tuples of the queries generated when the computer recursively queries a database of a database management system (DBMS) that supports a recursive query form. To implement a first function of constructing recursive result tuple trees and a second function of processing each recursive result tuple tree into a group and generating an XML value of one recursive structure for the tree. A computer-readable recording medium having a program recorded thereon is provided.

그 프로그램은 상기 제1기능과 제2기능을 포함하는 SQL 계층집단함수 XMLNEST를 포함한다. 또한, 상기 프로그램은, 상기 SQL 계층집단함수 XMLNEST의 직간접 인자로만 사용되며 재귀적 결과투플 트리의 노드들 각각에 대해 그 노드를 루트로 가지는 서브트리의 모든 노드들에 해당하는 재귀적 결과투플들을 하나의 집단으로 보고 그들 각 집단에 대해 하나의 값을 계산하여 그 값을 그 집단을 대표하는 루트 노드에 해당하는 재귀적 결과투플에게 반환하는 기능을 포함하는 'XMLNEST 관련 SQL 함수'들을 더 포함한다. The program includes an SQL hierarchy group function XMLNEST that includes the first and second functions. In addition, the program is used only as a direct and indirect argument of the SQL hierarchical function XMLNEST, and for each node of the recursive result tuple tree, one recursive result tuple corresponding to all nodes of the subtree rooted at that node is given. It further includes 'XMLNEST-related SQL functions' that include the function of looking at a group of and calculating a value for each group and returning the value to a recursive result tuple corresponding to the root node representing that group.

나아가, 상기 프로그램은, 재귀적 질의 양식을 제공하는 DBMS의 재귀적 질의에 사용되어 그 질의의 모든 재귀적 결과투플들이 재귀적 임시 결과투플들의 단수 복제에 의해 생성된 경우에 한하여 그 재귀적 결과투플들을 그들의 기원 투플들에 해당하는 노드들이 소속된 재귀적 임시 결과투플 트리별로 분류하여 하나 이상의 재귀적 결과투플을 구성원으로 가지는 각 분류의 모든 재귀적 결과투플들을 하나의 집단으로 처리함으로써 그들 각 집단에 대해 하나의 값을 반환하는 기능을 갖는 SQL 계층집단연산자 tc_root를 더 포함한다. Furthermore, the program is used for a recursive query of a DBMS providing a recursive query form so that all recursive result tuples of the query are generated by singular copying of recursive temporary result tuples. Are classified by recursive temporary result tuple tree to which nodes corresponding to their origin tuples belong to each group by processing all recursive result tuples of each classification having one or more recursive result tuples as members. It also includes the SQL hierarchy operator tc_root, which has the function to return a single value.

이상 설명한 바와 같이, SQL:2003 표준에 정의된 기존 SQL/XML 출판 함수들만으로는 재귀적으로 연결된 관계 투플들로부터 그 투플들의 내용과 그 투플들 간의 연결 관계를 반영하는 재귀적 구조의 XML 값을 생성하는 SQL 질의를 작성하는 것은 쉽지 않거나 불가능하다. 본 발명은 그 문제를 해결하는 SQL 함수 XMLNEST, XMLNEST의 직간접 인자로만 사용될 수 있는 XMLNEST 관련 함수들, 그리고 SQL 연산자 tc_root를 제시하였다.As described above, existing SQL / XML publishing functions defined in the SQL: 2003 standard alone generate recursively structured XML values that reflect the contents of the tuples and the linkages between them. It is not easy or impossible to write an SQL query. The present invention proposes the SQL function XMLNEST, XMLNEST related functions that can be used only as direct and indirect arguments of XMLNEST, and the SQL operator tc_root.

본 발명이 제시하는 SQL 함수 XMLNEST는 재귀적 질의의 select 절에 사용되며 재귀적 결과투플들에 해당하는 모든 노드들이 "루트유지 독자환생" 재귀적 결과투플 트리들을 형성하는 경우에 한하여 각 재귀적 결과투플 트리를 형성하는 재귀적 결과투플들을 하나의 집단으로 처리하여 그들을 대상으로 하나의 재귀적 구조의 XML 값을 생성한다.The SQL function XMLNEST proposed by the present invention is used in the select clause of a recursive query, and each recursive result is limited to the case where all nodes corresponding to the recursive result tuples form "root-maintained recursive" recursive result tuple trees. The recursive result tuples that form the tuple tree are treated as a group and the XML values of a recursive structure are generated for them.

본 발명은 XMLNEST의 직간접 인자로만 사용될 수 있는 XMLNEST 관련함수들을 제시함으로써 재귀적 결과투플 트리들의 서브트리들 각각의 모든 노드들에 해당하는 투플들을 이용하여 계산한 값을 XMLNEST를 통한 재귀적 구조의 XML 값 생성에 이용할 수 있게 하였다.The present invention proposes XMLNEST related functions that can be used only as direct and indirect arguments of XMLNEST, and calculates a value calculated using tuples corresponding to all nodes of each subtree of recursive result tuple trees. Made available for value generation.

본 발명이 제시하는 SQL 연산자 tc_root는 그 연산자를 포함한 부질의의 모든 재귀적 결과투플들이 재귀적 임시 결과투플들의 단수 복제에 의해 생성된 경우에 한하여 재귀적 결과투플들을 그들의 기원 투플들에 해당하는 노드들이 소속된 재귀적 임시 결과투플 트리별로 분류하고 하나 이상의 재귀적 결과투플을 구성원으로 가지는 각 분류의 모든 재귀적 결과투플들을 하나의 집단으로 처리한다. SQL 연산자 tc_root는 그 연산자 자체의 기능뿐만 아니라 XMLNEST로부터 생성된 XML 값들을 정렬하기 위해 사용될 수 있다.The SQL operator tc_root proposed by the present invention is a node whose recursive result tuples correspond to their origin tuples only when all the recursive result tuples of the subquery including the operator are generated by singular copy of the recursive temporary result tuples. They are classified by the recursive temporary result tuple tree to which they belong, and all recursive result tuples of each classification having one or more recursive result tuples are treated as a group. The SQL operator tc_root can be used to sort XML values generated from XMLNEST as well as the function of the operator itself.

본 발명은 본 발명이 제시하는 SQL 함수들과 SQL 연산자의 구문과 의미를 SQL:1999 표준과 상용 DBMS들의 재귀적 질의의 문법을 고려하여 명세하였으며 그 SQL 함수들과 SQL 연산자의 개념을 명확히 하기 위하여 계층집단이라는 새로운 개념의 집단을 제시하였다. 본 발명은 XMLNEST와 SQL의 기존 집단함수들의 관계, XMLNEST와 SQL/XML 출판 함수들의 관계, 그리고 tc_root와 SQL의 기존 집단함수들의 관계를 정의하였다.The present invention specifies the syntax and semantics of the SQL functions and SQL operators of the present invention in consideration of the SQL: 1999 standard and the grammar of recursive queries of commercial DBMSs, and to clarify the concepts of the SQL functions and SQL operators. A new concept group is proposed. The present invention defines the relationship between the existing aggregate functions of XMLNEST and SQL, the relationship between XMLNEST and SQL / XML publishing functions, and the relationship between the existing aggregate functions of tc_root and SQL.

본 발명이 제시하는 계층집단함수들인 XMLNEST와 XMLNEST 관련함수들, 그리고 계층집단연산자인 tc_root가 재귀적 질의와 SQL/XML 출판 함수들을 지원하는 DBMS에서 지원될 경우, 그 계층집단함수들과 계층집단연산자 그리고 기존 SQL/XML 출판 함수들을 통해 관계 투플들로부터 재귀적 구조를 비롯한 다양한 구조의 XML 값을 SQL 질의만으로 생성할 수 있다.The hierarchical group functions, such as XMLNEST and XMLNEST related functions, and the hierarchical group operator tc_root, are supported in a DBMS that supports recursive queries and SQL / XML publishing functions. In addition, existing SQL / XML publishing functions can generate XML values of various structures, including recursive structures, from relational tuples using only SQL queries.

상기 목적을 달성하기 위하여 본 발명에 따른 SQL 함수 XMLNEST는 재귀적 질의의 select 절에만 사용될 수 있으며 그 함수는 그 질의에 의해 식별된 투플들을 대상으로 그들을 그들 간의 연결 관계에 따라 하나의 재귀적 구조의 XML 값으로 생성한다.In order to achieve the above object, the SQL function XMLNEST according to the present invention can be used only in the select clause of a recursive query. Generated as an XML value.

데이터베이스에서 재귀적 질의는 이행폐포(transitive closure, TC)를 기반으로 수행된다. SQL:1999 표준은 재귀적 질의를 지원한다. DB2와 SQL Server는 SQL:1999 표준의 재귀적 질의를 지원하며 Oracle은 Oracle 특유의 문법으로 재귀적 질의를 지원한다.Recursive queries in the database are performed based on transitive closure (TC). The SQL: 1999 standard supports recursive queries. DB2 and SQL Server support recursive queries in the SQL: 1999 standard, and Oracle supports recursive queries with Oracle-specific syntax.

SQL:1999 표준의 재귀적 질의는 하나의 select 문이다. 그 select 문은 (1) 하나의 with 절로써 이행폐포의 내용을 담을 임시 테이블들을 선언하고 정의하며 (2) 하나의 부질의로써 그 임시 테이블들과 그 외의 테이블들을 대상으로 최종 결과 투플들을 생성한다. Select 문의 with 절에서 임시 테이블들의 "선언과 정의"는 하나의 임시 테이블의 "선언과 정의"가 명시된 후 다음 임시 테이블의 "선언과 정의"가 차례로 명시되며, 각 임시 테이블의 "선언과 정의"는 그 임시 테이블의 명과 그 테이블의 칼럼명들의 리스트를 명시하는 선언 부분과 그 임시 테이블의 내용을 명시하는 부질의들로 구성되는 정의 부분으로 차례로 구성된다. 재귀적 질의의 with 절은 이행폐포의 내용을 담을 임시 테이블들뿐만 아니라 그렇지 않은 임시 테이블들의 "선언과 정의"를 함께 가질 수 있다.A recursive query in the SQL: 1999 standard is a select statement. The select statement (1) declares and defines temporary tables to hold the contents of the transitional closure as a with clause, and (2) creates final result tuples against the temporary tables and other tables as a subquery. . In the with clause of the Select statement, the "declaration and definition" of temporary tables is followed by the "declaration and definition" of one temporary table, followed by the "declaration and definition" of the next temporary table, and the "declaration and definition" of each temporary table. Consists of a declaration part that specifies the name of the temporary table, a list of column names in that table, and a definition part consisting of subqueries that specify the contents of the temporary table. The with clause of a recursive query can have "declarations and definitions" of temporary tables as well as temporary tables that contain the contents of a transitional closure.

본 발명은 상용 데이터베이스 관리 시스템(Database Management System, DBMS)들이 지원하는 범위 내에서 제안하는 SQL 함수 XMLNEST와 SQL 연산자 tc_root가 기반으로 하는 SQL:1999 표준의 재귀적 질의의 문법과 의미, 그리고 특징을 소개한다. The present invention introduces the syntax, semantics, and features of the SQL: 1999 standard recursive query based on the proposed SQL function XMLNEST and the SQL operator tc_root within the scope supported by commercial database management systems (DBMS). do.

본 발명은 재귀적 질의를 설명하기 위하여 다음 1~5의 용어들을 사용한다.The present invention uses the following terms 1 to 5 to describe recursive queries.

용어 1. 이행폐포의 내용을 담을 with 절의 임시 테이블을 재귀적 임시 테이블 (recursive temporary table)이라 하며 그 재귀적 임시 테이블의 투플들을 재귀적 임시 결과투플들(recursive_temporary_result_tuples, RTRTs)이라 한다.Terminology 1. The temporary table of the with clause that contains the contents of the redistribution is called a recursive temporary table and the tuples of the recursive temporary table are called recursive temporary result tuples (RTRTs).

용어 2. 재귀적 임시 테이블의 내용의 정의는 루트 식별 부질의들(root_finding_subqueries)과 자식 식별 부질의들(children_finding_subqueries)로 구성된다.Terminology 2. The definition of the contents of a recursive temporary table consists of root identification subqueries (root_finding_subqueries) and child identification subqueries (children_finding_subqueries).

용어 3. 루트 식별 부질의들은 이행폐포의 시작 투플들을 식별하여 재귀적 임시 테이블을 초기화하는 것으로서 "이행폐포의 루트조건들"(TC_root_conditions) 을 포함한다. 재귀적 임시 테이블의 테이블 명을 TA라 할 때, 그 테이블의 정의에서 루트 식별 부질의들은 그 부질의들의 from 절에서 테이블 TA를 참조하지 않아야 한다.Terminology 3. Root Identification Subqueries identify "starting tuples of transitional lungs" and initialize "recursive temporary tables" to include "rooted conditions of transitional lungs" (TC_root_conditions). When the table name of a recursive temporary table is T A , the root identification subqueries in the definition of that table must not refer to table T A in the from clause of those subqueries.

용어 4. 자식 식별 부질의들은 재귀적 임시 테이블의 기존 재귀적 임시 결과투플들에 연결된 새로운 투플들의 집합을 반복적으로 그 재귀적 임시 테이블에 추가함으로써 그 재귀적 임시 테이블을 완성하는 것으로서 "이행폐포의 부모-자식 조건들"(TC_parent_child_conditions)을 포함한다. 재귀적 임시 테이블의 테이블 명을 TA라 할 때, 자식 식별 부질의들은 그 부질의들의 from 절에서 테이블 TA를 참조하여야 한다.Term 4. Child Identification Subqueries are defined as "completely closed" by completing a recursive temporary table by repeatedly adding to the recursive temporary table a set of new tuples linked to existing recursive temporary result tuples of the recursive temporary table. Parent-child conditions "(TC_parent_child_conditions). When the table name of a recursive temporary table is T A , child identifying subqueries should refer to table T A in the from clause of those subqueries.

용어 5. SQL:1999 표준의 재귀적 질의에서 재귀적 임시 테이블들과 그 외의 테이블들을 대상으로 최종 결과투플들을 생성하는 하나의 부질의를 마감 부질의(closing_subquery)라 한다. 마감 부질의의 임의의 부질의에서 그 부질의의 from 절에 재귀적 임시 테이블들 중 적어도 하나가 (그 from 절에 내제된 또 다른 부질의의 from 절이 아닌 그 from 절 자체에 직접적으로) 포함된 경우, 그 부질의를 "재귀적 결과투플 생성" 양식의 부질의라 한다. 마감 부질의는 하나 이상의 "재귀적 결과투플 생성" 양식의 부질의들을 가질 수 있다. "재귀적 결과투플 생성" 양식의 부질의의 조건들을 필터링 조건들(filtering_conditions)이라 하고 그 필터링 조건들을 만족함으로써 그 부질의에 의해 식별된 투플들을 재귀적 결과투플 들(recursive_result_tuples, RRTs)이라 한다. 각 재귀적 결과투플은 그를 생성하게 한 투플들이 가지는 모든 칼럼들을 가진다. 재귀적 결과투플들을 생성하게 한 부질의의 최종 결과투플들은 그 부질의의 select 절을 그 재귀적 결과투플들에 대해 적용함으로써 생성된다. 본 문서의 나머지 부분은 재귀적 질의의 일반성을 해치지 않는 범위 내에서 재귀적 질의의 설명을 간략히 하기 위하여 마감 부질의 자체가 "재귀적 결과투플 생성" 양식의 부질의라고 가정한다. Terminology 5. A subquery that generates final result tuples on recursive temporary tables and other tables in a recursive query of the SQL: 1999 standard is called a closing subquery. In any subquery of the closing subquery, the from clause of the subquery contains at least one of the recursive temporary tables (directly in the from clause itself, not in the from clause of another subquery implied in the from clause). In that case, the subquery is called a subquery of the form "recursive result tuple". A closing subquery can have one or more "recursive result tuple generation" forms of subqueries. The conditions of a subquery in the form of "generating a recursive result tuple" are called filtering_conditions, and the tuples identified by the subquery by satisfying the filtering conditions are called recursive result tuples (RRTs). Each recursive result tuple has all the columns that the tuples that caused him to produce. The final result tuples of the subquery that caused the recursive result tuples to be generated are applied by applying the select clause of the subquery to the recursive result tuples. The remainder of this document assumes that the closing subquery itself is a subquery of the form "recursive result tuple" in order to simplify the description of the recursive query without impairing the generality of the recursive query.

도 6은 재귀적 질의에서 재귀적 임시 결과투플들, 재귀적 결과투플들, 그리고 최종 결과투플들의 예를 제시하기 위해 작성된 질의이다. 도 6의 재귀적 질의의 with 절은 <employee_id, first_name, last_name, salary, supervisor_id, department_id>의 칼럼들로 구성된 재귀적 임시 테이블 empHierarchy의 "선언과 정의"를 가지며 그 재귀적 질의의 마감 부질의는 그 with 절에서 정의된 재귀적 임시 테이블 empHierarchy와 도 1의 테이블 departments를 대상으로 그 마감 부질의의 최종 결과투플들을 생성한다. 도 6의 재귀적 질의는 employee_id가 10인 사원에 해당하는 투플과 그 사원의 모든 직간접 부하사원들에 해당하는 투플들인 도 7(a)의 투플들을 재귀적 임시 테이블 empHierarchy의 재귀적 임시 결과투플들로 생성한다. 재귀적 임시 결과투플들이 식별되는 과정은 본 문서의 뒤 부분에서 제시되므로 도 7(a)의 재귀적 임시 테이블 empHierarchy의 재귀적 임시 결과투플들이 생성되는 과정의 제시는 생략한다. 도 7(a)의 재귀적 임시 테이블 empHierarchy와 도 1의 테이블 departments로부터 도 6의 재귀적 질의의 마감 부질의의 필터링 조건들을 만족함으로써 그 마감 부질의의 재귀적 결과투플들로 생성되는 투플들은 도 7(b)와 같 다. 도 6의 재귀적 질의의 마감 부질의는 그 마감 부질의의 select 절을 도 7(b)의 재귀적 결과투플들에 대해 적용함으로써 도 7(c)의 투플들을 그 마감 부질의의 최종 결과투플들로 생성한다.6 is a query written to present an example of recursive temporary result tuples, recursive result tuples, and final result tuples in a recursive query. The with clause of the recursive query of FIG. 6 has a "declaration and definition" of the recursive temporary table empHierarchy consisting of columns of <employee_id, first_name, last_name, salary, supervisor_id, department_id>, and the closing subquery of the recursive query is The final result tuples of the closing subquery are generated for the recursive temporary table empHierarchy defined in the with clause and the table departments of FIG. The recursive query of FIG. 6 uses two tuples corresponding to an employee with employee_id 10 and tuples of FIG. 7 (a), which are tuples corresponding to all direct and indirect subordinates of that employee. To create. Since the process of identifying the recursive temporary result tuples is presented later in this document, the presentation of the process of generating the recursive temporary result tuples of the recursive temporary table empHierarchy of FIG. 7 (a) is omitted. Tuples generated as recursive result tuples of the closing subquery by satisfying the filtering conditions of the closing subquery of FIG. 6 from the recursive temporary table empHierarchy of FIG. 7 (a) and the table departments of FIG. Same as 7 (b). The closing subquery of the recursive query of FIG. 6 applies the select clause of the closing subquery to the recursive result tuples of FIG. 7 (b) to apply the tuples of FIG. 7 (c) to the final result tuple of the closing subquery. To create.

SQL Server와 DB2는 특정 재귀적 임시 테이블의 정의에서 루트 식별 부질의들과 자식 식별 부질의들의 순서에 대해 제약을 두고 있다. SQL Server의 경우, 특정 재귀적 임시 테이블의 정의에서 모든 루트 식별 부질의들은 모든 자식 식별 부질의들보다 먼저 명시되어야 한다. DB2의 경우, 특정 재귀적 임시 테이블의 정의에서 모든 루트 식별 부질의들이 모든 자식 식별 부질의들보다 먼저 명시되어야 하는 것은 아니지만 그 정의에서 첫 번째로 명시되는 부질의는 반드시 루트 식별 부질의이여야 한다.SQL Server and DB2 place restrictions on the order of root identification subqueries and child identification subqueries in the definition of certain recursive temporary tables. For SQL Server, all root identity subqueries in the definition of a particular recursive temporary table must be specified before all child identity subqueries. For DB2, not all root identification subqueries in the definition of a particular recursive temporary table must be specified before all child identification subqueries, but the first subquery specified in that definition must be the root identification subquery.

SQL 질의의 with 절에서 다수 개의 부질의들에 의해 생성된 투플 집합들을 연결하여 하나의 투플 집합을 형성하기 위해 관계 DBMS에서 제공하는 집합 연사자들로는 UNION, UNION ALL, EXCEPT, EXCEPT ALL, INTERSECT, 그리고 INTERSECT ALL이 있다.The set speakers provided by the relational DBMS to form a tuple set by concatenating tuple sets generated by multiple subqueries in the with clause of an SQL query include UNION, UNION ALL, EXCEPT, EXCEPT ALL, INTERSECT, and There is INTERSECT ALL.

SQL Server는 특정 재귀적 임시 테이블의 정의에서 루트 식별 부질의들을 연결할 수 있는 집합 연산자들로서 관계 DBMS에서 제공하는 집합 연산자들 중 EXCEPT ALL과 INTERSECT ALL을 제외한 모든 집합 연산자들을 지원하며 그 정의의 마지막 루트 식별 부질의와 첫 번째 자식 식별 부질의를 연결하는 집합 연산자로서 그리고 자식 식별 부질의들을 연결하는 집합 연산자로서 UNION ALL만을 지원한다. DB2는 특정 재귀적 임시 테이블의 정의에서 루트 식별 부질의들을 연결할 수 있는 집합 연산자들로서 관계 DBMS에서 제공하는 집합 연산자들 중 UNION을 제외한 모든 집합 연산자들을 지원하며 루트 식별 부질의와 자식 식별 부질의, 자식 식별 부질의와 루트 식별 부질의, 그리고 자식 식별 부질의들을 연결하는 집합 연산자로서 UNION ALL만을 지원한다.SQL Server is a set of operators that can link root identification subqueries in the definition of a particular recursive temporary table. It supports all of the set operators provided by the relational DBMS except EXCEPT ALL and INTERSECT ALL, and identifies the last root of the definition. Only UNION ALL is supported as a set operator linking a subquery with the first child identification subquery and as a set operator linking the child identification subqueries. DB2 is a set of operators that can link root identification subqueries in the definition of a specific recursive temporary table. It supports all set operators except UNION among the set operators provided by the relational DBMS. DB2 supports root identification subqueries and child identification subqueries. Only UNION ALL is supported as a set operator that connects an identity subquery, a root identity subquery, and a child identity subquery.

도 8은 하나의 with 절과 하나의 마감 부질의로 구성된 SQL:1999 표준의 재귀적 질의에서 그 질의의 전체 구성을 나타내고 하나의 재귀적 임시 테이블의 선언과 정의에 대한 내부 구성을 도식화한 것이다. 도 8은 재귀적 임시 테이블의 선언과 정의 부분을 강조하기 위하여 오직 하나의 재귀적 임시 테이블만을 명시하였으며 그 재귀적 임시 테이블의 정의에서 부질의들의 순서는 SQL Server에서 규정하는 순서를 따라 구성하였다. 도 8에서 키워드(keyword) recursive는 DB2와 SQL Server에서 지원되지 않는다. 따라서 본 문서의 나머지 부분에서 제시되는 재귀적 질의에서 키워드 recursive를 생략한다.8 shows the overall structure of a query in a recursive query of the SQL: 1999 standard consisting of a with clause and a closing subquery, and illustrates the internal structure of the declaration and definition of a recursive temporary table. FIG. 8 specifies only one recursive temporary table in order to emphasize the declaration and definition of the recursive temporary table, and the order of subqueries in the definition of the recursive temporary table is organized according to the order specified in SQL Server. In Figure 8, keyword recursive is not supported in DB2 and SQL Server. Therefore, the keyword recursive is omitted from the recursive query presented in the rest of this document.

도 8의 with 절에 의해 정의되는 재귀적 임시 테이블의 선언 부분은 그 테이블의 이름인 recursive_temp_table과 그 테이블을 구성하는 2 개의 칼럼명들의 리스트로 구성되었으며, 그 테이블의 내용을 정의하는 부분은 3 개의 루트 식별 부질의들과 4 개의 자식 식별 부질의들로 구성되었다. 재귀적 임시 테이블 recursive_temp_table의 내용을 정의하는 부분에서 set_operator는 루트 식별 부질의들을 연결하기 위한 임의의 집합 연산자를 의미하며 그 임시 테이블의 내용을 정의하는 부질의들 중 마지막 루트 식별 부질의인 root_finding_subquery3과 첫 번째 자식 식별 부질의인 children_finding_subquery1, 그리고 자식 식별 부질의들끼리 는 집합 연산자 UNION ALL로 연결되었다. 도 8의 재귀적 질의에서 closing_subquery는 그 질의의 with 절을 통해 정의된 임시 테이블과 그 외의 테이블들을 대상으로 재귀적 결과투플들을 생성하는 마감 부질의를 나타낸다.The declaration portion of the recursive temporary table defined by the with clause of FIG. 8 is composed of a list of recursive_temp_table, which is the name of the table, and two column names constituting the table. It consists of root identification subqueries and four child identification subqueries. In the part of defining the contents of the recursive temporary table recursive_temp_table, set_operator is an arbitrary set operator for concatenating the root identification subqueries, and root_finding_subquery3 and the first root identification subquery among the subqueries defining the contents of the temporary table. The first child identification subquery, children_finding_subquery1, and the child identification subqueries are connected by the set operator UNION ALL. In the recursive query of FIG. 8, closing_subquery represents a closing subquery that generates recursive result tuples for temporary tables and other tables defined through the with clause of the query.

재귀적 질의의 with 절의 특정 재귀적 임시 테이블의 정의에서 루트 식별 부질의들과 자식 식별 부질의들, 그리고 그 재귀적 질의를 마감하는 마감 부질의의 상세 구성을 나타내기 위하여 SQL:1999 표준의 재귀적 질의의 문법을 따라 하나의 재귀적 임시 테이블만을 생성하고 그를 대상으로 재귀적 질의를 형성하는 예를 도 9에 나타내었다. 도 9의 with 절에서 선언되고 정의된 재귀적 임시 테이블은 하나의 루트 식별 부질의와 하나의 자식 식별 부질의만으로 형성되었다.The recursion of the SQL: 1999 standard to indicate the detailed composition of root identification subqueries, child identification subqueries, and the closing subquery that terminates the recursive query in the definition of a particular recursive temporary table in the with clause of a recursive query. An example of generating only one recursive temporary table according to the grammar of an enemy query and forming a recursive query for it is shown in FIG. 9. The recursive temporary table declared and defined in the with clause of FIG. 9 is formed of only one root identification subquery and one child identification subquery.

정의 4. SQL:1999 표준의 재귀적 질의의 하나의 재귀적 임시 테이블의 "선언과 정의"에서 그 정의의 각 루트 식별 부질의의 from 절에서 참조된 테이블들을 그 루트 식별 부질의의 기반 테이블들(基盤 테이블들, foundation tables)이라 하며, 그 정의의 각 자식 식별 부질의의 from 절에서 참조된 테이블들에서 그 선언에 의해 선언되는 재귀적 임시 테이블을 제외한 그 외의 테이블들을 그 자식 식별 부질의의 기반 테이블들이라 한다. Definition 4. The tables referenced in the from clause of each root identification subquery of the definition in the "declaration and definition" of a recursive temporary table of the SQL: 1999 standard recursive query base tables of the root identification subquery. (Base tables), other than the recursive temporary tables declared by the declaration, in the tables referenced in the from clause of each child identification subquery of the definition, the child identification subquery These are called base tables.

하나의 재귀적 임시 테이블의 "선언과 정의"에서 그 정의의 루트 식별 부질의들의 기반 테이블들, 그리고 그 정의의 자식 식별 부질의들의 기반 테이블들은 서로 다를 수 있다. 그러나 그 부질의들에 의해 식별된 투플들은 집합 연산자들로 연결됨으로 그 투플들의 칼럼들의 수와 순서가 일치해야 하며 자료유형은 서로 호환 가능해야 한다.In the "declaration and definition" of a recursive temporary table, the base tables of the root identification subqueries of the definition and the base tables of the child identification subqueries of the definition may be different. However, the tuples identified by the subqueries are linked by set operators, so the number and order of the columns in the tuples must match and the data types must be compatible with each other.

하나의 재귀적 질의의 마감 부질의의 from 절에는 (1) 그 재귀적 질의에서 with 절로 선언되고 정의된 재귀적 임시 테이블들, (2) 그 재귀적 임시 테이블들 외에 그 재귀적 질의에서 with 절로 선언되고 정의된 임시 테이블들, 그리고 (3) 그 재귀적 질의에서 정의되지 않은 다른 테이블들이 명시될 수 있다.The closing clause of a recursive query contains (1) recursive temporary tables declared and defined with the with clause in the recursive query, and (2) with the with clause in the recursive query in addition to the recursive temporary tables. Declared and defined temporary tables, and (3) other tables not defined in the recursive query can be specified.

정의 5. SQL:1999 표준의 재귀적 질의의 마감 부질의의 from 절에서 참조된 테이블들 중 그 질의의 with 절에서 선언되고 정의된 재귀적 임시 테이블들을 제외한 테이블들을 그 재귀적 질의의 마감 부질의의 부가 테이블들(附加 테이블들, extra tables)이라 한다. Definition 5. Among the tables referenced in the from clause of a recursive query in the SQL: 1999 standard, except for the recursive temporary tables declared and defined in the with clause of the query, the recursive subquery of the recursive query These are called extra tables.

특정 재귀적 임시 테이블의 "선언과 정의"의 루트 식별 부질의들에서 각 루트 식별 부질의에 명시된 조건들을 "이행폐포의 루트 조건들"이라 하며, 그 "선언과 정의"의 자식 식별 부질의들에서 각 자식 식별 부질의에 명시된 조건들을 "이행폐포의 부모-자식 조건들"이라 한다.In the root identification subqueries of the "declaration and definition" of a particular recursive temporary table, the conditions specified in each route identification subquery are called "root conditions of the implementation alveoli," and the child identification subqueries of the "declaration and definition". The conditions specified in each child identification subquery in XX are referred to as "parent-child conditions of the implementation alveolus".

특정 재귀적 임시 테이블의 "선언과 정의"의 루트 식별 부질의에서 "이행폐포의 루트 조건들"은 루트 조인 조건들(root_join_conditions)과 루트 선택 조건들(root_selection_conditions)로 구분된다. 루트 조인 조건들은 루트 식별 부질의의 기반 테이블들 간의 조인 조건들이며 루트 선택 조건들은 각 기반 테이블의 각 투플이 만족해야 할 조건들 즉, "이행폐포의 루트 조건들"에서 루트 조인 조건들을 제외한 조건들이다. 특정 재귀적 임시 테이블의 "선언과 정의"의 루트 식별 부질의의 결과투플들은 그 재귀적 임시 테이블을 형성하는 이행폐포의 시작 투플들이다.In the root identification subquery of the "declaration and definition" of a particular recursive temporary table, "root conditions of the redistribution" are divided into root join conditions (root_join_conditions) and root selection conditions (root_selection_conditions). Root join conditions are join conditions between the base tables of the root identification subquery, and route selection conditions are conditions that each tuple of each base table must satisfy, ie, conditions that exclude the root join condition from "Route conditions of the redistribution". . The result tuples of the root identification subquery of the "declaration and definition" of a particular recursive temporary table are the starting tuples of transitional closures that form the recursive temporary table.

루트 식별 부질의가 하나의 기반 테이블만을 가지는 경우, 그 부질의는 루트 조인 조건들을 가질 수 없으므로 그 부질의가 루트 선택 조건들을 가지면 그 루트 선택 조건들을 만족하는 그 기반 테이블의 투플들이 해당 이행폐포의 시작 투플들이 되며, 그 부질의가 루트 선택 조건들을 가지지 않으면 그 기반 테이블의 모든 투플들이 해당 이행폐포의 시작 투플들이 된다.If a root identification subquery has only one base table, the subquery cannot have root join conditions, so if the subquery has root selection conditions, the tuples of the base table that satisfy the root selection conditions will be Start tuples, and if the subquery does not have route selection conditions, all tuples in the base table become start tuples of the corresponding redistribution.

루트 식별 부질의가 다수 개의 기반 테이블들을 가지는 경우, (1) 그 부질의가 루트 선택 조건들만을 가지면 그 기반 테이블들의 카티션 곱(Cartesian product)으로 생성된 모든 투플들에서 그 루트 선택 조건들을 만족하는 투플들이 해당 이행폐포의 시작 투플들이 되며, (2) 그 부질의가 루트 조인 조건들만을 가지면 그 조인 조건들을 만족함으로써 그 기반 테이블들의 투플들로부터 생성된 투플들이 해당 이행폐포의 시작 투플들이 되며, (3) 그 부질의가 어떠한 "이행폐포의 루트 조건들"도 가지지 않으면 그 기반 테이블들의 카티션 곱으로 생성된 모든 투플들이 해당 이행폐포의 시작 투플들이 되며, (4) 그 부질의가 "이행폐포의 루트 조건들"로서 루트 선택 조건들과 루트 조인 조건들을 모두 가지면 그 조건들을 만족함으로써 그 기반 테이블들의 투플들로부터 생성된 투플들이 해당 이행폐포의 시작 투플들이 된다.If a route identification subquery has multiple base tables, (1) if the subquery has only route selection conditions, it satisfies the route selection conditions in all tuples generated by the Cartesian product of the base tables. 2 tuples are the starting tuples of the corresponding redistribution, and (2) if the subquery has only root join conditions, the tuples generated from the tuples of the underlying tables are the starting tuples of the corresponding redistribution by satisfying the join conditions. (3) If the subquery does not have any "root closing conditions", then all tuples generated by the Cartesian product of its base tables become the starting tuples of the corresponding redistribution, and (4) the subquery " "Root conditions of transitional redundancy" if both route selection conditions and route join conditions are met, then the conditions are satisfied to the tuples of the underlying tables. Tuples created from this will be the starting tuples of the transitional closing.

정의 6. 재귀적 임시 결과투플들 간의 부모 투플, 자식 투플, 그리고 부모-자식 관계. 특정 재귀적 임시 테이블의 임의의 재귀적 임시 결과투플 tp에 대하여 그 테이블의 "선언과 정의"에서 자식 식별 부질의들에 명시된 "이행폐포의 부모-자식 조건들"을 적용함으로써 직접적으로 그 재귀적 임시 테이블에 포함된 재귀적 임 시 결과투플들의 집합을 SC라 할 때, 투플 tp를 집합 SC의 투플들의 부모 투플(parent tuple)이라 하고, 집합 SC의 투플들을 투플 tp의 자식 투플(child tuple)들이라 하며, 투플 tp와 집합 SC의 투플들의 관계를 부모-자식 관계(parent-child relationship)라 한다. Definition 6. Parent tuples, child tuples, and parent-child relationships between recursive temporary outcome tuples. For any recursive temporary result tuple t p of a particular recursive temporary table, the recursion is applied directly by applying the "parent-child conditions of the redistribution" specified in the child identification subqueries in the "declaration and definition" of that table. When the set of recursive temporary result tuples included in the temporary temporary table is SC, the tuple t p is called the parent tuple of the tuples of the set SC, and the tuples of the set SC are the child tuples of the tuple t p ( child tuples), and the relationship between the tuple t p and the tuples of the set SC is called a parent-child relationship.

정의 7. 재귀적 임시 결과투플들의 조상 투플, 후손 투플, 그리고 조상-후손 관계. 특정 재귀적 임시 테이블의 임의의 재귀적 임시 결과투플 ta에 대하여 그 테이블의 정의에서 자식 식별 부질의들에 명시된 "이행폐포의 부모-자식 조건들"을 만족함으로써 반복적으로 식별되어 그 임시 테이블에 포함된 재귀적 임시 결과투플들의 집합을 SD라 할 때, 집합 SD의 각 투플을 투플 ta의 후손 투플(descendant tuple)이라 하고, 투플 ta를 집합 SD의 각 투플의 조상 투플(ancestor tuple)이라 하며, 투플 ta와 집합 SD의 투플들의 관계를 조상-후손 관계(ancestor-descendant relationship)라 한다. Definition 7. Ancestor tuples, posterity tuples, and ancestor-descent relationships of recursive temporary outcome tuples. For any recursive temporary result tuple t a of a particular recursive temporary table, iteratively identified by satisfying the "parent-child conditions of the obsolescence" specified in the child identification subqueries in its definition. recursively temporary result included when La SD a set of tuples, set as descendants tuple (descendant tuple) for each tuple of the SD tuple t a, and the ancestors of each tuple in the tuple t a set SD tuple (ancestor tuple) The relationship between the tuple t a and the tuples of the set SD is called an ancestor-descendant relationship.

특정 재귀적 임시 테이블의 "선언과 정의"의 자식 식별 부질의에서 "이행폐포의 부모-자식 조건들"은 부모-자식 선택 조건들(parent-child_selection_conditions)과 부모-자식 연결 조건들(parent-child_connection_condtions)로 구분된다. 부모-자식 선택 조건들은 부모 조건들(parent_conditions)과 자식 조건들(child_conditions)로 구분된다. 부모 조건들은 그 부질의의 재귀적 임시 테이블의 투플들이 자식 투플들을 가지는 투플인 부모 투플이 되기 위해 만족해야 할 조건들인 부모 선택 조건들(parent_selection_conditions)이다. 자식 조건들은 그 자식 식별 부질의의 기반 테이블들의 투플들이 만족해야 할 조건들로서 그 부질의의 기반 테이블들 간의 조인 조건들인 자식 조인 조건들(child_join_conditions)과 그 부질의의 각 기반 테이블의 각 투플이 만족해야 할 조건들 즉, 그 자식 조건들에서 자식 조인 조건들을 제외한 조건들인 자식 선택 조건들(child_selection_conditions)로 구분된다. 부모-자식 연결 조건들은 그 자식 식별 부질의의 재귀적 임시 테이블과 기반 테이블들 간의 조인 조건들이다.In the child identification subquery of the "declaration and definition" of a particular recursive temporary table, the "parent-child conditions of implementation" are defined as parent-child_selection_conditions and parent-child_connection_condtions. ). Parent-child selection conditions are divided into parent conditions (child_conditions) and child conditions (child_conditions). Parent conditions are parent selection conditions (parent_selection_conditions), which are the conditions that the tuples of the recursive temporary table of the subquery must satisfy to be a parent tuple, which is a tuple with child tuples. The child conditions are the conditions that the tuples of the base tables of the child identification subquery must satisfy, and the child join conditions (child_join_conditions), which are join conditions between the base tables of the subquery, and each tuple of each base table of the subquery are satisfied. Conditions to be divided into child selection conditions (child_selection_conditions) are excluded from the child join conditions. Parent-child linkage conditions are join conditions between the recursive temporary table and the base tables of the child identity subquery.

자식 식별 부질의가 부모 선택 조건들을 가지지 않을 경우, 그 부질의의 재귀적 임시 테이블의 모든 투플들은 부모 투플들이 될 수 있는 후보가 되어 그 부질의의 부모-자식 연결 조건들이 적용될 투플들이 된다.If the child identification subquery does not have parent selection conditions, all tuples of the recursive temporary table of that subquery are candidates for being parent tuples and tuples to which the parent-child linkage conditions of the subquery are applied.

자식 식별 부질의가 하나의 기반 테이블만을 가질 경우, 그 부질의는 자식 조인 조건들을 가질 수 없으므로 그 부질의가 자식 선택 조건들을 가지면 그 자식 선택 조건들을 만족하는 그 기반 테이블의 투플들이 그 부질의의 부모-자식 연결 조건들이 적용될 기반 테이블의 투플들로 선택되며, 그 부질의가 자식 선택 조건을 가지지 않으면 그 기반 테이블의 모든 투플들이 그 부질의의 부모-자식 연결 조건들이 적용될 기반 테이블의 투플들로 선택된다.If a child identification subquery has only one base table, the subquery cannot have child join conditions, so if the subquery has child selection conditions, the tuples of the base table that satisfy the child selection conditions are defined by the subquery. If the subquery has no child selection condition, all tuples of the base table to which the parent-child linkage conditions will be applied are selected as tuples of the base table to which the parent-child linkage conditions of the subquery will be applied. Is selected.

자식 식별 부질의가 다수 개의 기반 테이블들을 가지는 경우, (1) 그 부질의가 자식 조인 조건들을 가지지 않지만 자식 선택 조건들을 가지면 그 기반 테이블들 간의 카티션 곱으로 생성된 투플들에서 그 자식 선택 조건들을 만족하는 투플들 이 그 부질의의 부모-자식 연결 조건들이 적용될 기반 테이블들의 투플들로 선택되며, (2) 그 부질의가 자식 조인 조건들을 가지지만 자식 선택 조건들을 가지지 않으면 그 조인 조건들을 만족함으로써 그 기반 테이블들의 투플들로부터 생성된 투플들이 그 부질의의 부모-자식 연결 조건들이 적용될 기반 테이블들의 투플들로 선택되며, (3) 그 부질의가 자식 조건 자체를 가지지 않으면 그 기반 테이블들 간의 카티션 곱으로 생성된 모든 투플들이 그 부질의의 부모-자식 연결 조건들이 적용될 기반 테이블들의 투플들로 선택되며, (4) 그 부질의가 자식 조건들로서 자식 선택 조건들과 자식 조인 조건들을 모두 가지면 그 조건들을 만족함으로써 그 기반 테이블들의 투플들로부터 생성된 투플들이 그 부질의의 부모-자식 연결 조건들이 적용될 기반 테이블들의 투플들로 선택된다.If a child identification subquery has multiple base tables, then (1) if the subquery does not have child join conditions but has child selection conditions, the child selection conditions in tuples generated by the Cartesian product between the base tables Satisfying tuples are selected as tuples of the base tables to which the sub-query's parent-child linkage conditions are applied, and (2) if the subquery has child join conditions but no child selection conditions, Tuples generated from the tuples of the base tables are selected as tuples of the base tables to which the parent-child linkage conditions of the subquery are to be applied; The tuples of the base tables to which all tuples generated by the Sean product are to be applied to the parent-child linkage conditions of the subquery (4) if the subquery has both child selection conditions and child join conditions as child conditions, the tuples generated from the tuples of the base tables by satisfying the conditions are the parent-child connection of the subquery. Conditions are selected as tuples of the base tables to which they apply.

재귀적 질의의 마감 부질의의 필터링 조건들은 (1) 그 마감 부질의의 부가 테이블들의 투플들이 만족해야 할 조건들(extraTables_conditions), (2) 재귀적 임시 테이블들과 그 마감 부질의의 부가 테이블들 간의 조인 조건들(recursiveExtraTables_join_conditions), 그리고 (3) 재귀적 임시 테이블들의 투플들이 만족해야 할 조건들(recursiveTables_closing_conditions)로 구분된다.The filtering conditions of the closing subquery of the recursive query are: (1) extratables_conditions that the tuples of the side tables of the closing subquery must satisfy, (2) the recursive temporary tables and the side tables of the closing subquery. RecursiveExtraTables_join_conditions, and (3) conditions that the tuples of recursive temporary tables must satisfy (recursiveTables_closing_conditions).

재귀적 질의의 마감 부질의의 부가 테이블들의 투플들이 만족해야 할 조건들은 그 마감 부질의의 부가 테이블들 간의 조인 조건들(extraTables_join_condtions)과 그 마감 부질의의 각 부가 테이블의 각 투플이 만족해야 할 조건들 즉, 그 마감 부질의의 부가 테이블들의 투플들이 만족해야 할 조건들에서 부가 테이블들 간의 조인 조건들을 제외한 조건들인 부가 테이블 선택 조건들(extraTables_selection_conditions)로 구분된다. 마감 부질의에서 재귀적 임시 테이블들의 투플들이 만족해야 할 조건들은 재귀적 임시 테이블들 간의 조인 조건들(recursiveTables_closing_join_conditions)과 각 재귀적 임시 테이블의 각 투플이 만족해야 할 조건들 즉, 재귀적 임시 테이블들의 투플들이 만족해야 할 조건들에서 재귀적 임시 테이블들 간의 조인 조건들을 제외한 조건들인 재귀적 임시 결과투플 선택 조건들(recursiveTables_closing_selection_conditions)로 구분된다.The conditions that tuples of the side tables of the recursive subquery of the recursive query must satisfy the join conditions (extraTables_join_condtions) between the side tables of the recursive subquery and the conditions that each tuple of each side table of the closing subquery must satisfy. In other words, the tuples of the side tables of the closing subquery are divided into additional table selection conditions extraTables_selection_conditions, which are conditions except join conditions between the side tables. The conditions that the tuples of the recursive temporary tables in the closing subquery must satisfy are the join conditions (recursiveTables_closing_join_conditions) between the recursive temporary tables and the conditions that each tuple of each recursive temporary table must satisfy. Tuples are classified into recursive temporary result tuple selection conditions (recursiveTables_closing_selection_conditions), which are conditions excluding join conditions between recursive temporary tables.

도 10은 SQL:1999 표준의 재귀적 질의에 명시되는 조건들을 도식화한 것이다. 재귀적 질의에 명시되는 도 10의 조건들의 의미를 도식화하면 도 11과 같다. 도 11(a)는 특정 재귀적 임시 테이블의 정의에서 루트 식별 부질의의 기반 테이블들을 대상으로 루트 조인 조건들과 루트 선택 조건들을 적용하여 해당 이행폐포의 시작 투플들을 식별함을 나타낸다. 도 11(a)에 명시적으로 표현되지는 않았지만 루트 식별 부질의들이 둘 이상인 경우, 도 11(a)와 같이 식별된 각 루트 식별 부질의의 결과투플들은 그 루트 식별 부질의들을 연결하는 집합 연산자들의 우선순위에 따라 연결되어 하나의 투플 집합으로 생성된다. 도 11(b)는 특정 재귀적 임시 테이블의 정의의 자식 식별 부질의의 기반 테이블들에서 자식 조인 조건들과 자식 선택 조건들을 만족함으로써 생성된 투플들과 해당 이행폐포의 기존 투플들에서 그 부질의의 부모 선택 조건들을 만족하는 투플들을 대상으로 그 부질의의 부모-자식 연결 조건들을 적용하여 생성된 투플들을 그 재귀적 임시 테이블에 반복적으로 추가함을 나타낸다. 자식 식별 부질의들이 둘 이상인 경우, 각 자식 식별 부질의에 대해 도 11(b)와 같이 식별된 그 부질의의 결과투플들을 재귀적 임시 테이블에 추가한다. 도 11(c)는 마감 부질의의 from 절의 재귀적 임시 테이블들에서 재귀적 임시 테이블들 간의 조인 조건들과 재귀적 임시 테이블 선택 조건들을 만족함으로써 생성된 투플들과 그 마감 부질의의 from 절의 부가 테이블들에서 그 부가 테이블들 간의 조인 조건들과 부가 테이블 선택 조건들을 만족함으로써 생성된 투플들을 대상으로 재귀적 임시 테이블들과 부가 테이블들 간의 조인 조건들을 적용하여 재귀적 결과투플들을 생성하고 그 재귀적 결과투플들에 대해 그 마감 부질의의 select 절을 적용함으로써 최종 결과투플들을 생성함을 나타낸다.Figure 10 illustrates the conditions specified in the recursive query of the SQL: 1999 standard. The meanings of the conditions of FIG. 10 specified in the recursive query are illustrated in FIG. 11. FIG. 11 (a) shows that starting tuples of the corresponding redistribution are identified by applying route join conditions and route selection conditions to the base tables of the root identification subquery in the definition of a specific recursive temporary table. Although not explicitly represented in Fig. 11 (a), if there are two or more root identification subqueries, the result tuples of each root identification subquery identified as in Fig. 11 (a) are a set operator connecting the root identification subqueries. They are concatenated according to their priorities and are generated as a set of tuples. 11 (b) shows the subquery generated in the base tables of the child identification subquery of the definition of the specific recursive temporary table and the existing tuples of the corresponding redistribution in the tuples generated by satisfying the child join conditions and the child selection conditions. Indicates that the tuples generated by applying parent-child linkage conditions of the subquery are added to the recursive temporary table repeatedly for tuples that satisfy the parent selection conditions of. If there are two or more child identification subqueries, the result tuples of the subqueries identified as shown in FIG. 11 (b) for each child identification subquery are added to the recursive temporary table. 11 (c) shows the addition of tuples generated by satisfying join conditions and recursive temporary table selection conditions between recursive temporary tables in recursive temporary tables of the from clause of the closing subquery and the adding clause of the closing subquery. Recursive result tuples are generated by applying join conditions between recursive temporary tables and side tables to tuples generated by satisfying join conditions between side tables and side table selection conditions in tables. Indicates that the final result tuples are generated by applying the select clause of the closing subquery to the result tuples.

예제 3. 테이블 employees에서 상사를 가지지 않는 각 사원에 대해 그 사원과 그 사원의 모든 직간접 부하사원들에 해당하는 투플들의 <employee_id, first_name, last_name, salary, supervisor_id>를 인출하시오. Example 3. For each employee who does not have a boss in the table employees, draw <employee_id, first_name, last_name, salary, supervisor_id> of the tuples corresponding to that employee and all its direct and indirect subordinates.

예제 3을 위한 질의를 SQL:1999 표준에 따라 작성하면 도 12(a)와 같고 그 질의를 도 1의 테이블 employees를 대상으로 평가하면 그 질의의 재귀적 임시 결과투플들은 도 12(b)와 같다. 도 12(a)의 재귀적 질의에서 재귀적 임시 테이블 empHierarchy의 정의의 루트 식별 부질의는 기반 테이블 employees를 대상으로 루트 선택 조건인 "supervisor_id IS NULL"을 만족하는 투플들을 식별하며 그 정의의 자식 식별 부질의는 기반 테이블 employees와 재귀적 임시 테이블 empHierarchy를 대상으로 부모-자식 연결 조건인 "e.supervisor_id=eh.emp_id"를 만족하는 투플들을 반복적으로 식별한다.If the query for Example 3 is written according to the SQL: 1999 standard, it is as shown in Fig. 12 (a). If the query is evaluated for the table employees of Fig. 1, the recursive temporary result tuples of the query are as shown in Fig. 12 (b). . In the recursive query of Fig. 12 (a), the root identification subquery of the definition of the recursive temporary table empHierarchy identifies tuples that satisfy the root selection condition "supervisor_id IS NULL" for the base table employees and identify the children of the definition. The subquery repeatedly identifies tuples that satisfy the parent-child linkage condition "e.supervisor_id = eh.emp_id" for the base table employees and the recursive temporary table empHierarchy.

도 12(b)의 투플들에서 employee_id가 10인 투플과 21인 투플은 supervisor_id를 NULL로 가지므로 재귀적 임시 테이블 empHierarchy를 위한 루트 선택 조건을 만족함으로써 식별된 투플들이다. 도 12(b)의 투플들에서 employee_id가 11, 13, 14, 15, 16, 17인 투플들은 employee_id가 10인 투플의 모든 직간접 부하사원들에 해당하는 투플들이며 employee_id가 23, 24인 투플들은 employee_id가 21인 투플의 모든 직간접 부하사원들에 해당하는 투플들로서 그들은 모두 재귀적 임시 테이블 empHierarchy를 위한 자식 식별 부질의의 부모-자식 연결 조건들에 의해 식별된 투플들이다.In the tuples of FIG. 12B, tuples having employee_id of 10 and 21 having tuples of 21 are tuples identified by satisfying a root selection condition for the recursive temporary table empHierarchy because the supervisor_id is NULL. In the tuples of FIG. 12 (b), tuples with employee_id 11, 13, 14, 15, 16, and 17 are tuples corresponding to all direct and indirect subordinates of tuple with employee_id 10, and tuples with employee_id 23 and 24 are employee_id. As tuples corresponding to all direct and indirect subordinates of a tuple of 21, they are all tuples identified by the parent-child linkage conditions of the child identity subquery for the recursive temporary table empHierarchy.

도 12(a)의 재귀적 질의의 마감 부질의는 재귀적 임시 테이블 empHierarchy만을 가지며 필터링 조건들을 가지지 않는다. 따라서 그 질의는 재귀적 임시 테이블 empHierarchy의 모든 투플들을 재귀적 결과투플들로 생성한다. 도 12(a)의 마감 부질의 select 절은 재귀적 결과투플의 모든 칼럼들을 그대로 가지므로 그 질의의 재귀적 결과투플들은 그 질의의 최종 결과투플들로 생성된다.The final subquery of the recursive query of FIG. 12 (a) has only the recursive temporary table empHierarchy and has no filtering conditions. Thus, the query creates all the tuples of the recursive temporary table empHierarchy as recursive result tuples. Since the select clause of the closing subquery of FIG. 12 (a) has all the columns of the recursive result tuple, the recursive result tuples of the query are generated as the final result tuples of the query.

고찰 1. 재귀적 질의의 마감 부질의가 하나의 재귀적 임시 테이블만을 가지며 부가 테이블들을 가지지 않으며 재귀적 임시 결과투플 선택 조건들을 가지지 않을 경우, 그 재귀적 임시 테이블을 구성하는 모든 재귀적 임시 결과투플들은 그 재귀적 질의의 재귀적 결과투플들로 생성된다. Discussion 1. Closing Recursive Queries When a subquery has only one recursive temporary table, no side tables, and no recursive temporary result tuple selection conditions, all the recursive temporary result tuples that make up the recursive temporary table Are generated as recursive result tuples of the recursive query.

예제 4. 테이블 employees와 테이블 departments를 대상으로 부서명이 'HR' 또는 'TFT'인 부서들의 관리자들과 그 관리자들 각각의 모든 직간접 부하사원들 중 월급이 30000 이상인 사원들의 <employee_id, first name, salary, supervisor_id, department_name>을 인출하시오. 단, (1) 이름이 'CHANHO'인 사원의 모든 직간접 부하사원들은 결과에서 배제되며, (2) 월급이 26000 미만인 부하사원들과 그 사원들의 모든 직간접 부하사원들은 결과에서 배제된다. Example 4. Managers of departments whose department name is 'HR' or 'TFT' for table employees and table departments and <employee_id, first name, salary of all direct and indirect subordinates of each of those managers whose salary is over 30000 Fetch, supervisor_id, department_name>. However, (1) all direct and indirect subordinates of employees named CHANHO are excluded from the results, and (2) subordinates with salaries below 26000 and all direct and indirect subordinates of those employees are excluded from the results.

예제 4를 위한 질의를 SQL:1999 표준에 따라 작성하면 도 13(a)와 같고 그 질의를 도 1의 테이블 employees와 테이블 departments를 대상으로 평가하면 그 질의의 재귀적 임시 결과투플들과 재귀적 결과투플들은 각각 도 13(b) 그리고 도 13(c)와 같다. 도 13(a)의 재귀적 질의에서 재귀적 임시 테이블 empHierarchy의 정의의 루트 식별 부질의는 기반 테이블 employees와 기반 테이블 departments를 대상으로 루트 선택 조건인 "d.department_name='HR' OR d.department_name = 'TFT'"를 만족하며 루트 조인 조건인 "e.employee_id=d.manager_id"를 만족하는 투플들을 해당 이행폐포의 시작 투플들로 식별한다. 그 정의의 자식 식별 부질의는 기반 테이블 employees와 기반 테이블 departments, 그리고 재귀적 임시 테이블 empHierarchy를 대상으로 부모 선택 조건인 "eh.first_name<>'CHANHO'", 자식 선택 조건인 "e.salary>=26000", 자식 조인 조건인 "e.department_id=d.department_id", 그리고 부모-자식 연결 조건인 "e.supervisor_id=eh.employee_id"를 만족하는 투플들을 반복적으로 식별한다. 도 13(a)의 재귀적 질의에서 마감 부질의는 재귀적 임시 테이블 empHierarchy에서 재귀적 임시 결과투플 선택 조건인 "salary>=30000"을 만족하는 투플들을 인출한다.When the query for Example 4 is written according to the SQL: 1999 standard, it is shown in FIG. 13 (a). When the query is evaluated for the table employees and table departments of FIG. 1, the recursive temporary result tuples and the recursive result of the query are evaluated. The tuples are the same as in Figs. 13 (b) and 13 (c), respectively. In the recursive query of FIG. 13 (a), the root identification subquery of the definition of the recursive temporary table empHierarchy is the root selection condition "d.department_name = 'HR' OR d.department_name = Tuples that satisfy 'TFT' and satisfy the root join condition "e.employee_id = d.manager_id" are identified as starting tuples of the corresponding transitional closure. The child identification subquery in the definition is the parent selection condition "eh.first_name <> 'CHANHO'" for the base table employees, the base table departments, and the recursive temporary table empHierarchy, and the child selection condition "e.salary> =. 26000 ", the child join condition" e.department_id = d.department_id "and the parent-child connection condition" e.supervisor_id = eh.employee_id "are repeatedly identified. In the recursive query of FIG. 13 (a), the closing subquery fetches tuples satisfying the recursive temporary result tuple selection condition “salary> = 30000” from the recursive temporary table empHierarchy.

도 13(b)의 투플들에서 employee_id가 10인 투플과 21인 투플은 도 13(a)의 재귀적 임시 테이블 empHierarchy의 정의에서 "이행폐포의 루트 조건들"을 만족함으로써 식별된 투플들이다. 그 정의의 자식 식별 부질의에 명시된 "이행폐포의 부 모-자식 조건들"에 따라 employee_id가 10인 투플은 employee_id가 11, 16인 투플들을 자식 투플들로 가지며, employee_id가 16인 투플은 employee_id가 14, 15인 투플들을 자식 투플들로 가진다. 이에 따라 employee_id가 11, 14, 15, 16인 투플들은 그 재귀적 임시 테이블에 포함된다. 그러나 employee_id가 14인 투플은 자식 식별 부질의의 부모 선택 조건인 "eh.first_name<>'CHANHO'"를 만족하지 않으므로 그 투플의 자식 투플들인 employee_id가 13, 17인 투플들은 그 재귀적 임시 테이블에 포함되지 않는다. Employee_id가 11인 투플과 15인 투플은 자식 투플들을 가지지 않는다. Employee_id가 24인 투플은 employee_id가 21인 투플의 자식 투플로서 재귀적 임시 테이블에 포함될 후보가 되었지만 자식 식별 부질의의 자식 선택 조건인 "e.salary>=26000"을 만족하지 않으므로 그 투플은 재귀적 임시 테이블에 포함되지 않는다. Employee_id가 23인 투플은 employee_id가 21인 투플의 자식 투플로서 재귀적 임시 테이블에 포함되었다. Empoloyee_id가 23인 투플은 자식 투플을 가지지 않는다. 따라서 도 13(a)의 질의에서 재귀적 임시 테이블 empHierarchy의 투플들은 그 재귀적 임시 테이블의 루트 식별 부질의에 의해 식별된 투플들인 employee_id가 10, 21인 투플들 그리고 그 재귀적 임시 테이블의 자식 식별 부질의에 의해 식별된 투플들인 employee_id가 11, 16, 14, 15, 23인 투플들로서 도 13(b)의 투플들과 같다. 도 13(b)의 재귀적 임시 결과투플들에서 employee_id가 21인 투플만이 도 13(a)의 질의의 마감 부질의에 명시된 재귀적 임시 결과투플 선택 조건인 "salary>=30000"을 만족하지 않으므로 도 13(b)의 재귀적 임시 결과투플들에서 employee_id가 21인 투플을 제외한 나머지 투플들이 재귀적 결과투플들로 도 13(c)와 같이 생성된다. 도 13(a)의 재귀적 질의의 마감 부질의의 select 절은 재귀적 결과투플의 모든 칼럼들을 그대로 가지므로 그 질의의 재귀적 결과투플들은 그 질의의 최종 결과투플들로 생성된다.The tuples with employee_id of 10 and the tuples with 21 of the tuples of FIG. 13 (b) are tuples identified by satisfying the "root conditions of the pulmonary alveoli" in the definition of the recursive temporary table empHierarchy of FIG. 13 (a). According to the "parent-child conditions of the implementation alveoli" specified in the child identification subquery of the definition, a tuple with employee_id of 10 has tuples with employee_id of 11 and 16 as child tuples, and a tuple of employee_id of 16 has an employee_id of Have 14, 15 tuples as child tuples. Accordingly, tuples with employee_id 11, 14, 15, and 16 are included in the recursive temporary table. However, a tuple with employee_id of 14 does not satisfy the parent selection condition "eh.first_name <> 'CHANHO'" of the child identity subquery, so tuples with child tuples of employee_id of 13 and 17 in the recursive temporary table not included. A tuple with an Employee_id of 11 and a tuple with 15 have no child tuples. A tuple with an Employee_id of 24 is a child tuple of a tuple with an employee_id of 21 and is a candidate for inclusion in a recursive temporary table, but the tuple is recursive because it does not satisfy the child selection condition "e.salary> = 26000" in the child identity subquery. It is not included in the temporary table. The tuple with employee_id 23 is a child tuple of tuple with employee_id 21 and is included in the recursive temporary table. A tuple with Empoloyee_id of 23 has no child tuples. Thus, the tuples of the recursive temporary table empHierarchy in the query of FIG. 13 (a) are the tuples identified by the root identification subquery of the recursive temporary table, the tuples of employee_id 10, 21 and the child identification of the recursive temporary table. The tuples identified by the subquery are tuples whose employee_id is 11, 16, 14, 15, and 23, as in the tuples of FIG. 13 (b). Only tuples with employee_id of 21 in the recursive temporary result tuples of FIG. 13 (b) do not satisfy the recursive temporary result tuple selection condition "salary> = 30000" specified in the closing subquery of the query of FIG. 13 (a). Therefore, in the recursive temporary result tuples of FIG. 13 (b), the remaining tuples except for the tuple having employee_id 21 are generated as the recursive result tuples as shown in FIG. 13 (c). Since the select clause of the closing subquery of the recursive query of FIG. 13 (a) has all the columns of the recursive result tuple, the recursive result tuples of the query are generated as the final result tuples of the query.

도 13(a)의 재귀적 질의를 도 11의 표기 방법으로 표현하면 도 14와 같다. 도 14(a)는 재귀적 임시 테이블 empHierarchy의 정의 부분에 명시된 루트 식별 부질의의 기반 테이블들인 테이블 employees와 테이블 departments를 대상으로 루트 조인 조건인 "e.employee_id = d.manager_id"와 루트 선택 조건인 "d.department_name = 'HR' OR d.department_name = 'TFT'"를 적용하여 생성된 투플들로 재귀적 임시 테이블 empHierarchy를 초기화함을 나타낸다. 도 14(b)는 재귀적 임시 테이블 empHierarchy의 정의 부분에 명시된 자식 식별 부질의의 기반 테이블들인 테이블 employees와 테이블 departments에서 자식 조인 조건인 "e.department_id=d.department_id"와 자식 선택 조건인 "e.salary >= 26000"를 만족하여 생성된 투플들과 재귀적 임시 테이블 empHierarchy의 기존 투플들에서 부모 선택 조건인 "eh.first_name <> 'CHANHO'"를 만족하는 투플들을 대상으로 부모-자식 연결 조건인 "eh.employee_id = e.supervisor_id"를 적용하여 생성된 투플들을 반복적으로 재귀적 임시 테이블 empHierarchy에 추가함을 나타낸다. 도 14(c)는 마감 부질의의 from 절에서 참조된 재귀적 임시 테이블 empHierarchy에서 재귀적 임시 결과투플 선택 조건 "salary >= 30000"을 만족하는 투플들을 식별하여 재귀적 결과투플들로 생성하고 그 재귀적 결과투플들에 대해 그 마감 부질의의 select 절을 적용함으로써 최종 결과투플들을 생성함을 나타낸다.The recursive query of FIG. 13 (a) is expressed in FIG. 11 using the notation method of FIG. 11. Fig. 14 (a) shows the root join condition "e.employee_id = d.manager_id" and the root selection condition for table employees and table departments, which are the base tables of the root identification subquery specified in the definition of the recursive temporary table empHierarchy. Indicates that the recursive temporary table empHierarchy is initialized with tuples created by applying "d.department_name = 'HR' OR d.department_name = 'TFT'". 14 (b) shows a child join condition "e.department_id = d.department_id" and a child selection condition "e.department_id = d.department_id" in table employees and table departments, which are base tables of the child identification subquery specified in the definition part of the recursive temporary table empHierarchy. Parent-child linking condition for tuples that satisfy .salary> = 26000 "and tuples that satisfy parental selection condition" eh.first_name <> 'CHANHO' "in existing tuples of recursive temporary table empHierarchy The "tu.employee_id = e.supervisor_id" is applied to add the tuples created to the recursive temporary table empHierarchy. FIG. 14 (c) shows tuples satisfying the recursive temporary result tuple selection condition “salary> = 30000” in the recursive temporary table empHierarchy referenced in the from clause of the closing subquery, and generates recursive result tuples. Indicates that final result tuples are generated by applying the select clause of the closing subquery to recursive result tuples.

재귀적 임시 결과투플들과 재귀적 결과투플들의 관계는 재귀적 질의의 마감 부질의를 구성하는 재귀적 임시 테이블들과 그 부질의의 부가 테이블들, 그리고 필터링 조건들에 따라 다음과 같이 분류될 수 있다.The relationship between recursive temporary result tuples and recursive result tuples can be classified as follows according to the recursive temporary tables constituting the closing subquery of the recursive query, the side tables of the subquery, and the filtering conditions. have.

하나의 재귀적 임시 결과투플이 최대 하나의 재귀적 결과투플을 생성하는 경우.One recursive temporary result tuple produces at most one recursive result tuple.

- 하나의 재귀적 임시 결과투플이 둘 이상의 재귀적 결과투플들을 생성하는 경우.A recursive temporary result tuple produces more than one recursive result tuple.

- 하나의 재귀적 결과투플을 생성하게 한 재귀적 임시 결과투플이 오직 하나인 경우.If there is only one recursive temporary result tuple that caused one recursive result tuple to be generated.

- 하나의 재귀적 결과투플을 생성하게 한 재귀적 임시 결과투플들이 둘 이상인 경우.Two or more recursive temporary result tuples that result in a single recursive result tuple.

정의 8. 재귀적 임시 결과투플과 재귀적 결과투플 간의 관계. 재귀적 질의의 마감 부질의에서 하나의 재귀적 임시 결과투플 ta에 의해 생성된 하나의 재귀적 결과투플을 ta′이라 할 때 ta를 ta′의 기원 투플(起源 투플, original tuple)이라 하고 ta′을 ta의 환생 투플(還生 투플, reincarnated tuple)이라 한다. Definition 8. Relation between recursive ad hoc tuple and recursive result tuple. In the closing subquery of a recursive query, if a recursive result tuple produced by a recursive temporary result tuple t a is t a ′, then t a is the origin tuple of t a ′ (original tuple) T a ′ is called a reincarnated tuple of t a .

정의 9. 재귀적 임시 결과투플들 간의 결합. 재귀적 질의의 마감 부질의가 둘 이상의 재귀적 임시 테이블들을 from 절에서 참조하는 경우, 재귀적 결과투플들은 그 재귀적 임시 테이블들 간의 카티션 곱 또는 조인으로 생성된다. 이 경우, 그 재귀적 결과투플들을 그 재귀적 임시 결과투플들 간의 결합(結合, bond)으로 생성 되었다고 한다. Definition 9. The union between recursive ad hoc result tuples. If the closing subquery of a recursive query references more than one recursive temporary tables in the from clause, recursive result tuples are created as Cartesian products or joins between the recursive temporary tables. In this case, the recursive result tuples are said to be created as a bond between the recursive temporary result tuples.

따라서 하나의 재귀적 결과투플이 둘 이상의 기원 투플들을 가질 경우, 그 재귀적 결과투플은 그 기원 투플들 간의 결합에 의해 생성된 투플이다.Thus, if a recursive result tuple has two or more origin tuples, the recursive result tuple is a tuple produced by the combination between the origin tuples.

정의 10. 재귀적 임시 결과투플의 복제. 재귀적 질의의 마감 부질의가 오직 하나의 재귀적 임시 테이블을 from 절에서 참조하는 경우, 재귀적 결과투플들은 부가 테이블이 없다면 그 재귀적 임시 테이블에 의해 그리고 부가 테이블(들)이 있다면 그 재귀적 임시 테이블과 그 부가 테이블(들)의 카티션 곱 또는 조인에 의해 생성된다. 이 경우, 재귀적 결과투플들은 그 재귀적 임시 테이블의 재귀적 임시 결과투플들의 복제(複製, replication)에 의해 생성되었다고 한다. Definition 10. Replica of Recursive Temporary Results Tuples. If the closing subquery of a recursive query references only one recursive temporary table in the from clause, the recursive result tuples are recursively by the recursive temporary table if there is no side table and the recursive temporary table if there is one. It is created by a Cartesian product or join of the temporary table and its side table (s). In this case, recursive result tuples are said to be created by replication of the recursive temporary result tuples of the recursive temporary table.

재귀적 임시 결과투플의 복제는 기원 투플의 환생 회수에 따라 단수 복제(single replication)와 복수 복제(multiple replication)로 구분된다. 하나의 재귀적 임시 결과투플이 오직 하나의 재귀적 결과투플로 복제된 경우에는 단수 복제라 하며 둘 이상의 재귀적 결과투플들로 복제된 경우에는 복수 복제라 한다.Replication of recursive temporary outcome tuples is divided into single replication and multiple replication according to the number of recurrences of origin tuple. When a recursive temporary result tuple is replicated with only one recursive result tuple, it is referred to as singular replication.

예를 들어, 도 12(a)의 질의의 마감 부질의와 도 13(a)의 질의의 마감 부질의는 재귀적 임시 테이블을 오직 하나만 가지며 부가 테이블들을 가지지 않으므로 그 질의들 각각의 재귀적 결과투플들은 재귀적 임시 결과투플들의 단수 복제에 의해 생성된 투플들이다.For example, the closing subquery of the query of FIG. 12 (a) and the closing subquery of the query of FIG. 13 (a) have only one recursive temporary table and no additional tables, so the recursive result tuple of each of the queries is Are tuples produced by a singular copy of the recursive temporary result tuples.

재귀적 임시 결과투플들의 복수 복제에 의해 재귀적 결과투플들이 생성되는 예를 고려해 보자.Consider an example where recursive result tuples are generated by multiple copies of recursive temporary result tuples.

예제 5. 테이블 employees에서 employee_id가 21인 사원과 그 사원의 모든 직간접 부하사원들에 해당하는 투플들을 구하는 재귀적 임시 테이블을 정의하고 그 재귀적 임시 테이블과 테이블 departments를 카티션 곱하여 생성된 투플들의 <employee_id, supervisor_id>를 재귀적 결과투플들로 생성하시오. Example 5. Define a recursive temporary table that obtains tuples corresponding to an employee with employee_id 21 in the table employees and all the direct and indirect subordinates of that employee, and then Cartesian multiplies the recursive temporary table by table departments < Create employee_id, supervisor_id> as recursive result tuples.

예제 5를 위한 질의를 SQL:1999 표준에 따라 작성하면 도 15(a)와 같고 그 질의를 도 1의 테이블 employees와 테이블 departments를 대상으로 평가하면 그 질의의 재귀적 임시 결과투플들은 도 15(b)와 같으며 그 질의의 재귀적 결과투플들은 도 15(c)와 같다. 도 15(a)의 재귀적 질의의 마감 부질의는 도 15(c)의 재귀적 결과투플들의 칼럼 employee_id와 supervisor_id만을 가짐으로써 그 질의의 최종 결과투플들을 생성한다.When the query for Example 5 is written according to the SQL: 1999 standard, it is as shown in FIG. 15 (a). When the query is evaluated for the table employees and table departments of FIG. 1, the recursive temporary result tuples of the query are shown in FIG. ) And the recursive result tuples of the query are shown in FIG. 15 (c). The final subquery of the recursive query of FIG. 15 (a) has only the column employee_id and supervisor_id of the recursive result tuples of FIG. 15 (c) to generate the final result tuples of the query.

도 15(a)의 질의의 마감 부질의에서 재귀적 임시 테이블 empHierarchy는 네 개의 투플들을 가지는 도 1의 테이블 departments와 카티션 곱 됨으로 도 15(b)의 각 재귀적 임시 결과투플은 네 개의 투플들로 복수 복제되어 도 15(c)의 투플들을 재귀적 결과투플들로 생성한다. 즉, 도 15(b)의 각 재귀적 임시 결과투플은 네 개의 환생 투플들을 가지며 도 15(c)의 각 재귀적 결과투플은 오직 하나의 기원 투플을 가진다.In the closing subquery of the query of FIG. 15 (a), the recursive temporary table empHierarchy is multiplied by the table departments of FIG. 1 having four tuples, so each recursive temporary result tuple of FIG. 15 (b) has four tuples. A plurality of copies of the tuples of FIG. 15 (c) are generated as recursive result tuples. That is, each recursive temporary result tuple of FIG. 15 (b) has four reincarnation tuples and each recursive result tuple of FIG. 15 (c) has only one origin tuple.

재귀적 결과투플들이 재귀적 임시 결과투플들 간의 결합에 의해 생성되는 경우를 고려해 보자.Consider the case where recursive result tuples are generated by combining between recursive temporary result tuples.

예제 6. 테이블 employees에서 employee_id가 10인 사원과 그 사원의 모든 직간접 부하사원들에 해당하는 투플들의 <employee_id, supervisor_id, first_name>을 구하는 재귀적 임시 테이블 empHierarchy1을 정의하고, 테이블 employees와 테이블 departments에서 employee_id가 14인 사원과 그 사원의 모든 직간접 상사들에 해당하는 투플들의 <employee_id, supervisor_id, department_name>을 구하는 재귀적 임시 테이블 empHierarchy2를 정의한 후, 재귀적 임시 테이블들 간의 조인 조건 "empHierarchy1.employee_id=empHierarchy2.employee_id"를 만족함으로써 그 재귀적 임시 테이블들로부터 식별된 재귀적 결과투플들의 <employee_id, first_name, department_name>의 칼럼들로 구성된 최종 결과투플들을 생성하시오. Example 6. Define a recursive temporary table empHierarchy1 that obtains <employee_id, supervisor_id, first_name> of tuples corresponding to an employee with employee_id 10 in the table employees and all direct and indirect subordinates of the employee, and employee_id in the table employees and table departments. After defining the recursive temporary table empHierarchy2 to obtain <employee_id, supervisor_id, department_name> of the tuples corresponding to the employee having a value of 14 and all the direct and indirect bosses of the employee, the join condition "empHierarchy1.employee_id = empHierarchy2." Generate final result tuples consisting of the columns of <employee_id, first_name, department_name> of the recursive result tuples identified from the recursive temporary tables by satisfying "employee_id".

예제 6을 위한 질의를 SQL:1999 표준에 따라 작성하면 도 16(a)와 같고 그 질의를 도 1의 테이블 employees와 테이블 departments를 대상으로 평가하면 재귀적 임시 테이블 empHiearchy1과 재귀적 임시 테이블 empHierarch2의 재귀적 임시 결과투플들은 각각 도 16(b) 그리고 도 16(c)와 같으며 그 질의의 재귀적 결과투플들은 도 16(d)와 같다. 도 16(d)의 재귀적 결과투플들로부터 그들을 생성하게 한 재귀적 임시 테이블 empHierarchy1의 칼럼 employee_id와 칼럼 first_name 그리고 재귀적 임시 테이블 empHierarchy2의 칼럼 department_name을 가짐으로써 도 16(a)의 재귀적 질의의 최종 결과투플들이 생성된다.When the query for Example 6 is written according to the SQL: 1999 standard, it is as shown in FIG. 16 (a). When the query is evaluated for the table employees and table departments of FIG. 1, the recursion of the recursive temporary table empHiearchy1 and the recursive temporary table empHierarch2 is performed. The preliminary temporary result tuples are shown in Figure 16 (b) and Figure 16 (c), respectively, and the recursive result tuples of the query are shown in Figure 16 (d). The final of the recursive query of FIG. 16 (a) by having the column employee_id of the recursive temporary table empHierarchy1 and the column first_name and the column department_name of the recursive temporary table empHierarchy2 which caused them to be generated from the recursive result tuples of FIG. 16 (d). Result tuples are generated.

도 16(d)의 재귀적 결과투플들 각각은 도 16(b)의 특정 투플과 도 16(c)의 특정 투플을 그 투플의 기원 투플들로 가진다. 즉, 그 재귀적 결과투플들은 재귀적 임시 결과투플들 간의 결합에 의해 생성된 투플들이다.Each of the recursive result tuples of FIG. 16 (d) has a particular tuple of FIG. 16 (b) and a particular tuple of FIG. 16 (c) as the origin tuples of the tuple. That is, the recursive result tuples are tuples produced by the combination between the recursive temporary result tuples.

고찰 2. 특정 재귀적 질의의 모든 재귀적 결과투플들이 재귀적 임시 결과투플들의 단수 복제에 의해 생성되었다면 그 질의의 임의의 재귀적 임시 결과투플의 환생 투플은 오직 하나이며 임의의 재귀적 결과투플의 기원 투플도 오직 하나이다. Consideration 2. If all recursive result tuples of a particular recursive query were generated by singular copies of recursive temporal result tuples, the recursive tuple of any recursive temporal result tuple of that query is only one, and any recursive result tuple of There is only one origin tuple.

정의 11. 재귀적 결과투플들 간의 부모 투플, 자식 투플, 그리고 부모-자식 관계. 재귀적 질의의 모든 재귀적 결과투플들이 재귀적 임시 결과투플들의 단수 복제에 의해 생성된 경우에 한하여, 부모-자식 관계의 두 개의 재귀적 임시 결과 투플들인 tp와 tc에 대하여 tp가 부모 투플이고 tc가 자식 투플일 때, tp의 환생 투플이 tp′이고 tc의 환생 투플이 tc′이면 tp′과 tc′은 부모-자식 관계에 있으며 tp′을 tc′의 부모 투플이라 하고 tc′을 tp′의 자식 투플이라 한다. Definition 11. Parent tuple, child tuple, and parent-child relationship between recursive outcome tuples. T p is the parent for two recursive temporary result tuples of parent-child relationship, t p and t c , provided that all recursive result tuples of the recursive query are generated by singular copies of the recursive temporary result tuples. tuples and t c is a child-to-peulil time, t p of rebirth tuples yi t p 'and this t c reincarnation of t c tuple "is t p, and t c' is a parent-a, and t p, the child relationship t c It is called the parent tuple of ′ and t c ′ is called the child tuple of t p ′.

고찰 3. 정의 11에 따라 부모-자식 관계의 재귀적 임시 결과투플들인 tp와 tc에 대하여 tp와 tc가 각각 하나 이상의 환생 투플들을 가지며 tp 또는 tc의 환생 투플이 둘 이상이면 (즉, tp 또는 tc가 복수 복제되었다면) tp의 임의의 환생 투플과 tc의 임의의 환생 투플 간에는 부모-자식 관계가 성립하지 않는다. Discussion 3. If t p and t c have one or more reincarnation tuples for t p and t c , the recursive temporary outcome tuples of the parent-child relationship according to definition 11, and two or more reincarnation tuples of t p or t c There is no parent-child relationship between any reborn tuple of t p and any recurring tuple of t c (ie, if t p or t c were replicated in plural).

고찰 4. 정의 11에 따라 재귀적 결과투플들인 tp′과 tc′에 대하여 tp′의 기원 투플 tp가 tc′의 기원 투플 tc의 부모 투플일지라도 tp′ 또는 tc′이 재귀적 임시 결과투플들의 결합에 의해서 생성되었다면 tp′과 tc′ 간에는 부모-자식 관계가 성립하지 않는다. 4. Consideration defines 11 recursive results, which are tuple t p 'and t c, t p' of origin tuple t p a t c 'origin tuple t c t p a parent tuple even' or t c 'with respect to according to the If generated by a combination of recursive temporary result tuples, no parent-child relationship is established between t p 'and t c '.

예를 들어, 도 12(b)와 도 13(c)의 재귀적 결과투플들은 모두가 재귀적 임시 결과투플들의 단수 복제에 의해 생성되었으므로 그 재귀적 결과투플들 간에는 부모 -자식 관계가 성립한다. 그러나 도 15(c)의 재귀적 결과투플들은 재귀적 임시 결과투플들의 복수 복제에 의해 그리고 도 16(d)의 재귀적 결과투플들은 재귀적 임시 결과투플들 간의 결합에 의해 생성되었으므로 그 재귀적 결과투플들 간에는 부모-자식 관계가 성립하지 않는다.For example, the recursive result tuples of FIGS. 12 (b) and 13 (c) are all generated by singular copies of recursive temporal result tuples, so a parent-child relationship is established between the recursive result tuples. However, the recursive result tuples of FIG. 15 (c) are generated by plural copies of the recursive temporary result tuples, and the recursive result tuples of FIG. 16 (d) are generated by combining the recursive temporary result tuples. There is no parent-child relationship between tuples.

정의 12. 재귀적 결과투플들의 조상 투플, 후손 투플, 그리고 조상-후손 관계. 재귀적 질의의 모든 재귀적 결과투플들이 재귀적 임시 결과투플들의 단수 복제에 의해 생성된 경우에 한하여, 조상-후손 관계의 재귀적 임시 결과 투플들인 ta와 td에 대하여 ta가 td의 조상 투플이고 td가 ta의 후손 투플일 때, 그 재귀적 결과투플들의 집합에서 ta의 환생 투플이 ta′이고 td의 환생 투플이 td′이면 ta′을 td′의 조상 투플이라 하고 td′을 ta′의 후손 투플이라 하며 ta′과 td′은 조상-후손 관계에 있다라고 한다. Definition 12. Ancestor tuples, posterity tuples, and ancestor-descent relationships of recursive outcome tuples. All recursive result tuple of recursive queries will only when produced by the single cloning of the recursive temporary result tuples, ancestor-descendant of recursive temporary result tuples, which are t a and t d t a is t d with respect to the relationship ancestors tuple and t d that t a of offspring to-peulil case, if the recursive results reincarnation of t a in the set of tuples tuple is t a 'and the reincarnation tuple of t d t d' t a 'to t d' as ancestor tuple is referred to as a descendant of a tuple t d 'a a t', and t a 'd and t' are ancestor-descendant relationship is said to be in a.

정의 13. 특정 재귀적 임시 테이블의 재귀적 임시 결과 투플들을 대상으로 그 투플들을 노드들로 표현하고, 부모-자식 관계의 투플들에 해당하는 노드들을 부모 노드로부터 자식 노드로 향하는 방향 에지로 연결하여 표현함으로써 형성되는 트리들을 재귀적 임시 결과투플 트리들(recursive temporary result tuple trees, RTRT-trees)이라 한다. Definition 13. Represent the tuples as nodes for the recursive temporary result tuples of a specific recursive temporary table, and connect the nodes corresponding to the tuples of the parent-child relationship with the direction edge from the parent node to the child node. Trees formed by representation are called recursive temporary result tuple trees (RTRT-trees).

특정 재귀적 임시 결과 투플트리에서 루트 노드로부터 특정 노드에 이르는 경로(path)의 길이를 그 노드의 깊이(depth)라 하고 그 트리의 임의의 노드의 깊이에 1을 더한 값을 그 노드의 수준(level)이라 하자. SQL:1999 표준의 재귀적 질의 에서 재귀적 임시 결과투플 트리들의 노드들 중 1부터 특정 수준까지의 노드들에 해당하는 투플들만을 재귀적 결과투플들로 생성할 수 있게 하는 것이 가능하다. 예를 들어, 특정 재귀적 임시 테이블의 결과칼럼으로서 level을 with 절에서 선언하고 그 재귀적 임시 테이블의 정의 부분에 명시된 루트 식별 부질의의 select 절의 level 칼럼값을 1로 설정함으로써 그 루트 식별 부질의의 결과투플들의 칼럼 level의 값을 1로 초기화하며 그 정의의 자식 식별 부질의의 select 절의 level 칼럼값을 부모 투플의 level 칼럼값에 1을 더한 값으로 설정함으로써 그 자식 식별 부질의의 결과투플들의 칼럼 level 값을 설정하면 그 재귀적 임시 테이블의 투플들 각각은 그 투플에 해당하는 노드의 재귀적 임시 결과투플 트리에서의 수준을 그 투플의 칼럼 level의 값으로 가지게 된다. 따라서 그 재귀적 질의의 마감 부질의에 재귀적 임시 결과투플 선택 조건으로 "level <=N"을 명시하면 재귀적 임시 결과투플 트리들에서 1부터 N까지의 수준을 가지는 노드들에 해당하는 재귀적 임시 결과투플들만이 그 질의의 재귀적 결과투플들로 생성된다.In a particular recursive temporary result tuple tree, the length of the path from the root node to a particular node is called the depth of that node, plus the depth of any node in that tree, plus the level of that node ( level). In a recursive query of the SQL: 1999 standard, it is possible to make recursive result tuples only tuples corresponding to 1 to a certain level of nodes of a recursive temporary result tuple tree. For example, the root identity subquery is defined by declaring level in the with clause as the result column of a particular recursive temporary table and setting the level column value of the select clause of the root identity subquery specified in the definition of the recursive temporary table to 1. Initializes the column level of the result tuples of to 1 and sets the level column value of the select clause of the child identification subquery of the definition to the value of the result tuple of the child identification subquery of the parent tuple. If a column level value is set, each of the tuples of the recursive temporary table has the level in the recursive temporary result tuple tree of the node corresponding to the tuple as the column level value of the tuple. Therefore, if "level <= N" is specified as the recursive temporary result tuple selection criterion in the closing subquery of the recursive query, the recursive values corresponding to nodes having a level from 1 to N in the recursive temporary result tuple trees Only temporary result tuples are generated with the recursive result tuples of the query.

정의 14. 특정 재귀적 질의의 재귀적 결과투플들을 대상으로, 그 재귀적 결과투플들 모두가 재귀적 임시 결과투플들의 단수 복제에 의해 생성된 경우에 한하여, 그 투플들을 노드들로 표현하고 부모-자식 관계의 투플들에 해당하는 노드들을 부모 노드로부터 자식 노드로 향하는 방향 에지로 연결하여 표현함으로써 형성되는 트리들을 재귀적 결과투플 트리들(recursive result tuple trees, RRT-trees)이라 한다. Definition 14. For a recursive result tuple of a particular recursive query, express both the tuples as nodes and only if all of the recursive result tuples are generated by a singular copy of the recursive temporary result tuples. Trees formed by connecting nodes corresponding to tuples of a child relationship with a direction edge from a parent node to a child node are called recursive result tuple trees (RRT-trees).

도 12(a)의 질의의 마감 부질의는 하나의 재귀적 임시 테이블 empHierarchy 만을 가지며 재귀적 임시 결과투플 선택 조건들을 가지지 않는다. 따라서 고찰 1에 의해 그 질의의 재귀적 임시 결과투플 트리들과 그 질의의 재귀적 결과투플 트리들은 동일하다. 도 17은 그 질의의 재귀적 결과투플 트리들을 나타낸다. 참고로, 도 17의 형제 노드들은 칼럼 employee_id 값의 오름차순으로 의도적으로 정렬된 것이다.The closing subquery of the query of FIG. 12 (a) has only one recursive temporary table empHierarchy and no recursive temporary result tuple selection conditions. Therefore, by consideration 1, the recursive temporary result tuple trees of the query and the recursive result tuple trees of the query are the same. 17 shows the recursive result tuple trees of the query. For reference, sibling nodes of FIG. 17 are intentionally arranged in ascending order of the column employee_id value.

도 15(c)의 재귀적 결과투플들은 재귀적 임시 결과투플들의 복수 복제에 의해 생성되었으며, 도 16(d)의 재귀적 결과투플들은 재귀적 임시 결과투플들 간의 결합에 의해 생성되었다. 따라서 그 재귀적 결과투플들은 재귀적 결과투플 트리들을 형성하지 않는다.The recursive result tuples of FIG. 15 (c) were generated by multiple copies of the recursive temporary result tuples, and the recursive result tuples of FIG. 16 (d) were generated by combining between the recursive temporary result tuples. Thus, the recursive result tuples do not form recursive result tuple trees.

정의 15. 특정 재귀적 임시 테이블의 투플들이 형성하는 재귀적 임시 결과투플 트리(들)에 대해 그 트리(들)의 루트 노드(들)에 대한 가상의 부모 노드를 두고 그 가상의 부모 노드로부터 그 루트 노드(들)로 향하는 방향 에지를 연결하면 하나의 트리가 형성된다. 이를 가상의 재귀적 임시 결과투플 트리(Virtual Recursive Temporary Result Tuple Tree, VRTRT-Tree)라 한다. Definition 15. For a recursive temporary result tuple tree (s) formed by tuples of a particular recursive temporary table, leave a virtual parent node for the root node (s) of that tree (s) and then recreate it from that virtual parent node. Connecting the directional edges towards the root node (s) forms a tree. This is called a virtual recursive temporary result tuple tree (VRTRT-Tree).

예를 들어, 도 17의 두 개의 재귀적 임시 결과투플 트리들의 루트 노드들에 대해 가상의 부모 노드를 둠으로써 형성되는 가상의 재귀적 임시 결과투플 트리는 도 18과 같다.For example, a virtual recursive temporary result tuple tree formed by placing a virtual parent node for the root nodes of the two recursive temporary result tuple trees of FIG. 17 is shown in FIG. 18.

Oracle은 임시 테이블들을 정의하기 위한 with 절을 제공하지만 그 with 절을 통한 재귀적 임시 테이블들의 정의는 지원하지 않는다. Oracle은 SQL:1999 표준의 재귀적 질의의 기능을 계층 질의(hierarchical query)라는 Oracle 특유의 질의 로써 제공한다. Oracle의 계층 질의의 문법은 도 19와 같다. 본 문서의 나머지 부분에서 Oracle의 계층 질의를 Oracle의 재귀적 질의라 한다.Oracle provides a with clause for defining temporary tables, but does not support the definition of recursive temporary tables through that with clause. Oracle provides the functionality of recursive queries in the SQL: 1999 standard as Oracle-specific queries called hierarchical queries. The syntax of Oracle's hierarchical query is shown in FIG. In the rest of this document, Oracle's hierarchical query is called Oracle's recursive query.

도 19에 표현되었듯이 Oracle의 재귀적 질의는 connect by 절을 포함한 하나의 select 문으로서 SQL:1999 표준의 재귀적 질의와 비교하여 다음 1~3의 특징을 가진다.As shown in FIG. 19, Oracle's recursive query is a select statement including a connect by clause, and has the following features 1 to 3 compared to the recursive query of the SQL: 1999 standard.

특징 1. Oracle의 재귀적 질의가 생성하는 재귀적 임시 테이블의 수효는 오직 하나이다.Features 1. There is only one number of recursive temporary tables created by Oracle's recursive queries.

특징 2. Oracle의 재귀적 질의에서 재귀적 임시 테이블을 구성하는 이행폐포의 시작 투플들과 그 투플들 각각의 후손 투플들은 동일한 기반 테이블들을 대상으로 생성된다.Feature 2. In Oracle's recursive query, the starting tuples of transitional redistribution that make up the recursive temporary table and the descendant tuples of each of those tuples are generated for the same base table.

특징 3. Oracle의 재귀적 질의는 부가 테이블들을 가지지 않는다.Feature 3. Recursive queries in Oracle do not have side tables.

Oracle의 재귀적 질의는 특징_1에 의해 SQL:1999 표준의 재귀적 질의의 마감 부질의에 명시된 필터링 조건들을 구성하는 조건들 중에서 재귀적 임시 테이블들 간의 조인 조건들을 가지지 않으며 특징_3에 의해 재귀적 임시 테이블과 부가 테이블 간의 조인 조건들, 부가 테이블들 간의 조인 조건들, 그리고 부가 테이블 선택 조건들을 가지지 않는다. 따라서 Oracle의 재귀적 질의는 필터링 조건들로서 재귀적 임시 결과투플 선택 조건들만을 가진다. Oracle의 재귀적 질의에서 재귀적 임시 결과투플 선택 조건들은 그 질의의 where 절에 명시된다.Oracle's recursive query does not have join conditions between recursive temporary tables among the conditions that make up the filtering conditions specified in the SQL: 1999 standard recursive query subquery by feature_1 and recursively by feature_3. There are no join conditions between the temporary table and the side table, join conditions between the side tables, and side table selection conditions. Thus, Oracle's recursive query has only recursive temporary result tuple selection conditions as filtering conditions. In Oracle's recursive query, the recursive temporary result tuple selection conditions are specified in the where clause of the query.

Oracle의 재귀적 질의는 특징_2에 의해 이행폐포의 시작 투플들을 생성하기 위해서만 적용되는 조인 조건들, 그 투플들 각각의 후손 투플들을 생성하기 위해서 만 적용되는 조인 조건들, 그리고 이행폐포의 시작 투플들과 그 투플들 각각의 후손 투플들을 생성하기 위해 공통으로 적용되는 조인 조건들을 가질 수 있다. 본 문서는 그들 각각을 루트 특유의 조인 조건들(root_specific_join_conditions), 자식 특유의 조인 조건들(child_specific_join_conditions), 그리고 루트와 자식의 공통 조인 조건들(root_child_common_join_conditions)이라 한다. Oracle의 재귀적 질의에서 루트와 자식의 공통 조인 조건들과 루트 특유의 조인 조건들은 SQL:1999 표준의 재귀적 질의의 루트 조인 조건들과 동일한 의미의 조건들을 형성하며 루트와 자식의 공통 조인 조건들과 자식 특유의 조인 조건들은 SQL:1999 표준의 재귀적 질의의 자식 조인 조건들과 동일한 의미의 조건들을 형성한다.Oracle's recursive query is characterized by the join conditions that are only applied to generate the starting tuples of the transitional redistribution by feature_2, the join conditions that are applied only to generate the descendant tuples of each of those tuples, and the starting tuple of the transitional closure. And join tuples that are commonly applied to generate descendant tuples of each of the tuples. This document refers to each of them as root-specific join conditions (root_specific_join_conditions), child-specific join conditions (child_specific_join_conditions), and root and child common join conditions (root_child_common_join_conditions). In Oracle's recursive query, the common join conditions of root and child and the root-specific join conditions form the same meanings as the root join conditions of the recursive query of SQL: 1999 standard. And child-specific join conditions form conditions that have the same meaning as child join conditions in recursive queries in the SQL: 1999 standard.

Oracle의 재귀적 질의에서 루트와 자식의 공통 조인 조건들은 그 질의의 where 절(또는 from 절)에, 루트 특유의 조인 조건들은 그 질의의 start with 절에, 그리고 자식 특유의 조인 조건들은 그 질의의 connect by 절에 각각 명시된다. 이를 요약하면 도 20과 같다. Oracle의 재귀적 질의에서 재귀적 임시 결과투플 선택 조건들은 하나의 재귀적 임시 테이블을 대상으로 적용되지만 표기의 일관성을 위해 그 조건들에 대한 영문 표기를 SQL:1999 표준의 재귀적 질의의 경우와 동일하게 recursiveTables_closing_selection conditions로 표기한다.In Oracle recursive queries, the common join conditions for root and children are in the where clause (or from clause) of the query, the root-specific join conditions are in the start with clause of the query, and the child-specific join conditions are in the query. Each specified in the connect by clause. This is summarized in FIG. 20. In Oracle's recursive queries, the recursive temporary result tuple selection conditions apply to a single recursive temporary table, but for the sake of consistency, the English notation for those conditions is the same as that of the recursive query in the SQL: 1999 standard. RecursiveTables_closing_selection conditions.

Oracle의 재귀적 질의의 from 절에서 참조되는 테이블들은 SQL:1999 표준의 재귀적 질의의 기반 테이블들에 대응된다. 따라서 본 문서는 Oracle의 재귀적 질의의 from 절의 테이블들 또한 기반 테이블들이라 한다.The tables referenced in the from clause of Oracle's recursive query correspond to the base tables of the recursive query in the SQL: 1999 standard. Therefore, this document refers to the tables in the from clause of Oracle's recursive queries as well as base tables.

Oracle의 재귀적 질의에서 루트와 자식의 공통 조인 조건들, start with 절 의 조건들, 그리고 connect by 절의 조건들을 만족함으로써 식별된 투플들은 SQL:1999 표준의 재귀적 질의의 재귀적 임시 결과투플들에 대응된다. 따라서 본 문서는 Oracle의 재귀적 질의의 그 투플들 또한 재귀적 임시 결과투플들이라 한다.In Oracle's recursive query, the tuples identified by satisfying the common join conditions of the root and child, the conditions of the start with clause, and the conditions of the connect by clause are applied to the recursive temporary result tuples of the recursive query of the SQL: 1999 standard. Corresponding. Thus, this document refers to those tuples of Oracle's recursive query as recursive ad hoc result tuples.

Oracle의 재귀적 질의의 재귀적 임시 결과투플들 중에서 그 질의의 재귀적 임시 결과투플 선택 조건들을 만족하는 투플들은 SQL:1999 표준의 재귀적 질의의 재귀적 결과투플들에 대응된다. 따라서 본 문서는 Oracle의 재귀적 질의의 그 투플들 또한 재귀적 결과투플들이라 한다.Among the recursive temporary result tuples of Oracle's recursive query, the tuples that satisfy the recursive temporary result tuple selection conditions of the query correspond to the recursive result tuples of the recursive query of the SQL: 1999 standard. Thus, this document refers to those tuples of Oracle's recursive query as recursive result tuples.

Oracle의 재귀적 질의는 하나의 재귀적 임시 테이블만을 생성하며 부가 테이블들을 가지지 않으므로 Oracle의 재귀적 질의에서는 재귀적 임시 결과투플들 간의 결합이 발생하지 않으며 재귀적 임시 결과투플의 복수 복제가 발생하지 않는다. 즉, Oracle의 재귀적 질의의 모든 재귀적 결과투플들은 그 질의의 재귀적 임시 결과투플들의 단수 복제에 의해 생성된 것이다.Oracle recursive queries create only one recursive temporary table and do not have side tables, so in Oracle recursive queries no joins between recursive temporary result tuples occur and multiple replications of recursive temporary result tuples do not occur. . That is, all recursive result tuples of Oracle's recursive queries are generated by singular copies of the recursive temporary result tuples of the query.

Oracle은 재귀적 질의의 connect by 절에 선택사양(option)인 nocycle이 명시되지 않을 경우, 그 질의의 실행 시에 재귀적 임시 결과투플들 간의 부모-자식 관계가 형성하는 임의의 사이클이 발견되면 그를 실행 시간 오류로 처리하며, 그 선택사양이 명시된 경우, 그 질의의 실행 시에 사이클이 발견되면 그 사이클을 따라가지 않음으로써 재귀적 임시 결과투플들을 식별한다.If Oracle does not specify an optional nocycle in the connect by clause of a recursive query, Oracle will detect any cycle found in the parent-child relationship between recursive temporary result tuples when executing the query. Treat as a runtime error and, if the option is specified, identify a recursive temporary result tuple by not following the cycle if a cycle is found at the time of execution of the query.

Oracle의 재귀적 질의에서 order siblings by 절은 동일한 부모를 가지는 투플들 즉, 형제 투플들 간의 정렬 기준을 명시한다. Order siblings by 절은 재귀적 질의에만 사용될 수 있으며 order by 절과 동시에 동일 부질의에 명시될 수 없다. SQL:1999 표준의 재귀적 질의는 Oracle의 order siblings by 절과 동일한 기능의 절을 지원하지 않는다.In Oracle's recursive query, the order siblings by clause specifies the sorting criteria between tuples with the same parent, that is, siblings. The Order siblings by clause can only be used for recursive queries and cannot be specified in the same subquery as the order by clause. Recursive queries in the SQL: 1999 standard do not support clauses equivalent to Oracle's order siblings by clause.

Oracle의 재귀적 질의에 명시되는 조건들의 의미를 도식화하면 도 21과 같다. 도 21(a)는 Oracle의 재귀적 질의의 루트와 자식의 공통 조인 조건들, 루트 특유의 조인 조건들, 그리고 루트 선택 조건들을 그 질의의 기반 테이블들을 대상으로 적용하여 이행폐포의 시작 투플들을 식별함을 나타낸다. 도 21(b)는 Oracle의 재귀적 질의의 루트와 자식의 공통 조인 조건들, 자식 특유의 조인 조건들, 그리고 자식 선택 조건들을 만족함으로써 기반 테이블들로부터 생성된 투플들과 부모 선택 조건들을 만족하는 해당 이행폐포의 기존 투플들을 대상으로 부모-자식 연결 조건들을 적용하여 재귀적 임시 결과투플들을 생성함을 나타낸다. 도 21(c)는 Oracle의 재귀적 질의의 재귀적 임시 결과투플 선택 조건들을 만족함으로써 재귀적 임시 결과투플들로부터 생성된 재귀적 결과투플들에 대해 그 질의의 select 절을 적용함으로써 최종 결과투플들을 생성함을 나타낸다.Figure 21 shows the meaning of the conditions specified in the Oracle recursive query. Figure 21 (a) identifies the starting tuples of a transitional redundancy by applying Oracle's root and child common join conditions, root-specific join conditions, and route selection conditions to the base tables of the query. It is displayed. Figure 21 (b) shows that the tuples and parent selection conditions generated from the base tables are satisfied by satisfying the common join conditions of the root and child, child-specific join conditions, and child selection conditions of Oracle's recursive query. It indicates that recursive temporary result tuples are generated by applying parent-child linkage conditions to existing tuples of the transitional alveoli. Fig. 21 (c) shows final result tuples by applying the select clause of the query to recursive result tuples generated from recursive temporary result tuples by satisfying the recursive temporary result tuple selection conditions of Oracle's recursive query. To create.

도 21에 표현된 바와 같이 Oracle은 "이행폐포의 부모-자식 조건들"을 만족하는 투플들 뿐만 아니라 이행폐포의 시작 투플들에 대해서도 order siblings by 절을 적용한다. 도 18의 가상의 재귀적 임시 결과투플 트리에 표현된 바와 같이 Oracle은 이행폐포의 시작 투플들이 가상의 동일한 부모 투플을 가지는 것으로 가정하여 그 투플들 또한 형제 투플들로 간주한다. 따라서 도 21(a)와 도 21(b)에 공통으로 order siblings by 절을 표현하였다.As represented in FIG. 21, Oracle applies an order siblings by clause to not only tuples that satisfy "parent-child conditions of transitional closure" but also starting tuples of transitional closure. As represented in the hypothetical recursive interim result tuple tree of FIG. 18, Oracle assumes that the starting tuples of the transitional redundancy have virtually identical parent tuples, and the tuples are also sibling tuples. Therefore, the order siblings by clause is commonly expressed in FIGS. 21 (a) and 21 (b).

Order siblings by 절을 제외한다면 Oracle의 모든 재귀적 질의는 SQL:1999 표준의 재귀적 질의를 이용하여 도 22와 같이 표현될 수 있다. 도 22의 재귀적 질의에서 루트 식별 부질의와 자식 식별 부질의의 기반 테이블들은 Oracle의 재귀적 질의의 기반 테이블들에 해당한다. 따라서 그 부질의들의 기반 테이블들은 동일하여야 한다. 도 22의 재귀적 질의에서 마감 부질의의 order by 절은 Oracle의 재귀적 질의의 order by 절에 해당한다.Except for the order siblings by clause, all Oracle recursive queries can be expressed as shown in FIG. 22 using a recursive query of the SQL: 1999 standard. The base tables of the root identification subquery and the child identification subquery in the recursive query of FIG. 22 correspond to the base tables of the recursive query of Oracle. Thus the base tables of the subqueries must be identical. The order by clause of the closing subquery in the recursive query of FIG. 22 corresponds to the order by clause of the recursive query of Oracle.

Oracle의 재귀적 질의의 루트와 자식의 공통 조인 조건들과 루트 특유의 조인 조건들은 도 22의 재귀적 질의에서 루트 식별 부질의의 루트 조인 조건들로 명시되며 Oracle의 재귀적 질의의 루트와 자식의 공통 조인 조건들과 자식 특유의 조인 조건들은 도 22의 재귀적 질의에서 자식 식별 부질의의 자식 조인 조건들로 명시된다.The common join conditions of root and child and root-specific join conditions of Oracle's recursive query are specified as the root join conditions of the root identification subquery in the recursive query of FIG. 22 and the root and child of Oracle's recursive query. Common join conditions and child-specific join conditions are specified as child join conditions of the child identification subquery in the recursive query of FIG. 22.

예를 들어, 도 13(a)의 질의와 동등한 질의를 Oracle에서 작성하면 그 질의는 도 23의 질의와 같다. 도 23의 질의에 표현되었듯이 connect by 절의 조건들에서 부모 투플의 칼럼은 키워드 prior와 함께 명시된다.For example, if a query equivalent to that of FIG. 13 (a) is created in Oracle, the query is the same as that of FIG. As represented in the query of FIG. 23, the columns of the parent tuple in the conditions of the connect by clause are specified together with the keyword prior.

부가 테이블을 가지는 도 15(a)의 질의와 동등한 질의를 Oracle에서 작성하면 도 24와 같다. 도 24의 질의에서 그 질의의 from 절에 명시된 부질의와 테이블 departments는 도 15(a)의 질의에서 그 질의의 마감 부질의의 from 절에서 참조된 재귀적 임시 테이블 empHierarchy와 부가 테이블 departments에 각각 해당한다. SQL:1999 표준의 재귀적 질의의 마감 부질의에서 재귀적 임시 테이블(들)을 포함한 다수 개의 테이블들이 그 부질의의 from 절에서 참조될 경우, 그 재귀적 질의와 동등한 질의를 Oracle에서 작성하면 그 질의는 도 24와 같이 하나의 재귀적 질의 또 는 다수 개의 재귀적 질의들을 from 절의 부질의들로 가지게 된다.A query equivalent to that of FIG. 15 (a) having an side table in Oracle is shown in FIG. In the query of Fig. 24, the subquery and table departments specified in the from clause of the query correspond to the recursive temporary table empHierarchy and the side table departments referenced in the from clause of the closing subquery of the query in Fig. 15 (a), respectively. do. When multiple tables, including recursive temporary table (s), are referenced in the subclause of a recursive query in the SQL: 1999 standard, when a query equivalent to the recursive query is written in Oracle, The query has one recursive query or multiple recursive queries as subqueries of the from clause, as shown in FIG.

Oracle의 재귀적 질의는 재귀적 임시 결과투플들 각각에 대해 그 투플의 재귀적 임시 결과투플 트리에서의 해당 노드가 루트 노드이면 1을, 그렇지 않으면 그 노드의 부모 노드의 수준에 1을 더한 값을 반환하는 의사칼럼(pseudo column) level을 제공한다. 따라서 재귀적 임시 결과투플 트리들에서 1부터 N까지의 수준을 가지는 노드들에 해당하는 재귀적 임시 결과투플들만을 재귀적 결과투플들로 생성하고자 한다면 재귀적 임시 결과투플 선택 조건으로 "level <= N"을 명시하면 된다.Oracle's recursive query adds 1 for each of the recursive temporary result tuples to 1 if the node in the tuple's recursive temporary result tuple tree is the root node, otherwise 1 is added to the parent node's level. Provides a pseudo column level to return. Therefore, if you want to generate only recursive temporary result tuples that correspond to nodes having a level from 1 to N in the recursive temporary result tuple trees, the "level <= N "can be specified.

SQL:2003 표준은 숫자 값 표현식(numeric value expression), 문자열 값 표현식(string value expression), 날짜시간 값 표현식(datetime value expression), XML 값 표현식(XML value expression) 등의 값 표현식들을 정의한다. SQL/XML 출판 함수 XMLELEMENT와 XMLFOREST는 그 함수의 인자로 SQL:2003 표준의 임의의 값 표현식을 가질 수 있으며, SQL/XML 출판 함수 XMLCONCAT과 XMLAGG는 XML 데이터 유형의 값을 반환하는 XML 값 표현식만을 인자로 가질 수 있으며, SQL/XML 출판 함수 XMLATTRIBUTES는 XML 값 표현식을 제외한 SQL:2003 표준의 임의의 값 표현식을 인자로 가질 수 있다. XMLATTRIBUTES와 XMLFOREST의 경우, 그 함수들의 인자들 각각은 <값 표현식, 식별자>의 쌍을 가질 수 있다. 식별자라 함은 XMLATTRIBUTES의 경우에는 속성명을 그리고 XMLFOREST의 경우에는 엘리먼트명을 의미한다. 식별자가 생략된 경우, 값 표현식은 오직 하나의 칼럼명이어야 하며 그 경우 그 인자의 식별자는 그 칼럼명이 된다.The SQL: 2003 standard defines value expressions such as numeric value expressions, string value expressions, datetime value expressions, and XML value expressions. The SQL / XML publishing functions XMLELEMENT and XMLFOREST can take arbitrary value expressions in the SQL: 2003 standard as arguments to those functions. The SQL / XML publishing functions XMLCONCAT and XMLAGG only accept XML value expressions that return a value of the XML data type. The SQL / XML publishing function XMLATTRIBUTES can have any value expression of the SQL: 2003 standard except XML value expressions as its argument. For XMLATTRIBUTES and XMLFOREST, each of the arguments to those functions can have a pair of <value expression, identifier>. An identifier means an attribute name in case of XMLATTRIBUTES and an element name in case of XMLFOREST. If the identifier is omitted, the value expression must be only one column name, in which case the identifier of the argument is that column name.

XMLELEMNT, XMLFOREST, 그리고 XMLCONCAT은 그 함수의 인자들로 사용된 값 표현식들 각각의 반환 값을 연결하여 하나의 XML 값을 생성하여 반환한다. 집단함수를 포함하지 않은 표현식을 투플 표현식이라 하고 집단함수를 포함한 표현식을 집단 표현식이라 하자. XMLELEMENT, XMLFOREST, 그리고 XMLCONCAT은 그 함수의 인자들로 사용된 표현식들이 투플 표현식들인 경우에는 그 표현식들이 각 투플에 대하여 반환하는 값들로써 하나의 XML 값을 생성하여 반환하며, 그 인자들로 사용된 표현식들이 집단 표현식들인 경우에는 그 집단 표현식들이 각 집단에 대하여 반환하는 값들로써 하나의 XML 값을 생성하여 반환한다.XMLELEMNT, XMLFOREST, and XMLCONCAT construct a single XML value by concatenating the return values of each of the value expressions used as arguments to the function. An expression that does not contain an aggregate function is called a tuple expression, and an expression that contains an aggregate function is called an expression. XMLELEMENT, XMLFOREST, and XMLCONCAT generate and return an XML value as the values that the expressions return for each tuple if the expressions used as arguments to the function are tuple expressions. Are group expressions, they generate and return an XML value as the values they return for each group.

XMLATTRIBUTES는 그 함수의 인자로 명시된 각 <값 표현식, 속성 명>의 쌍에 대해 하나의 XML 속성을 생성한다. 기존 SQL/XML 출판 함수들 중, XMLELEMENT 만이 XMLATTRIBUTES를 인자로 가질 수 있다.XMLATTRIBUTES creates one XML attribute for each pair of <value expression, attribute name> specified as arguments to the function. Of the existing SQL / XML publishing functions, only XMLELEMENT can take XMLATTRIBUTES as an argument.

XMLAGG는 그 함수가 사용된 부질의의 group by 절에 따라 분류된 각 집단의 투플들에 대해 그 함수의 인자로 사용된 XML 값 표현식이 반환하는 값들을 하나의 XML 값으로 생성하여 반환한다. XMLAGG는 그 함수에 관한 한 각 집단 내의 투플들을 정렬한 후 그들 각 투플에 대해 차례로 그 함수의 인자로 사용된 XML 값 표현식을 적용할 수 있도록 order by 선택사양을 그 함수에 명시할 수 있게 한다.XMLAGG generates and returns as an XML value the values returned by the XML value expression used as the function's argument for each group of tuples classified according to the group by clause of the subquery in which the function is used. XMLAGG allows you to specify an order by option to the function so that you can sort the tuples within each population as far as the function is concerned and then apply the XML value expression used as the function's argument to each of those tuples in turn.

참고로, SUM, COUNT, AVG, MIN, MAX, XMLAGG 등의 SQL의 기존 집단함수들이 임의의 집단함수의 인자로 사용될 경우, DB2와 SQL Server는 그를 오류로 처리한다. 반면, Oracle 10g는 그를 오류로 처리하지 않고 다음과 같이 처리한다. 특정 집단함수 A가 임의의 집단함수 Aㅄ을 인자로 가질 경우, 집단함수 A는 집단함수 A ㅄ이 집단들의 수효만큼 반환하는 모든 값들을 하나의 집단으로 분류하여 전체 집단들에 대해 하나의 값을 생성하여 반환한다.For reference, when existing aggregate functions of SQL such as SUM, COUNT, AVG, MIN, MAX, XMLAGG are used as arguments to arbitrary aggregate functions, DB2 and SQL Server treat them as errors. Oracle 10g, on the other hand, does not treat it as an error, but instead: If a particular group function A has any group function A 인자 as a factor, then group function A classifies all values returned by the number of group functions A 집단 into one group and sets one value for the entire group. Create and return

예를 들어, 질의 "select XMLAGG(XMLELEMENT(TOTAL_SALARY, SUM(salary))) from employees group by department_id"의 경우, DB2는 그 질의를 오류로 처리한다. 그러나 Oracle 10g의 경우, XMLELEMENT는 group by 절에 의해 형성되는 각 집단에 대해 집단함수 SUM이 반환하는 각 값으로써 XML 엘리먼트 TOTAL_SALARY를 생성하여 하나의 XML 값으로 반환하며 XMLAGG는 XMLELEMENT가 반환하는 XML 값들을 모두 연결하여 전체 집단들에 대해 하나의 XML 값을 생성하여 반환한다.For example, for the query "select XMLAGG (XMLELEMENT (TOTAL_SALARY, SUM (salary))) from employees group by department_id", DB2 treats the query as an error. However, in Oracle 10g, XMLELEMENT creates an XML element TOTAL_SALARY as each value returned by the group function SUM for each group formed by the group by clause and returns it as an XML value. XMLAGG returns the XML values returned by XMLELEMENT. Connect all together to generate and return an XML value for the entire population.

SQL/XML 출판 함수들을 포함한 질의들의 예와 그 질의들의 결과투플들은 도 25와 같다.Examples of queries including SQL / XML publishing functions and the result tuples of the queries are shown in FIG. 25.

SQL:1999 표준, DB2, SQL Server, 그리고 Oracle의 재귀적 질의들과 SQL:2003 표준의 SQL/XML 출판 함수들은 이상과 같은 특징들을 가진다. 이제 그들을 기반으로 (1) 그 질의들에 적용되어 그 질의들의 재귀적 결과투플들에 해당하는 노드들이 형성하는 각 재귀적 결과투플 트리에 대해 하나의 재귀적 구조의 XML 값을 생성하는 새로운 SQL 함수 XMLNEST와 (2) XMLNEST의 직간접 인자로만 사용되며 재귀적 결과투플 트리의 노드들 각각에 대해 그 노드를 루트로 가지는 서브트리(sub-tree)의 모든 노드들에 해당하는 재귀적 결과투플들을 하나의 집단으로 처리함으로써 그들 각 집단에 대해 하나의 값을 계산하여 그 값을 그 집단을 대표하는 루트 노드에 해당하는 재귀적 결과투플에게 반환하는 NEST_SUM, NEST_COUNT, NEST_AVG, NEST_MIN, NEST_MAX의 SQL 함수들, 그리고 (3) 재귀적 결과투플들을 그 들의 기원 투플들에 해당하는 노드들이 소속된 재귀적 임시 결과투플 트리별로 분류하고 하나 이상의 재귀적 결과투플을 구성원으로 가진 각 분류의 모든 재귀적 결과투플들을 하나의 집단으로 처리함으로써 그들 각 집단에 대해 하나의 값을 반환하는 SQL 연산자 tc_root를 제시한다.The recursive queries in the SQL: 1999 standard, DB2, SQL Server, and Oracle, and the SQL / XML publishing functions in the SQL: 2003 standard have the following characteristics: Now, based on them, (1) a new SQL function that is applied to the queries and generates one recursive XML value for each recursive result tuple tree formed by nodes corresponding to the recursive result tuples of the queries. For each node of the recursive result tuple tree, for each node of the recursive result tuple tree, recursive result tuples corresponding to all nodes of the sub-tree subtree are used. SQL functions of NEST_SUM, NEST_COUNT, NEST_AVG, NEST_MIN, NEST_MAX that compute a single value for each group by returning it to the group and return that value to the recursive result tuple corresponding to the root node representing that group. (3) classify recursive result tuples by the recursive temporary result tuple tree to which nodes corresponding to their origin tuples belong and classify one or more recursive result tuples. We present the SQL operator tc_root, which returns a value for each group by treating all the recursive result tuples of each class as members as a group.

본 발명이 제시하는 SQL 함수 XMLNEST는 재귀적 질의를 위한 함수이므로 재귀적 질의 양식을 제공하는 DBMS라면 그 종류의 제한을 받지 않고 적용될 수 있다. 이의 대표적인 예로서, SQL:1999 표준의 재귀적 질의 양식을 따르는 DBMS나 오라클(Oracle) 11g와 같이 자신만의 독자적인 재귀적 질의 양식을 제공하는 DMBS를 들 수 있다. 즉, SQL 함수 XMLNEST는 예컨대, (1) SQL:1999 표준의 재귀적 질의의 경우에는 마감 부질의의 "재귀적 결과투플 생성" 양식의 부질의의 select 절에 그리고 (2) Oracle의 재귀적 질의의 경우에는 그 질의의 select 절에 명시되어야 한다. Since the SQL function XMLNEST proposed by the present invention is a function for recursive queries, any DBMS providing a recursive query form can be applied without any limitation. A good example of this is the DBMS that follows the recursive query style of the SQL: 1999 standard, or DMBS, which provides its own recursive query style, such as Oracle 11g. That is, the SQL function XMLNEST can be used, for example, in the select clause of a subquery of the form "1). Must be specified in the select clause of the query.

본 발명이 제시하는 SQL 연산자 tc_root도 마찬가지로 재귀적 질의를 위한 집단연산자이므로 재귀적 질의 양식을 제공하는 DBMS라면 그 종류의 제한을 받지 않고 적용될 수 있다. SQL 연산자 tc_root는 예컨대, (1) SQL:1999 표준의 재귀적 질의의 경우에는 마감 부질의의 "재귀적 결과투플 생성" 양식의 부질의의 select 절과 order by 절에 그리고 (2) Oracle의 재귀적 질의의 경우에는 그 질의의 select 절과 order by 절에 명시될 수 있다. Similarly, the SQL operator tc_root proposed by the present invention is a group operator for recursive queries. Therefore, any DBMS providing a recursive query form can be applied without any limitation. The SQL operator tc_root can be used in, for example, (1) the recursive query of the SQL: 1999 standard, in the select and order by clauses of the subquery in the form of "recursive result tuple" of the closing subquery, and (2) in Oracle recursion. In the case of an enemy query, it can be specified in the select and order by clauses of that query.

정의 16. 재귀적 질의의 마감 부질의의 임의의 부질의에서 하나의 재귀적 임시 결과투플 트리가 정확히 하나의 재귀적 결과투플 트리를 생성한 경우, 생성된 그 재귀적 결과투플 트리를 그 재귀적 임시 결과투플 트리의 "독자환생" 재귀적 결 과투플 트리라 한다. Definition 16. Closing a recursive query When a recursive ad hoc result tuple tree in any subquery of a subquery produces exactly one recursive result tuple tree, the recursive result tuple tree is generated Temporary Outcomes Tuple Tree "Solo Regeneration" Recursive Results

정의 17. 재귀적 질의의 마감 부질의의 임의의 부질의에서 임의의 재귀적 임시 결과투플 트리에 대하여 그 트리의 루트 노드에 해당하는 재귀적 임시 결과투플을 기원 투플로 가지는 재귀적 결과투플이 존재할 경우, 그 재귀적 결과투플에 해당하는 노드를 루트로 가지는 재귀적 결과투플 트리를 그 재귀적 임시 결과투플 트리의 "루트유지" 재귀적 결과투플 트리라 한다. Definition 17. Closing a recursive query In any subquery of a subquery, for any recursive temporary result tuple tree, there is a recursive result tuple with origin tuple of the recursive temporary result tuple corresponding to the root node of the tree. In this case, a recursive result tuple tree having a node corresponding to the recursive result tuple as a root is referred to as a "root maintained" recursive result tuple tree of the recursive temporary result tuple tree.

고찰 5. 재귀적 질의에서 하나의 재귀적 임시 결과투플 트리로부터 생성한 "루트유지" 재귀적 결과투플 트리의 수효는 최대 하나이다. Discussion 5. The maximum number of "root-maintain" recursive result tuple trees generated from one recursive temporary result tuple tree in a recursive query is at most one.

정의 18. 재귀적 질의의 마감 부질의의 임의의 부질의에서 하나의 재귀적 결과투플 트리가 특정 재귀적 임시 결과투플 트리의 "독자환생" 재귀적 결과투플 트리이면서 "루트유지" 재귀적 결과투플 트리인 경우, 그 재귀적 결과투플 트리를 그 재귀적 임시 결과투플 트리의 "루트유지 독자환생" 재귀적 결과투플 트리라 한다. Definition 18. Closing Recursive Queries In any subquery of a subquery, a recursive result tuple tree is a "standback" recursive result tuple tree of a particular recursive temporary result tuple tree and a "maintain root" recursive result tuple. In the case of a tree, the recursive result tuple tree is referred to as the "root-maintained reincarnation" recursive result tuple tree of the recursive temporary result tuple tree.

SQL 함수 XMLNEST는 그 함수가 포함된 재귀적 질의의 마감 부질의의 임의의 부질의에서 그 부질의의 모든 재귀적 결과투플 트리들이 "루트유지 독자환생"인 경우에 한하여 의미를 가지며 그 재귀적 결과투플 트리들에 적용된다. 그렇지 않으면 오류로 처리된다.The SQL function XMLNEST is meaningful only if all the recursive result tuple trees of the subquery are "root-maintained reincarnation" in any subquery of the closing subquery of the recursive query that contains the function, and the recursive result. Applies to tuple trees. Otherwise it is treated as an error.

도 17의 재귀적 임시 결과투플 트리들에서 재귀적 임시 결과투플 선택 조건에 의해 employee_id가 14인 노드가 삭제되었다고 가정해보자. 그 경우, 도 17(a)의 재귀적 임시 결과투플 트리로부터 employee_id가 10, 13, 17인 노드들을 루트들로 가지는 3 개의 재귀적 결과투플 트리들이 생성되며 도 17(b)의 재귀적 임시 결 과투플 트리로부터 employee_id가 21인 노드를 루트로 가지는 하나의 재귀적 결과투플 트리가 생성된다. 그 재귀적 결과투플 트리들에서 employee_id가 10, 13, 17인 노드들을 루트들로 가지는 재귀적 결과투플 트리들은 동일한 재귀적 임시 결과투플 트리로부터 생성되었으므로 "독자환생"의 재귀적 결과투플 트리들이 아니다. 그 재귀적 결과투플 트리들에서 employee_id가 13인 노드와 17인 노드를 루트들로 가지는 재귀적 결과투플 트리들은 그 루트 노드들에 해당하는 재귀적 결과투플들의 기원 투플들이 재귀적 임시 결과투플 트리들의 루트 노드들에 해당하는 재귀적 임시 결과투플들이 아니므로 "루트유지"의 재귀적 결과투플 트리들이 아니다. 반면 employee_id가 21인 노드를 루트로 가지는 재귀적 결과투플 트리는 "루트유지 독자환생"의 재귀적 결과투플 트리이다. SQL 함수 XMLNEST는 그 함수가 사용된 부질의의 모든 재귀적 결과투플 트리들이 "루트유지 독자환생"인 경우에 한하여 의미를 가지므로 그 재귀적 결과투플들을 대상으로 XMLNEST를 적용하는 경우, XMLNEST는 그를 오류로 처리한다.Assume that the node with employee_id of 14 is deleted by the recursive temporary result tuple selection condition in the recursive temporary result tuple trees of FIG. 17. In that case, three recursive result tuple trees are created with roots having nodes of employee_id 10, 13, and 17 from the recursive temporary result tuple tree of FIG. 17 (a), and the recursive temporary result of FIG. 17 (b). A recursive result tuple tree is created from the guatuple tree with a node rooted at employee_id 21. The recursive result tuple trees with nodes with employee_id 10, 13, and 17 as roots in the recursive result tuple trees are not the recursive result tuple trees of "Solo Regeneration" because they are generated from the same recursive temporary result tuple tree. . In the recursive result tuple trees, the recursive result tuple trees with the nodes employee_id 13 and 17 as roots are the origin tuples of the recursive result tuples corresponding to the root nodes. It is not a recursive result tuple tree of "root maintenance" because it is not a recursive temporary result tuple corresponding to root nodes. On the other hand, a recursive result tuple tree whose root is a node with employee_id 21 is a recursive result tuple tree of "root maintenance independent reincarnation". The SQL function XMLNEST is meaningful only when all the recursive result tuple trees of the subquery where the function is used are "root-maintained reincarnation," so when XMLNEST is applied to the recursive result tuples, Treat it as an error.

SQL 함수 XMLNEST는 재귀적 질의의 재귀적 결과투플들을 대상으로 그 투플들에 해당하는 노드들이 형성하는 재귀적 결과투플 트리들 각각에 대하여 그 트리를 구성하는 노드들을 예컨대 깊이우선 탐색(depth-first search, DFS)으로 탐색하여 그 트리에 속하는 노드들에 해당하는 투플들로써 하나의 재귀적 구조의 XML 값을 생성한다. 따라서 XMLNEST는 하나의 재귀적 결과투플 트리를 하나의 집단으로 처리하는 집단함수이다. 여기서, 깊이우선 탐색 알고리즘은 바람직한 예에 불과하고, 다른 종류의 알고리즘을 이용한 탐색도 가능함은 물론이다.The SQL function XMLNEST targets the recursive result tuples of the recursive query, and for each recursive result tuple tree formed by the nodes corresponding to the tuples, the nodes constituting the tree, for example, depth-first search. , DFS) to generate an XML value of a recursive structure with tuples corresponding to the nodes in the tree. Therefore, XMLNEST is a group function that processes one recursive result tuple tree into one group. Here, the depth-first search algorithm is only a preferable example, and the search using another kind of algorithm is also possible.

SQL 함수 XMLNEST는 그 기능을 수행하기 위하여 재귀적 질의의 재귀적 결과투플들을 대상으로 다음의 두 작업들을 차례로 수행한다.The SQL function XMLNEST performs the following two tasks in turn on the recursive result tuples of the recursive query.

(1) 작업_1: 재귀적 결과투플들로써 재귀적 결과투플 트리들을 구성한다. 재귀적 결과투플 트리들 간의 정렬은 임의의 순서를 따른다. 그러나 각 재귀적 결과투플 트리에서 형제 노드들의 순서는 XMLNEST에 그 노드들의 정렬 기준이 명시된 경우에는 그 기준을 따라, 그렇지 않고 재귀적 질의 자체에 그 노드들의 정렬 기준이 명시된 경우에는 그 기준을 따라, 그렇지 않은 경우에는 임의의 순서로 구성된다. (1) Task_1: Construct recursive result tuple trees with recursive result tuples. Sorting between recursive result tuple trees follows an arbitrary order. However, the order of sibling nodes in each recursive result tuple tree follows that criterion if the sorting criteria of those nodes are specified in XMLNEST; otherwise, if the sorting criteria of the nodes is specified in the recursive query itself, Otherwise, they are in any order.

재귀적 결과투플 트리들을 그에 관한 구성정보를 별도로 물리적으로 생성하는 방식으로 구성할 수도 있겠지만, 이하에서 제시하는 투플 식별자 tid(tuple identifier)를 이용하여 논리적으로 구성하는 방법을 이용할 수도 있다. 본 발명에서 투플 식별자 tid는 (i) 재귀적 결과투플들이 재귀적 임시 결과투플들의 단수 복제에 의해 생성되었는지 여부를 판단하며 (ii) 재귀적 결과투플 트리가 "루트유지 독자환생"의 재귀적 결과투플 트리인지를 판단하며, (iii) 하나의 재귀적 결과투플 트리를 구성하는 노드들에 해당하는 재귀적 결과투플들을 또는 하나의 재귀적 임시 결과투플 트리를 구성하는 노드들에 해당하는 재귀적 임시 결과투플들을 기원 투플들로 가지는 재귀적 결과투플들을 하나의 계층집단으로 처리하기 위한 용도로 이용된다. Although the recursive result tuple trees may be configured by physically generating configuration information about the recursive result tuple trees, a method of logically configuring the tuple identifier tid (tuple identifier) described below may be used. In the present invention, the tuple identifier tid determines whether (i) recursive result tuples have been generated by singular copies of recursive temporary result tuples, and (ii) the recursive result tuple tree is a recursive result of "root-maintained reincarnation". Determine a tuple tree, and (iii) recursive temporary tuples corresponding to nodes constituting one recursive result tuple tree, or recursive temporary tuples corresponding to nodes constituting one recursive temporary result tuple tree. It is used to treat recursive result tuples with result tuples as origin tuples as a hierarchy.

재귀적 임시 결과투플들 각각에게는 <루트 투플의 tid인 root_tid, 자기자신의 tid, 그 투플의 부모 투플의 tid인 parent_tid>가 그 재귀적 임시 결과투플의 생성 단계에서 부여된다. 식별자 tid는 '재귀적 임시 결과투플들에서 식별자 tid의 유일성'이라는 특성을 가진다. 즉, 특정 재귀적 임시 테이블의 모든 재귀적 임시 결과투플들은 서로 다른 tid 값을 가지며, 식별자 tid의 값으로는 연속된 정수 값이 사용될 수 있다. Each of the recursive temporary result tuples is given a root_tid which is the tid of the root tuple, its own tid, and the parent_tid which is the tid of the parent tuple of the tuple. The identifier tid has the property of 'uniqueness of the identifier tid in recursive temporary result tuples'. In other words, All recursive temporary result tuples of a particular recursive temporary table have different tid values, and a consecutive integer value may be used as the value of the identifier tid.

재귀적 임시 결과투플이 부모 투플을 가질 경우, 그 투플은 부모 투플의 tid를 parent_tid로 가지며, 부모 투플을 가지지 않을 경우, NULL을 parent_tid로 가진다. 재귀적 결과투플들 각각은 그 재귀적 결과투플의 기원 투플의 <root_tid, tid, parent_tid>를 그대로 가진다. 그러나 재귀적 임시 결과투플들의 결합에 의해 생성된 재귀적 결과투플들에게는 <root_tid, tid, parent_tid>를 부여하지 않는다. If a recursive temporary result tuple has a parent tuple, the tuple has a parent tuple of tid as parent_tid, and if it does not have a parent tuple, NULL as parent_tid. Each of the recursive result tuples retains the root of the recursive result tuple <root_tid, tid, parent_tid>. However, recursive result tuples created by combining recursive temporary result tuples are not given <root_tid, tid, parent_tid>.

재귀적 결과투플들이 재귀적 임시 결과투플들의 단수 복제에 의해 생성된 경우에 한해 그 재귀적 결과투플들에서 식별자 tid의 유일성은 유지된다. 모든 재귀적 결과투플들이 재귀적 임시 결과투플들의 단수 복제에 의해 생성된 경우, 그 재귀적 결과투플들의 root_tid로 참조된 재귀적 임시 결과투플들의 환생 투플들에 해당하는 노드들을 루트들로 가지는 재귀적 결과투플 트리들은 루트유지의 재귀적 결과투플 트리들이다. 재귀적 결과투플 트리들의 루트 노드들에 해당하는 재귀적 결과투플들의 root_tid들의 리스트를 LR이라 할 때, 리스트 LR에 두 번 이상 포함된 root_tid들의 집합을 SR이라 하면 집합 SR의 각 root_tid의 값을 root_tid로 가지는 재귀적 결과투플들에 해당하는 노드들은 독자 환생의 재귀적 결과투플 트리들을 형성하지 않는다.The uniqueness of the identifier tid in the recursive result tuples is maintained only if the recursive result tuples are generated by a singular copy of the recursive temporary result tuples. If all recursive result tuples are generated by singular copies of recursive temporary result tuples, recursive with roots of nodes corresponding to recursive tuples of recursive temporary result tuples referred to as root_tid of the recursive result tuples The result tuple trees are recursive result tuple trees of root maintenance. When the list of root_tids of the recursive result tuples corresponding to the root nodes of the recursive result tuple trees is LR, the set of root_tids included in the list LR more than once is called SR and the value of each root_tid of the set SR is root_tid. Nodes that correspond to recursive result tuples do not form recursive result tuple trees of the original reincarnation.

(2) 작업_2: 각 재귀적 결과투플 트리에 대하여 그 트리를 DFS로 탐색하여 하나의 재귀적 구조의 XML 값을 생성한다.(2) Task_2: For each recursive result tuple tree, search the tree with DFS to generate an XML value of one recursive structure.

본 발명은 새로운 SQL 함수들인 XMLNEST, NEST_SUM, NEST_COUNT, NEST_AVG, NEST_MIN, NEST_MAX 그리고 SQL 연산자인 tc_root의 개념을 명확히 하기 위해 투플들이 형성하는 집단을 동치집단과 계층집단의 두 가지로 분류한다.In order to clarify the concept of new SQL functions XMLNEST, NEST_SUM, NEST_COUNT, NEST_AVG, NEST_MIN, NEST_MAX and SQL operator tc_root, the present invention classifies groups formed by tuples into equal groups and hierarchical groups.

정의 19. 동치(同値)집단(same-value group). 특정 칼럼(들)에 대하여 동일 값을 가지는 투플들의 모음(collection)을 동치집단이라 한다. Definition 19. Same-value group. A collection of tuples with the same value for a particular column (s) is called an equivalence group.

정의 20. 계층(階層)집단(hierarchy group). 재귀적 질의의 재귀적 임시 결과투플들 또는 재귀적 결과투플들에 의해 형성되는 집단으로서 하나의 투플과 그 투플을 조상 투플로 가지는 모든 투플들의 모음을 계층집단이라 한다. Definition 20. Hierarchy group. A collection formed by recursive temporary result tuples or recursive result tuples of a recursive query is a hierarchy of all tuples having one tuple and its tuples as ancestor tuples.

SQL의 기존 집단함수들은 동치집단들만을 대상으로 적용되었다. 본 발명은 SQL의 기존 집단함수들이 대상으로 하는 집단들의 종류를 동치집단들뿐만 아니라 계층집단들로 확장하는 것을 제시한다. 이에 따라 SQL의 기존 집단함수들이 대상으로 하는 집단들과 본 발명이 제시하는 SQL 함수들과 SQL 연산자가 대상으로 하는 집단들은 다음과 같다.The existing group functions of SQL are applied only to equivalence groups. The present invention proposes to extend the types of groups targeted by existing group functions of SQL to hierarchical groups as well as equivalent groups. Accordingly, the groups targeted by the existing group functions of SQL, the SQL functions proposed by the present invention, and the groups targeted by the SQL operator are as follows.

- SQL의 기존 집단함수들인 SUM, COUNT, AVG, MIN, MAX, XMLAGG는 동치집단들과 계층집단들을 대상으로 적용될 수 있다.SQL's existing group functions SUM, COUNT, AVG, MIN, MAX, and XMLAGG can be applied to equivalence groups and hierarchical groups.

- 본 발명이 제시하는 SQL 함수들인 XMLNEST, NEST_SUM, NEST_COUNT, NEST_AVG, NEST_MIN, NEST_MAX, 그리고 SQL 연산자 tc_root는 계층집단들만을 대상으로 적용될 수 있다.The SQL functions XMLNEST, NEST_SUM, NEST_COUNT, NEST_AVG, NEST_MIN, NEST_MAX, and the SQL operator tc_root proposed by the present invention can be applied only to hierarchical groups.

본 발명은 계층집단들만을 대상으로 적용될 수 있는 SQL 함수들을 SQL의 기 존 집단함수들과 구분하기 위해 계층집단함수들(hierarchical aggregate functions)이라 하고 계층집단들만을 대상으로 적용되는 SQL 연산자를 계층집단연산자(hierarchical aggregate operator)라 한다.According to the present invention, hierarchical aggregate functions are used to distinguish SQL functions that can be applied only to hierarchical groups from the existing aggregate functions of SQL, and an SQL operator applied only to hierarchical groups. It is called a hierarchical aggregate operator.

본 문서는 재귀적 질의의 재귀적 결과투플들, 그 투플들이 형성하는 재귀적 결과투플 트리들, 그리고 계층집단함수인 XMLNEST를 적용하여 재귀적 결과투플들로부터 생성되는 XML 값을 나타내기 위하여 다음의 용어들을 사용한다.This document describes the recursive result tuples of recursive queries, the recursive result tuple trees they form, and the XML values generated from recursive result tuples by applying the hierarchical function XMLNEST. Use terms.

- 재귀적 질의의 재귀적 결과투플들로부터 구성한 재귀적 결과투플 트리들에서 각 트리의 모든 노드들에 해당하는 투플들의 집합을 하나의 투플가족(tuple family)이라 한다.In a recursive result tuple trees constructed from recursive result tuples of a recursive query, a set of tuples corresponding to all nodes of each tree is called a tuple family.

- 하나의 투플가족에 속하는 각 투플을 그 투플가족의 구성원 투플(member tuple)이라 한다.Each tuple in a tuple family is called a member tuple of that tuple family.

- 하나의 재귀적 결과투플 트리의 투플가족의 모든 구성원 투플들로써 생성한 하나의 재귀적 구조의 XML 값을 그 트리의 XML 값이라 한다.A recursive result tuple A XML value of a recursive structure created by all the member tuples of a tuple family of a tree is called the XML value of that tree.

예를 들어, 도 12(a)의 질의의 재귀적 결과투플들인 도 12(b)의 투플들은 도 17(a)의 트리와 도 17(b)의 트리를 재귀적 결과투플 트리들로 형성한다. 따라서 도 12(b)의 재귀적 결과투플들에서 도 17(a)의 트리를 구성하는 노드들에 해당하는 투플들인 employee_id가 10, 11, 13, 14, 15, 16, 17인 투플들이 하나의 투플가족을 형성하며 도 17(b)의 트리를 구성하는 노드들에 해당하는 투플들인 employee_id가 21, 23, 24인 투플들이 또 다른 하나의 투플가족을 형성한다.For example, the tuples of FIG. 12 (b), the recursive result tuples of the query of FIG. 12 (a), form the tree of FIG. 17 (a) and the tree of FIG. 17 (b) as recursive result tuple trees. . Therefore, in the recursive result tuples of FIG. 12 (b), tuples having employee_id of 10, 11, 13, 14, 15, 16, and 17, which are tuples corresponding to nodes constituting the tree of FIG. Tuples having employee_ids of 21, 23, and 24, which are tuples corresponding to nodes forming the tree of FIG. 17 (b), form a tuple family and form another tuple family.

도 17의 각 재귀적 결과투플 트리에 대하여 XML 값들을 다음과 같이 생성하 는 경우를 고려해 보자.Consider the case of generating XML values for each recursive result tuple tree of FIG. 17 as follows.

- 각 노드 Nk에 대하여 하나의 XML 엘리먼트 "EMPLOYEE"를 생성한다. 노드 Nk에 해당하는 투플을 투플 tk라 하자.Create one XML element "EMPLOYEE" for each node N k . Let tuple corresponding to node N k be tuple t k .

- XML 엘리먼트 "EMPLOYEE"는 속성으로 "id"를 가지며 자식 엘리먼트들로 "FIRSTNAME", "LASTNAME", 그리고 "SUBORDINATES"를 가진다.The XML element "EMPLOYEE" has "id" as an attribute and "FIRSTNAME", "LASTNAME" and "SUBORDINATES" as child elements.

- XML 엘리먼트 "EMPLOYEE"의 속성 "id"의 값을 투플 tk의 칼럼 employee_id의 값으로 생성한다.Create the value of the attribute "id" of the XML element "EMPLOYEE" as the value of the column employee_id of the tuple t k .

- XML 엘리먼트 "FIRSTNAME"의 텍스트 값과 XML 엘리먼트 "LASTNAME"의 텍스트 값을 투플 tk의 칼럼 first_name의 값과 칼럼 last_name의 값으로 각각 생성한다.Create a text value of the XML element "FIRSTNAME" and a text value of the XML element "LASTNAME" as the value of the column first_name of the tuple t k and the value of the column last_name, respectively.

- XML 엘리먼트 "SUBORDINATES"는 노드 Nk의 자식 노드들에 대해 생성한 모든 "EMPLOYEE" 엘리먼트들을 자식들로 가지며 그 자식 엘리먼트들의 문서 순서(document order)는 그 노드들을 왼쪽에서 오른쪽으로 나열한 순서이다.The XML element "SUBORDINATES" has all the "EMPLOYEE" elements created for the child nodes of node N k as children and the document order of those child elements is the order in which they are listed from left to right.

도 17의 재귀적 결과투플 트리들 각각에 대하여 위에서 기술한 하나의 XML 값을 계층집단함수인 XMLNEST를 이용하여 생성하고 그 XML 값과 함께 그 트리를 구성하는 투플가족의 평균 급여를 기존 집단함수인 AVG를 이용하여 구하는 경우를 고려해 보자.For each of the recursive result tuple trees of FIG. 17, one XML value described above is generated using the hierarchical group function XMLNEST, and the average salary of the tuple family constituting the tree together with the XML value is the existing group function. Consider the case of using AVG.

그 경우, XMLNEST와 AVG는 각 재귀적 결과투플 트리에 대해 적용되어야 한 다. XMLNEST와 AVG를 select 절에 포함한 재귀적 질의를 SQL:1999 표준의 문법을 기반으로 작성하면 그 질의는 도 26과 같다. SQL 함수 XMLNEST의 명세는 아직 제시되지 않았으므로 도 26에서 그 SQL 함수의 인자들은 생략되었다.In that case, XMLNEST and AVG should be applied to each recursive result tuple tree. If a recursive query including XMLNEST and AVG in a select clause is written based on the syntax of the SQL: 1999 standard, the query is as shown in FIG. Since the specification of the SQL function XMLNEST has not been presented yet, the arguments of the SQL function are omitted in FIG.

도 26에서 재귀적 질의의 마감 부질의의 select 절에 포함된 집단함수들은 도 17의 재귀적 결과투플 트리들 각각을 집단으로 처리함으로써 그 질의는 <xml_value, avg_salary>의 결과칼럼들로 구성된 두 개의 결과투플들을 생성한다. 도 27은 그 결과투플들을 나타낸다. 도 27의 두 개의 결과투플들 간의 순서는 임의로 구성된 것이다. 도 27의 결과칼럼 xml_value에서 XML 엘리먼트 "EMPLOYEE"들의 문서 순서는 도 17의 재귀적 결과투플 트리들의 노드들을 DFS로 방문한 순서이다.In FIG. 26, the group functions included in the select clause of the closing subquery of the recursive query process each of the recursive result tuple trees of FIG. 17 so that the query is composed of two result columns of <xml_value, avg_salary>. Generate result tuples. 27 shows the resulting tuples. The order between the two result tuples of FIG. 27 is arbitrarily constructed. The document order of the XML elements "EMPLOYEE" in the result column xml_value of FIG. 27 is the order of visiting the nodes of the recursive result tuple trees of FIG. 17 to DFS.

본 발명이 정의하는 계층집단함수 XMLNEST는 NEST_ROOT 엘리먼트, NEST_SUBORDINATE 엘리먼트, 그리고 NEST_ROOT 엘리먼트의 자식 엘리먼트들을 명시할 수 있게 하고 형제 NEST_ROOT 엘리먼트들 간의 순서를 그 함수에 명시할 수 있게 함으로써 재귀적 결과투플 트리에 대해 하나의 재귀적 구조의 XML 값을 생성할 수 있게 한다. 예를 들어, 도 27의 XML 값들에서 XML 엘리먼트 "EMPLOYEE"는 속성으로 "id"를 가지며 자식으로 하나씩의 "FIRSTNAME", "LASTNAME", 그리고 "SUBORDINATES" 엘리먼트들을 가진다. 엘리먼트 "SUBORDINATES"는 다수 개의 "EMPLOYEE" 엘리먼트들을 자식으로 가질 수 있다. 이를 XML 스키마 그래프로 표현하면 도 28과 같다. 도 28의 XML 스키마 그래프에서 노드 "EMPLOYEE"는 NEST_ROOT 노드이며 노드 "SUBORDINATES"는 NEST_SUBORDINATE 노드이다. 노드 "EMPLOYEE"와 노드 "SUBORDINATES" 그리고 그 노드들을 연결하는 에지들은 하나의 사이클을 형성 한다. 따라서 도 27의 결과칼럼 xml_value의 값들은 재귀적 구조의 XML 값들이다.The hierarchical group function XMLNEST defined by the present invention enables specifying the NEST_ROOT element, the NEST_SUBORDINATE element, and the child elements of the NEST_ROOT element, and the order between sibling NEST_ROOT elements in the function, thereby recursively. Allows you to create an XML value of a recursive structure. For example, in the XML values of FIG. 27, the XML element "EMPLOYEE" has "id" as an attribute and one "FIRSTNAME", "LASTNAME", and "SUBORDINATES" elements as children. The element "SUBORDINATES" can have multiple "EMPLOYEE" elements as children. This is expressed as an XML schema graph as shown in FIG. 28. In the XML schema graph of FIG. 28, node "EMPLOYEE" is a NEST_ROOT node and node "SUBORDINATES" is a NEST_SUBORDINATE node. Node "EMPLOYEE" and node "SUBORDINATES" and the edges connecting them form a cycle. Accordingly, the values of the result column xml_value of FIG. 27 are XML values of a recursive structure.

계층집단함수 XMLNEST가 생성하는 XML 값을 XML 스키마 그래프로 표현하면 그 XML 스키마 그래프는 다음의 특징을 가진다. 첫 째, 그 XML 스키마 그래프는 정확히(exactly) 하나의 사이클을 가진다. 둘 째, 그 XML 스키마 그래프는 NEST_ROOT 노드를 반드시 가지며 NEST_SUBORDINATE 노드를 선택적으로 가질 수 있다. 셋 째, NEST_SUBORDINATE 노드는 NEST_ROOT 노드 이외의 자식 노드들을 가지지 않는다. 따라서 XMLNEST는 재귀적 구조의 XML 값을 생성하기 위해 다음 사항들을 그 함수에 명시할 수 있게 한다.When the XML value generated by the hierarchical group function XMLNEST is expressed as an XML schema graph, the XML schema graph has the following characteristics. First, the XML schema graph has exactly one cycle. Second, the XML schema graph must have a NEST_ROOT node and can optionally have a NEST_SUBORDINATE node. Third, the NEST_SUBORDINATE node does not have child nodes other than the NEST_ROOT node. Therefore, XMLNEST allows you to specify the following to the function to generate an XML value of a recursive structure.

- NEST_ROOT 엘리먼트의 이름과 그 XML 엘리먼트의 XML 속성들.The name of the NEST_ROOT element and the XML attributes of that XML element.

- NEST_SUBORDINATE 엘리먼트의 이름과 그 XML 엘리먼트의 XML 속성들.The name of the NEST_SUBORDINATE element and the XML attributes of that XML element.

- NEST_ROOT 엘리먼트의 자식 엘리먼트들.Child elements of the NEST_ROOT element.

- 형제 NEST_ROOT 엘리먼트들 간의 정렬.Alignment between sibling NEST_ROOT elements.

예를 들어, 도 1의 테이블 employees를 대상으로 도 27의 XML 값들을 생성하기 위해 XMLNEST를 select 절에 포함한 질의를 Oracle의 문법을 기반으로 작성하면 그 질의는 도 29와 같다.For example, a query including XMLNEST in a select clause for generating XML values of FIG. 27 for the table employees of FIG. 1 is written based on Oracle's grammar, and the query is as shown in FIG.

도 29에서 XMLNEST의 인자들은 다음의 의미를 가진다.In FIG. 29, the arguments of XMLNEST have the following meanings.

- 첫 번째 인자인 "EMPLOYEE"는 NEST_ROOT 엘리먼트의 이름을 나타낸다.The first argument "EMPLOYEE" represents the name of the NEST_ROOT element.

- 두 번째 인자인 XMLATTRIBUTES(employee_id AS "id")는 XML 엘리먼트 "EMPLOYEE"의 속성 "id"의 값을 그 엘리먼트를 생성하게 한 투플의 칼럼 employee_id의 값으로 생성해야 함을 나타낸다.The second argument, XMLATTRIBUTES (employee_id AS "id"), indicates that the value of attribute "id" of the XML element "EMPLOYEE" should be created as the value of the column employee_id of the tuple that caused the element to be created.

- 세 번째 인자인 XMLELEMENT("FIRSTNAME", first_name)과 네 번째 인자인 XMLELEMENT("LASTNAME", last_name)은 NEST_ROOT 엘리먼트인 XML 엘리먼트 "EMPLOYEE"의 자식 엘리먼트들로서 "FIRSTNAME"과 "LASTNAME"을 생성해야 함을 각각 나타낸다. 그 자식 엘리먼트들 간의 순서는 그들이 명시된 순서이다.The third argument, XMLELEMENT ("FIRSTNAME", first_name) and the fourth argument, XMLELEMENT ("LASTNAME", last_name) are the child elements of the XML element "EMPLOYEE" which is the NEST_ROOT element, and must create "FIRSTNAME" and "LASTNAME". Respectively. The order between their child elements is the order in which they are specified.

- 다섯 번째 인자인 XMLNESTSPEC("SUBORDINATES") ORDER CHILDREN BY employee_id에서 XMLNESTSPEC은 NEST_SUBORDINATE 엘리먼트의 이름과 속성들을 명시하며 XMLNESTSPEC과 함께 명시된 ORDER CHILDREN BY 선택사양은 형제 NEST_ROOT 엘리먼트들 간의 정렬 기준을 나타낸다. 이 예의 경우, NEST_SUBORDINATE 엘리먼트의 이름은 "SUBORDINATES"가 되며 NEST_SUBORDINATE 엘리먼트의 자식 엘리먼트들로 생성되는 NEST_ROOT 엘리먼트들 간의 순서는 그 NEST_ROOT 엘리먼트들을 생성하게 한 투플들의 칼럼 employee_id의 칼럼값의 오름차순임을 나타낸다. 함수 XMLNESTSPEC이 명시된 위치는 NEST_ROOT 엘리먼트의 자식 엘리먼트로서 NEST_SUBORDINATE 엘리먼트의 위치를 나타낸다. 이 예의 경우, XMLELEMENT들을 통해 생성한 엘리먼트들인 "FIRSTNAME"과 "LASTNAME" 다음에 엘리먼트 "SUBORDINATES"가 위치한다.In the fifth argument, XMLNESTSPEC ("SUBORDINATES") ORDER CHILDREN BY employee_id, XMLNESTSPEC specifies the name and attributes of the NEST_SUBORDINATE element, and the ORDER CHILDREN BY option specified with XMLNESTSPEC indicates the sorting criteria among sibling NEST_ROOT elements. In this example, the name of the NEST_SUBORDINATE element is "SUBORDINATES" and the order between the NEST_ROOT elements created as child elements of the NEST_SUBORDINATE element indicates the ascending order of the column values of the column employee_id of the tuples that caused the NEST_ROOT elements to be created. The position where the function XMLNESTSPEC is specified indicates the position of the NEST_SUBORDINATE element as a child element of the NEST_ROOT element. In this example, the elements "SUBORDINATES" are placed after the "FIRSTNAME" and "LASTNAME" elements created via XMLELEMENTs.

계층집단함수 XMLNEST의 명세는 도 30과 같다. 도 30의 명세는 SQL/XML 표준의 표기 방법을 따른다. 참고로, 도 30의 명세에서 "["와 "]" 사이의 명세는 선택사양으로서 생략될 수 있음을 나타내며 "…" 표시는 그 표시 바로 앞에 표기된 명세가 무한히 반복될 수 있음을 나타낸다.The specification of the hierarchical group function XMLNEST is shown in FIG. The specification of FIG. 30 follows the notation method of the SQL / XML standard. For reference, in the specification of FIG. 30, the specification between "[" and "]" may be omitted as an option, and the "..." designation indicates that the specification indicated immediately before the display may be repeated indefinitely.

도 30의 XMLNEST 명세에서 (1) <XML nest_root element spec>은 NEST_ROOT 엘리먼트의 이름과 그 엘리먼트의 XML 이름공간에 대한 명세, 그리고 그 엘리먼트의 XML 속성들 이며, (2) <XML element content>들은 NEST_SUBORDINATE 엘리먼트를 제외한 NEST_ROOT 엘리먼트의 자식 엘리먼트들에 대한 명세이며, (3) <XML nest_subordinate element spec>은 NEST_SUBORDINATE 엘리먼트의 이름과 선택사양, 그 엘리먼트의 XML 속성들, 그리고 NEST_SUBORDINATE 엘리먼트의 자식들로 생성되는 NEST_ROOT 엘리먼트들 간의 정렬에 대한 명세이다.In the XMLNEST specification of FIG. 30, (1) <XML nest_root element spec> is a name of the NEST_ROOT element, a specification of the XML namespace of the element, and XML attributes of the element, and (2) <XML element content> is NEST_SUBORDINATE. (3) The <XML nest_subordinate element spec> element specifies the name and options of the NEST_SUBORDINATE element, the XML attributes of the element, and the NEST_ROOT element created as children of the NEST_SUBORDINATE element. This is a specification of the alignment between them.

도 30의 XMLNEST의 명세에서 <XML element name>, <XML namespace declaration>, <XML attributes>, <XML element content>, 그리고 <sort specification list>의 명세는 그들에 대한 SQL/XML의 명세와 동일하다. 참고로, 재귀적 임시 결과투플 트리의 최대 깊이를 제한하는 기능은 재귀적 질의 자체에서 제공될 수 있으므로 도 30의 XMLNEST의 명세는 그와 관련된 명세를 별도로 포함하지 않는다.In the specification of XMLNEST in FIG. 30, the specifications of <XML element name>, <XML namespace declaration>, <XML attributes>, <XML element content>, and <sort specification list> are the same as those of SQL / XML for them. . For reference, since the function of limiting the maximum depth of the recursive temporal result tuple tree may be provided in the recursive query itself, the specification of XMLNEST of FIG. 30 does not include the specification related thereto.

<XML nest_subordinate element spec>에 의해 명세되는 속성들의 의미는 다음과 같다.The meanings of the attributes specified by <XML nest_subordinate element spec> are as follows.

- <XML element name>은 NEST_SUBORDINATE 엘리먼트의 이름을 의미한다. NEST_SUBORDINATE 엘리먼트의 이름은 명시되지 않을 수 있다. NEST_SUBORDINATE 엘리먼트의 이름이 명시되지 않은 경우, NEST_SUBORDINATE 엘리먼트를 생성하지 않으며 재귀적 결과투플 트리에서 비단말(non-terminal) 노드를 위해 생성되는 NEST_ROOT 엘리먼트는 그 노드의 자식 노드들을 위해 생성된 NEST_ROOT 엘리먼트들을 그 엘리먼트의 자식 엘리먼트들로 가진다.<XML element name> represents the name of the NEST_SUBORDINATE element. The name of the NEST_SUBORDINATE element may not be specified. If the name of the NEST_SUBORDINATE element is not specified, it does not create a NEST_SUBORDINATE element, and a NEST_ROOT element that is created for a non-terminal node in the recursive result tuple tree uses the NEST_ROOT elements created for the child nodes of that node. Have as child elements of the element.

- <XML nest_subordinate element option>으로 "OPTIONAL" 또는 "MANDATORY"가 명시될 수 있다. 디폴트(default)는 "MANDATORY"이다. "MANDATORY"는 모든 NEST_ROOT 엘리먼트들이 NEST_SUBORDINATE 엘리먼트를 가짐을 의미하며, "OPTIONAL"은 NEST_ROOT 엘리먼트를 후손으로 가지지 않는 NEST_ROOT 엘리먼트는 NEST_SUBORDINATE 엘리먼트를 가지지 않음을 의미한다."OPTIONAL" or "MANDATORY" may be specified as an <XML nest_subordinate element option>. The default is "MANDATORY". "MANDATORY" means that all NEST_ROOT elements have a NEST_SUBORDINATE element, and "OPTIONAL" means that a NEST_ROOT element that does not have a NEST_ROOT element as a descendant does not have a NEST_SUBORDINATE element.

- <XML attributes>는 NEST_SUBORDINATE 엘리먼트의 XML 속성들을 명시한다.<XML attributes> specifies the XML attributes of the NEST_SUBORDINATE element.

- ORDER CHILDREN BY 선택사양은 형제 NEST_ROOT 엘리먼트들 사이의 정렬 기준을 명시한다.The ORDER CHILDREN BY option specifies the sorting criteria between sibling NEST_ROOT elements.

예를 들어, 도 27의 XML 값들에서 NEST_SUBORDINATE 엘리먼트인 엘리먼트 "SUBORDINATES"의 XML 속성으로 해당 사원의 부서번호를 나타내는 dept_id를 가지게 하려면 도 29의 질의에 명시된 함수 XMLNEST의 XMLNESTSPEC에 XMLATTRIBUTES(department_id AS "dept_id")를 추가함으로써 "XMLNESTSPEC("SUBORDINATES", XMLATTRIBUTES(department_id AS "dept_id")) ORDER CHILDREN BY employee_id"로 수정하면 된다. 따라서 XMLATTRIBUTES를 인자로 가질 수 있는 함수들로는 기존 SQL/XML 출판 함수들 중에는 XMLELEMENT가 유일하며 XMLNEST와 XMLNEST의 인자인 XMLNESTSPEC이 추가된다.For example, to have dept_id indicating the department number of the employee as the XML attribute of the element "SUBORDINATES" which is the NEST_SUBORDINATE element in the XML values of FIG. 27, XMLATTRIBUTES (department_id AS "dept_id" in XMLNESTSPEC of the function XMLNEST specified in the query of FIG. ) By modifying "XMLNESTSPEC (" SUBORDINATES ", XMLATTRIBUTES (department_id AS" dept_id ")) ORDER CHILDREN BY employee_id". Therefore, among the existing SQL / XML publishing functions, XMLELEMENT is the only function that can take XMLATTRIBUTES as an argument, and XMLNEST and XMLNESTSPEC, which are the arguments of XMLNEST, are added.

본 발명이 제시하는 계층집단함수 XMLNEST는 재귀적 질의에 사용될 경우에만 유효하다. 그 이유는 재귀적 결과투플 트리들의 구조와 그 트리들을 구성하는 노드들에 해당하는 재귀적 결과투플들의 내용을 XML 값으로 생성하는 것이 XMLNEST의 기능이기 때문이며 XMLNEST가 SQL의 기존 집단함수들과 기존 SQL/XML 출판 함수들 에 미치는 영향이 크기 때문에 그 함수가 사용될 수 있는 질의를 재귀적 질의로 한정하여 그 영향을 최소화하기 위함이다. 따라서 XMLNEST를 포함한 SQL 질의의 처리 흐름은 도 31과 같다.The hierarchical group function XMLNEST proposed by the present invention is valid only when used in a recursive query. The reason is that XMLNEST is a function of XMLNEST that generates the structure of recursive result tuple trees and the contents of recursive result tuples corresponding to the nodes constituting the trees as XML values. Because the impact on / XML publishing functions is large, it is to limit the query to which the function can be used to recursive queries to minimize the effects. Therefore, the processing flow of the SQL query including XMLNEST is shown in FIG. 31.

계층집단함수인 XMLNEST와 SQL의 기존 집단함수들 그리고 기존 SQL/XML 출판 함수들의 관계는 다음과 같다.The relationship between the hierarchical group function XMLNEST, the existing group functions of SQL, and the existing SQL / XML publishing functions is as follows.

관계_1. XMLNEST와 SQL의 기존 집단함수들의 관계.Relationship_1. Relationship between XMLNEST and existing aggregate functions in SQL.

SQL은 select 문의 group by 절에 집단 속성들(grouping attributes)을 기술할 수 있게 하여 그 칼럼들의 값으로 투플들의 집단들을 형성할 수 있게 하며, 형성된 각 집단의 투플들에 적용할 집단함수들로서 SUM, COUNT, AVG, MIN, MAX, 그리고 XMLAGG를 제공한다.SQL allows grouping attributes to be described in the group by clause of the select statement, allowing the formation of groups of tuples with the values of those columns, and SUM, Provides COUNT, AVG, MIN, MAX, and XMLAGG.

SQL의 기존 집단함수들인 SUM, COUNT, AVG, MIN, MAX, 그리고 XMLAGG가 재귀적 질의에 사용될 경우, 그 집단함수들이 대상으로 하는 집단들은 그 집단함수들이 일반 SQL 질의에 사용될 경우와 동일하게 형성된다. 즉, 그 집단함수들이 대상으로 하는 집단들은 동치집단들이다.When SQL's existing aggregate functions SUM, COUNT, AVG, MIN, MAX, and XMLAGG are used for recursive queries, the populations they target are formed the same as when they are used in regular SQL queries. . That is, the groups targeted by the group functions are equivalent groups.

본 발명이 제시하는 XMLNEST는 하나의 "루트유지 독자환생"의 재귀적 결과투플 트리를 구성하는 투플가족을 하나의 집단으로 처리하는 계층집단함수이기 때문에 그 함수를 select 절에 포함한 부질의에 group by 절이 포함된 경우에는 의미상으로 충돌이 발생한다. 따라서 SQL 함수 XMLNEST를 포함한 select 절과 group by 절은 하나의 부질의에 함께 사용되지 않아야 한다.XMLNEST proposed by the present invention is a hierarchical group function that processes a tuple family constituting a recursive result tuple tree of a single "root-maintained reincarnation" into a group, so that group by subquery including the function in a select clause. If a clause is included, there is a semantically conflict. Therefore, the select clause and group by clause including the SQL function XMLNEST should not be used together in one subquery.

SQL의 기존 집단함수들은 XMLNEST와 함께 동일 부질의의 select 절에 명시될 수 있다. 그 경우 즉, 계층집단함수 XMLNEST가 명시된 select 절에 함께 명시된 SQL의 기존 집단함수들의 의미는 기존 의미와 동일하다. 그러나 그 기존 집단함수들은 그 질의의 재귀적 결과투플들을 그들의 기원 투플들에 해당하는 노드들이 소속된 재귀적 임시 결과투플 트리별로 분류하여 하나 이상의 재귀적 결과투플을 구성원으로 가지는 각 분류의 모든 재귀적 결과투플들을 하나의 집단 즉, 하나의 계층집단으로 처리하여야 한다.Existing aggregate functions in SQL can be specified in the select clause of the same subquery with XMLNEST. In that case, the semantics of the existing aggregate functions of SQL specified together with the select clause with the hierarchical group function XMLNEST are the same as the existing ones. However, the existing group functions classify the recursive result tuples of the query by the recursive temporary result tuple tree to which the nodes corresponding to their origin tuples belong, and all recursive results tuples of each classification having one or more recursive result tuples as members. The result tuples should be treated as one group, one hierarchy.

계층집단함수 XMLNEST와 함께 SQL의 기존 집단함수 AVG를 재귀적 질의의 select 절에 사용한 예는 도 26의 질의에서 간략히 소개하였다. SQL의 나머지 기존 집단함수들 또한 그 재귀적 질의의 select 절에 사용되는 경우를 고려해 보자. 예를 들어, 도 27의 결과투플들이 결과 칼럼들로서 xml_value와 avg_salary뿐만 아니라 MIN(salary)로써 생성한 min_salary, MAX(salary)로써 생성한 max_salary, COUNT(*)로써 생성한 tuple_cnt, 그리고 XMLAGG(XMLELEMENT("DEPTID", department_id))로써 생성한 dept_id_xml의 결과칼럼들을 추가로 가지도록 XMLNEST와 SQL의 기존 집단함수들을 이용한 질의를 SQL:1999 표준의 문법을 기반으로 작성하면 그 질의는 도 32와 같다.An example of using the existing group function AVG of SQL together with the hierarchical group function XMLNEST in the select clause of a recursive query is briefly introduced in the query of FIG. 26. Consider the case where the rest of the existing aggregate functions in SQL are also used in the select clause of the recursive query. For example, the result tuples of FIG. 27 are not only xml_value and avg_salary as result columns, but also min_salary generated by MIN (salary), max_salary generated by MAX (salary), tuple_cnt generated by COUNT (*), and XMLAGG (XMLELEMENT ( The query using XMLNEST and SQL's existing aggregate functions to have additional columns of dept_id_xml generated as "DEPTID", department_id)) is created based on the syntax of the SQL: 1999 standard.

도 32의 재귀적 질의를 도 1의 테이블 employees를 대상으로 평가할 경우, 그 질의의 재귀적 결과투플들은 도 17의 트리들과 동일한 재귀적 결과투플 트리들을 형성한다. 따라서 도 32의 질의는 두 개의 결과투플들을 도 33과 같이 생성한다. 도 33에서 결과투플들의 순서는 임의로 구성된 것이다. 도 33의 결과칼럼 xml_val에서 생략된 부분은 도 27의 XML 값들과 동일하다.If the recursive query of FIG. 32 is evaluated against the table employees of FIG. 1, the recursive result tuples of the query form the same recursive result tuple trees as the trees of FIG. Therefore, the query of FIG. 32 generates two result tuples as shown in FIG. 33. The order of the result tuples in Figure 33 is arbitrarily configured. Parts omitted from the result column xml_val of FIG. 33 are the same as the XML values of FIG. 27.

XMLAGG가 XMLNEST와 동일 부질의에 사용될 경우, XMLAGG가 대상으로 하는 집단들은 계층집단들이며 동일 계층집단에 소속된 재귀적 결과투플들 간의 순서는 XMLAGG에 order by 선택사양이 명시되면 그 선택사양의 정렬 기준을 따르지만 XMLAGG에 그 선택사양이 명시되지 않으면 그 재귀적 결과투플들에 해당하는 노드들이 형성하는 재귀적 결과투플 트리를 DFS로 방문하는 순서와 동일하여야 한다.When XMLAGG is used in the same subquery as XMLNEST, the groups targeted by XMLAGG are hierarchical groups, and the order between the recursive result tuples belonging to the same hierarchical group is the order by which the order by option is specified in XMLAGG. However, if the option is not specified in XMLAGG, the recursive result tuple tree formed by the nodes corresponding to the recursive result tuples should be the same as the order of visiting DFS.

도 32의 재귀적 질의에 명시된 XMLAGG는 order by 선택사양을 가지지 않는다. 따라서 도 33의 결과칼럼 dept_id_xml의 칼럼값들에서 각 칼럼값을 구성하는 XML 엘리먼트들인 "DEPTID"들의 순서는 그 엘리먼트들을 생성하게 한 재귀적 결과투플들에 해당하는 도 17의 노드들을 DFS로 방문한 순서와 동일하다.The XMLAGG specified in the recursive query of FIG. 32 does not have an order by option. Accordingly, the order of the XML elements constituting each column value of the "DEPTIDs" in the column values of the result column dept_id_xml of FIG. 33 is the order of visiting the nodes of FIG. 17 corresponding to the recursive result tuples that caused the elements to be generated. Is the same as

본 발명은 집단함수를 직간접 인자로 가지는 집단함수의 처리에 관한 한 DB2와 SQL Server의 처리 방식을 따른다. 즉, "하나의 부질의에서 하나의 집단함수 또는 집단연산자는 임의의 집단함수 또는 집단연산자를 직간접 인자로 가질 수 없다"라는 명제(命題, proposition)하에 계층집단함수 XMLNEST와 SQL의 기존 집단함수들의 인자 관계를 다음과 같이 설정한다. (1) 계층집단함수 XMLNEST는 직간접 인자로 SUM, COUNT, AVG, MIN, MAX 등의 SQL의 기존 집단함수들과 SQL/XML 출판 함수이며 SQL의 기존 집단함수인 XMLAGG를 가질 수 없으며 (2) XMLNEST는 XMLAGG의 직간접 인자로 사용될 수 없다.The present invention follows the processing methods of DB2 and SQL Server as far as the processing of a collection function having a collection function as a direct or indirect factor. That is, under the proposition of "one group function or group operator in a subquery cannot have any group function or group operator as a direct or indirect argument", the existing group functions of the hierarchical group functions XMLNEST and SQL Set the argument relationship as follows: (1) The hierarchical group function XMLNEST is a direct and indirect argument, and existing SQL functions such as SUM, COUNT, AVG, MIN, and MAX, SQL / XML publishing functions, and cannot have XMLAGG, which is an existing group function of SQL, and (2) XMLNEST Cannot be used as a direct or indirect argument to XMLAGG.

관계_2. XMLNEST의 직간접 인자로 사용 가능한 SQL/XML 출판 함수들.Relationship_2. SQL / XML publishing functions that can be used as direct and indirect arguments to XMLNEST.

XMLNEST의 인자로 사용 가능한 SQL/XML 출판 함수들은 하나의 투플에 적용되어 XML 값들을 생성할 수 있어야 한다. SQL/XML 출판 함수 XMLELEMENT, XMLCONCAT, XMLFOREST, 그리고 XMLATTRIBUTES는 하나의 투플에 적용될 수 있는 함수들이다. 따라서 그 함수들은 XMLNEST의 인자로 사용될 수 있다.SQL / XML publishing functions that can be used as arguments to XMLNEST must be applied to a tuple to generate XML values. SQL / XML publishing functions XMLELEMENT, XMLCONCAT, XMLFOREST, and XMLATTRIBUTES are functions that can be applied to a tuple. Thus they can be used as arguments to XMLNEST.

관계_3. XMLNEST를 직간접 인자로 가질 수 있는 SQL/XML 출판 함수들.Relationship_3. SQL / XML publishing functions that can take XMLNEST as a direct or indirect argument.

SQL/XML 출판 함수 XMLELEMENT, XMLCONCAT, 그리고 XMLFOREST는 XML 값을 반환하는 함수들을 인자들로 가질 수 있다. 따라서 그 함수들은 XMLNEST를 인자로 가질 수 있다. XMLNEST를 인자로 가지는 XMLELEMENT, XMLCONCAT, XMLFOREST는 XMLNEST가 하나의 재귀적 결과투플 트리마다 반환하는 하나의 XML 값을 입력으로 새로운 하나의 XML 값을 생성해야 한다.The SQL / XML publishing functions XMLELEMENT, XMLCONCAT, and XMLFOREST can take as arguments functions that return an XML value. Thus, they can take XMLNEST as an argument. XMLELEMENT, XMLCONCAT, and XMLFOREST with XMLNEST as arguments must generate a new XML value with one XML value that XMLNEST returns for each recursive result tuple tree.

XMLNEST가 XMLELEMENT의 인자로 사용되는 예를 고려해 보자.Consider the example where XMLNEST is used as an argument of XMLELEMENT.

예제 7. 도 1의 테이블 employees를 대상으로 상사를 가지지 않는 각 사원에 대하여 그 사원과 그 사원의 모든 직간접 부하사원들의 사원번호와 이름을 이용하여 하나의 재귀적 구조의 XML 값을 생성하고 그 XML 값을 엘리먼트 "HIERARCHY"의 자식 엘리먼트로 구성한 XML 값을 하나의 결과투플로 출력하시오. Example 7. For each employee who does not have a boss for the table employees in Figure 1, create an XML value of a recursive structure using the employee number and name of the employee and all direct and indirect subordinates of that employee. Output an XML value consisting of the value as a child element of the element "HIERARCHY" as a result tuple.

예제 7을 위해 Oracle의 문법을 기반으로 작성한 질의는 도 34와 같다. 도 34의 질의에서 XMLNEST는 그 질의의 재귀적 결과투플들이 형성하는 도 17의 재귀적 결과투플 트리들 각각에 대해 하나의 XML 값을 생성하며 XMLELEMENT는 그 XML 값들 각각을 입력으로 새로운 XML 값을 생성한다. 따라서 그 질의는 두 개의 결과투플들을 도 35와 같이 생성한다. 도 35의 결과투플들에서 그들 간의 순서는 임의로 구성된 것이다. 도 35의 XML 값들에서 생략된 부분은 도 27의 XML 값들과 동일하다.The query created based on Oracle's syntax for Example 7 is shown in FIG. In the query of FIG. 34, XMLNEST generates one XML value for each of the recursive result tuple trees of FIG. 17 formed by the recursive result tuples of the query, and XMLELEMENT creates a new XML value by inputting each of the XML values. do. Therefore, the query generates two result tuples as shown in FIG. The order between them in the result tuples of FIG. 35 is arbitrarily constructed. Parts omitted from the XML values in FIG. 35 are the same as the XML values in FIG. 27.

XMLNEST가 XMLCONCAT의 인자로 사용되는 예를 고려해 보자.Consider the example where XMLNEST is used as an argument of XMLCONCAT.

예제 8. 도 1의 테이블 employees를 대상으로 상사를 가지지 않는 각 사원에 대하여 그 사원과 그 사원의 모든 직간접 부하사원들의 투플들의 집합을 X라 할 때, <집합 X의 투플들의 칼럼 employee, 칼럼 first_name, 그리고 칼럼 last_name의 칼럼값으로써 그 투플들 간의 상사-부하 관계를 따라 생성한 하나의 재귀적 구조의 XML 값, 집합 X의 모든 투플들의 칼럼 salary의 칼럼값의 합을 이용하여 생성한 하나의 XML 값>의 쌍을 연결하여 생성한 하나의 XML 값을 하나의 결과투플로 구성하여 출력하시오. Example 8. For each employee who does not have a boss for the table employees in FIG. 1, a set of tuples of that employee and all direct and indirect subordinates of that employee is X. <column of tuples of set X, column first_name And a single XML generated using the sum of the column values of the column salary of all tuples of the set X and the recursive XML values generated along the similarity-load relationship between the tuples as the column values of the column last_name. Output one XML value created by concatenating pairs of values> with one result tuple.

예제 8을 위해 Oracle의 문법을 기반으로 작성한 질의는 도 36과 같다. 도 36의 질의에서 XMLNEST와 SUM을 인자로 가지는 XMLELEMENT는 그 질의의 재귀적 결과투플들이 형성하는 도 17의 재귀적 결과투플 트리들 각각에 대해 하나씩의 XML 값을 생성하며 XMLCONCAT은 그 XML 값들을 연결하여 새로운 XML 값을 생성한다. 따라서 그 질의는 두 개의 결과투플들을 도 37과 같이 생성한다. 도 37에서 결과투플들의 순서는 임의로 구성된 것이다. 도 37의 XML 값들에서 생략된 부분은 도 27의 XML 값들과 동일하다.The query created based on Oracle's syntax for Example 8 is shown in FIG. In the query of FIG. 36, XMLELEMENT having XMLNEST and SUM as arguments generates one XML value for each of the recursive result tuple trees of FIG. 17 formed by the recursive result tuples of the query, and XMLCONCAT concatenates the XML values. To generate a new XML value. Therefore, the query generates two result tuples as shown in FIG. The order of the result tuples in Figure 37 is arbitrarily configured. Parts omitted from the XML values in FIG. 37 are the same as the XML values in FIG. 27.

XMLNEST가 XMLFOREST의 입력 인자로 사용되는 예를 고려해 보자. 예제 8을 위한 질의를 XMLCONCAT을 대신하여 XMLFOREST를 이용하여 작성할 경우, 그 질의는 도 38과 같다.Consider the example where XMLNEST is used as an input argument to XMLFOREST. When the query for Example 8 is written using XMLFOREST instead of XMLCONCAT, the query is as shown in FIG.

도 38의 질의에서 XMLFOREST는 XMLNEST와 SUM을 인자로 가지는 XMLELEMENT가 그 질의의 재귀적 결과투플들이 형성하는 도 17의 재귀적 결과투플 트리들 각각에 대해 반환하는 XML 값들을 XML 엘리먼트 "HIERARCHY"와 XML 엘리먼트 "PAYMENT"의 내용으로 각각 구성하여 연결함으로써 하나의 XML 값으로 생성하여 반환한다. 따라서 그 질의는 두 개의 결과투플들을 도 39와 같이 생성한다. 도 39에서 결과투플들 간의 순서는 임의로 구성한 것이다. 도 39의 XML 값들에서 생략된 부분은 도 27의 XML 값들과 동일하다.In the query of FIG. 38, XMLFOREST specifies XML values returned by XMLELEMENT with XMLNEST and SUM as arguments for each of the recursive result tuple trees of FIG. 17 formed by the recursive result tuples of the query, and the XML elements "HIERARCHY" and XML. Create and return an XML value by constructing and concatenating the contents of the element "PAYMENT". Therefore, the query generates two result tuples as shown in FIG. In FIG. 39, the order between the result tuples is arbitrarily configured. Parts omitted from the XML values of FIG. 39 are the same as the XML values of FIG. 27.

예제 9. 도 1의 테이블 employees를 대상으로 상사를 가지지 않는 각 사원에 대하여 그 사원과 그 사원의 모든 직간접 부하사원들의 집합을 X라 할 때, (1) 집합 X에 속한 사원들의 연결 관계를 반영하는 재귀적 구조의 XML 값, (2) 집합 X에 속한 사원들의 급여의 합계, 급여의 평균, 수(數), 그리고 (3) 집합 X에 속한 사원들의 급여의 최대값과 최소값을 하나의 결과투플로 출력하시오. 단, 급여가 32000 미만이거나 급여가 38000 이상이고 52800 이하의 범위에 속하는 사원들만이 각 집합에 포함되도록 하시오. Example 9. For each employee who does not have a supervisor for the table employees of FIG. 1, the set of the employee and all the direct and indirect subordinates of the employee is X. (1) Reflects the connection of the employees of the set X. XML value of the recursive structure, (2) sum of salaries of employees in set X, average of salaries, number, and (3) maximum and minimum salaries of employees in set X. Print two to one. However, make sure that only those employees whose salary is less than 32000 or whose salary is above 38000 and in the range below 52800 are included in each set.

예제 9를 위한 질의를 Oracle의 문법을 기반으로 작성하면 그 질의는 도 40과 같다. 도 40의 재귀적 질의의 재귀적 임시 결과투플들에 해당하는 노드들은 도 17의 재귀적 임시 결과투플 트리들을 형성한다. 도 40의 재귀적 임시 결과투플 선택 조건인 "salary < 32000 OR (salary >= 38000 AND salary <= 52800)"에 의해 employee_id가 11인 노드, 13인 노드, 그리고 14인 노드가 도 17의 재귀적 임시 결과투플 트리들에서 삭제된다. 따라서 도 17(a)의 재귀적 임시 결과투플 트리로부터 employee_id가 10인 노드와 17인 노드를 루트들로 가지는 두 개의 재귀적 결과투플 트리들이 형성되고 도 17(b)의 재귀적 임시 결과투플 트리로부터 그 트리와 동일한 재귀적 결과투플 트리가 형성된다. 이를 도식화하면 도 41과 같다.If the query for Example 9 is written based on Oracle's syntax, the query is as shown in FIG. The nodes corresponding to the recursive temporary result tuples of the recursive query of FIG. 40 form the recursive temporary result tuple trees of FIG. 17. The node with employee_id of 11, the node of 13, and the node of 14 are recursively of FIG. 17 according to the recursive temporary result tuple selection condition of FIG. 40. It is deleted from the temporary result tuple trees. Therefore, two recursive result tuple trees are formed from the recursive temporary result tuple tree of FIG. From this a recursive result tuple tree identical to that tree is formed. This is illustrated in FIG. 41.

도 41에서 employee_id가 10인 노드와 21인 노드를 루트들로 가지는 재귀적 결과투플 트리들은 "루트유지" 재귀적 결과투플 트리들이지만 employee_id가 17인 노드를 루트로 가지는 재귀적 결과투플 트리는 "루트유지" 재귀적 결과투플 트리가 아니다. 도 41에서 employee_id가 21인 노드를 루트로 가지는 재귀적 결과투플 트리는 "독자환생" 재귀적 결과투플 트리이지만 employee_id가 10인 노드와 17인 노드를 루트들로 가지는 재귀적 결과투플 트리들은 "독자환생" 재귀적 결과투플 트리들이 아니다. SQL 함수 XMLNEST는 그 함수가 사용된 부질의의 재귀적 결과투플들에 해당하는 노드들이 형성하는 모든 재귀적 결과투플 트리들이 "루트유지 독자환생"인 경우에 한하여 의미를 가지므로 도 40의 재귀적 질의에 사용된 XMLNEST는 오류를 반환한다. 이는 그 질의에 사용된 나머지 집단함수들은 정상적으로 처리될 수 있음에도 불구하고 그 질의는 오류를 반환함을 의미한다.In FIG. 41, the recursive result tuple trees having a node having an employee_id of 10 and a node having roots are "root maintaining" recursive result tuple trees, but a recursive result tuple tree having a node having an employee_id of 17 as the root is "root". Maintain "recursive result is not a tuple tree. In FIG. 41, a recursive result tuple tree having a node having an employee_id of 21 as a root is a "reading reincarnation" recursive result tuple tree, but a recursive result tuple tree having a node having an employee_id of 10 and a node having roots has a "reading reincarnation". "Recursive results are not tuple trees. The SQL function XMLNEST is meaningful only when all the recursive result tuple trees formed by nodes corresponding to the recursive result tuples of the subquery in which the function is used are "root-maintained reincarnation". XMLNEST used in the query returns an error. This means that the query returns an error even though the rest of the aggregate functions used in the query can be processed normally.

본 발명은 계층집단함수 XMLNEST에 추가하여 XMLNEST의 직간접 인자로만 사용될 수 있는 계층집단함수들인 NEST_SUM, NEST_COUNT, NEST_AVG, NEST_MIN, 그리고 NEST_MAX를 제시한다. 본 발명에서는 이 다섯 가지의 계층집단함수들을 특별히 XMLNEST 관련함수들(XMLNEST-related functions)이라 한다. XMLNEST 관련함수들은 XMLNEST의 인자로 사용되거나 XMLNEST의 인자로 사용된 SQL 함수들의 인자로 사용되는 경우에만 의미를 가진다. 그렇지 않은 경우, XMLNEST 관련함수들을 포함한 질의는 오류를 반환한다. XMLNEST 관련함수들은 재귀적 결과투플 트리의 노드들 각각에 대해 그 노드를 루트로 가지는 서브트리의 모든 노드들에 해당하는 재귀적 결과투플들을 하나의 집단으로 처리함으로써 그들 각 집단에 대해 그 함수들의 인자로 명시된 값 표현식의 값을 계산하여 그 값을 그 집단을 대표하는 루트 노드에 해당하는 재귀적 결과투플에게 반환한다. The present invention proposes NEST_SUM, NEST_COUNT, NEST_AVG, NEST_MIN, and NEST_MAX, which are hierarchical group functions that can be used only as direct and indirect arguments of XMLNEST, in addition to the hierarchical group function XMLNEST. In the present invention, these five hierarchical group functions are specifically called XMLNEST-related functions. XMLNEST related functions are meaningful only when used as arguments to XMLNEST or as arguments to SQL functions used as arguments to XMLNEST. Otherwise, queries containing XMLNEST related functions return an error. The XMLNEST related functions provide a function for each group of recursive result tuple trees by processing the recursive result tuples corresponding to all nodes of the subtree rooted at that node as a group. Calculates the value of the value expression specified by and returns the value to the recursive result tuple corresponding to the root node representing the group.

구체적으로, 이들 XMLNEST 관련함수들은 각 재귀적 결과투플이 특정 재귀적 결과투플 트리의 하나의 서브트리의 루트 노드에 해당하기 때문에 각 재귀적 결과투플에 해당하는 노드를 루트로 하는 서브트리의 모든 노드들에 해당하는 재귀적 결과투플들로 형성된 하나의 집단을 처리대상으로 삼고, 함수의 인자로 명시된 값 표현식을 기준으로 하여, 그 값 표현식을 그 집단의 재귀적 결과투플들 각각에게 적용하여 함수값을 산출한다. 구체적으로, NEST_SUM 함수는 해당 집단의 재귀적 결과투플들 각각에 함수 인자로 표시된 값 표현식을 적용하여 구한 값들의 합을 산출한다. NEST_COUNT함수는 해당 집단의 재귀적 결과투플들 중 그 값 표현식의 값이 NULL이 아닌 투플들의 수를 산출한다. NEST_AVG 함수는 그의 값 표현식을 그 집단의 재귀적 결과투플들 각각에게 적용하여 구한 값들의 평균값을 산출한다. NEST_MIN 함수와 NEST_MAX 함수는 그 값 표현식을 그 집단의 재귀적 결과투플들 각각에게 적용하여 구한 값들 중 최소값과 최대값을 각각 산출한다. 이들 XMLNEST 관련함수들은 산출한 값을 그 집단을 대표하는 루트 노드에 해당하는 재귀적 결과투플에게 반환함으로써 재귀적 결과투플들 각각에게 하나의 집단값을 반환하게 되는 것이다. Specifically, these XMLNEST related functions are all nodes of the subtree rooted at the node corresponding to each recursive result tuple because each recursive result tuple corresponds to the root node of one subtree of a particular recursive result tuple tree. A group consisting of recursive result tuples corresponding to one of these fields is processed, and the value expression is applied to each of the recursive result tuples of the group based on the value expression specified as a function argument. To calculate. Specifically, the NEST_SUM function calculates the sum of values obtained by applying a value expression indicated as a function argument to each of the group's recursive result tuples. The NEST_COUNT function calculates the number of tuples whose value expression is not NULL among the recursive result tuples of the group. The NEST_AVG function applies its value expression to each of the group's recursive result tuples to produce an average of the values found. The NEST_MIN and NEST_MAX functions apply the value expression to each of the group's recursive result tuples to produce the minimum and maximum values, respectively. These XMLNEST related functions return a calculated value to each recursive result tuple by returning the calculated value to the recursive result tuple corresponding to the root node representing the group.

XMLNEST 관련함수들은 SQL의 분석함수(analytic function)들과 다르다. 그 이유는 후자의 경우, 사용자에 의해 설정된 임의의 기준에 따라 투플들을 분할(分割, partition)하고 각 분할의 투플들 각각에 대해 이미 처리된 그 분할 내의 투플 들의 누적값(cumulative value)과 그 투플을 이용하여 계산한 값을 반환하기 때문이다.The XMLNEST related functions are different from the analytic functions of SQL. The reason is that in the latter case, the tuples are partitioned according to any criteria set by the user, and the cumulative value of the tuples in the partition already processed for each of the tuples in each division and the tuples This is because it returns a value calculated using.

재귀적 결과투플들이 형성하는 재귀적 결과투플 트리들의 서브트리들의 수는 그 재귀적 결과투플들의 수와 동일하며 재귀적 결과투플들 각각은 하나의 서브트리의 루트 노드에 해당한다. 이는 XMLNEST 관련함수들은 재귀적 결과투플 트리의 하나의 서브트리에 의해 형성되는 하나의 계층집단에 대해 하나의 값을 반환함으로써 재귀적 결과투플들 각각에 대해 하나의 값을 반환하게 됨을 의미한다. XMLNEST 관련함수들은 항상 재귀적 결과투플들 각각에 대해 하나의 값을 반환하게 된다는 점에서 SQL의 기존 집단함수들과 구분된다.The number of subtrees of the recursive result tuple trees formed by the recursive result tuples is equal to the number of recursive result tuples, and each of the recursive result tuples corresponds to the root node of one subtree. This means that XMLNEST related functions return one value for each recursive result tuple by returning one value for one hierarchical group formed by one subtree of the recursive result tuple tree. XMLNEST related functions are distinguished from SQL's existing aggregate functions in that they always return a value for each recursive result tuple.

XMLNEST 관련함수들 각각의 명세와 의미는 그 함수의 접두사(接頭辭, prefix)인 "NEST_"를 그 함수의 이름에서 제외함으로써 대응되는 SQL의 기존 집단함수의 그것들과 동일하다.The specification and semantics of each of the XMLNEST-related functions is identical to those of the corresponding SQL's existing aggregate functions by excluding the function's prefix "NEST_" from the name of the function.

예제 10. 도 1의 테이블 employees를 대상으로 사원번호가 10인 사원에 대하여 그 사원과 그 사원의 모든 직간접 부하사원들의 정보를 이용하여 하나의 재귀적 구조의 XML 값을 생성하시오. 단, 그 사원과 그 사원의 모든 직간접 부하사원들의 집합을 X라 할 때, 집합 X에 속한 사원들 각각에 대하여 (1) 그 사원의 급여, (2) 그 사원과 그 사원의 부하사원들의 급여의 합, 그리고 (3) 그 사원과 그 사원의 부하사원들의 수의 합을 나타내는 XML 엘리먼트들을 생성하여야 한다. Example 10 For a table employee of FIG. 1, for an employee with employee number 10, generate an XML value of one recursive structure using information of that employee and all direct and indirect subordinates of that employee. Provided that X is the employee and the set of all direct and indirect subordinates of the employee, X, for each employee in the set X: (1) the salary of the employee, and (2) the salary of the employee and his subordinates. And (3) create XML elements that represent the sum of the employee and the number of subordinates of the employee.

예제 10을 위한 질의를 Oracle의 문법을 기반으로 작성하면 도 42와 같다.The query for Example 10 is written based on Oracle's syntax as shown in FIG. 42.

42의 재귀적 질의의 재귀적 결과투플들에 해당하는 노드들은 employee_id가 10인 노드를 루트로 가지는 도 17(a)의 재귀적 결과투플 트리를 형성한다. 따라서 도 42의 재귀적 질의는 하나의 최종 결과투플을 도 43과 같이 생성한다. The nodes corresponding to the recursive result tuples of the recursive query of 42 form a recursive result tuple tree of FIG. 17 (a) having a node having an employee_id of 10 as the root. Therefore, the recursive query of FIG. 42 generates one final result tuple as shown in FIG. 43.

본 발명은 SQL 함수 XMLNEST와 그 함수의 직간접 인자로만 사용될 수 있는 XMLNEST 관련함수들에 추가하여 하나의 계층집단연산자인 tc_root를 제시한다. 계층집단연산자 tc_root는 재귀적 결과투플들이 재귀적 임시 결과투플들의 단수 복제에 의해 생성된 경우에 한하여 그 재귀적 결과투플들을 그들의 기원 투플들에 해당하는 노드들이 소속된 재귀적 임시 결과투플 트리별로 분류하고 하나 이상의 재귀적 결과투플을 구성원으로 가지는 각 분류에 대해 그 분류에 해당하는 재귀적 임시 결과투플 트리의 루트 노드에 해당하는 재귀적 임시 결과투플을 이용하여 그 연산자의 인자로 명시된 값 표현식의 값을 계산하여 반환한다. 따라서 tc_root는 각 분류의 모든 재귀적 결과투플들을 그들의 기원 투플들에 해당하는 노드들이 소속된 하나의 재귀적 임시 결과투플 트리라는 하나의 계층집단으로 처리하는 계층집단연산자이다. XMLNEST는 모든 재귀적 결과투플들에 해당하는 노드들이 "루트유지 독자환생" 재귀적 결과투플 트리들을 형성하는 경우에 한하여 의미를 가지지만, tc_root는 모든 재귀적 결과투플들이 재귀적 임시 결과투플들의 단수 복제에 의해 생성된 경우에만 의미를 가진다. 즉, 재귀적 결과투플들이 재귀적 임시 결과투플들의 복수 복제 또는 결합에 의해 생성된 경우, tc_root는 오류를 반환한다.The present invention provides a hierarchical group operator tc_root in addition to the SQL function XMLNEST and XMLNEST related functions that can be used only as direct and indirect arguments of the function. The hierarchical group operator tc_root classifies the recursive result tuples by the recursive temporary result tuple tree to which the nodes corresponding to their origin tuples belong only if the recursive result tuples are generated by singular copies of the recursive temporary result tuples. And for each classification whose members are one or more recursive result tuples, the value of the expression specified as the argument of the operator using the recursive temporary result tuple corresponding to the root node of the recursive temporary result tuple tree corresponding to that classification. Calculate and return Thus, tc_root is a hierarchical group operator that processes all recursive result tuples of each classification into a hierarchical group called a recursive temporary result tuple tree to which nodes corresponding to their origin tuples belong. XMLNEST is meaningful only if the nodes corresponding to all recursive result tuples form "root-maintained recursive" recursive result tuple trees, but tc_root means that all recursive result tuples are singular of recursive temporary result tuples. Only meaningful if created by replication. That is, when recursive result tuples are generated by multiple copies or combinations of recursive temporary result tuples, tc_root returns an error.

계층집단연산자 tc_root는 SQL:2003 표준에 정의된 임의의 값 표현식을 인자로 가진다. 계층집단연산자 tc_root가 대상으로 하는 집단들은 group by 절에 의해 형성되지 않으므로 tc_root를 포함한 부질의는 group by 절을 동일 부질의에 사용 할 수 없다. 계층집단연산자 tc_root의 인자는 본 문서에서 제시한 "하나의 부질의에서 하나의 집단함수 또는 집단연산자는 임의의 집단함수 또는 집단연산자를 직간접 인자로 가질 수 없다"라는 명제를 따라 SQL의 집단함수들 또는 집단연산자들을 직간접 인자로 가질 수 없으며 SQL의 집단함수들 또는 집단연산자들의 직간접 인자로 사용될 수 없다. 계층집단연산자 tc_root가 반환하는 값의 데이터 유형은 tc_root의 인자로 명시된 값 표현식의 데이터 유형을 따른다. 계층집단연산자 tc_root는 계층집단함수 XMLNEST와 마찬가지로 재귀적 질의에 사용될 경우에만 유효하다.The hierarchical operator tc_root takes as argument any value expression defined in the SQL: 2003 standard. Because groups targeted by the hierarchical group operator tc_root are not formed by the group by clause, subqueries including tc_root cannot use the group by clause in the same subquery. The arguments of the hierarchical group operator tc_root are set to SQL group functions according to the propositions "one group function or group operator in one subquery cannot have any group function or group operator as a direct or indirect argument". Alternatively, the group operator cannot be used as a direct or indirect argument, and can not be used as a direct or indirect argument of a group function or a group operator in SQL. The data type of the value returned by the hierarchical operator tc_root depends on the data type of the value expression specified as the argument to tc_root. The hierarchical group operator tc_root, like the hierarchical group function XMLNEST, is only valid when used in recursive queries.

SUM, COUNT, AVG, MIN, MAX, XMLAGG와 같은 SQL의 기존 집단함수들이 재귀적 질의의 동일 부질의에 계층집단연산자인 tc_root와 함께 사용될 경우, 그 기존 집단함수들의 의미는 기존 의미와 동일하다. 그러나 그 기존 집단함수들은 재귀적 결과투플들을 그들의 기원 투플들에 해당하는 노드들이 소속된 재귀적 임시 결과투플 트리별로 분류하여 하나 이상의 재귀적 결과투플을 구성원으로 가지는 각 분류의 모든 재귀적 결과투플들을 하나의 집단으로 처리하여야 한다.When existing group functions of SQL such as SUM, COUNT, AVG, MIN, MAX, XMLAGG are used together with the hierarchical group operator tc_root in the same subquery of recursive query, the meaning of the existing group functions is the same as the existing meaning. However, the existing group functions classify the recursive result tuples by the recursive temporary result tuple tree to which the nodes corresponding to their origin tuples belong and collect all the recursive result tuples of each classification having one or more recursive result tuples as members. It should be treated as a group.

계층집단연산자 tc_root를 포함한 SQL 질의의 처리 흐름은 도 44와 같으며 tc_root의 명세는 도 45와 같다. 도 45의 tc_root의 명세에서 <value expression>은 SQL:2003 표준의 임의의 값 표현식을 의미한다.The processing flow of the SQL query including the hierarchical group operator tc_root is shown in FIG. 44, and the specification of tc_root is shown in FIG. In the specification of tc_root of FIG. 45, <value expression> means any value expression of the SQL: 2003 standard.

참고로, Oracle의 SQL 연산자 connect_by_root는 재귀적 질의에만 사용되며 재귀적 결과투플들 각각에게 하나의 값을 반환한다. 그 연산자는 하나의 값 표현식만을 인자로 가지며 그 값 표현식이 데이터베이스 칼럼명들을 포함할 경우, 재귀적 결과투플들 각각에게 그 재귀적 결과투플의 기원 투플에 해당하는 노드가 소속된 재귀적 임시 결과투플 트리의 루트 노드에 해당하는 재귀적 임시 결과투플의 칼럼값들을 이용하여 생성한 그 값 표현식의 값을 반환한다.For reference, Oracle's SQL operator connect_by_root is used only for recursive queries and returns a value for each of the recursive result tuples. The operator has only one value expression as an argument, and if the value expression contains database column names, each of the recursive result tuples has a recursive temporary result tuple to which the node corresponding to the origin tuple of the recursive result tuple belongs. Returns the value of the value expression created using the column values of the recursive temporary result tuple corresponding to the root node of the tree.

본 발명이 제시하는 계층집단연산자 tc_root와 Oracle의 SQL 연산자 connect_by_root는 그들 모두 재귀적 결과투플의 기원 투플에 해당하는 노드가 소속된 재귀적 임시 결과투플 트리의 루트 노드에 해당하는 재귀적 임시 결과투플에 대하여 인자로 설정된 값 표현식의 값을 계산하는 것은 동일하지만, connect_by_root는 재귀적 결과투플들 각각에게 그 값을 반환하는 반면 tc_root는 재귀적 결과투플들의 기원 투플들에 해당하는 노드들이 소속된 각 재귀적 임시 결과투플 트리라는 집단에 대해 그 값을 반환한다는 것이 차이이다.The hierarchical group operator tc_root and Oracle's SQL operator connect_by_root proposed by the present invention are in the recursive temporary result tuple corresponding to the root node of the recursive temporary result tuple tree to which the node corresponding to the origin tuple of the recursive result tuple belongs. Computing the value of the value expression set as an argument to is the same, but connect_by_root returns the value to each of the recursive result tuples, while tc_root is the recursive result of each node belonging to the nodes corresponding to the origin tuples of the recursive result tuples. The difference is that it returns a value for a group called a temporary result tuple tree.

예를 들어, 도 17과 같이 재귀적 임시 결과투플 트리들과 재귀적 결과투플 트리들이 동일한 경우, tc_root(employee_id)는 도 17(a)의 재귀적 결과투플 트리에 대해 10을 그리고 도 17(b)의 재귀적 결과투플 트리에 대해 21을 반환한다. 그러나 connect_by_root(employee_id)는 도 17(a)의 재귀적 결과투플 트리의 7 개의 노드들 각각에 해당하는 재귀적 결과투플에게 10을 그리고 도 17(b)의 재귀적 결과투플 트리의 3 개의 노드들 각각에 해당하는 재귀적 결과투플에게 21을 반환한다.For example, when the recursive temporary tuple trees and the recursive result tuple trees are the same as shown in FIG. 17, tc_root (employee_id) is 10 for the recursive result tuple tree of FIG. 17 (a) and FIG. 17 (b). Recursive result of) returns 21 for the tuple tree. However, connect_by_root (employee_id) indicates 10 to a recursive result tuple corresponding to each of the 7 nodes of the recursive result tuple tree of FIG. 17 (a) and three nodes of the recursive result tuple tree of FIG. 17 (b). Returns 21 to each recursive result tuple.

예제 11. 도 1의 테이블 employees를 대상으로 상사를 가지지 않는 각 사원에 대하여 그 사원과 그 사원의 모든 직간접 부하사원들의 집합을 X라 할 때, (1) 집합 X에 속한 사원들의 최고 상사에 해당하는 사원의 이름, (2) 집합 X에 속한 사원들의 급여의 합계, 급여의 평균, 수 그리고 (3) 집합 X에 속한 사원들의 급여의 최대값과 최소값을 하나의 결과투플로 출력하시오. 단, 급여가 32000 미만이거나 급여가 38000 이상이고 52800 이하의 범위에 속하는 사원들만이 각 집합에 포함되도록 하시오. Example 11. For each employee who does not have a boss for the table employees in FIG. 1, the set of the employee and all the direct and indirect subordinates of the employee is X, (1) the highest boss of the employees in the set X. Output the name of the employee doing (2) the sum of the salaries of the employees in set X, the average of the salaries, and the number and (3) the maximum and minimum salaries of the employees in set X. However, make sure that only those employees whose salary is less than 32000 or whose salary is above 38000 and in the range below 52800 are included in each set.

예제 11을 위한 질의를 Oracle의 문법을 기반으로 작성하면 그 질의는 도 46과 같다. 도 46의 재귀적 질의의 재귀적 임시 결과투플들에 해당하는 노드들이 형성하는 재귀적 임시 결과투플 트리들과 그 질의의 재귀적 결과투플들에 해당하는 노드들이 형성하는 재귀적 결과투플 트리들은 도 41과 같다. 도 41의 재귀적 결과투플 트리들의 노드들에 해당하는 모든 재귀적 결과투플들은 재귀적 임시 결과투플들의 단수 복제에 의해 생성되었으므로 도 46의 재귀적 질의는 도 40의 재귀적 질의와 달리 오류를 반환하지 않고 도 47의 투플들을 최종 결과투플들로 생성한다.If the query for Example 11 is written based on Oracle's syntax, the query is as shown in FIG. The recursive temporary result tuple trees formed by the nodes corresponding to the recursive temporary result tuples of the recursive query of FIG. 46 and the recursive result tuple trees formed by the nodes corresponding to the recursive result tuples of the query are shown in FIG. Same as 41. Since all recursive result tuples corresponding to nodes of the recursive result tuple trees of FIG. 41 are generated by singular copies of recursive temporary result tuples, the recursive query of FIG. 46 returns an error unlike the recursive query of FIG. The tuples of FIG. 47 are generated as the final result tuples.

예제 12. 도 1의 테이블 employees와 테이블 departments를 대상으로 부서명이 'HR', 'RD', 그리고 'TFT'인 부서의 관리자들 각각에 대하여 그 사원과 그 사원의 모든 직간접 부하사원들의 집합을 X라 할 때, (1) 집합 X에 속한 사원들의 최고 상사에 해당하는 사원의 이름과 소속 부서의 이름, (2) 집합 X에 속한 사원들의 급여의 합계, 급여의 평균, 수, 그리고 (3) 집합 X에 속한 사원들의 급여의 최대값과 최소값을 하나의 결과투플로 출력하시오. 단, 해당 부서의 관리자와 그 관리자로부터 두 단계 아래까지의 부하사원들 즉, 수준이 3 이하인 사원들과 급여가 40000 보다 크고 52800 미만의 범위에 속하는 사원들만이 각 집합에 포함되도록 하시오. Example 12. For each of the table employees and table departments of FIG. 1, for each manager of a department whose department name is 'HR', 'RD', and 'TFT', the employee and all the direct and indirect subordinates of that employee are X. (1) the name of the employee and the department belonging to the chief supervisor of the employees of set X, (2) the sum of the salaries of the employees of set X, the average, number of salaries, and (3) Output the maximum and minimum salaries of the employees in set X in a single result tuple. However, make sure that each set includes only the manager of the department and subordinates up to two levels below it, that is, those with level 3 or less, and those with salaries greater than 40000 and in the range of less than 52800.

예제 12를 위한 질의를 Oracle의 문법을 기반으로 작성하면 그 질의는 도 48과 같다. 도 48의 재귀적 질의에서 CONNECT BY 절에 명시된 테이블 employees와 테 이블 departments 간의 조인 조건인 "e.department_id = d.department_id"는 자식 특유의 조인 조건으로서 그 CONNECT BY 절의 부모-자식 연결 조건인 "PRIOR e.employee_id = e.supervisor_id"가 적용될 대상 투플들을 테이블 employees의 투플들 각각에 대해 하나씩 생성되는 투플들로 한정하기 위해 명시되었다. 그 자식 특유의 조인 조건이 도 48의 재귀적 질의의 CONNECT BY 절에 명시되지 않을 경우, 그 부모-자식 연결 조건은 테이블 employees와 테이블 departments의 카티션 곱으로 생성된 모든 투플들을 대상으로 적용된다.If the query for Example 12 is written based on Oracle's syntax, the query is as shown in FIG. In the recursive query of FIG. 48, "e.department_id = d.department_id", a join condition between table employees and table departments specified in the CONNECT BY clause, is a child-specific join condition and "PRIOR", the parent-child connection condition of the CONNECT BY clause. e.employee_id = e.supervisor_id "is specified to limit the target tuples to which the tuples to be applied are created, one for each of the tuples of the table employees. If the child-specific join condition is not specified in the CONNECT BY clause of the recursive query of FIG. 48, the parent-child connection condition applies to all tuples generated by the Cartesian product of table employees and table departments.

도 48의 재귀적 질의의 재귀적 임시 결과투플들에 해당하는 노드들이 형성하는 재귀적 임시 결과투플 트리들과 그 재귀적 임시 결과투플들을 대상으로 도 48의 재귀적 임시 결과투플 선택 조건들을 적용함으로써 생성되는 재귀적 결과투플들에 해당하는 노드들이 형성하는 재귀적 결과투플 트리들은 도 49와 같다. Employee_id가 10인 노드를 루트로 가지는 도 49의 재귀적 임시 결과투플 트리에서 employee_id가 11인 노드와 14인 노드는 salary의 조건에 의해 그리고 13인 노드와 17인 노드는 level의 조건에 의해 삭제된다. 따라서 그 재귀적 임시 결과투플 트리는 employee_id가 10인 노드를 루트로 가지는 도 49의 재귀적 결과투플 트리를 생성한다. 그 재귀적 결과투플 트리는 "루트유지 독자환생" 재귀적 결과투플 트리이다. Employee_id가 14인 노드를 루트로 가지는 도 49의 재귀적 임시 결과투플 트리에서 employee_id가 13인 노드와 14인 노드는 salary의 조건에 의해 그 트리에서 삭제된다. 따라서 그 재귀적 임시 결과투플 트리는 employee_id가 17인 노드를 루트로 가지는 도 49의 재귀적 결과투플 트리를 생성한다. 그 재귀적 결과투플 트리 는 "루트유지"는 아니지만 "독자환생" 재귀적 결과투플 트리이다. Employee_id가 21인 노드를 루트로 가지는 도 49의 재귀적 임시 결과투플 트리에서 모든 노드들은 salary의 조건에 의해 삭제된다. 따라서 그 재귀적 임시 결과투플 트리는 재귀적 결과투플 트리를 생성하지 않는다.By applying the recursive temporary result tuple selection conditions of FIG. 48 to the recursive temporary result tuple trees formed by nodes corresponding to the recursive temporary result tuples of the recursive query of FIG. The recursive result tuple trees formed by the nodes corresponding to the generated recursive result tuples are illustrated in FIG. 49. In the recursive temporary result tuple tree of FIG. 49 with the root of the node whose employee_id is 10, nodes with employee_id 11 and 14 are deleted by salary condition, and nodes 13 and 17 by level condition. . Therefore, the recursive temporary result tuple tree generates the recursive result tuple tree of FIG. 49 having a node whose employee_id is 10 as a root. The recursive result tuple tree is a "root-maintained reincarnation" recursive result tuple tree. In the recursive temporary result tuple tree of FIG. 49 having the root of the node whose employee_id is 14, the node whose employee_id is 13 and the node whose 14 are deleted from the tree by the condition of salary. Therefore, the recursive temporary result tuple tree generates the recursive result tuple tree of FIG. 49 having a node whose employee_id is 17 as a root. The recursive result tuple tree is not "root-maintained" but "read-only recursive" recursive result tuple tree. In the recursive temporary result tuple tree of FIG. 49 having the root of a node whose employee_id is 21, all nodes are deleted by the salary condition. Thus, the recursive temporary result tuple tree does not produce a recursive result tuple tree.

도 48의 재귀적 질의에 명시된 계층집단연산자 tc_root와 SQL의 기존 집단함수들은 재귀적 결과투플들을 그들의 기원 투플들에 해당하는 노드들이 소속된 재귀적 임시 결과투플 트리별로 분류하고 하나 이상의 재귀적 결과투플을 구성원으로 가지는 각 분류를 하나의 집단으로 처리하므로 두 개의 최종 결과투플들을 도 50과 같이 생성한다.The existing group functions of the hierarchical group operator tc_root and SQL specified in the recursive query of FIG. 48 classify the recursive result tuples by the recursive temporary result tuple tree to which the nodes corresponding to their origin tuples belong and one or more recursive result tuples. Since each classification having as members is treated as a group, two final result tuples are generated as shown in FIG.

예제 13. 도 1의 테이블 employees를 대상으로 상사를 가지지 않는 각 사원에 대하여 <그 사원의 이름, 그 사원과 그 사원의 모든 직간접 부하사원들의 사원번호와 이름을 이용하여 생성한 재귀적 구조의 XML 값>의 쌍으로 하나의 결과투플을 구성하여 출력하시오. 단, 그 결과투플들을 그들의 첫 번째 결과칼럼의 칼럼값을 기준으로 오름차순으로 정렬하시오. Example 13. A recursive XML generated using <employee's name, employee number and name of the employee and all direct and indirect subordinates of the employee, for each employee who does not have a boss for the table employees of FIG. Output one result tuple with a pair of values>. However, sort the result tuples in ascending order based on the column value of their first result column.

예제 13을 위한 질의들을 Oracle의 문법과 SQL:1999 표준의 문법을 기반으로 작성하면 그 질의들은 각각 도 51(a) 그리고 도 51(b)와 같다. 도 51(a)와 도 51(b)의 각 재귀적 질의에서 tc_root와 XMLNEST는 그 질의의 재귀적 결과투플들이 형성하는 도 17의 재귀적 결과투플 트리들 각각에 대해 하나씩의 값을 생성함으로 그 질의들은 두 개의 결과칼럼들로 구성된 두 개의 결과투플들을 도 52와 같이 생성한다. 도 52의 결과투플들은 도 51의 질의들의 order by 절에 의해 결과칼럼 root_fname의 값에 따라 오름차순으로 정렬되었다. 도 52의 XML 값들에서 생략된 부분은 도 27의 XML 값들과 동일하다.When the queries for Example 13 are written based on the grammar of Oracle and the grammar of the SQL: 1999 standard, the queries are as shown in Figs. 51 (a) and 51 (b), respectively. In each of the recursive queries of FIGS. 51 (a) and 51 (b), tc_root and XMLNEST generate one value for each of the recursive result tuple trees of FIG. 17 formed by the recursive result tuples of the query. The queries generate two result tuples consisting of two result columns as shown in FIG. 52. The result tuples of FIG. 52 are sorted in ascending order according to the value of the result column root_fname by the order by clause of the queries of FIG. 51. Parts omitted from the XML values in FIG. 52 are the same as the XML values in FIG. 27.

예제 14. 도 1의 테이블 employees를 대상으로 상사를 가지지 않는 각 사원에 대하여 그 사원과 그 사원의 모든 직간접 부하사원들의 집합을 X라 할 때, 집합 X에 속한 투플들의 <급여의 합계, 수, 급여의 평균>을 하나의 결과투플로 출력하시오. 단, 그 결과투플들을 그 결과투플들 각각을 생성하게 한 집단의 최고 상사에 해당하는 사원의 이름의 증가 순으로 정렬하시오. Example 14. For each employee who does not have a boss for the table employees in FIG. 1, the sum of the employee and all the direct and indirect subordinates of the employee is X, the sum, number, Print the average of salaries> in a single result tuple. However, order the result tuples in increasing order of the name of the employee corresponding to the chief boss of the group that generated each of the result tuples.

예제 14를 위한 질의를 Oracle의 문법을 기반으로 작성하면 도 53과 같다. 도 53의 질의는 그 질의의 order by 절의 정렬 명세로 tc_root를 가지므로 그 질의의 select 절에 명시된 SQL의 기존 집단함수들은 재귀적 결과투플들을 그들의 기원 투플들에 해당하는 노드들이 소속된 재귀적 임시 결과투플 트리별로 분류하고 하나 이상의 재귀적 결과투플을 구성원으로 가지는 각 분류를 하나의 집단으로 처리해야 한다. 도 53의 재귀적 질의의 재귀적 결과투플들의 기원 투플들에 해당하는 노드들은 도 17의 재귀적 임시 결과투플 트리들을 형성한다. 따라서 도 53의 재귀적 질의는 두 개의 결과투플들을 도 54와 같이 생성한다. 도 54의 결과투플들은 그 결과투플들 각각을 생성하게 한 계층집단의 최고 상사에 해당하는 투플의 칼럼 first_name의 칼럼값을 기준으로 오름차순으로 정렬된 것이다. 도 54의 결과투플들에서 첫 번째와 두 번째 결과투플에 대한 tc_root(first_name)의 값은 각각 "BH"와 "CHRISTINE"이다.The query for Example 14 is written based on Oracle's syntax. The query of Figure 53 has tc_root as the sort specification of the order by clause of the query, so the existing aggregate functions of SQL specified in the select clause of the query can use recursive temporary tuples whose nodes correspond to their origin tuples. You should classify each result tuple tree and treat each classification with one or more recursive result tuples as a group. The nodes corresponding to the origin tuples of the recursive result tuples of the recursive query of FIG. 53 form the recursive temporary result tuple trees of FIG. 17. Therefore, the recursive query of FIG. 53 generates two result tuples as shown in FIG. 54. The result tuples of FIG. 54 are sorted in ascending order based on the column value of the column first_name of the tuple corresponding to the highest superior of the hierarchical group that generated each of the result tuples. In the result tuples of FIG. 54, the values of tc_root (first_name) for the first and second result tuples are "BH" and "CHRISTINE", respectively.

예제 15. 도 1의 테이블 employees를 대상으로 상사를 가지지 않는 각 사원 에 대하여 그 사원과 그 사원의 모든 직간접 부하사원들의 집합을 X라 할 때, 집합 X에 속한 사원들의 최고 상사에 해당하는 사원의 이름과 소속 부서의 이름, 그 집합에 속한 사원들의 수와 급여의 합계, 그 집합에 속한 사원들의 연결 관계를 반영하는 재귀적 구조의 XML 값을 생성하고 그 값들을 하나의 XML 값으로 생성하시오. Example 15 For each employee who does not have a boss for the table employees in FIG. 1, the set of employees that are the highest bosses of the employees in set X, when X is the set of employees and all direct and indirect subordinates of that employee. Create an XML value with a recursive structure that reflects the name, the name of your department, the sum of the number and salaries of the employees in the set, and the connection of the employees in the set, and create those values as a single XML value.

예제 15를 위한 질의를 Oracle의 문법을 기반으로 작성하면 도 55와 같다. 도 55의 질의의 from 절의 부질의는 그 부질의의 재귀적 결과투플들이 형성하는 도 17의 각 재귀적 결과투플 트리에 대해 tc_root, COUNT, SUM, 그리고 XMLNEST를 적용함으로써 두 개의 투플들을 그 부질의의 최종 결과투플들로 생성한다. 도 55의 질의는 그 질의의 from 절의 부질의에 의해 생성된 두 개의 투플들 각각에 대해 XMLELEMENT를 적용하므로 두 개의 최종 결과투플들을 도 56과 같이 생성한다.If the query for Example 15 is written based on the grammar of Oracle, it is as shown in FIG. The subquery in the from clause of the query of FIG. 55 applies two tuples to the subquery by applying tc_root, COUNT, SUM, and XMLNEST to each recursive result tuple tree of FIG. 17 formed by the recursive result tuples of the subquery. Generate the final result tuple of. The query of FIG. 55 applies XMLELEMENT to each of the two tuples generated by the subquery of the from clause of the query, thus generating two final result tuples as shown in FIG. 56.

계층집단함수 XMLNEST 또는 계층집단연산자 tc_root가 재귀적 질의에 사용된 경우, 그들은 그 질의의 최종 결과투플들 간의 정렬에 영향을 미치지 않는다. 그 최종 결과투플들 간의 정렬은 SQL:1999 표준의 재귀적 질의의 경우에는 마감 부질의에 그리고 Oracle의 재귀적 질의의 경우에는 그 질의 자체에 명시되는 order by 절에 의해 결정된다. 이에 추가하여, 그 order by 절은 XMLNEST가 생성하는 XML 값 그리고 tc_root가 생성하는 표현식의 값에 영향을 미치지 않는다.If the hierarchical function XMLNEST or the hierarchical group operator tc_root is used in a recursive query, they do not affect the alignment between the final result tuples of the query. The ordering between the final result tuples is determined by the order by clause specified in the closing subquery for recursive queries in the SQL: 1999 standard and in the query itself for Oracle recursive queries. In addition, the order by clause does not affect the value of the XML value generated by XMLNEST and the expression generated by tc_root.

한편, 도 57은 본 발명을 실시하기 위한 컴퓨터 시스템의 구성을 나타내는 블록도이다. 본 발명이 제안하는 새로운 SQL 계층집단함수 XMLNEST와 이의 다섯 가지 관련함수 NEST_SUM, NEST_COUNT, NEST_AVG, NEST_MIN 그리고 NEST_MAX, 그리고 관련 연산자 tc_root는 프로그램 모듈과 같은 컴퓨터-실행가능한 명령어 들(computer-executable instructions)로 구현되어 재귀적 질의 양식을 지원하는 DBMS의 일부로서 포함될 수 있다. 이들 함수들과 연산자를 포함하는 DBMS는 도 57에 도시된 바와 같이 적어도 중앙처리장치(C)와 같은 프로세서(processor)가 시스템 버스(B)를 통해 시스템 메모리(PM)와 데이터 저장장치(AM)에 연결된 통상적인 컴퓨터 시스템에서 실시될 수 있다. 시스템 메모리(PM)는 적어도 바이오스(BIOS)가 저장된 롬(ROM)과, 중앙처리장치(C)가 데이터 및/또는 프로그램을 적재해두고 직접 액세스 하여 데이터 처리를 할 수 있는 공간을 제공하는 램(RAM)을 포함한다. 데이터 저장장치(AM)는 예컨대 하드디스크, 시디롬, 테이프, 마그네틱 기록매체, 이피롬, 이이피롬, 롬 등과 같은 비휘발성 저장매체로 구성될 수 있다. 중앙처리장치(C)는 그 밖의 다른 입/출력 채널(비도시)과 보조 장치(비도시)에도 액세스할 수 있다. 본 발명은 개인용 컴퓨터(PC), 컴퓨팅 기능을 갖는 핸드헬드 장치, 멀티프로세서 시스템, 마이크로프로세서 기반의 프로그램가능 전자장치, 네트워크 PCs, 미니컴퓨터, 메인프레임 컴퓨터, 휴대형 통신장치 등과 같은 장치들이나 이들의 조합된 장치로 구성된 환경, 또는 분산 컴퓨팅 환경 등에서도 실시될 수 있다. 그러므로 도 57에 예시한 컴퓨팅 환경은 본 발명을 실시하기에 적합한 하나의 컴퓨팅 환경의 예를 제시한 것에 불과하며 본 발명의 이용 범위, 본 발명의 방법과 시스템의 기능 등을 제한하고자 하는 것은 아닌 것으로 이해되어야 할 것이다. 57 is a block diagram showing the construction of a computer system for implementing the present invention. The new SQL hierarchical function XMLNEST proposed by the present invention and its five related functions NEST_SUM, NEST_COUNT, NEST_AVG, NEST_MIN and NEST_MAX, and the related operator tc_root are implemented as computer-executable instructions such as program modules. And can be included as part of a DBMS that supports recursive query forms. The DBMS comprising these functions and operators is characterized in that at least a processor, such as a central processing unit C, is provided with a system memory PM and a data storage unit AM, as shown in FIG. It may be implemented in a conventional computer system connected to. The system memory PM includes at least a ROM in which a BIOS is stored, and a RAM in which the central processing unit C stores data and / or programs to directly access and process data. RAM). The data storage device AM may be composed of, for example, a nonvolatile storage medium such as a hard disk, a CD-ROM, a tape, a magnetic recording medium, an ipyrom, an ypyrom, a ROM, or the like. Central processing unit C may also access other input / output channels (not shown) and auxiliary devices (not shown). The present invention relates to devices such as personal computers (PCs), handheld devices with computing capabilities, multiprocessor systems, microprocessor-based programmable electronics, network PCs, minicomputers, mainframe computers, portable communication devices, and combinations thereof. It can also be implemented in an environment consisting of a device, or a distributed computing environment. Therefore, the computing environment illustrated in FIG. 57 is merely an example of a computing environment suitable for implementing the present invention, and is not intended to limit the scope of use of the present invention, the functions of the method and system of the present invention, and the like. It should be understood.

도 57에 나타낸 바와 같이 본 발명이 구현되는 데이터베이스 시스템(100)은 관계 데이터의 모음(collection)인 데이터베이스(110)와 그를 관리하고 운용하기 위한 데이터베이스 관리 시스템(database management system: DBMS, 160)을 구비한 다.As shown in FIG. 57, the database system 100 in which the present invention is implemented includes a database 110 which is a collection of relational data and a database management system (DBMS) 160 for managing and operating the database 110. do.

데이터베이스(110)는 데이터를 저장하고 있는 데이터 파일들(data files)과 그 데이터 파일들에 대한 색인 파일들(index files), 그리고 데이터베이스에 저장된 데이터에 대한 메타 데이터(meta data)를 저장하고 있는 시스템 카탈로그(system catalog) 등으로 구성된다. 이러한 데이터베이스(110)는 하드디스크 등의 컴퓨터로 읽을 수 있는 데이터저장 매체(AM)에 저장된다.The database 110 stores data files that store data, index files for the data files, and metadata for data stored in the database. It consists of a system catalog. The database 110 is stored in a computer-readable data storage medium AM such as a hard disk.

데이터 저장 매체(AM)에는 데이터베이스 관리 시스템 프로그램파일들(122) 및 기타 다른 프로그램파일(124, 126)들이 저장되어 있다.The database storage system program files 122 and other program files 124 and 126 are stored in the data storage medium AM.

데이터베이스 관리 시스템(160)은 일반적으로 파서(parser, 171), 최적화기(optimizer, 172), 질의 계획 실행기(plan executor, 173), SQL 함수 처리기(SQL function evaluator, 175), SQL 연산자 처리기(SQL operator evaluator, 177) 등으로 구성되는 질의 처리기(query processor, 170)와 트랜잭션 관리자(transaction manager, 182)와 잠금 관리자(lock manager, 184)로 구성되는 동시성 제어기(concurrency control, 180), 회복 관리자(recovery manager, 191), 파일들 및 인덱스 구조들(files and index structures, 192), 버퍼 관리자(buffer manager, 193), 디스크 공간 관리자(disk space manager, 194) 등으로 구성되는 저장 관리자(storage manager, 190)를 구비한다. 이러한 데이터베이스 관리 시스템(160)은 저장 매체(AM)에 프로그램파일들(122)로 저장되어 있다가 프로그램 실행에 따라 주기억장치의 역할을 하는 시스템 메모리(PM)에 로드 되어 중앙처리장치(central processing unit, C)의 제어에 따라 제 기능들을 수행한다. 물론, 시스템 메모 리(PM)에는 다른 프로세스들(200)도 함께 로드 된다.The database management system 160 typically includes a parser 171, an optimizer 172, a query plan executor 173, an SQL function evaluator 175, and an SQL operator handler. concurrency control (180), recovery manager (consist of a query processor 170) consisting of an operator evaluator (177), a transaction manager (182), and a lock manager (184). a storage manager consisting of a recovery manager 191, files and index structures 192, a buffer manager 193, a disk space manager 194, and the like. 190). The database management system 160 is stored as program files 122 in a storage medium AM, and is loaded into system memory PM serving as a main memory device according to program execution. , C) perform their functions under the control of C). Of course, other processes 200 are also loaded into the system memory PM.

데이터베이스 관리 시스템(160)으로는 웹폼들(132), 어플리케이션들(134), SQL 인터페이스들(136) 등을 통해 SQL 명령어들이 인가되고, 데이터베이스 관리 시스템(160)은 인가되는 SQL 명령어들을 해석하여 처리한다.SQL commands are applied to the database management system 160 through web forms 132, applications 134, SQL interfaces 136, etc., and the database management system 160 interprets and processes the SQL commands. do.

본 발명이 제시하는 SQL 계층집단함수 XMLNEST, 이 XMLNEST 함수의 직간접 인자로만 사용될 수 있는 계층집단함수들인 'XMLNEST 관련 SQL 함수'들(NEST_SUM, NEST_COUNT, NEST_AVG, NEST_MIN, 그리고 NEST_MAX), 그리고 SQL 계층집단연산자 tc_root는 기존 SQL 함수들 그리고 기존 SQL 연산자들과 같이 질의 처리기(170)를 구성하는 SQL 함수 처리기(175)와 SQL 연산자 처리기(177)의 한 요소로서 구현되어 데이터저장 매체(AM)에 DBMS의 프로그램 파일들(122)로 존재하게 된다. The SQL hierarchical function XMLNEST proposed by the present invention, 'XMLNEST related SQL functions' (NEST_SUM, NEST_COUNT, NEST_AVG, NEST_MIN, and NEST_MAX), which are hierarchical functions that can be used only as direct and indirect arguments of the XMLNEST function, and SQL hierarchical operator tc_root is implemented as an element of the SQL function processor 175 and the SQL operator processor 177 that compose the query processor 170 like the existing SQL functions and the existing SQL operators. Files 122.

DBMS 프로그램들은 일반적으로 데이터 저장장치(AM)에 저장되어 있다가 그 DBMS를 실행할 때에는 중앙처리장치(C)가 그 DBMS 프로그램을 읽어 와서 시스템 메모리(PM)에 로드해 두고 프로그램 로직에 따라서 실행을 한다. 이 때, 본 발명이 제시하는 SQL 함수들과 SQL 연산자를 포함한 프로그램 파일들(122) 역시 데이터베이스 관리 시스템(160) 프로세스의 일부로서 컴퓨터의 시스템 메모리(PM)에 적재되며 그 SQL 함수들과 그 SQL 연산자를 포함하는 SQL 질의의 수행 시 시스템 메모리(PM)에 적재된 그 프로그램 파일들에 해당하는 로직(logic)이 중앙처리장치(C)에 의해 실행되고 그 실행 결과는 시스템 메모리(PM)에 반영된다.DBMS programs are generally stored in the data storage device (AM). When the DBMS is executed, the central processing unit (C) reads the DBMS program, loads it into system memory (PM), and executes the program logic. . At this time, the program files 122 including the SQL functions and SQL operators proposed by the present invention are also loaded into the system memory (PM) of the computer as part of the database management system 160 process, and the SQL functions and the SQL When executing an SQL query including an operator, logic corresponding to those program files loaded in system memory (PM) is executed by the central processing unit (C) and the execution result is reflected in the system memory (PM). do.

도 58은 SQL 질의가 본 발명이 제안하는 SQL 함수들과 연산자에 의해 처리되는 처리 과정을 도식적으로 보여준다. 도 57과 도 58을 참조하면, SQL 질의는 웹(web)을 통한 웹폼들(132), 응용 프로그램들인 어플리케이션들(134) 또는 다양한 SQL 인터페이스들(136)을 통해 데이터베이스 관리 시스템(160)에 전달되고, 이 전달된 SQL 질의는 저장매체(AM)의 데이터베이스(110)를 대상으로 질의 처리기(170)와 저장 관리자(190)에 의해 처리된다. 질의 처리기(170)는 SQL 질의를 구문 분석한 후, 가장 저렴한 비용으로 그 질의를 수행하기 위한 질의 계획을 수립하며 그 질의 계획에 따라 저장 관리자(190), SQL 함수 처리기(175), SQL 연산자 처리기(177)가 재귀적 임시 결과투플 트리와 재귀적 결과투플 트리를 생성하며, 이하에서 정의되고 상세하게 설명되는 본 발명에 따른 함수들과 연산자를 처리하는 기능을 수행한다.58 is a diagram schematically illustrating a process in which an SQL query is processed by SQL functions and operators proposed by the present invention. Referring to FIGS. 57 and 58, an SQL query is transmitted to the database management system 160 through web forms 132, web applications 134, or various SQL interfaces 136. The transferred SQL query is processed by the query processor 170 and the storage manager 190 for the database 110 of the storage medium AM. The query processor 170 parses the SQL query and then establishes a query plan for executing the query at the lowest cost, and according to the query plan, the storage manager 190, the SQL function processor 175, and the SQL operator processor 177 generates a recursive temporary result tuple tree and a recursive result tuple tree, and performs a function of processing functions and operators according to the present invention as defined and described in detail below.

특히, 질의처리기(170)는 생성된 재귀적 임시 결과투플 트리와 재귀적 결과투플 트리를 대상으로 재귀적 임시 결과투플 트리 하나가 하나의 재귀적 결과투플 트리만을 생성하는지 및 재귀적 결과투플 트리의 루트 노드에 해당하는 재귀적 결과투플이 재귀적 임시 결과투플 트리의 루트 노드에 해당하는 재귀적 임시 결과투플을 기원 투플로 가지는지를 비교하여 판단하여 둘 중 어느 하나라도 만족하지 않는 경우 오류신호를 생성하고, 둘 모두를 만족하는 경우 상기 재귀적 결과투플 트리에 대하여 그 트리를 구성하는 노드들을 깊이우선 탐색으로 탐색하여 그 트리에 속하는 노드들에 해당하는 투플들로 하나의 재귀적 구조의 XML 값을 생성하는 재귀적 구조의 XML 값 생성단계를 수행한다. 이러한 질의처리기(170)의 기능들은 그 기능들을 수행하는 프로세스들이 어디에 포함되느냐에 따라 SQL 함수 처리기(175)에서 단독으로 또는 SQL 함수 처리기(175)가 질의처리기(170) 내의 다른 프로세스와 협력하여 수행된다.In particular, the query processor 170 targets the generated recursive temporary result tuple tree and the recursive result tuple tree to determine whether one recursive temporary result tuple tree generates only one recursive result tuple tree and the recursive result tuple tree. By comparing whether the recursive result tuple corresponding to the root node has a recursive temporary result tuple corresponding to the root node of the recursive temporary result tuple of the origin tuple, an error signal is generated when either of them is not satisfied. If both are satisfied, the recursive result tuple tree is searched with depth-first search for nodes constituting the tree, and the XML value of one recursive structure is searched with tuples corresponding to the nodes belonging to the tree. Performs the XML value generation step of the recursive structure to generate. These functions of the query processor 170 may be performed by the SQL function processor 175 alone or in cooperation with other processes in the query processor 170 depending on where the processes that perform the functions are included. do.

또한, 질의처리기(170)는 재귀적 결과투플 트리의 재귀적 결과투플들이 재귀적 임시 결과투플 트리의 재귀적 임시 결과투플들의 단수 복제에 의해 생성되었는지를 판단하는 단수복제 판단단계를 수행하고, 단수복제 판단단계를 만족하지 않는 경우, 오류신호를 생성하고, 단수복제 판단단계를 만족하는 경우, 재귀적 결과투플들을 그들의 기원 투플들에 해당하는 노드들이 소속된 재귀적 임시 결과투플 트리별로 분류하는 분류단계와, 하나 이상의 재귀적 결과투플을 구성원으로 가지는 각 분류에 대해 그 분류에 해당하는 재귀적 임시 결과투플 트리의 루트 노드에 해당하는 재귀적 임시 결과투플을 이용하여 인자로 명시된 값 표현식의 값을 계산하여 상기 하나 이상의 재귀적 결과투플을 구성원으로 가지는 각 분류의 모든 재귀적 결과투플들을 하나의 집단으로 처리함으로써 그들 각 집단에 대해 하나의 값을 반환하는 반환단계를 수행한다. 이러한 질의처리기(170)의 기능들은 그 기능들을 수행하는 프로세스들이 어디에 포함되느냐에 따라 SQL 연산자 처리기(177)에서 단독으로 또는 SQL 연산자 처리기(177)가 질의처리기(170) 내의 다른 프로세스와 협력하여 수행된다. In addition, the query processor 170 performs a singular replication judgment step of determining whether recursive result tuples of the recursive result tuple tree are generated by singular replication of the recursive temporary result tuples of the recursive temporary result tuple tree, and When not satisfied with the replication decision step, generates an error signal, and if the singular replication decision step is satisfied, classification to classify the recursive result tuples by the recursive temporary result tuple tree to which the nodes corresponding to their origin tuples belong. Step, and for each classification that has one or more recursive result tuples, use the recursive temporary result tuple corresponding to the root node of the recursive temporary result tuple tree corresponding to that classification to retrieve the value of the value expression specified as a factor. Calculate one recursive result tuple of each classification with the at least one recursive result tuple as a member By treatment with a group performs a return step of returning a value for their respective group. These functions of the query processor 170 may be performed by the SQL operator processor 177 alone or in cooperation with other processes in the query processor 170, depending on where the processes that perform the functions are included. do.

본 발명은 데이터베이스 관련 산업에 이용 가능성이 있다. 특히, 재귀적 질의 양식을 제공하는 DBMS의 SQL 함수와 연산자로서 구현되어 그러한 DBMS의 일부로서 이용될 수 있다. 예컨대 SQL:2003 표준의 SQL/XML 출판함수들을 지원하는 DBMS의 일부로서 구현될 수 있을 것이다. 또한, 예를 들면 Oracle 11g, DB2, SQL Server 2008 등과 같은 상용 객체관계형(object relational: OR) DBMS 제품이나 기타 다른 상용 관계형 DBMS 제품 또는 새롭게 만들어질 DBMS 제품에 SQL 함수와 연산자로서 추가 내지 포함될 수 있을 것이다.The present invention is applicable to a database related industry. In particular, it can be implemented as an SQL function and operator in a DBMS that provides a recursive query form and used as part of such a DBMS. For example, it could be implemented as part of a DBMS that supports the SQL / XML publishing functions of the SQL: 2003 standard. It can also be added to or included as SQL functions and operators in commercial object relational (OR) DBMS products such as Oracle 11g, DB2, SQL Server 2008, or any other commercial relational DBMS product, or in the new DBMS product. will be.

도 1은 본 문서의 SQL 질의들에서 참조되는 테이블들과 그 테이블들의 투플들이고,1 is a table referenced in the SQL queries of this document and the tuples of the tables,

도 2는 SQL/XML 출판 함수들을 이용하여 부서번호가 1인 부서에 해당하는 테이블 departments의 투플과 그 부서의 관리자에 해당하는 테이블 employees의 투플로부터 하나의 XML 값을 생성하기 위해 작성된 SQL 질의이고,FIG. 2 is an SQL query written to generate an XML value from a tuple of a table departments corresponding to a department having a department number 1 and a tuple of a table employees corresponding to a manager of the department using SQL / XML publishing functions. ,

도 3은 SQL/XML 출판 함수들을 이용하여 상사와 부하의 관계로 연결된 테이블 employees의 특정 투플들로부터 XML 값을 생성하기 위해 작성된 SQL 질의이고,FIG. 3 is an SQL query written to generate XML values from specific tuples of table employees connected in a boss-to-load relationship using SQL / XML publishing functions,

도 4는 도 3의 SQL 질의의 결과투플로 생성된 XML 값이고,4 is an XML value generated as a result tuple of the SQL query of FIG.

도 5는 도 4의 XML 값의 구조를 표현한 XML 스키마 그래프이고,5 is an XML schema graph representing the structure of the XML value of FIG.

도 6은 재귀적 질의에서 재귀적 임시 결과투플들, 재귀적 결과투플들, 그리고 최종 결과투플들의 예를 제시하기 위해 작성된 질의이고,6 is a query written to present an example of recursive temporary result tuples, recursive result tuples, and final result tuples in a recursive query,

도 7은 도 6의 재귀적 질의의 재귀적 임시 결과투플들, 재귀적 결과투플들, 그리고 최종 결과투플들을 나타낸 것이고,FIG. 7 illustrates recursive temporary result tuples, recursive result tuples, and final result tuples of the recursive query of FIG.

도 8은 하나의 with 절과 하나의 마감 부질의로 구성된 SQL:1999 표준의 재귀적 질의에서 그 질의의 전체 구성을 나타내고 하나의 재귀적 임시 테이블의 선언과 정의에 대한 내부 구성을 도식화한 것이고,8 shows the overall structure of a query in a recursive query of the SQL: 1999 standard consisting of a with clause and a closing subquery, and illustrates the internal structure of the declaration and definition of a recursive temporary table.

도 9는 with 절에서 루트 식별 부질의들과 자식 식별 부질의들, 그리고 재귀적 질의를 마감하는 마감 부질의의 상세 구성을 나타내기 위하여 SQL:1999 표준의 재귀적 질의의 문법을 따라 하나의 재귀적 임시 테이블만을 생성하고 그를 대상으 로 재귀적 질의를 형성하는 예를 도식화한 것이고,Figure 9 shows a single recursion according to the syntax of the recursive query of the SQL: 1999 standard to show the detailed structure of root identification subqueries, child identification subqueries, and closing subqueries closing a recursive query in a with clause. This is an example of creating only a temporary table and forming a recursive query against it.

도 10은 SQL:1999 표준의 재귀적 질의에 명시되는 조건들을 도식화한 것이고,10 is a diagram illustrating conditions specified in a recursive query of the SQL: 1999 standard.

도 11은 도 10에 명시된 조건들의 의미를 도식화한 것이고,FIG. 11 illustrates the meanings of the conditions specified in FIG. 10.

도 12는 테이블 employees에서 상사를 가지지 않는 각 사원에 대해 그 사원과 그 사원의 모든 직간접 부하사원들에 해당하는 투플들을 인출하는 SQL:1999 표준의 재귀적 질의와 그 질의의 재귀적 임시 결과투플들을 도식화한 것이고,Figure 12 shows a recursive query of the SQL: 1999 standard and a recursive ad hoc result tuple of that query for each employee who does not have a boss in the table employees and retrieves tuples corresponding to that employee and all its direct and indirect subordinates. It's a schematic,

도 13은 테이블 employees와 테이블 departments를 대상으로 부서명이 'HR' 또는 'TFT'인 부서들의 관리자들과 그 관리자들 각각의 모든 직간접 부하사원들 중 월급이 30000 이상인 사원들을 인출하되 이름이 'CHANHO'인 사원의 모든 직간접 부하사원들을 결과에서 배제하고 월급이 26000 미만인 부하사원들과 그 사원들의 모든 직간접 부하사원들을 결과에서 배제하는 SQL:1999 표준의 재귀적 질의와 그 질의의 재귀적 임시 결과투플들, 그리고 그 질의의 재귀적 결과투플들을 도식화한 것이고,Fig. 13 shows the managers of departments whose department name is 'HR' or 'TFT' and the employees whose salary is more than 30000 among all the direct and indirect subordinates of each of the managers with the name 'CHANHO' for the table employees and the table departments. Recursive queries in the SQL: 1999 standard and recursive ad hoc result tuples that exclude all direct and indirect subordinates of an employee from the results and exclude subordinates with a salary less than 26000 and all direct and indirect subordinates of the employee from the result. , And plot the recursive result tuples of the query,

도 14는 도 13(a)의 재귀적 질의를 도 11의 표기 방법으로 표현한 것이고,FIG. 14 is a representation of the recursive query of FIG. 13 (a) using the notation method of FIG.

도 15는 테이블 employees에서 employee_id가 21인 사원과 그 사원의 모든 직간접 부하사원들에 해당하는 투플들을 구하는 재귀적 임시 테이블을 정의하고 그 재귀적 임시 테이블과 테이블 departments를 카티션 곱하여 생성된 투플들을 인출하는 SQL:1999 표준의 재귀적 질의와 그 질의의 재귀적 임시 결과투플들 그리고 그 질의의 재귀적 결과투플들을 도식화한 것이고,Fig. 15 defines a recursive temporary table that obtains tuples corresponding to an employee whose employee_id is 21 and all the direct and indirect subordinates of the employee in the table employees, and fetches tuples generated by multiplying the recursive temporary table and table departments. Schematizes the recursive query of the SQL: 1999 standard, the recursive temporary result tuples of the query, and the recursive result tuple of the query,

도 16은 테이블 employees에서 employee_id가 10인 사원과 그 사원의 모든 직간접 부하사원들에 해당하는 투플들을 구하는 재귀적 임시 테이블, 그리고 테이블 employees와 테이블 departments에서 employee_id가 14인 사원과 그 사원의 모든 직간접 상사들에 해당하는 투플들을 구하는 재귀적 임시 테이블을 정의하고 그 재귀적 임시 테이블들 간의 조인으로 생성된 투플들을 인출하는 SQL:1999 표준의 재귀적 질의와 그 질의의 재귀적 임시 결과투플들 그리고 그 질의의 재귀적 결과투플들을 도식화한 것이고,Figure 16 shows a recursive temporary table that obtains tuples corresponding to an employee with employee_id of 10 in the table employees and all direct and indirect subordinates of the employee, and an employee with employee_id of 14 in the table employees and table departments and all direct and indirect bosses of the employee. Recursive queries in the SQL: 1999 standard and recursive temporary result tuples of the query, defining a recursive temporary table that finds tuples corresponding to the fields, and retrieving tuples created by joins between the recursive temporary tables. Of the recursive result tuple of

도 17은 도 12(a)의 재귀적 질의의 재귀적 결과투플들이 형성하는 재귀적 결과투플 트리들을 도식화한 것이고,FIG. 17 illustrates recursive result tuple trees formed by the recursive result tuples of the recursive query of FIG.

도 18은 도 17의 재귀적 임시 결과투플 트리들의 루트 노드들에 대해 가상의 부모 노드를 둠으로써 형성되는 가상의 재귀적 임시 결과투플 트리를 도식화한 것이고,FIG. 18 is a schematic diagram of a virtual recursive temporary result tuple tree formed by placing a virtual parent node with respect to root nodes of the recursive temporary result tuple trees of FIG.

도 19는 Oracle의 재귀적 질의의 문법을 도식화한 것이고,19 illustrates the syntax of Oracle's recursive query,

도 20은 Oracle의 재귀적 질의의 문법을 그 질의에 명시되는 조건들의 상세 내역을 기반으로 도식화한 것이고,20 is a diagram of the grammar of an Oracle recursive query based on details of the conditions specified in the query,

도 21은 Oracle의 재귀적 질의에 명시되는 조건들의 의미를 도식화한 것이고,Figure 21 illustrates the meaning of the conditions specified in Oracle's recursive query,

도 22는 Oracle의 재귀적 질의의 의미를 SQL:1999 표준의 재귀적 질의로 표현한 것이고,22 illustrates the meaning of an Oracle recursive query as a recursive query of the SQL: 1999 standard.

도 23은 도 13(a)의 질의와 동등한 의미의 질의를 Oracle의 질의로 작성한 것이고,FIG. 23 is a query of Oracle equivalent to the query of FIG. 13 (a);

도 24는 도 15(a)의 질의와 동등한 의미의 질의를 Oracle의 질의로 작성한 것이고,FIG. 24 illustrates a query having an equivalent meaning as the query of FIG. 15A as an Oracle query.

도 25는 SQL/XML 출판 함수들을 포함한 SQL 질의들의 예와 그 질의들의 결과투플들을 나타낸 것이고,Figure 25 shows an example of SQL queries including SQL / XML publishing functions and the result tuples of those queries,

도 26은 도 17의 재귀적 결과투플 트리들 각각으로부터 재귀적 구조의 XML 값과 그 트리의 투플가족의 평균 급여의 쌍으로 구성된 하나의 결과투플을 생성하는 SQL 질의를 나타낸 것이고,FIG. 26 illustrates an SQL query for generating a result tuple consisting of a pair of XML values of a recursive structure and an average salary of a tuple family of the tree from each of the recursive result tuple trees of FIG. 17.

도 27은 도 26의 질의의 결과투플들을 나타낸 것이고,FIG. 27 shows the result tuples of the query of FIG.

도 28은 XML 값인 도 27의 칼럼 xml_value의 값의 구조를 표현한 XML 스키마 그래프이고,FIG. 28 is an XML schema graph representing a structure of a value of the column xml_value of FIG. 27 that is an XML value.

도 29는 도 27의 XML 값들을 생성하기 위해 SQL 함수 XMLNEST를 select 절에 포함한 질의를 Oracle의 문법을 기반으로 작성한 것이고,FIG. 29 is a query based on Oracle's grammar including a query including SQL function XMLNEST in a select clause to generate XML values of FIG.

도 30은 SQL 함수 XMLNEST의 명세를 표현한 것이고,30 represents a specification of the SQL function XMLNEST,

도 31은 SQL 함수 XMLNEST를 포함한 SQL 질의의 처리 흐름을 도식화한 것이고,31 is a diagram illustrating a processing flow of an SQL query including an SQL function XMLNEST.

도 32는 XMLNEST와 SQL의 기존 집단함수들을 select 절에 포함한 재귀적 질의를 SQL:1999 표준의 문법을 기반으로 작성한 것이고,32 illustrates a recursive query including XMLNEST and SQL existing aggregate functions in a select clause based on the syntax of the SQL: 1999 standard.

도 33은 도 32의 질의의 결과투플들을 나타낸 것이고,33 shows the result tuples of the query of FIG.

도 34는 도 1의 테이블 employees를 대상으로 상사를 가지지 않는 각 사원에 대하여 그 사원과 그 사원의 모든 직간접 부하사원들의 사원번호와 이름을 이용하여 하나의 재귀적 구조의 XML 값을 생성하고 그 XML 값을 엘리먼트 "HIERARCHY"의 자식 엘리먼트로 구성한 XML 값을 하나의 결과투플로 생성하는 질의를 Oracle의 문법을 기반으로 작성한 것이고,FIG. 34 generates an XML value of one recursive structure using the employee number and name of the employee and all direct and indirect subordinates of the employee for each employee who does not have a boss for the table employees of FIG. Based on Oracle's grammar, a query that generates an XML value consisting of a child element of the element "HIERARCHY" as a result tuple,

도 35는 도 34의 질의의 결과투플들을 나타낸 것이고,35 shows the result tuples of the query of FIG. 34,

도 36은 도 1의 테이블 employees를 대상으로 상사를 가지지 않는 각 사원에 대하여 그 사원과 그 사원의 모든 직간접 부하사원들의 투플들의 집합을 X라 할 때, <집합 X의 투플들의 칼럼 employee, 칼럼 first_name, 그리고 칼럼 last_name의 칼럼값으로써 그 투플들 간의 상사-부하 관계를 따라 생성한 하나의 재귀적 구조의 XML 값, 집합 X의 모든 투플들의 칼럼 salary의 칼럼값의 합을 이용하여 생성한 하나의 XML 값>의 쌍을 연결하여 생성한 하나의 XML 값을 하나의 결과투플로 생성하는 질의를 Oracle의 문법을 기반으로 작성한 것이고,FIG. 36 is a set of tuples of the employee and all the direct and indirect subordinates of the employee for each employee who does not have a boss for the table employees of FIG. 1, where <column of tuples of set X, column first_name And a single XML generated using the sum of the column values of the column salary of all tuples of the set X and the recursive XML values generated along the similarity-load relationship between the tuples as the column values of the column last_name. Based on Oracle's grammar, a query that generates one XML value generated by concatenating pairs of values> with one result tuple,

도 37은 도 36의 질의의 결과투플들을 나타낸 것이고,FIG. 37 shows the result tuples of the query of FIG. 36;

도 38은 도 36을 위한 질의를 XMLCONCAT을 대신하여 XMLFOREST를 이용하여 Oracle의 문법을 기반으로 작성한 것이고,FIG. 38 is a query based on Oracle's grammar using XMLFOREST instead of XMLCONCAT.

도 39는 도 38의 질의의 결과투플들을 나타낸 것이고,39 shows the result tuples of the query of FIG. 38,

도 40은 도 1의 테이블 employees를 대상으로 상사를 가지지 않는 각 사원에 대하여 그 사원과 그 사원의 모든 직간접 부하사원들의 집합을 X라 할 때, (1) 집합 X에 속한 사원들의 연결 관계를 반영하는 재귀적 구조의 XML 값, (2) 집합 X에 속한 사원들의 급여의 합계, 급여의 평균, 수, 그리고 (3) 집합 X에 속한 사원들의 급여의 최대값과 최소값을 하나의 결과투플로 인출하되 급여가 32000 미만이거나 급여가 38000 이상이고 52800 이하의 범위에 속하는 사원들만이 각 집합에 포함되도록 Oracle의 문법을 기반으로 작성한 질의를 나타낸 것이고,FIG. 40 is a table of employees who do not have a supervisor with respect to the table employees of FIG. 1, when the set of employees and all direct and indirect subordinates of the employees is X, (1) reflects the connection relationship of employees belonging to the set X; Recursive XML values, (2) sum of salaries of employees in set X, average, number of salaries, and (3) maximum and minimum salaries of employees in set X. However, the query is written based on Oracle's grammar so that only those employees whose salary is less than 32000 or whose salary is more than 38000 and within the range of 52800 are included in each set.

도 41은 도 40의 질의의 재귀적 임시 결과투플들이 형성하는 재귀적 임시 결과투플 트리들과 그 질의의 재귀적 결과투플들이 형성하는 재귀적 결과투플 트리들을 나타낸 것이고,FIG. 41 illustrates recursive temporary result tuple trees formed by the recursive temporary result tuples of the query of FIG. 40 and recursive result tuple trees formed by the recursive result tuples of the query.

도 42는 도 1의 테이블 employees를 대상으로 사원번호가 10인 사원에 대하여 그 사원과 그 사원의 모든 직간접 부하사원들의 정보를 이용하여 하나의 재귀적 구조의 XML 값을 생성하되 그 사원과 그 사원의 모든 직간접 부하사원들의 집합을 X라 할 때, 집합 X에 속한 사원들 각각에 대하여 (1) 그 사원의 급여, (2) 그 사원과 그 사원의 부하사원들의 급여의 합, 그리고 (3) 그 사원과 그 사원의 부하사원들의 수의 합을 나타내는 XML 엘리먼트들을 생성하는 질의를 Oracle의 문법을 기반으로 작성한 것이고,42 generates an XML value of one recursive structure using the information of the employee and all direct and indirect subordinates of the employee for the employee having the employee number 10 for the table employees of FIG. When X is the set of all direct and indirect subordinates of X, for each of the employees in set X, (1) the salary of the employee, (2) the sum of the salary of the employee and its subordinates, and (3) Based on Oracle's grammar, a query is generated that generates XML elements representing the sum of the employee and the number of employees in the employee.

도 43은 도 42의 질의의 결과투플을 나타낸 것이고,43 shows the result tuple of the query of FIG.

도 44는 SQL 연산자 tc_root를 포함한 SQL 질의의 처리 흐름을 도식화한 것이고,44 is a diagram illustrating the processing flow of an SQL query including the SQL operator tc_root,

도 45는 SQL 연산자 tc_root의 명세를 표현한 것이고,45 is a representation of the specification of the SQL operator tc_root,

도 46은 도 1의 테이블 employees를 대상으로 상사를 가지지 않는 각 사원에 대하여 그 사원과 그 사원의 모든 직간접 부하사원들의 집합을 X라 할 때, (1) 집합 X에 속한 사원들의 최고 상사에 해당하는 사원의 이름, (2) 집합 X에 속한 사원 들의 급여의 합계, 급여의 평균, 수 그리고 (3) 집합 X에 속한 사원들의 급여의 최대값과 최소값을 하나의 결과투플로 인출하되 급여가 32000 미만이거나 급여가 38000 이상이고 52800 이하의 범위에 속하는 사원들만이 각 집합에 포함되도록 Oracle의 문법을 기반으로 작성한 질의이고,46 is a set of the employee and all direct and indirect subordinates of the employee for each employee who does not have a boss for the table employees of FIG. 1, which corresponds to (1) the highest boss of employees belonging to the set X; The employee's name, (2) the sum of salaries of employees in set X, the average of salaries, and the number and (3) the maximum and minimum salaries of employees in set X are drawn with one result tuple, but the salary is 32000. A query written based on Oracle's grammar so that only those employees who are less than or equal to or above salary of 38000 and in the range of 52800 or less are included in each set.

도 47은 도 46의 질의의 결과투플들을 나타낸 것이고,FIG. 47 shows the result tuples of the query of FIG. 46;

도 48은 도 1의 테이블 employees와 테이블 departments를 대상으로 부서명이 'HR', 'RD', 그리고 'TFT'인 부서의 관리자들 각각에 대하여 그 사원과 그 사원의 모든 직간접 부하사원들의 집합을 X라 할 때, (1) 집합 X에 속한 사원들의 최고 상사에 해당하는 사원의 이름과 소속 부서의 이름, (2) 집합 X에 속한 사원들의 급여의 합계, 급여의 평균, 수, 그리고 (3) 집합 X에 속한 사원들의 급여의 최대값과 최소값을 하나의 결과투플로 인출하되 해당 부서의 관리자와 그 관리자로부터 두 단계 아래까지의 부하사원들 즉, 수준이 3 이하인 사원들과 급여가 40000 보다 크고 52800 미만의 범위에 속하는 사원들만이 각 집합에 포함되도록 Oracle의 문법을 기반으로 작성한 질의이고,FIG. 48 shows the set of employees and all direct and indirect subordinates of the employee for each of the managers of a department whose names are 'HR', 'RD', and 'TFT' for the table employees and table departments of FIG. (1) the name of the employee and the department belonging to the chief supervisor of the employees of set X, (2) the sum of the salaries of the employees of set X, the average, number of salaries, and (3) Withdraw the maximum and minimum salaries of the employees in the set X in one result tuple, but the manager of the department and the subordinates up to two levels below the manager, that is, employees with level 3 or less, and salaries greater than 40000 The query is written based on Oracle's grammar so that only employees within the range of less than 52800 are included in each set.

도 49는 도 48의 질의의 재귀적 임시 결과투플들이 형성하는 재귀적 임시 결과투플 트리들과 그 질의의 재귀적 결과투플들이 형성하는 재귀적 결과투플 트리들을 나타낸 것이고,FIG. 49 illustrates recursive temporary result tuple trees formed by the recursive temporary result tuples of the query of FIG. 48 and recursive result tuple trees formed by the recursive result tuples of the query.

도 50은 도 48의 질의의 결과투플들을 나타낸 것이고,FIG. 50 shows the result tuples of the query of FIG. 48,

도 51은 도 1의 테이블 employees를 대상으로 상사를 가지지 않는 각 사원에 대하여 <그 사원의 이름, 그 사원과 그 사원의 모든 직간접 부하사원들의 사원번호 와 이름을 이용하여 생성한 재귀적 구조의 XML 값>의 쌍으로 하나의 결과투플을 구성하되 그 결과투플들을 그들의 첫 번째 결과칼럼의 칼럼값을 기준으로 오름차순으로 정렬하는 질의를 Oracle의 문법과 SQL:1999 표준의 문법을 기반으로 작성한 질의들이고,51 is a recursive XML generated by using <employee's name, employee number and name of the employee and all direct and indirect subordinates of the employee for each employee who does not have a boss for the table employees of FIG. A query that composes a result tuple of value> pairs and sorts the result tuples in ascending order based on the column value of their first result column based on Oracle's syntax and the syntax of the SQL: 1999 standard.

도 52는 도 51의 질의의 결과투플들을 나타낸 것이고,FIG. 52 shows the result tuples of the query of FIG. 51;

도 53은 도 1의 테이블 employees를 대상으로 상사를 가지지 않는 각 사원에 대하여 그 사원과 그 사원의 모든 직간접 부하사원들의 집합을 X라 할 때, 집합 X에 속한 투플들의 <급여의 합계, 수, 급여의 평균>을 하나의 결과투플로 인출하되 그 결과투플들을 그 결과투플들 각각을 생성하게 한 집단의 최고 상사에 해당하는 사원의 이름의 증가 순으로 정렬하는 질의를 Oracle의 문법을 기반으로 작성한 것이고,53 is a sum of the number of tuples of the tuples belonging to the set X, the sum of the salaries of the employees and the direct and indirect subordinates of the employee for each employee who does not have a boss for the table employees of FIG. Based on Oracle's grammar, a query is made that draws the average of salaries> into one result tuple and sorts the result tuples in increasing order of the employee's name, which is the chief boss of the group that generated each of the result tuples. Will,

도 54는 도 53의 질의의 결과투플들을 나타낸 것이고,54 shows the result tuples of the query of FIG. 53,

도 55는 도 1의 테이블 employees를 대상으로 상사를 가지지 않는 각 사원에 대하여 그 사원과 그 사원의 모든 직간접 부하사원들의 집합을 X라 할 때, 집합 X에 속한 사원들의 최고 상사에 해당하는 사원의 이름과 소속 부서의 이름, 그 집합에 속한 사원들의 수와 급여의 합계, 그 집합에 속한 사원들의 연결 관계를 반영하는 재귀적 구조의 XML 값을 생성하고 그 값들을 하나의 XML 값으로 생성하는 질의를 Oracle의 문법을 기반으로 작성한 것이고,FIG. 55 is a diagram of an employee corresponding to the highest boss of employees belonging to the set X when X is a set of employees and all direct and indirect subordinates of the employee for each employee having no boss for the table employees of FIG. A query that creates an XML value with a recursive structure that reflects the name, the name of the department, the sum of the number and salaries of the employees in the set, and the connection of the employees in the set, and creates the value as an XML value. Is written based on Oracle's syntax,

도 56은 도 55의 질의의 결과투플들을 나타낸 것이고,56 shows the result tuples of the query of FIG. 55,

도 57은 본 발명이 구현되는 관계형 데이터베이스 시스템의 블록도이고, 57 is a block diagram of a relational database system in which the present invention is implemented,

도 58은 SQL 질의가 본 발명이 제안하는 SQL 함수들과 연산자에 의해 처리되는 처리 과정을 도식적으로 보여준다.58 is a diagram schematically illustrating a process in which an SQL query is processed by SQL functions and operators proposed by the present invention.

* 도면의 주요 부분에 대한 부호의 설명 *Explanation of symbols on the main parts of the drawings

100 : 데이터베이스 시스템 110 : 데이터베이스100: database system 110: database

122 : 데이터베이스 프로그램파일들 124, 126 : 다른 프로그램들122: database program files 124, 126: other programs

160 : 데이터베이스 관리 시스템 170 : 질의처리기160: database management system 170: query processor

175 : SQL 함수처리기 177 : SQL 연산자처리기175: SQL function handler 177: SQL operator handler

180 : 동시성제어기 190 : 저장관리자180: concurrency controller 190: storage manager

200 : 다른 프로세스들 C : 중앙처리장치200: other processes C: central processing unit

AM : 데이터저장 매체 PM : 시스템 메모리AM: Data Storage Medium PM: System Memory

Claims (29)

컴퓨팅 시스템의 프로세서에서 데이터베이스 관리 시스템(DBMS)의 프로세스를 그 컴퓨팅 시스템의 메모리에 로드하여 데이터베이스에 대한 질의의 처리를 수행하는 방법에 있어서,A method of loading a process of a database management system (DBMS) in a processor of a computing system into a memory of the computing system to perform a query for a database. 상기 데이터베이스에 대하여 재귀적 질의를 수행하여 재귀적 임시 결과투플들과 재귀적 결과투플들을 생성하는 단계;Performing a recursive query against the database to generate recursive temporary result tuples and recursive result tuples; 상기 재귀적 결과 투플들에 해당하는 노드들이 형성하는 재귀적 결과투플 트리들 각각에 대하여 재귀적 임시 결과투플 트리들 각각이 하나의 재귀적 결과투플 트리만을 생성하는지를 판단하는 제1판단단계; A first determination step of determining whether each of the recursive temporary result tuple trees generates only one recursive result tuple tree for each of the recursive result tuple trees formed by the nodes corresponding to the recursive result tuples; 상기 재귀적 결과투플 트리의 루트 노드에 해당하는 재귀적 결과투플이 상기 재귀적 임시 결과투플 트리의 루트 노드에 해당하는 재귀적 임시 결과투플을 기원 투플로 가지는지 판단하는 제2판단단계; 및A second judging step of determining whether a recursive result tuple corresponding to a root node of the recursive result tuple tree has a recursive temporary result tuple corresponding to a root node of the recursive temporary result tuple tree as an origin tuple; And 상기 제1판단단계와 제2판단단계 중 어느 하나라도 만족하지 않는 경우 오류신호를 생성하고, 상기 제1판단단계와 제2판단단계 모두를 만족하는 경우 상기 재귀적 결과투플 트리들 각각에 대하여 그 트리를 구성하는 노드들을 탐색하여 그 트리에 속하는 노드들에 해당하는 투플들로 하나의 재귀적 구조의 XML 값을 생성하는 단계를 수행하는 것을 특징으로 하는 데이터베이스에 대한 재귀적 구조의 XML 값을 생성하는 방법. An error signal is generated when neither one of the first determination step and the second determination step is satisfied, and for each of the recursive result tuple trees when both of the first determination step and the second determination step are satisfied. Searching for the nodes constituting the tree and generating XML values of a recursive structure with tuples corresponding to the nodes belonging to the tree. How to. 제1항에 있어서, 상기 XML 값을 생성하는 방법은 SQL:1999 표준의 재귀적 질의 양식을 따르는 DBMS 또는 자신만의 독자적인 재귀적 질의 양식을 제공하는 DBMS의 재귀적 질의의 SELECT 절에 사용되어 그 질의의 재귀적 결과투플들을 대상으로 재귀적 구조의 XML 값을 생성하는 기능을 갖는 특정 이름(XMLNEST)의 SQL 함수로 구현되어 상기 DBMS의 일부로서 포함되는 것을 특징으로 하는 재귀적 구조의 XML 값을 생성하는 방법.The method of claim 1, wherein the XML value generating method is used in a SELECT clause of a recursive query of a DBMS that provides a recursive query form of its own or a DBMS that follows the recursive query form of the SQL: 1999 standard. The XML value of the recursive structure is implemented as an SQL function of a specific name (XMLNEST) having the function of generating the XML value of the recursive structure targeting the recursive result tuples of the query and included as part of the DBMS. How to produce. 제1항에 있어서, 상기 재귀적 임시 결과투플의 생성 시에, 재귀적 임시 결과투플들 각각에게는 자기의 루트 투플의 투플 식별자(root_tid), 자기의 투플 식별자(tid), 그리고 자기의 부모 투플의 투플 식별자(parent_tid)를 부여하고, 이 식별자 정보 <root_tid, tid, parent_tid>를 이용하여 상기 재귀적 임시 결과투플들과 상기 재귀적 결과투플들에 대하여 재귀적 임시 결과투플 트리들과 재귀적 결과투플 트리들을 각각 구성하는 것을 특징으로 하는 재귀적 구조의 XML 값을 생성하는 방법.The method of claim 1, wherein in generating the recursive temporary result tuple, each of the recursive temporary result tuples has a tuple identifier root_tid of its root tuple, a tuple identifier tid of its parent, and a parent tuple of its own. Give a tuple identifier (parent_tid), and use this identifier information <root_tid, tid, parent_tid> for the recursive temporary result tuples and the recursive result tuples recursive temporary result tuple trees and recursive result tuple A method of generating an XML value of a recursive structure, each constructing a tree. 제2항에 있어서, 상기 SQL 함수 XMLNEST는 계층집단(hierarchy group)만을 대상으로 삼는 계층집단함수이며, 상기 계층집단은 재귀적 질의의 재귀적 임시 결과투플들 또는 재귀적 결과투플들에 의해 형성되는 집단으로서 하나의 투플과 그 투플을 조상 투플로 가지는 모든 투플들의 모음으로 정의되는 것을 특징으로 하는 재귀적 구조의 XML 값을 생성하는 방법. The method of claim 2, wherein the SQL function XMLNEST is a hierarchical group function targeting only a hierarchy group, and the hierarchy group is formed by recursive temporary result tuples or recursive result tuples of a recursive query. A method of generating an XML value of a recursive structure characterized in that a tuple is defined as a collection of all tuples having a tuple as its collective and its ancestor tuple. 제2항에 있어서, 상기 재귀적 결과투플 트리별로 생성된 상기 재귀적 구조의 XML 값들을 XML 스키마 그래프로 표현할 때, 그 XML 스키마 그래프는 (1)정확히 하나의 사이클을 가지고, (2) NEST_ROOT 노드를 반드시 가지며 NEST_SUBORDINATE 노드를 선택적으로 가질 수 있으며, (3) NEST_SUBORDINATE 노드는 NEST_ROOT 노드 이외의 자식 노드들을 가지지 않는 조건을 만족하며, The XML schema graph according to claim 2, wherein when representing the XML values of the recursive structure generated for each recursive result tuple tree in an XML schema graph, the XML schema graph has (1) exactly one cycle, and (2) a NEST_ROOT node. Must have NEST_SUBORDINATE node, and (3) NEST_SUBORDINATE node satisfies the condition of not having child nodes other than NEST_ROOT node, 여기서, NEST_ROOT 노드는 XML 스키마 그래프에서 사이클에 참여하는 노드들 중 그 사이클의 시작이 되는 노드를 의미하며, NEST_SUBORDINATE 노드는 그 NEST_ROOT 노드의 자식 노드로서 NEST_ROOT 노드와 사이클을 형성하며 NEST_ROOT 노드를 제외한 어떠한 자식 노드도 가지지 않는 노드를 의미하는 것을 특징으로 하는 재귀적 구조의 XML 값을 생성하는 방법.Here, the NEST_ROOT node means the node that starts the cycle among the nodes participating in the cycle in the XML schema graph, and the NEST_SUBORDINATE node forms a cycle with the NEST_ROOT node as a child node of the NEST_ROOT node, and any child except the NEST_ROOT node. A method of generating an XML value of a recursive structure, meaning a node having no nodes. 제2항에 있어서, 상기 SQL 함수 XMLNEST는 (1) NEST_ROOT 엘리먼트의 이름과 그 XML 엘리먼트의 XML 속성들, (2) NEST_SUBORDINATE 엘리먼트의 이름과 그 XML 엘리먼트의 XML 속성들, (3) NEST_ROOT 엘리먼트의 자식 엘리먼트들에 대한 명세, 그리고 (4) 형제 NEST_ROOT 엘리먼트들 간의 정렬을 명시할 수 있는 명세를 가지며,3. The SQL function XMLNEST of claim 2 wherein (1) the name of the NEST_ROOT element and XML attributes of the XML element, (2) the name of the NEST_SUBORDINATE element and the XML attributes of the XML element, and (3) a child of the NEST_ROOT element. A specification for the elements, and (4) a specification for specifying the alignment between sibling NEST_ROOT elements, 여기서 상기 재귀적 결과투플 트리별로 생성된 상기 재귀적 구조의 XML 값들을 XML 스키마 그래프로 표현할 때, NEST_ROOT 엘리먼트는 XML 스키마 그래프에서 사이클에 참여하는 노드들 중 그 사이클의 시작이 되는 노드인 NEST_ROOT 노드가 나타내는 XML 엘리먼트를 의미하며, NEST_SUBORDINATE 엘리먼트는 그 NEST_ROOT 노 드의 자식 노드로서 NEST_ROOT 노드와 사이클을 형성하며 NEST_ROOT 노드를 제외한 어떠한 자식 노드도 가지지 않는 노드인 NEST_SUBORDINATE 노드가 나타내는 XML 엘리먼트를 의미하는 것을 특징으로 하는 재귀적 구조의 XML 값을 생성하는 방법.Here, when expressing the XML values of the recursive structure generated by the recursive result tuple tree in an XML schema graph, the NEST_ROOT element is the NEST_ROOT node that is the node that starts the cycle among the nodes participating in the cycle in the XML schema graph. The NEST_SUBORDINATE element represents an XML element represented by a NEST_SUBORDINATE node, which is a node that does not have any child nodes except NEST_ROOT node, forming a cycle with the NEST_ROOT node as a child node of the NEST_ROOT node. How to generate an XML value of a recursive structure. 제2항에 있어서, 상기 SQL 함수 XMLNEST는 SQL:2003 표준의 SQL/XML 출판 함수들인 XMLELEMENT, XMLCONCAT, XMLFOREST, 그리고 XMLATTRIBUTES를 자신의 입력 인자로 가질 수 있는 것을 특징으로 하는 재귀적 구조의 XML 값을 생성하는 방법.The XML function of claim 2, wherein the SQL function XMLNEST can have XMLELEMENT, XMLCONCAT, XMLFOREST, and XMLATTRIBUTES, which are SQL / XML publishing functions of the SQL: 2003 standard, as its input parameters. How to produce. 제2항에 있어서, 상기 SQL 함수 XMLNEST는 SQL:2003 표준의 SQL/XML 출판 함수들인 XMLELEMENT, XMLCONCAT, 그리고 XMLFOREST의 입력 인자로 사용될 수 있는 것을 특징으로 하는 재귀적 구조의 XML 값을 생성하는 방법.3. The method of claim 2, wherein the SQL function XMLNEST can be used as an input argument of XMLELEMENT, XMLCONCAT, and XMLFOREST, which are SQL / XML publishing functions of the SQL: 2003 standard. 제2항에 있어서, 상기 재귀적 질의의 상기 SELECT 절에 상기 SQL 함수 XMLNEST와 함께 포함된 SQL의 기존 집단함수들인 SUM, COUNT, AVG, MIN, MAX, XMLAGG는 상기 재귀적 질의의 재귀적 결과투플들을 그들의 기원 투플들에 해당하는 노드들이 소속된 재귀적 임시 결과투플 트리별로 분류하여 하나 이상의 재귀적 결과투플을 구성원으로 가지는 각 분류의 모든 재귀적 결과투플들을 하나의 계층집단으로 처리해야 하는 제한을 갖는 것을 특징으로 하는 재귀적 구조의 XML 값을 생성하는 방법.The recursive result tuple of the recursive query according to claim 2, wherein the existing aggregate functions of SQL included in the SELECT clause of the recursive query together with the SQL function XMLNEST are SUM, COUNT, AVG, MIN, MAX, and XMLAGG. Classify nodes by their recursive temporary result tuple tree to which the nodes corresponding to their origin tuples belong, and treat the recursive result tuples of each classification having one or more recursive result tuples as members. And a method for generating an XML value of a recursive structure. 제2항에 있어서, 상기 SQL 함수 XMLNEST의 직간접 인자로만 사용되며 재귀적 결과투플 트리의 노드들 각각에 대해 그 노드를 루트로 가지는 서브트리의 모든 노드들에 해당하는 재귀적 결과투플들을 하나의 집단으로 보고 그들 각 집단에 대해 하나의 값을 계산하여 그 값을 그 집단을 대표하는 루트 노드에 해당하는 재귀적 결과투플에게 반환하는 'XMLNEST 관련 SQL 함수'들을 더 포함하는 것을 특징으로 하는 재귀적 구조의 XML 값을 생성하는 방법.3. The method of claim 2, wherein the recursive result tuples corresponding to all nodes of the subtree, which are used only as direct and indirect arguments of the SQL function XMLNEST and whose node is the root, for each node of the recursive result tuple tree The recursive structure further includes 'XMLNEST related SQL functions' that calculate a value for each group and return the value to the recursive result tuple corresponding to the root node representing the group. How to generate an XML value. 제10항에 있어서, 상기 XMLNEST 관련 SQL 함수들은 상기 각 집단의 재귀적 결과투플들에 대하여 함수 인자로 명시된 값 표현식을 적용하여 상기 하나의 값을 계산하는 함수들인 NEST_SUM, NEST_AVG, NEST_MIN, NEST_MAX 그리고 NEST_COUNT 중 적어도 어느 하나를 포함하며, The NEST_SUM, NEST_AVG, NEST_MIN, NEST_MAX and NEST_COUNT functions of claim 10, wherein the XMLNEST-related SQL functions apply the value expression specified as a function argument to the recursive result tuples of each group. At least one of, 상기 함수 NEST_SUM, NEST_AVG, NEST_MIN, NEST_MAX 그리고 NEST_COUNT는 그의 값 표현식을 해당 집단의 재귀적 결과투플들 각각에게 적용하여 구한 값들의 합, 평균값, 최소값, 최대값, 그리고 상기 구한 값이 NULL이 아닌 투플의 수를 각각 계산하여 그 집단을 대표하는 루트 노드에 해당하는 재귀적 결과투플에게 반환함으로써 재귀적 결과투플들 각각에게 하나의 집단값을 반환하는 SQL 집단함수인 것임을 특징으로 하는 재귀적 구조의 XML 값을 생성하는 방법.The functions NEST_SUM, NEST_AVG, NEST_MIN, NEST_MAX and NEST_COUNT apply their value expressions to each of the group's recursive result tuples, the sum, average, minimum, maximum, and value of the tuple whose value is not NULL. An XML value of a recursive structure, which is an SQL group function that returns a group value to each of the recursive result tuples by calculating each number and returning it to the recursive result tuple corresponding to the root node representing the group. How to generate. 제11항에 있어서, 상기 함수 NEST_SUM, NEST_AVG, NEST_MIN, NEST_MAX 그리고 NEST_COUNT는 SQL의 기존 집단함수 SUM, AVG, MIN, MAX 그리고 COUNT와 각각 동 일한 명세를 가지는 것을 특징으로 재귀적 구조의 XML 값을 생성하는 방법.12. The method of claim 11, wherein the functions NEST_SUM, NEST_AVG, NEST_MIN, NEST_MAX and NEST_COUNT each have the same specification as SUM, AVG, MIN, MAX and COUNT in the existing aggregate functions of SQL. How to. 제2항에 있어서, 상기 SQL 함수 XMLNEST는 하나의 재귀적 결과투플 트리를 하나의 집단으로 처리하는 집단함수의 특징을 가짐으로써 재귀적 질의에서 XMLNEST를 포함한 부질의는 group by 절을 포함할 수 없다는 제약을 갖는 것을 특징으로 하는 재귀적 구조의 XML 값을 생성하는 방법.The method of claim 2, wherein the SQL function XMLNEST is characterized by a group function that processes one recursive result tuple tree into one group, so that a subquery including XMLNEST in a recursive query cannot include a group by clause. A method for generating an XML value of a recursive structure, characterized in that it has a constraint. 제1항에 있어서, 상기 DBMS는 재귀적 질의와 SQL:2003 표준의 SQL/XML 출판함수들을 지원하는 DBMS인 것을 특징으로 하는 데이터베이스에 대한 재귀적 구조의 XML 값을 생성하는 방법.The method of claim 1, wherein the DBMS is a DBMS that supports recursive queries and SQL / XML publishing functions of the SQL: 2003 standard. 제14항에 있어서, 상기 DBMS는 오브젝트 관계형(Object-Relational) DBMS 또는 관계형 DBMS인 것을 특징으로 하는 데이터베이스에 대한 재귀적 구조의 XML 값을 생성하는 방법.15. The method of claim 14, wherein said DBMS is an object-relational DBMS or a relational DBMS. 제1항에 있어서, 상기 재귀적 결과투플 트리들 각각에 대하여 그 트리를 구성하는 노드들을 탐색하는 방법은 그 노드들에 대한 깊이우선탐색(depth-first search) 방법으로 수행되는 것을 특징으로 하는 데이터베이스에 대한 재귀적 구조의 XML 값을 생성하는 방법.The method of claim 1, wherein the method for searching the nodes constituting the tree for each of the recursive result tuple trees is performed by a depth-first search method for the nodes. How to generate XML value of recursive structure for. 제2항에 있어서, 자신만의 독자적인 재귀적 질의 양식을 제공하는 DBMS는 오라클(Oracle) 11g 또는 이것의 상위버전의 DBMS인 것을 특징으로 하는 데이터베이스에 대한 재귀적 구조의 XML 값을 생성하는 방법.3. The method of claim 2, wherein the DBMS providing its own recursive query form is an Oracle 11g or higher version of the DBMS. 제1항에 있어서, 상기 재귀적 임시 결과투플 트리는 상기 데이터베이스에 대한 재귀적 질의를 수행하는 과정에서 생성되는 재귀적 임시 테이블의 재귀적 임시 결과 투플들을 대상으로, 그 투플들을 노드들로 표현하고, 부모-자식 관계의 투플들에 해당하는 노드들을 부모 노드로부터 자식 노드로 향하는 방향 에지로 연결하여 표현함으로써 형성되는 트리들이고,The method of claim 1, wherein the recursive temporary result tuple tree represents the tuples as nodes for the recursive temporary result tuples of the recursive temporary table generated during the recursive query on the database, Trees formed by connecting nodes corresponding to tuples of a parent-child relationship with a direction edge from a parent node to a child node, 상기 재귀적 결과투플 트리는 상기 재귀적 결과투플들을 대상으로, 상기 재귀적 결과투플들 모두가 상기 재귀적 임시 결과투플들의 단수 복제에 의해 생성된 경우에 한하여, 상기 재귀적 결과투플들을 노드들로 표현하고 부모-자식 관계의 투플들에 해당하는 노드들을 부모 노드로부터 자식 노드로 향하는 방향 에지로 연결하여 표현함으로써 형성되는 트리들인 것을 특징으로 하는 데이터베이스에 대한 재귀적 구조의 XML 값을 생성하는 방법.The recursive result tuple tree targets the recursive result tuples and expresses the recursive result tuples as nodes only if all of the recursive result tuples are generated by singular copying of the recursive temporary result tuples. And trees formed by connecting nodes corresponding to tuples of a parent-child relationship with a direction edge from a parent node to a child node. 컴퓨팅 시스템의 프로세서에서 데이터베이스 관리 시스템(DBMS)의 프로세스를 그 컴퓨팅 시스템의 메모리에 로드하여 데이터베이스에 대한 질의의 처리를 수행함에 있어서, In the processor of the computing system to load a process of the database management system (DBMS) into the memory of the computing system to perform a query for the database, 상기 데이터베이스에 대하여 재귀적 질의를 수행하여 생성된 재귀적 임시 결 과투플들과 재귀적 결과투플들에 대한 연산처리를 특정 이름(tc_root)의 SQL 계층집단연산자를 실행하여 수행하는 방법으로서, A method of performing a recursive temporary result tuples and recursive result tuples generated by performing a recursive query on the database by executing an SQL hierarchical group operator of a specific name (tc_root), 상기 SQL 계층집단연산자 tc_root는,The SQL hierarchy group operator tc_root is 재귀적 질의 양식을 제공하는 DBMS의 재귀적 질의에 사용되어 그 질의의 모든 재귀적 결과투플들이 재귀적 임시 결과투플들의 단수 복제에 의해 생성된 경우에 한하여 그 재귀적 결과투플들을 그들의 기원 투플들에 해당하는 노드들이 소속된 재귀적 임시 결과투플 트리별로 분류하여 하나 이상의 재귀적 결과투플을 구성원으로 가지는 각 분류의 모든 재귀적 결과투플들을 하나의 집단으로 처리함으로써 그들 각 집단에 대해 하나의 값을 반환하는 기능을 갖는 것을 특징으로 하는 데이터베이스의 데이터를 연산처리 하는 방법.Used in a recursive query of a DBMS that provides a recursive query form so that all recursive result tuples of that query are generated by singular copies of recursive ad hoc result tuples to their origin tuples. Returns a value for each group by classifying all the recursive result tuples of each classification that have one or more recursive result tuples as members by classifying the recursive temporary result tuple tree to which the corresponding nodes belong. A method for arithmetic processing data of a database, characterized in that it has a function to do so. 제19항에 있어서, 상기 SQL 계층집단연산자 tc_root의 기능은,20. The method of claim 19, wherein the function of the SQL hierarchy operator tc_root is: 상기 재귀적 결과투플들이 상기 재귀적 임시 결과투플들의 단수 복제에 의해 생성되었는지를 판단하는 단수복제 판단단계;A singular replication determining step of determining whether the recursive result tuples are generated by a singular copy of the recursive temporary result tuples; 상기 단수복제 판단단계의 판단결과가 거짓(false)이면 오류신호를 생성하는 단계; 및Generating an error signal if the determination result of the singular replication determination step is false; And 상기 단수복제 판단단계의 판단결과가 참(true)이면, (i)상기 재귀적 결과투플들을 그들의 기원 투플들에 해당하는 노드들이 소속된 재귀적 임시 결과투플 트리별로 분류하는 단계와, (ii) 분류된 각 재귀적 결과투플들의 집단에 대해 그 집단에 해당하는 재귀적 임시 결과투플 트리의 루트 노드에 해당하는 재귀적 임시 결과투플의 칼럼값들을 이용하여 상기 SQL 계층집단연산자 tc_root의 인자로 명시된 값 표현식의 값을 계산하여 반환하는 반환단계를 수행하는 기능들을 포함하는 것을 특징으로 하는 데이터베이스의 데이터를 연산처리 하는 방법.(I) classifying the recursive result tuples by the recursive temporary result tuple tree to which nodes corresponding to their origin tuples belong; and (ii) if the judgment result of the singular replication judgment step is true; For each group of classified recursive result tuples, the value specified as the argument of the SQL hierarchy operator tc_root using the column values of the recursive temporary result tuple corresponding to the root node of the recursive temporary result tuple tree corresponding to that group. A method for arithmetic processing data of a database comprising functions of performing a return step of calculating and returning a value of an expression. 제20항 있어서, 상기 SQL 계층집단연산자 tc_root는 SQL:2003 표준의 임의의 값 표현식을 인자로 가짐으로써 재귀적 임시 결과투플 트리의 루트 노드에 해당하는 재귀적 임시 결과투플의 칼럼값들을 이용하여 그 값 표현식의 값을 생성하는 명세를 포함하는 것을 특징으로 하는 데이터베이스의 데이터를 연산처리 하는 방법.21. The SQL hierarchical group operator tc_root uses the column values of the recursive temporary result tuple corresponding to the root node of the recursive temporary result tuple tree by taking an arbitrary value expression of the SQL: 2003 standard as an argument. A method of computing data in a database comprising a specification for generating a value of a value expression. 제19항 있어서, 상기 SQL 계층집단연산자 tc_root는 집단연산자의 특징을 가지지만 tc_root가 대상으로 하는 집단들은 재귀적 임시 결과투플 트리들을 기준으로 형성되므로 재귀적 질의에서 tc_root를 포함한 부질의는 group by 절을 포함할 수 없다는 제약을 갖는 것을 특징으로 하는 데이터베이스의 데이터를 연산처리 하는 방법.The subquery including tc_root in a recursive query has a group by clause because the SQL hierarchical group operator tc_root has characteristics of a group operator, but the groups targeted by tc_root are formed based on recursive temporary result tuple trees. Method for arithmetic data of a database, characterized in that it has a constraint that it can not include. 제20항 있어서, 상기 SQL 계층집단연산자 tc_root와 함께 재귀적 질의의 동일 부질의에 포함된 SQL의 기존 집단함수들인 SUM, COUNT, AVG, MIN, MAX, XMLAGG각각은 그 질의의 재귀적 결과투플들을 그들의 기원 투플들에 해당하는 노드들이 소속된 재귀적 임시 결과투플 트리별로 분류하여 하나 이상의 재귀적 결과투플을 구성원으로 가지는 각 분류의 모든 재귀적 결과투플들을 하나의 집단으로 처리해야 하는 것을 특징으로 하는 데이터베이스의 데이터를 연산처리 하는 방법.21. The method of claim 20, wherein SUM, COUNT, AVG, MIN, MAX, and XMLAGG, which are existing aggregate functions of SQL included in the same subquery of the recursive query together with the SQL hierarchical operator tc_root, respectively, are used for recursive result tuples of the query. Nodes corresponding to their origin tuples are classified by recursive temporary result tuple tree to which all the recursive result tuples of each classification having one or more recursive result tuples are treated as one group. How to compute data in a database. 제19항에 있어서, 상기 SQL 계층집단연산자 tc_root는 SQL:1999 표준의 재귀적 질의 양식을 따르는 DBMS 또는 자신만의 독자적인 재귀적 질의 양식을 제공하는 DBMS의 재귀적 질의에 사용되는 연산자인 것을 특징으로 하는 데이터베이스의 데이터를 연산처리 하는 방법.20. The method of claim 19, wherein the SQL hierarchy operator tc_root is an operator used for a recursive query of a DBMS that provides a recursive query form of its own or a DBMS that follows the recursive query form of the SQL: 1999 standard. How to process data in a database. 컴퓨터에 제1항 내지 제24항 중 어느 한 항의 방법을 실행시키기 위한 프로그램을 기록한 컴퓨터-가독형 기록매체.A computer-readable recording medium having a computer recorded thereon a program for executing the method of any one of claims 1 to 24. 컴퓨터에 제1항 내지 제24항 중 어느 한 항의 방법을 실행시키기 위한 프로그램을 기록한 컴퓨터로 읽을 수 있는 매체와, 상기 매체로부터 상기 프로그램을 로드하기 위한 메모리와, 상기 메모리에 로드된 프로그램을 실행하는 중앙처리장치를 포함하는 것을 특징으로 하는 컴퓨터 시스템.A computer readable medium having recorded thereon a program for causing the computer to execute the method of any one of claims 1 to 24, a memory for loading the program from the medium, and a program loaded in the memory. A computer system comprising a central processing unit. 컴퓨터에, On your computer, 재귀적 질의 양식을 지원하는 데이터베이스 관리 시스템(DBMS)의 데이터베이스에 재귀적 질의를 하였을 때 생성되는 그 질의들의 재귀적 결과투플들에 해당하는 노드들로써 재귀적 결과투플 트리들을 구성하는 제1기능과, A first function of constructing recursive result tuple trees with nodes corresponding to recursive result tuples of queries generated when a recursive query is made to a database of a database management system (DBMS) that supports a recursive query form; 각 재귀적 결과투플 트리를 하나의 집단으로 처리하여 그 트리에 대해 하나의 재귀적 구조의 XML 값을 생성하는 제2기능을 실현하기 위한 프로그램이 기록된 컴퓨터-가독형 기록 매체. A computer-readable recording medium having recorded thereon a program for realizing a second function of processing each recursive result tuple tree into one group and generating an XML value of one recursive structure for the tree. 제27항에 있어서, The method of claim 27, 상기 프로그램은 상기 제1기능과 제2기능을 포함하는 SQL 계층집단함수 XMLNEST를 포함하며,The program includes an SQL hierarchy group function XMLNEST including the first function and the second function, 상기 프로그램은, The program, 상기 SQL 계층집단함수 XMLNEST의 직간접 인자로만 사용되며 재귀적 결과투플 트리의 노드들 각각에 대해 그 노드를 루트로 가지는 서브트리의 모든 노드들에 해당하는 재귀적 결과투플들을 하나의 집단으로 보고 그들 각 집단에 대해 하나의 값을 계산하여 그 값을 그 집단을 대표하는 루트 노드에 해당하는 재귀적 결과투플에게 반환하는 기능을 포함하는 'XMLNEST 관련 SQL 함수'들을 더 포함하는 것을 특징으로 하는 프로그램이 기록된 컴퓨터-가독형 기록 매체. For each node of the recursive result tuple tree, which is used only as a direct and indirect argument of the SQL hierarchical group function XMLNEST, the recursive result tuples corresponding to all nodes of the subtree rooted at that node are regarded as a group. The program may further include 'XMLNEST related SQL functions' including a function of calculating a value for a group and returning the value to a recursive result tuple corresponding to the root node representing the group. Computer-readable recording medium. 제27항 또는 제28항에 있어서, 상기 프로그램은, The method of claim 27 or 28, wherein the program, 재귀적 질의 양식을 제공하는 DBMS의 재귀적 질의에 사용되어 그 질의의 모든 재귀적 결과투플들이 재귀적 임시 결과투플들의 단수 복제에 의해 생성된 경우에 한하여 그 재귀적 결과투플들을 그들의 기원 투플들에 해당하는 노드들이 소속된 재귀적 임시 결과투플 트리별로 분류하여 하나 이상의 재귀적 결과투플을 구성 원으로 가지는 각 분류의 모든 재귀적 결과투플들을 하나의 집단으로 처리함으로써 그들 각 집단에 대해 하나의 값을 반환하는 기능을 갖는 SQL 계층집단연산자 tc_root를 더 포함하는 것을 특징으로 하는 프로그램이 기록된 컴퓨터-가독형 기록 매체.Used in a recursive query of a DBMS providing a recursive query form so that all recursive result tuples of that query are generated by singular copies of recursive ad hoc result tuples to their origin tuples. By classifying the recursive temporary result tuple tree to which the corresponding nodes belong and processing all the recursive result tuples of each classification that have one or more recursive result tuples as members, one value for each group is obtained. And a SQL hierarchical group operator tc_root having a function to return.
KR1020080125993A 2008-12-11 2008-12-11 Method and computer system for publishing relational data to recursively structured XMLs by using new SQL functions and an SQL operator for recursive queries, and computer-readable recording medium having programs for performing the method KR100989453B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020080125993A KR100989453B1 (en) 2008-12-11 2008-12-11 Method and computer system for publishing relational data to recursively structured XMLs by using new SQL functions and an SQL operator for recursive queries, and computer-readable recording medium having programs for performing the method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020080125993A KR100989453B1 (en) 2008-12-11 2008-12-11 Method and computer system for publishing relational data to recursively structured XMLs by using new SQL functions and an SQL operator for recursive queries, and computer-readable recording medium having programs for performing the method

Publications (2)

Publication Number Publication Date
KR20100067425A KR20100067425A (en) 2010-06-21
KR100989453B1 true KR100989453B1 (en) 2010-10-26

Family

ID=42366102

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020080125993A KR100989453B1 (en) 2008-12-11 2008-12-11 Method and computer system for publishing relational data to recursively structured XMLs by using new SQL functions and an SQL operator for recursive queries, and computer-readable recording medium having programs for performing the method

Country Status (1)

Country Link
KR (1) KR100989453B1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6784612B2 (en) * 2017-03-02 2020-11-11 株式会社日立製作所 Analytical software management system and analytical software management method

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007179161A (en) 2005-12-27 2007-07-12 Internatl Business Mach Corp <Ibm> System for pre-fetching data necessary to execute program from database
US20080071754A1 (en) 2005-04-14 2008-03-20 International Business Machines Corporation Estimating a number of rows returned by a recursive query

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080071754A1 (en) 2005-04-14 2008-03-20 International Business Machines Corporation Estimating a number of rows returned by a recursive query
JP2007179161A (en) 2005-12-27 2007-07-12 Internatl Business Mach Corp <Ibm> System for pre-fetching data necessary to execute program from database

Also Published As

Publication number Publication date
KR20100067425A (en) 2010-06-21

Similar Documents

Publication Publication Date Title
US6529896B1 (en) Method of optimizing a query having an existi subquery and a not-exists subquery
Orenstein et al. Query processing in the ObjectStore database system
US6374263B1 (en) System for maintaining precomputed views
US7246108B2 (en) Reusing optimized query blocks in query processing
US6609123B1 (en) Query engine and method for querying data using metadata model
US7275056B2 (en) System and method for transforming queries using window aggregation
US6826562B1 (en) Method of simplifying and optimizing scalar subqueries and derived tables that return exactly or at most one tuple
US7634498B2 (en) Indexing XML datatype content system and method
US7769769B2 (en) Methods and transformations for transforming metadata model
US6574623B1 (en) Query transformation and simplification for group by queries with rollup/grouping sets in relational database management systems
US20040064456A1 (en) Methods for data warehousing based on heterogenous databases
US20080215559A1 (en) System and method for querying xml streams
CA2327167C (en) Method and system for composing a query for a database and traversing the database
EP1081611A2 (en) Query engine and method for Querying data using metadata model
US20040220908A1 (en) Information retrieval system and method for optimizing queries having maximum or minimum function aggregation predicates
US20060161525A1 (en) Method and system for supporting structured aggregation operations on semi-structured data
Koupil et al. A universal approach for multi-model schema inference
Simon et al. Design and implementation of an extendible integrity subsystem
Papastefanatos et al. Relational schema optimization for RDF-based knowledge graphs
US8312030B2 (en) Efficient evaluation of XQuery and XPath full text extension
KR100989453B1 (en) Method and computer system for publishing relational data to recursively structured XMLs by using new SQL functions and an SQL operator for recursive queries, and computer-readable recording medium having programs for performing the method
Rupley Jr Introduction to query processing and optimization
Johnson et al. Extending complex ad-hoc OLAP
Galvizo On indexing multi-valued fields in AsterixDB
Li et al. Merging relational views: A minimization approach

Legal Events

Date Code Title Description
A201 Request for examination
E902 Notification of reason for refusal
E701 Decision to grant or registration of patent right
GRNT Written decision to grant
FPAY Annual fee payment

Payment date: 20131014

Year of fee payment: 4

LAPS Lapse due to unpaid annual fee