Internet Engineering Task Force V. Prehnal, Ed. Internet-Draft Faculty of Informatics Intended status: Standards Track Masaryk University Expires: November 29, 2011 May 28, 2011 Relational Schema Protocol (RSP) draft-rsp-00 Abstract This document specifies the Relational Schema Protocol (RSP). RSP enables loosely coupled applications to share and exchange relational data. It defines fixed message format for an arbitrary relational schema so that the changes in the data schema do not affect the message format. This prevents the interacting applications from having to be reimplemented during the data schema evolvement. Status of this Memo This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at http://datatracker.ietf.org/drafts/current/. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." This Internet-Draft will expire on November 29, 2011. Copyright Notice Copyright (c) 2011 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as Prehnal Expires November 29, 2011 [Page 1] Internet-Draft Relational Schema Protocol (RSP) May 2011 described in the Simplified BSD License. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.1. Requirements Language . . . . . . . . . . . . . . . . . . 3 1.2. Protocol Overview . . . . . . . . . . . . . . . . . . . . 3 2. Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.1. Shared Data Types . . . . . . . . . . . . . . . . . . . . 4 2.1.1. TableHeader . . . . . . . . . . . . . . . . . . . . . 4 2.1.2. ArrayOfTableHeader . . . . . . . . . . . . . . . . . . 4 2.1.3. ArrayOfint . . . . . . . . . . . . . . . . . . . . . . 5 2.1.4. Field . . . . . . . . . . . . . . . . . . . . . . . . 5 2.1.5. ArrayOfField . . . . . . . . . . . . . . . . . . . . . 7 2.1.6. ArrayOfstring . . . . . . . . . . . . . . . . . . . . 7 2.1.7. ArrayOfArrayOfstring . . . . . . . . . . . . . . . . . 7 2.1.8. Reference . . . . . . . . . . . . . . . . . . . . . . 8 2.1.9. ArrayOfReference . . . . . . . . . . . . . . . . . . . 8 2.1.10. Table . . . . . . . . . . . . . . . . . . . . . . . . 9 2.2. Message Format Data Types . . . . . . . . . . . . . . . . 10 2.2.1. ReadTableHeadersRequest . . . . . . . . . . . . . . . 10 2.2.2. ReadTableHeadersResponse . . . . . . . . . . . . . . . 10 2.2.3. ReadTableRequest . . . . . . . . . . . . . . . . . . . 11 2.2.4. ReadTableResponse . . . . . . . . . . . . . . . . . . 11 2.2.5. SubmitRequest . . . . . . . . . . . . . . . . . . . . 12 2.2.6. SubmitResponse . . . . . . . . . . . . . . . . . . . . 13 3. Operations . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.1. ReadTableHeaders . . . . . . . . . . . . . . . . . . . . . 13 3.2. ReadTable . . . . . . . . . . . . . . . . . . . . . . . . 13 3.3. Submit . . . . . . . . . . . . . . . . . . . . . . . . . . 13 4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 14 5. Security Considerations . . . . . . . . . . . . . . . . . . . 14 5.1. Communication Security . . . . . . . . . . . . . . . . . . 14 5.2. System Security . . . . . . . . . . . . . . . . . . . . . 14 6. Normative References . . . . . . . . . . . . . . . . . . . . . 14 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 15 Prehnal Expires November 29, 2011 [Page 2] Internet-Draft Relational Schema Protocol (RSP) May 2011 1. Introduction Widely disparate applications are very often required to share and exchange data from relational data sources. Typically, this is accomplished by passing messages over a shared environment (e.g. computer network, file system, computing memory, etc.) in a well- defined, machine-processable format. In such a case, the data schema is mapped to the message format such that the elements of the message format reflect the relations and their attributes in the data schema. If the data schema is a subject to change, the message format needs to be redefined. As a consequence, all the interacting applications need to be reimplemented. This represents a serious issue for evolving data schemas. This specification defines a new communication protocol, RSP, for universal relational data exchange. This protocol enables the interacting applications to describe arbitrary relational schema (including the contained data) using a fixed hierarchy of data types. This way, the format of the messages does not need to be redefined when the data schema evolves. 1.1. Requirements Language The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [RFC2119]. 1.2. Protocol Overview The RSP protocol defines three REQUIRED request-response operations (remote procedures) listed below: o ReadTableHeaders - for data schema exploration o ReadTable - for data and metadata retrieval o Submit - for data manipulation (insertion, alteration, deletion) The operation behaviors are specified in section 3. The message format of operation requests and responses is defined using the hierarchy of abstract data types in section 2. These abstract data types MAY be serialized in arbitrary serialization format (e.g. XML, JSON, etc.). 2. Data Types This section specifies the data types used in the protocol. Prehnal Expires November 29, 2011 [Page 3] Internet-Draft Relational Schema Protocol (RSP) May 2011 2.1. Shared Data Types This section specifies the data types shared by multiple operations. 2.1.1. TableHeader Data type "TableHeader" represents basic metadata of particular data table. Attributes of this data type are specified in Table 1. +---------------+---------------------------+--------+--------------+ | Name | Definition | Data | Multiplicity | | | | Type | | +---------------+---------------------------+--------+--------------+ | Description | Description of the table | string | Zero or one | | | for the documentation | | (OPTIONAL) | | | purposes | | | | | | | | | PluralTitle | Plural user-friendly | string | One | | | title of the table in the | | (REQUIRED) | | | specified language | | | | | | | | | SingularTitle | Singular user-friendly | string | One | | | title of the table in the | | (REQUIRED) | | | specified language | | | | | | | | | TableName | Unique name of the table | string | One | | | within the whole data | | (REQUIRED) | | | schema | | | +---------------+---------------------------+--------+--------------+ Table 1 - Attributes of the "TableHeader" data type 2.1.2. ArrayOfTableHeader Data type "ArrayOfTableHeader" represents 1-dimensional list of table headers. Attributes of this data type are specified in Table 2. +-------------+-------------------+-----------------+---------------+ | Name | Definition | Data Type | Multiplicity | +-------------+-------------------+-----------------+---------------+ | TableHeader | Table header | TableHeader, | Zero or one | | | (item in the | see Table 1 | (OPTIONAL) | | | list) | | | +-------------+-------------------+-----------------+---------------+ Table 2 - Attributes of the "ArrayOfTableHeader" data type Prehnal Expires November 29, 2011 [Page 4] Internet-Draft Relational Schema Protocol (RSP) May 2011 2.1.3. ArrayOfint Data type "ArrayOfint" represents 1-dimensional list of integers. Attributes of this data type are specified in Table 3. +------+----------------------------+----------+--------------------+ | Name | Definition | Data | Multiplicity | | | | Type | | +------+----------------------------+----------+--------------------+ | int | Integer number (item in | int | Zero or one | | | the list) | | (OPTIONAL) | +------+----------------------------+----------+--------------------+ Table 3 - Attributes of the "ArrayOfint" data type 2.1.4. Field Data type "Field" represents metadata of particular table column. Attributes of this data type are specified in Table 4. +-----------------+------------------------+---------+--------------+ | Name | Definition | Data | Multiplicity | | | | Type | | +-----------------+------------------------+---------+--------------+ | DataType | Data type of the | string | One | | | column (int, varchar, | | (REQUIRED) | | | datetime, ...) | | | | | | | | | Description | Description of the | string | Zero or one | | | column for the | | (OPTIONAL) | | | documentation purposes | | | | | | | | | ID | Unique identifier of | string | One | | | the column within the | | (REQUIRED) | | | whole data schema | | | | | | | | | IsAutoGenerated | True if the column is | boolean | One | | | auto-generated | | (REQUIRED) | | | (identity) column | | | | | | | | | IsDisplayField | True if the column | boolean | One | | | from the joined table | | (REQUIRED) | | | should be displayed | | | | | instead of the foreign | | | | | key column in the | | | | | specified table | | | | | | | | Prehnal Expires November 29, 2011 [Page 5] Internet-Draft Relational Schema Protocol (RSP) May 2011 | IsEditable | True if the data in | boolean | One | | | the column is editable | | (REQUIRED) | | | | | | | IsForeignKey | True if the column is | boolean | One | | | the foreign key | | (REQUIRED) | | | | | | | IsJoined | True if the column is | boolean | One | | | a part of joined table | | (REQUIRED) | | | | | | | IsNullable | True if the column may | boolean | One | | | contain null-values | | (REQUIRED) | | | | | | | IsPrimaryKey | True if the column is | boolean | One | | | a part of the primary | | (REQUIRED) | | | key | | | | | | | | | MaximumLength | Maximum character | long | Zero or one | | | length (only for | | (OPTIONAL) | | | character data types) | | | | | | | | | Name | Unique name of the | string | One | | | column within its | | (REQUIRED) | | | parent table | | | | | | | | | ReferencedField | Unique name of the | string | Zero or one | | | referenced column | | (OPTIONAL) | | | within the referenced | | | | | table (only for | | | | | foreign key columns) | | | | | | | | | ReferencedTable | Unique name of the | long | Zero or one | | | referenced table (only | | (OPTIONAL) | | | for foreign key | | | | | columns) | | | | | | | | | Table | Name of the parent | string | One | | | table | | (REQUIRED) | | | | | | | Title | User-friendly title of | string | One | | | the column in the | | (REQUIRED) | | | specified language | | | +-----------------+------------------------+---------+--------------+ Table 4 - Attributes of the "Field" data type Prehnal Expires November 29, 2011 [Page 6] Internet-Draft Relational Schema Protocol (RSP) May 2011 2.1.5. ArrayOfField Data type "ArrayOfField" represents 1-dimensional list of fields. Attributes of this data type are specified in Table 5. +------+---------------------+-----------------+--------------------+ | Name | Definition | Data Type | Multiplicity | +------+---------------------+-----------------+--------------------+ | int | Field (item in the | Field, see | Zero or one | | | list) | Table 4 | (OPTIONAL) | +------+---------------------+-----------------+--------------------+ Table 5 - Attributes of the "ArrayOfField" data type 2.1.6. ArrayOfstring Data type "ArrayOfstring" represents 1-dimensional list of text strings. Attributes of this data type are specified in Table 6. +--------+-------------------------+----------+---------------------+ | Name | Definition | Data | Multiplicity | | | | Type | | +--------+-------------------------+----------+---------------------+ | string | Text string (item in | string | Zero or one | | | the list) | | (OPTIONAL) | +--------+-------------------------+----------+---------------------+ Table 6 - Attributes of the "ArrayOfstring" data type 2.1.7. ArrayOfArrayOfstring Data type "ArrayOfArrayOfstring" represents 2-dimensional list of text strings. Attributes of this data type are specified in Table 7. +---------------+-------------------+----------------+--------------+ | Name | Definition | Data Type | Multiplicity | +---------------+-------------------+----------------+--------------+ | ArrayOfstring | 1-dimensional | ArrayOfstring, | Zero or one | | | array of text | see Table 6 | (OPTIONAL) | | | strings (item in | | | | | the list) | | | +---------------+-------------------+----------------+--------------+ Table 7 - Attributes of the "ArrayOfArrayOfstring" data type Prehnal Expires November 29, 2011 [Page 7] Internet-Draft Relational Schema Protocol (RSP) May 2011 2.1.8. Reference Data type "Reference" represents metadata of the referencing table. Attributes of this data type are specified in Table 8. +----------------------+--------------------+--------+--------------+ | Name | Definition | Data | Multiplicity | | | | Type | | +----------------------+--------------------+--------+--------------+ | RedField | Unique name of the | string | One | | | referenced column | | (REQUIRED) | | | within the | | | | | referenced table | | | | | | | | | RedTable | Unique name of the | string | One | | | referenced table | | (REQUIRED) | | | | | | | RingField | Unique name of the | string | One | | | referencing column | | (REQUIRED) | | | within the | | | | | referencing table | | | | | | | | | RingFieldTitle | User-friendly | string | One | | | title of the | | (REQUIRED) | | | referencing column | | | | | in the specified | | | | | language | | | | | | | | | RingTable | Unique name of the | string | One | | | referencing table | | (REQUIRED) | | | | | | | RingTablePluralTitle | User-friendly | string | Zero or one | | | plural title of | | (OPTIONAL) | | | the referencing | | | | | table in the | | | | | specified language | | | +----------------------+--------------------+--------+--------------+ Table 8 - Attributes of the "Reference" data type 2.1.9. ArrayOfReference Data type "ArrayOfReference" represents 1-dimensional list of references. Attributes of this data type are specified in Table 9. Prehnal Expires November 29, 2011 [Page 8] Internet-Draft Relational Schema Protocol (RSP) May 2011 +-----------+-------------------+-----------------+-----------------+ | Name | Definition | Data Type | Multiplicity | +-----------+-------------------+-----------------+-----------------+ | Reference | Reference (item | Reference, see | Zero or one | | | in the list) | Table 8 | (OPTIONAL) | +-----------+-------------------+-----------------+-----------------+ Table 9 - Attributes of the "ArrayOfReference" data type 2.1.10. Table Data type "Table" represents data and metadata from the particular data table. Attributes of this data type are specified in Table 10. +------------+---------------+-----------------------+--------------+ | Name | Definition | Data Type | Multiplicity | +------------+---------------+-----------------------+--------------+ | Actions | List of | ArrayOfint, see Table | One | | | granted | 3 | (REQUIRED) | | | permissions | | | | | (actions) for | | | | | the specified | | | | | user and | | | | | table: 1 ~ | | | | | SELECT, 2 ~ | | | | | INSERT, 3 ~ | | | | | UPDATE, 4 ~ | | | | | DELETE | | | | | | | | | Fields | List of | ArrayOfField, see | One | | | fields | Table 5 | (REQUIRED) | | | (columns) | | | | | | | | | Header | Table header | TableHeader, see | One | | | | Table 1 | (REQUIRED) | | | | | | | Items | List of data | ArrayOfArrayOfstring, | One | | | items (rows) | see Table 7 | (REQUIRED) | | | | | | | References | List of | ArrayOfReference, see | One | | | references | Table 9 | (REQUIRED) | | | (e.g. list of | | | | | tables | | | | | referencing | | | | | specified | | | | | table) | | | +------------+---------------+-----------------------+--------------+ Prehnal Expires November 29, 2011 [Page 9] Internet-Draft Relational Schema Protocol (RSP) May 2011 Table 10 - Attributes of the "Table" data type 2.2. Message Format Data Types This section specifies the data types for operation requests and responses. 2.2.1. ReadTableHeadersRequest Data type "ReadTableHeadersRequest" defines the "ReadTableHeaders" operation request message format. Attributes of this data type are specified in Table 11. +----------+--------------------------------+--------+--------------+ | Name | Definition | Data | Multiplicity | | | | Type | | +----------+--------------------------------+--------+--------------+ | UserName | User name | string | One | | | | | (REQUIRED) | | | | | | | Password | Password | string | One | | | | | (REQUIRED) | | | | | | | Language | Preferred localization | string | Zero or one | | | language for the data schema | | (OPTIONAL) | | | (ISO 639-1 two-letter code) | | | +----------+--------------------------------+--------+--------------+ Table 11 - Attributes of the "ReadTableHeadersRequest" data type 2.2.2. ReadTableHeadersResponse Data type "ReadTableHeadersResponse" defines the "ReadTableHeaders" operation response message format. Attributes of this data type are specified in Table 12. +--------------+---------------+---------------------+--------------+ | Name | Definition | Data Type | Multiplicity | +--------------+---------------+---------------------+--------------+ | TableHeaders | 1-dimensional | ArrayOfTableHeader, | One | | | list of table | see Table 2 | (REQUIRED) | | | headers | | | +--------------+---------------+---------------------+--------------+ Table 12 - Attributes of the "ReadTableHeadersResponse" data type Prehnal Expires November 29, 2011 [Page 10] Internet-Draft Relational Schema Protocol (RSP) May 2011 2.2.3. ReadTableRequest Data type "ReadTableRequest" defines the "ReadTable" operation request message format. Attributes of this data type are specified in Table 13. +------------------+------------------------+--------+--------------+ | Name | Definition | Data | Multiplicity | | | | Type | | +------------------+------------------------+--------+--------------+ | UserName | User name | string | One | | | | | (REQUIRED) | | | | | | | Password | Password | string | One | | | | | (REQUIRED) | | | | | | | TableName | Unique name of the | string | One | | | data table | | (REQUIRED) | | | | | | | Language | Preferred localization | string | Zero or one | | | language for the data | | (OPTIONAL) | | | schema (ISO 639-1 | | | | | two-letter code) | | | | | | | | | Skip | Number of data items | long | One | | | (rows) to skip | | (REQUIRED) | | | | | | | Take | Number of data items | long | One | | | (rows) to take (if 0 | | (REQUIRED) | | | is specified, all | | | | | found items are | | | | | returned) | | | | | | | | | OrderExpression | Defines how the data | string | Zero or one | | | items should be sorted | | (OPTIONAL) | | | (ordered) | | | | | | | | | FilterExpression | Defines how the data | string | Zero or one | | | items should be | | (OPTIONAL) | | | filtered | | | +------------------+------------------------+--------+--------------+ Table 13 - Attributes of the "ReadTableRequest" data type 2.2.4. ReadTableResponse Data type "ReadTableResponse" defines the "ReadTable" operation response message format. Attributes of this data type are specified Prehnal Expires November 29, 2011 [Page 11] Internet-Draft Relational Schema Protocol (RSP) May 2011 in Table 14. +--------------+---------------+---------------------+--------------+ | Name | Definition | Data Type | Multiplicity | +--------------+---------------+---------------------+--------------+ | TableHeaders | 1-dimensional | ArrayOfTableHeader, | One | | | list of table | see Table 2 | (REQUIRED) | | | headers | | | +--------------+---------------+---------------------+--------------+ Table 14 - Attributes of the "ReadTableResponse" data type 2.2.5. SubmitRequest Data type "SubmitRequest" defines the "Submit" operation request message format. Attributes of this data type are specified in Table 15. +-----------+-----------------------+----------------+--------------+ | Name | Definition | Data Type | Multiplicity | +-----------+-----------------------+----------------+--------------+ | UserName | User name | string | One | | | | | (REQUIRED) | | | | | | | Password | Password | string | One | | | | | (REQUIRED) | | | | | | | TableName | Unique name of the | string | One | | | data table | | (REQUIRED) | | | | | | | Operation | Type of submit | int | One | | | operation (1 ~ | | (REQUIRED) | | | INSERT, 2 ~ UPDATE, 3 | | | | | ~ DELETE) | | | | | | | | | Fields | List of fields | ArrayOfField, | One | | | | see Table 5 | (REQUIRED) | | | | | | | Data | Data item (table row) | ArrayOfstring, | One | | | to submit. The order | see Table 6 | (REQUIRED) | | | of the data values | | | | | within the item must | | | | | match the order of | | | | | appropriate fields in | | | | | Fields attribute. | | | +-----------+-----------------------+----------------+--------------+ Table 15 - Attributes of the "SubmitRequest" data type Prehnal Expires November 29, 2011 [Page 12] Internet-Draft Relational Schema Protocol (RSP) May 2011 2.2.6. SubmitResponse Data type "SubmitResponse" defines the "Submit" operation response message format. Attributes of this data type are specified in Table 16. +----------+--------------------------------+--------+--------------+ | Name | Definition | Data | Multiplicity | | | | Type | | +----------+--------------------------------+--------+--------------+ | Identity | Identity of the new data item | string | Zero or one | | | (only for INSERT operation and | | (OPTIONAL) | | | tables with autogenerated | | | | | identity field) | | | +----------+--------------------------------+--------+--------------+ Table 16 - Attributes of the "SubmitResponse" data type 3. Operations This section specifies the operation behaviors. 3.1. ReadTableHeaders Operation "ReadTableHeaders" enumerates tables accessible for the specified user and returns their headers in the specified localization language. The operation request is of type "ReadTableHeadersRequest" (see Table 11). The operation response is of type "ReadTableHeadersResponse" (see Table 12). 3.2. ReadTable Operation "ReadTable" retrieves actions (access rights for specified user), header, fields (columns), items (rows) and references of the specified table. It automatically joins all the tables referenced by foreign keys from the specified table. The operation request is of type "ReadTableRequest" (see Table 13). The operation response is of type "ReadTableResponse" (see Table 14). 3.3. Submit Operation "Submit" inserts, updates or deletes a single data item (table row) on the side of the operation provider. The operation request is of type "SubmitRequest" (see Table 15). The operation response is of type "SubmitResponse" (see Table 16). Prehnal Expires November 29, 2011 [Page 13] Internet-Draft Relational Schema Protocol (RSP) May 2011 4. IANA Considerations This memo includes no request to IANA. 5. Security Considerations 5.1. Communication Security The communication security in the terms of RFC 3552 [RFC3552] is completely a matter of the communication environment (e.g. a transfer protocol). In order to ensure confidentiality across unsecured communication environment, the RSP messages SHOULD be encrypted. Furthermore, in unreliable communication environment, the data integrity SHOULD be verified. For these reasons, the HTTPS protocol is strongly RECOMMENDED as a transfer protocol for the RSP messages in the Internet environment. 5.2. System Security The RSP protocol does not ensure full system security as specified in RFC 3552 [RFC3552]. It only provides a user access control in order to prevent the applications from unauthorized usage: in each operation request, the user credentials (user name and password or password hash) have to be provided by the operation requester. The major threat regarding the system security represents inappropriate usage of the RSP-based applications, namely the SQL injection. Therefore, all the input data SHOULD be filtered on the side of the operation provider for the illegal characters and expressions depending upon the selected database engine. 6. Normative References [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. [RFC3552] Rescorla, E. and B. Korver, "Guidelines for Writing RFC Text on Security Considerations", BCP 72, RFC 3552, July 2003. Prehnal Expires November 29, 2011 [Page 14] Internet-Draft Relational Schema Protocol (RSP) May 2011 Author's Address Vojtech Prehnal (editor) Faculty of Informatics, Masaryk University Botanicka 68a Brno 602 00 Czech Republic Email: xprehn@mail.muni.cz Prehnal Expires November 29, 2011 [Page 15]