WO2003030031A2 - Mechanism for mapping xml schemas to object-relational database systems - Google Patents

Mechanism for mapping xml schemas to object-relational database systems Download PDF

Info

Publication number
WO2003030031A2
WO2003030031A2 PCT/US2002/030783 US0230783W WO03030031A2 WO 2003030031 A2 WO2003030031 A2 WO 2003030031A2 US 0230783 W US0230783 W US 0230783W WO 03030031 A2 WO03030031 A2 WO 03030031A2
Authority
WO
WIPO (PCT)
Prior art keywords
xml
xml schema
schema
database
mapping
Prior art date
Application number
PCT/US2002/030783
Other languages
French (fr)
Other versions
WO2003030031A3 (en
Inventor
Ravi Murthy
Muralidhar Krishnaprasad
Sivasankaran Chandrasekar
Eric Sedlar
Viswanathan Krishnamurthy
Nipun Agarwal
Original Assignee
Oracle International Corporation
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 Oracle International Corporation filed Critical Oracle International Corporation
Priority to AU2002334706A priority Critical patent/AU2002334706B2/en
Priority to EP02800376A priority patent/EP1440394A2/en
Priority to CN028223470A priority patent/CN1585945B/en
Priority to JP2003533163A priority patent/JP2005505058A/en
Priority to CA2461854A priority patent/CA2461854C/en
Publication of WO2003030031A2 publication Critical patent/WO2003030031A2/en
Publication of WO2003030031A3 publication Critical patent/WO2003030031A3/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/80Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML
    • G06F16/84Mapping; Conversion
    • G06F16/86Mapping to a database
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10TECHNICAL SUBJECTS COVERED BY FORMER USPC
    • Y10STECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10S707/00Data processing: database and file management or data structures
    • Y10S707/99931Database or file accessing
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10TECHNICAL SUBJECTS COVERED BY FORMER USPC
    • Y10STECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10S707/00Data processing: database and file management or data structures
    • Y10S707/99931Database or file accessing
    • Y10S707/99933Query processing, i.e. searching
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10TECHNICAL SUBJECTS COVERED BY FORMER USPC
    • Y10STECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10S707/00Data processing: database and file management or data structures
    • Y10S707/99941Database schema or data structure
    • Y10S707/99942Manipulating data structure, e.g. compression, compaction, compilation
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10TECHNICAL SUBJECTS COVERED BY FORMER USPC
    • Y10STECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10S707/00Data processing: database and file management or data structures
    • Y10S707/99941Database schema or data structure
    • Y10S707/99943Generating database or data structure, e.g. via user interface
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10TECHNICAL SUBJECTS COVERED BY FORMER USPC
    • Y10STECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10S707/00Data processing: database and file management or data structures
    • Y10S707/99941Database schema or data structure
    • Y10S707/99944Object-oriented database structure
    • Y10S707/99945Object-oriented database structure processing

Definitions

  • the present invention relates to techniques for storing XML data in a database system.
  • data is stored in various types of data containers.
  • Such data containers typically have a structure.
  • the structure of a container is imposed on the data it contains. For example, tables are organized into rows and columns.
  • data is stored in a table, individual data items within the data are stored in the specific rows and columns, thus imposing a structure on the data.
  • the structure imposed on the data corresponds to logical relationships within the data. For example, all values stored within a given row of a table will typically have some logical relationship to each other. For example, all values within a given row of an employee table may correspond to the same employee.
  • XML extensible Markup Language
  • XML schemas Information about the structure of specific types of XML documents may be specified in documents referred to as "XML schemas".
  • the XML schema for a particular type of XML document may specify the names for the data items contained in that particular type of XML document, the hierarchical relationship between the data items contained in that type of XML document, datatypes of the data items contained in that particular type of XML document, etc.
  • XML documents are structured, the structure of XML documents is largely ignored by database systems when database systems are used to store XML documents.
  • a highly structured XML document containing multiple values for multiple attributes, may simply be stored as if it were an atomic undifferentiated piece of data in a single CLOB column of a table.
  • XML documents are stored in this fashion, the performance and scalability features of the database cannot be fully exploited to access the XML data.
  • FIG. 1 is a block diagram of a database system that includes a mechanism for mapping constructs contained in XML schemas to object-relational constructs, according to an embodiment of the invention
  • FIG. 2 is a block diagram illustrating a computer system on which embodiments of the present invention may be implemented
  • FIG. 3 is a block diagram showing syntax for creating an XML type table, according to an embodiment of the invention.
  • FIG. 4 is a block diagram showing a database system configured to create database objects for an appropriate database representation for documents conform to a particular XML schema, according to an embodiment of the invention
  • FIG. 5 is a block diagram showing that XML strings are selectively mapped to two alternative database-supported datatypes
  • FIG. 6 shows a complexType being mapped to SQL for out-of-line storage
  • FIG. 7 shows complexType XML fragments mapped to character large objects (CLOBs)
  • FIG. 8 showis cross-referencing between complexTypes in the same XML schema
  • FIG. 9 is a block diagram showing complexType self-referencing within an XML schema.
  • FIG. 10 is a block diagram showing cyclical references between XML schema.
  • a mechanism is provided to allow users of a database system to register XML schemas with the database system.
  • An XML schema may be registered explicitly (via an API call) or implicitly (when an instance document conforming to the XML schema is first inserted into the database).
  • the database system determines (1) an appropriate database representation for the XML schema and (2) mapping information.
  • the "appropriate database representation" determination is a determination about how data that conforms to the XML schema should be managed by the database system. Determining the appropriate database representation for a given XML schema may involve, for example, determining the database objects, collection types, constraints, and even the indexes that are to be used by the database system to store data from XML documents that conform to the given XML schema.
  • the mapping information indicates the mapping between the constructs included in the XML schema and the constructs included in the appropriate database representation.
  • the mapping information may indicate, for example, that data associated with a specific element of the XML schema should be stored in a particular column of a table that is generated as part of the appropriate database representation.
  • the appropriate database representation and the mapping information are generated so as to create a high correlation between the structure described in the XML schema and the structure imposed on the data by the database containers in which the XML data is stored.
  • FIG. 1 is a block diagram of a system that includes a mechanism for mapping XML schemas to object-relational database systems.
  • a database server 104 also referred to herein as "XDB" includes an XML schema mapper 106.
  • XML schema mapper 106 determines the appropriate database representation 108 for documents that conform to the XML schema 102, and generates mapping information 110 that indicates the correlation between the elements of the XML schema and the elements of the appropriate database representation 108.
  • database server 104 is configured to:
  • XML schema mapper 106 is configured to:
  • an XML schema has to be first registered with database server 104 before it can be used or referenced within database server 104. After the registration process is completed, XML documents conforming to this schema (and referencing it via the schema URL within the document) can be handled by database server 104. Tables and/or columns can be created for root XML elements defined by this schema to store the conforming documents.
  • a schema is registered using a DBMS_XMLSCHEMA package by specifying the schema document and its URL (also known as schema location).
  • the URL used here is simply a name that uniquely identifies the registered schema within the database - and need not be the physical URL at which the schema document is located.
  • the target namespace of the schema is another URL (different from the schema location URL) that specifies an "abstract" namespace within which the elements and types get declared.
  • An instance document should specify both the namespace of the root element and the location (URL) of the schema that defines this element.
  • a registered XML Schema can be used to create schema-based XMLType tables and columns.
  • the following is an XMLType instance that conforms to the above XML schema.
  • the schemaLocation attribute specifies the schema URL.
  • PurchaseDate " 01-JAN-2001 " > ⁇ P0Num>1001 ⁇ /P0Num> ⁇ Company>Oracle Corp ⁇ /Company> ⁇ Item>
  • XML schema registration includes (1) schema validation, (2) determination of appropriate data structures, and (3) generation of mapping information. Each of these phases shall be described in greater detail hereafter.
  • XML schemas describe the structure of a particular type of XML document.
  • XML schemas are themselves XML documents that must conform to the structure specified in an XML schema.
  • each XML schema must conform to the structure described in the XML schema document associated with the XML schema document type.
  • the XML schema that is being registered is inspected to verify that the XML schema conforms to the structure specified in the XML schema associated with the XML schema document type.
  • the appropriate database representation determination is a determination about how data that conforms to an XML schema should be managed by the database system.
  • the appropriate database representation is selected to achieve a high correlation between (1) the structure imposed on data by the XML document in which the data is contained, and the (2) the structure imposed on the data by a database system.
  • the ability to achieve a high correlation depends, at least in part, on the capabilities of the database system.
  • the specific capabilities of database systems vary from vendor to vendor and version to version. While certain capabilities are common to most database systems, other capabilities are not.
  • embodiments of the present invention shall be described herein in the context of a database system with a specific set of capabilities, the invention is not limited to database systems that possess those specific capabilities.
  • the determination of the appropriate database representation is performed based on a set of general rules, governing the operation of XML schema mapper 106, about how to map each type of construct that may be encountered in an XML schema to a corresponding construct supported by the target object-relational database system.
  • the rules may be hard-coded into the logic of XML schema mapper 106, or represented in metadata that is used by XML schema mapper 106.
  • the general rules address the following issues:
  • XML schema declares a set of primitive types.
  • the rules used by the XML schema mapper 106 define the datatypes, supported by the target database system, to which each of the XML datatypes correspond.
  • the XML datatype "string" maps to either of VARCHAR or CLOB SQL datatypes.
  • the XML schema mapper 106 may choose whether to map a particular string element to a VCHAR or CLOB based, for example, on any length constraints that could be declared, for the string element, in the XML schema. Numerous examples of the datatype-to-datatype mapping rules that XML schema mapper 106 may use are presented hereafter, and described in Appendix I.
  • MAPPING XML STRUCTURE TO DATABASE OBJECTS SQL schemas describe the structure of an element in terms of the elements and attributes that can appear within it.
  • the rules that map XML structure to database objects indicate how to map an SQL object type with attributes corresponding to the XML attributes and elements defined within the XML schema. For example, an XML element A containing attribute X and elements Y and Z, will map to an object type with three attributes: X, Y and Z.
  • constraint that specifies a maximum number of occurrences of the element. When the maximum number is greater than one, the element can be mapped to an array type supported by the target database system (e.g. VARRAY). The number of occurrences specified for the XML constraint dictates the cardinality of the VARRAY.
  • constraints that may be specified for elements of an XML schema, and reflected in corresponding constraints in the appropriate database representation, include uniqueness constraints, referential integrity constraints, not null constraints, etc.
  • the XML schema model allows for inheritance of complex types.
  • the inheritance is mapped to the SQL object inheritance mechanisms supported by the target database system.
  • an XML complexType "USAddress” can be declared as an extention of another complexType "Address”.
  • an SQL object type "USAddress” is declared as a subtype of the SQL object type that corresponds to "Address”.
  • an XML schema belongs to the user performing the registration.
  • a reference to the XML schema document is stored within the XDB hierarchy within the directory /sys/schemas/ ⁇ username>/.... For example, if the user SCOTT registered the above schema, it gets mapped to the file
  • Such schemas are referred to as local schemas. In general, they are usable only by the user to whom it belongs. Note that there is no notion of qualifying the schema URL with a database user name, because the schema location appearing in instance XML documents are simply URLs. Thus, only the owner of the schema can use it in defining
  • privileged users can register a XML schema as a global schema - by specifying an argument to dbms_xmlschema registration function.
  • Global schemas are visible to all users and are stored under /sys/schemas/PUBLIC/.... directory within the XDB hierarchy. Note that the access to this directory is controlled by ACLs - and by default, is write-able only by DBA. A user needs to have write privileges on this directory to be able to register global schemas.
  • a user can register a local schema with the same URL as an existing global schema.
  • a local schema always hides any global schema with the same name(URL).
  • a user can register a link to an existing schema - potentially owned by some other user.
  • the schema link is identified by its URL.
  • the schema link URL can then be used wherever a schema URL is expected, e.g. creating a xmltype table.
  • the reference to the schema link gets translated to the underlying schema at the time of reference. If a user has a local schema with the same name as a global schema, there is a mechanism that allows the user to explicitly reference the global schema.
  • the user can register a link (with a different name) to the global schema.
  • an XML Schema can be deleted by using the dbms_xmlschema.deleteSchema procedure.
  • the database server first checks for its dependents. If there are any dependents, the database server raises an error and the deletion operation fails.
  • a FORCE option is provided while deleting schemas - if the user specifies the FORCE option, the schema deletion will proceed even though it fails the dependency check. In this mode, schema deletion will mark all its dependents as invalid.
  • the registration of a schema is non-transactional and auto-committed similar to other SQL DDL operations. If the registration is successful, the operation is auto-committed. However, if the registration fails, the database is rolled back to the state before the registration began. Since the schema registration process potentially involve creating object types and tables, the error recovery involves dropping any such created tables and types. Thus, the entire schema registration is guaranteed to be atomic i.e. it either succeeds or else the database is restored to the state before the start of registration.
  • XML SCHEMA EVOLUTION A user may evolve a registered XML schema by re-registering it and providing the new XML schema document.
  • the dbms_xmlschema.registerSchema function can be used to re-register the XML schema. This operation always succeeds if there are no XMLType tables that depend on this schema (XMLType views are okay).
  • database server 104 if there are any dependent XMLType tables, database server 104 requires that the input schema document contain the complete SQL mapping annotations - and that they represent a valid mapping applicable to all such XMLType tables.
  • Example - Changing the names of elements or attributes The user retrieves the registered schema document, makes the needed modifications and re -registers it. Note that this alteration does not affect the underlying tables.
  • Example - Adding a new element or attribute Since this alteration affects underlying tables, it has to be performed in multiple steps. The user first uses the ALTER TYPE and/or ALTER TABLE commands to evolve the underlying tables. This marks the XML schema as invalid. The user then modifies the XML schema document as appropriate and re-registers it.
  • a 1-step XML schema evolution is provided, i.e. a user simply inputs a new XML schema and all underlying type and table alterations are determined implicitly.
  • Schema-based XMLType tables and columns can be created by referencing the schema URL (of a registered schema) and the name of the root element.
  • a subset of the XPointer notation (shown below) can also be used in providing a single URL containing both the schema location and the element name.
  • schema-based XMLType is stored in an underlying (hidden) object type column.
  • the SQL object types can be created (optionally) during the schema registration process.
  • the mapping from XML to SQL object types and attributes is itself stored within the XML schema document as extra annotations i.e. new attributes defined by XDB.
  • Schema-based XMLType can also be stored in a single underlying LOB column.
  • database server 104 creates the appropriate SQL object types that enable a structured storage of XML documents conforming to this schema. All SQL object types are created in the current user's schema (by default). For example, when PO.xsd is registered, the following SQL types are created. create type Item_t as object ( part varchar2 ( 1000 ) , price number ) ; create type Item_varray_t as varray ( lOOO ) of OBJ_Tl ; create type PurchaseOrder_t as object ( purchasedate date, ponum number, company varchar2 ( 100 ) , item Item_varray_t ) ;
  • the names of the object types and attributes above may actually be system- generated. If the schema already contains the SQLName attribute filled in, this name is used as the object attribute's name. Else, the name is derived from the XML name - unless it cannot be used because of length, or conflict reasons. If the SQLSchema attribute is filled in, Oracle will attempt to create the type in the specified schema. The current user must have any necessary privileges to perform this operation. MAPPING XML SCHEMAS TO OBJECT TYPES - A DETAILED EXAMPLE The following sections provide the details on how the SQL object types may be generated from the XML schema information. As was mentioned above, the actual mapping rules may vary from implementation to implementation based on a variety of factors. One such factor is the capabilities of the target database system. In the following detailed example, it is assumed that the target database system supports the data types and object typing mechanisms currently available in the Oracle 9iR2, currently available from Oracle Corporation.
  • an XML primitive type is mapped to the closest SQL datatype. For example, decimal, positive Integer and float are all mapped to SQL NUMBER.
  • An XML enumeration type is mapped to an object type with a single RAW(n) attribute - the value of n is determined by the number of possible values in the enumeration declaration.
  • An XML list or union datatype is mapped to a string (VARCHAR2/CLOB) datatype in SQL.
  • a complextype is mapped to an object type.
  • XML attributes declared within the complexType map to object attributes - the simpIeType defining the XML attribute determines the SQL datatype of the corresponding attribute.
  • XML elements declared within the complexType are also mapped to object attributes.
  • the datatype of the object attribute is determined by the simpIeType or complexType defining the XML element.
  • the XML element is declared with maxOccurs attribute's value > 1, it is mapped to a collection attribute in SQL.
  • the collection could be either a VARRAY (default) or nested table (if the maintainOrder attribute is set to FALSE).
  • the default storage of the VARRAY is in tables (OCTs) [OCT-FS] instead of LOBs - the user can choose the LOB storage by setting the storeAsLob attribute to TRUE.
  • the name of the SQL attribute is generated from the XML element or attribute name using the following algorithm :
  • SYS_XDBPD$ In order to guarantee that the returned XML documents are identical to the original document for purposes of DOM traversals (referred to as DOM fidelity), a binary attribute called SYS_XDBPD$ is added to all generated SQL object types. This attribute stores all pieces of information that cannot be stored in any of the other attributes - thereby ensuring DOM fidelity of XML documents stored in the database system. Note : The SYS_XDBPD$ attribute is omitted in many examples for reasons of clarity. However, the attribute is may be present in all SQL object types generated by the schema registration process.
  • SQL OUT OF LINE STORAGE by default, a sub-element is mapped to an embedded object attribute.
  • the SQLInline attribute can be set to FALSE - and the XML schema mapper 106 generates an object type with an embedded REF attribute.
  • the REF points at another instance of XMLType that corresponds to the XML fragment that gets stored out-of-line.
  • Default tables (of XMLType) are also created to store the out-of-line fragments.
  • a user can specify the SQLType for a complex element as LOB(CLOB/BLOB) in which case, the entire XML fragment gets stored in a LOB attribute. This is useful in scenarios where some portions of the XML document are seldom queried upon, but are mostly retrieved and stored as a single piece. By storing the fragment as a LOB, the parsing/decomposition/recomposition overhead is reduced. Exampl e
  • a complexType based on a simpleContent declaration is mapped to an object type with attributes that correspond to the XML attributes and an extra SYS_XDBBODY$ attribute corresponding to the body value.
  • the datatype of the body attribute is based on the simpIeType which defines the body's type.
  • any element declarations and anyAttribute attribute declarations are mapped to LOBs in the object type.
  • the LOB stores the text of the XML fragment that matches the any declaration.
  • the namespace attribute can be used to restrict the contents to belong to a specified namespace.
  • the processContents att ⁇ bute withm the any element declaration indicates the level of validation required for the contents matching the any declaration.
  • ⁇ /sequence> ⁇ /complexType> create type 0BJ_T as object ( Name varchar2 (100) , Age number, SYS_XDBANY$ blob ) ,
  • the XML schema specifies the datatype to be "stnng" and a maxLength value of less than 4000, it gets mapped to a varchar2 att ⁇ bute of the specified length
  • the maxLength value is not specified in the XML schema, it can only be mapped to a LOB. This is sub-optimal in cases when the majo ⁇ ty of stnng values are actually small - and a very small fraction of them is large enough to necessitate a LOB.
  • the ideal SQL datatype would be varchar2(*) that would perform like varchars for small st ⁇ ngs but can accommodate larger st ⁇ ngs as well. Further, such columns should support all varchar functionality such as indexing, SQL functions, etc.
  • a similar case can be made for needing a raw(*) datatype to hold unbounded binary values without loss of performance and/or functionality for the small cases.
  • all unbounded st ⁇ ngs are mapped to CLOBs and all unbounded binary elements/att ⁇ butes are mapped to BLOBs
  • mapStringToNCHAR attribute to "true” at the top of the schema declaration. This ensures that all XML strings get mapped to NVARCHAR2 (or NCLOB) datatype, unless explicitly overridden at the element level.
  • a XMLType table can be created to store instances conforming to the PurchaseOrder element of this schema - in an object-relational format as follows : create table MyPOs of xmltype element "http: //www. oracle . com/PO. sd#PurchaseOder" ;
  • Hidden columns are created corresponding to the object type to which the PurchaseOrder element has been mapped.
  • a XMLExtra object column is created to store the top-level instance data such as namespaces declarations, etc.
  • XMLDATA is a pseudo-attribute of XMLType that allows directly accessing the underlying object column.
  • columns underlying a XMLType column can be referenced using either a object notation or a XML notation in the CREATE INDEX statements. create index ponum_idx on MyPOs (xmldata.ponum) ; create index ponum_idx on MyPOs p (ExtractValue(p, 1 /ponu ' ) ;
  • CONSTRAINTS Constraints can be specified for underlying columns by using either the object or the XML notation. create table MyPOs of xmltype element "http: //www. oracle . com/PO.xsd#PurchaseOrder"
  • New instances can be inserted into a XMLType table as : insert into MyPOs values
  • XPath based operators (Extract, ExistNode,ExtractValue) operating on schema- based XMLType columns are rewritten to go against the underlying SQL columns. This enables further SQL optimizations that fully exploit the object-relational storage of the XML.
  • the following kinds of XPath expressions can be translated into the underlying SQL queries :
  • Collection traversal expressions involve traversal of collection expressions. Only axes supported are child and attribute axes.
  • index foo_mdex on foo_tab extractvalue (xml_col , ' /PO/PONO 1 ) ) ;
  • the index is turned into a BTree or a domain index on the column, rather than being a functional index.
  • Simple XPath traversals are rewritten into object type accessors. Predicates are handled by putting them in the where clause. Any XPath child access over an object type is translated to an object attribute access on the underlying object type. For example A/B maps to a.b where A maps to the object type a and the XPath node B maps to the attribute of "a" named "b".
  • This rewrite is consistent at any level of the XPath expression, i.e. whether the XPath traversal occurs within a predicate, or a location path variable.
  • the XPath expressions may also span collection constructs and the queries are still rewritten by using subqueries on the collection tables. For example,
  • default tables can also be created.
  • the default table is most useful in cases when XML instance documents conforming to this schema are inserted through APIs that do not have any table specification e.g. FTP, HTTP. In such case, the XML instance is inserted into the default table. If the user has given a value for defaultTable attribute, the XMLType table is created with that name. Else, it gets created with some internally generated name. Further, any text specified as the tableStorage attribute is appended to the generated CREATE TABLE statement.
  • the XML data is stored in a C structure within RDBMS memory.
  • the in-memory representation of the XML data is such that it tries to avoid datatype conversions at load time, and converts data only when accessed, since many parts of the document may not be accessed at all.
  • the in-memory datatype is chosen based on the XML datatype - and this information is stored within the schema document using the memDatatype attribute.
  • an application may wish to override the default memory type in favor of a different in-memory representation.
  • mapping information is generated to indicate the co ⁇ elation between the elements of the appropriate database representation and the elements identified in the particular XML schema. For example, if the appropriate database representation for an XML schema for type "person" includes a table PERSON for storing the data items contained in person XML documents, then the mapping information would indicate a co ⁇ elation between person XML documents and table PERSON.
  • mapping information may reflect co ⁇ elations at much finer levels of granularity.
  • the mapping information may indicate which specific column of the PERSON table should be used to store each specific data item within person XML documents.
  • the information regarding the SQL mapping is itself stored within the XML schema document.
  • the XML schema mapper 106 generates the SQL types (as shown above). In addition it adds annotations to the XML schema document to store the mapping information. Annotations are in form of new attributes.
  • USER-SPECIFIED NAMES IN INPUT SCHEMA DOCUMENT The user can specify the names of the SQL object types and its attributes by filling in the SQLName and SQLType attributes prior to registering the schema. If the SQLName and SQLType values are specified by the user, then the XML schema mapper 106 creates the SQL object types using these names. If these attributes are not specified by the user, an internal name-generation algorithm is used to generate the names. See Appendix for details on the name generation algorithm.
  • the table below lists all the annotations used within the schema to capture the SQL mapping information. Note that the user need not specify values for any of these attributes.
  • the XML schema mapper 106 will fill in the appropriate values during the schema registration process. However, it is recommended that user specify the names of at least the top level SQL types - in order to be able to reference them later. All annotations are in form of attributes that can be specified within attribute and element declarations. These attributes belong to the XDB namespace : http://xmlns.oracle.com/xdb/XDBSchema.xsd
  • Table 1 XDB attributes specifiable within element and attribute declarations
  • the XML schema mapper 106 is implemented to support hybrid storage models in which the structure of some elements defined within the XML schema is maintained in the appropriate database representation, and the structure of other elements is not.
  • the most-often queried/updated portions of an XML document type may be mapped to object type attributes, while the rest of the portions of the XML document are stored together in a CLOB.
  • the specific portions for with structure is to be maintained or not to be maintained are designated by pre-annotating the XML schema with appropriate mapping directives.
  • the XML schema registration is performed using the transaction support of database server 104 in a manner that allows executing compensating action to undo partial effects when e ⁇ ors are encountered during the schema registration operation.
  • XML schema mapper 106 is configured to detect such cycles and break them by using REFs while mapping to SQL object types. A detailed description of how REFs may be used to break cycles is provided in Appendix I.
  • XML documents that conform with the schema can be intelligently managed by database server 104.
  • database server 104 checks the document's file name extension for .xml, .xsl, .xsd, and so on. If the document is XML, a pre-parse step is performed, where enough of the resource is read to determine the XML schemaLocation and namespace of the root element in the document. This location is used to look for a registered schema with that schemaLocation URL. If a registered schema is located with a definition for the root element of the cu ⁇ ent document, then the default table specified for that element is used to store that resource's contents.
  • the database server when an XML document is stored in a database server that supports the XML schema registration techniques described herein, the database server is able to validate the documents to verify that they confirm to the co ⁇ esponding XML schema.
  • the validation may include validation of both the structure and the datatypes used by the XML document.
  • the schema registration process allows the database server to enforce the integrity constraints and other forms of constraints on the XML documents and the tables used to store them.
  • the database server is able to create indexes on and partition XML tables based on XML data.
  • the tag information typically used to reflect the structure does not need to be stored along with the data.
  • the ability to avoid storing some or all of the XML tags can result in a significant decrease in storage overhead, since the XML tags often form a large portion of the size of XML documents.
  • query performance may be improved by rewriting XPath queries to directly access the underlying columns.
  • update performance may be improved by rewriting updates to directly update the underlying columns. Consequently, updating a portion of the XML data from a stored document would not always require the rewriting the entire XML data for the stored document.
  • FIG. 2 is a block diagram that illustrates a computer system 200 upon which an embodiment of the invention may be implemented.
  • Computer system 200 includes a bus 202 or other communication mechanism for communicating information, and a processor 204 coupled with bus 202 for processing information.
  • Computer system 200 also includes a main memory 206, such as a random access memory (RAM) or other dynamic storage device, coupled to bus 202 for storing information and instructions to be executed by processor 204.
  • Main memory 206 also may be used for storing temporary variables or other intermediate information during execution of instructions to be executed by processor 204.
  • Computer system 200 further includes a read only memory (ROM) 208 or other static storage device coupled to bus 202 for storing static information and instructions for processor 204.
  • ROM read only memory
  • a storage device 210 such as a magnetic disk or optical disk, is provided and coupled to bus 202 for storing information and instructions.
  • Computer system 200 may be coupled via bus 202 to a display 212, such as a cathode ray tube (CRT), for displaying information to a computer user.
  • a display 212 such as a cathode ray tube (CRT)
  • An input device 214 is coupled to bus 202 for communicating information and command selections to processor 204.
  • cursor control 216 is Another type of user input device
  • cursor control 216 such as a mouse, a trackball, or cursor direction keys for communicating direction information and command selections to processor 204 and for controlling cursor movement on display 212.
  • This input device typically has two degrees of freedom in two axes, a first axis (e.g., x) and a second axis (e.g., y), that allows the device to specify positions in a plane.
  • the invention is related to the use of computer system 200 for implementing the techniques described herein. According to one embodiment of the invention, those techniques are performed by computer system 200 in response to processor 204 executing one or more sequences of one or more instructions contained in main memory 206. Such instructions may be read into main memory 206 from another computer-readable medium, such as storage device 210. Execution of the sequences of instructions contained in main memory 206 causes processor 204 to perform the process steps described herein. In alternative embodiments, hard-wired circuitry may be used in place of or in combination with software instructions to implement the invention. Thus, embodiments of the invention are not limited to any specific combination of hardware circuitry and software.
  • Non-volatile media includes, for example, optical or magnetic disks, such as storage device 210.
  • Volatile media includes dynamic memory, such as main memory 206.
  • Transmission media includes coaxial cables, copper wire and fiber optics, including the wires that comprise bus 202. Transmission media can also take the form of acoustic or light waves, such as those generated during radio-wave and infra-red data communications.
  • Computer-readable media include, for example, a floppy disk, a flexible disk, hard disk, magnetic tape, or any other magnetic medium, a CD-ROM, any other optical medium, punchcards, papertape, any other physical medium with patterns of holes, a RAM, a PROM, and EPROM, a FLASH-EPROM, any other memory chip or cartridge, a carrier wave as described hereinafter, or any other medium from which a computer can read.
  • Various forms of computer readable media may be involved in ca ⁇ ying one or more sequences of one or more instructions to processor 204 for execution.
  • the instructions may initially be carried on a magnetic disk of a remote computer.
  • the remote computer can load the instructions into its dynamic memory and send the instructions over a telephone line using a modem.
  • a modem local to computer system 200 can receive the data on the telephone line and use an infra-red transmitter to convert the data to an infra-red signal.
  • An infra-red detector can receive the data carried in the infra-red signal and appropriate circuitry can place the data on bus 202.
  • Bus 202 carries the data to main memory 206, from which processor 204 retrieves and executes the instructions.
  • the instructions received by main memory 206 may optionally be stored on storage device 210 either before or after execution by processor 204.
  • Computer system 200 also includes a communication interface 218 coupled to bus 202.
  • Communication interface 218 provides a two-way data communication coupling to a network link 220 that is connected to a local network 222.
  • communication interface 218 may be an integrated services digital network (ISDN) card or a modem to provide a data communication connection to a co ⁇ esponding type of telephone line.
  • ISDN integrated services digital network
  • communication interface 218 may be a local area network (LAN) card to provide a data communication connection to a compatible LAN.
  • LAN local area network
  • Wireless links may also be implemented.
  • communication interface 218 sends and receives electrical, electromagnetic or optical signals that cany digital data streams representing various types of information.
  • Network link 220 typically provides data communication through one or more networks to other data devices.
  • network link 220 may provide a connection through local network 222 to a host computer 224 or to data equipment operated by an Internet Service Provider (ISP) 226.
  • ISP 226 in turn provides data communication services through the world wide packet data communication network now commonly refe ⁇ ed to as the "Internet" 228.
  • Internet 228 uses electrical, electromagnetic or optical signals that cany digital data streams.
  • the signals through the various networks and the signals on network link 220 and through communication interface 218, which cany the digital data to and from computer system 200, are exemplary forms of carrier waves transporting the information.
  • Computer system 200 can send messages and receive data, including program code, through the network(s), network link 220 and communication interface 218.
  • a server 230 might transmit a requested code for an application program through Internet 228, ISP 226, local network 222 and communication interface 218.
  • the received code may be executed by processor 204 as it is received, and/or stored in storage device 210, or other non-volatile storage for later execution. In this manner, computer system 200 may obtain application code in the form of a carrier wave.
  • Oracle XML DB Creates XMLType Tables and Colunms Based on XML Schema
  • the XML Schema recommendation was created by the World Wide Web Consortium (W3C) to describe the content and structure of XML documents in XML. It includes the full capabilities of Document Type Definitions (DTDs) so that existing DTDs can be converted to XML schema. XML schemas have additional capabilities compared to DTDs.
  • W3C World Wide Web Consortium
  • XML Schema is a schema definition language written in XML. It can be used to describe the structure and various other semantics of conforming instance do 4.nts. For example, the following XML schema definition, po.xsd, describes the structure and other properties of purchase order XML documents.
  • This manual refers to XML schema definitions as XML schema.
  • the URL ' http : / /www. oracle . com/PO . xsd' used here is simply a name that uniquely identifies the registered XML schema within the database and need not be the physical URL at the which the XML schema document is located.
  • the target namespace of the XML schema is another URL, different from the XML schema location URL, that specifies an abstract namespace within which elements and types get declared.
  • An XML schema can optionally specify the target namespace URL. If this attribute is omitted, the XML schema has no target namespace. Note: The targetnamespace is commonly the same as XML schema's URL.
  • An XML instance document must specify both the namespace of the root element (same as the XML schema's target namespace) and the location (URL) of the XML schema that defines this root element.
  • the location is specified with attribute xsi : schemaLocation.
  • attribute xsi noNamespaceSchemaLocation to specify the XML schema URL.
  • Oracle XML DB uses annotated XML schema as metadata, that is, the standard XML Schema definitions along with several Oracle XML DB-defined attributes. These attributes are in a different namespace and control how instance documents get mapped into the database. Since these attributes are in a different namespace from the XML schema namespace, such annotated XML schemas are still legal XML schema documents:
  • Oracle XML DB provides XML schema support for the following tasks:
  • Generating a structured database mapping from your XML schemas during XML schema registration. This includes generating SQL object types, collection types, and default tables, and capturing the mapping information using XML schema attributes.
  • XMLType is a datatype that facilitates storing XML in columns and tables in the database.
  • XML schemas further facilitate storing XML columns and tables in the database, and they offer you more storage and access options for XML data along with space- performance-saving options.
  • XML schema For example, you can use XML schema to declare which elements and attributes can be used and what kinds of element nesting, and datatypes are allowed in the XML documents being stored or processed.
  • XML schema with Oracle XML DB provides a flexible set up for XML storage mapping. For example:
  • each element in the XML documents can be stored as a column in a table.
  • COB Character Large Object
  • XML schema with Oracle XML DB
  • an XML schema can check that all incoming XML documents comply with definitions declared in the XML schema, such as allowed structure, type, number of allowed item occurences, or allowed length of items.
  • the XML schema information can influence how efficiently XML instances are inserted.
  • XML schema can be useful in predicting optimum storage, fidelity, and access.
  • Oracle XML DB's XML schema functionality is available through the PL/SQL supplied package, DBMS_XML SCHEMA, a server-side component that handles the registration of XML schema definitions for use by Oracle XML DB applications.
  • ⁇ XML schema source which can be in a variety of formats, including string, LOB, XMLType, and URIType
  • XML schema must be registered before it can be used or referenced in any context by Oracle XML DB.
  • XML schema are registered by using DBMS_ XMLSCHEMA . registerSchema ( ) and specifying the following:
  • the XML schema source document as a VARCHAR, CLOB, XMLType, or URIType.
  • the XML schema URL This is a name for the XML schema that is used within XML instance do the saments to specify the location of the XML schema to which they conform.
  • Tables and columns can be created for root XML elements defined by this XML schema to store the conforming XML documents.
  • the registered schema can be used to created XMLSchema-Based tables, or
  • XML schemas can be registered as local or global:
  • Global XML schema An XML schema registered as a global schema is, by default, visible and usable by all database users.
  • DBMS_XMLSCHEMA adds an Oracle XML DB resource corresponding to the XML schema into the Oracle XML DB Repository.
  • the XML schema URL determines the path name of the resource in Oracle XML DB Repository according to the following rules:
  • Database users need appropriate permissions (ACLs) to create a resource with this path name in order to register the XML schema as a local XML schema.
  • ACLs permissions
  • Such XML schemas are referred to as local. In general, they are usable only by you to whom they belong.
  • This extended URL can be used by privileged users to specify XML schema belonging to other users.
  • privileged users can register an XML schema as a global XML schema by specifying an argument in the DBMS_XMLSCHEMA registration function.
  • Access to this directory is controlled by Access Control Lists (ACLs) and, by default, is writeable only by a DBA. You need WRITE privileges on this directory to register global schemas.
  • ACLs Access Control Lists
  • XDB Admin role also provides WRITE access to this directory, assuming that it is protected by the default "protected" ACL.
  • Database users need appropriate permissions (ACLs) to create this resource in order to register the XML schema as global.
  • ACLs permissions
  • Oracle XML DB also performs several other steps to facilitate storing, accessing, and manipulating XML instances that conform to the XML schema. These steps include:
  • Oracle creates the appropriate SQL object types that enable the structured storage of XML documents that conform to this XML schema. You can use Oracle XML DB-defined attributes in XML schema documents to control how these object types are generated.
  • Oracle XML DB generates default XMLType tables for all root elements. You can also specify any column and table level constraints for use during table creation.
  • Java beans can be optionally generated during XML schema registration. These Java classes provide accessor and mutator methods for elements and attributes declared in the schema. Access using Java beans offers better performance for manipulating XML when the XML schema is well known. This helps avoid run-time name translation.
  • a FORCE mode option is provided while deleting XML schemas. If you specify the FORCE mode option, the XML schema deletion proceeds even if it fails the dependency check. In this mode, XML schema deletion marks all its dependents as invalid.
  • the CASCADE mode option drops all generated types, default tables, and Java beans as part of a previous call to register schema.
  • XML schema URL names are always referenced within the scope of the current user.
  • database users specify XML schema URLs, they are first resolved as the names of local XML schema owned by the current user.
  • Oracle XML DB raises an error.
  • Oracle XML DB supports a notion of hdly qualified XML schema URLs.
  • the name of the database user owning the XML schema is also specified as part of the XML schema
  • Registration of an XML schema is non transactional and auto committed as with other SQL DDL operations, as follows:
  • XML schema registration potentially involves creating object types and tables
  • error recovery involves dropping any such created types and tables.
  • the entire XML schema registration is guaranteed to be atomic. That is, either it succeeds or the database is restored to the state before the start of registration.
  • Java beans can be optionally generated during XML schema registration and provide accessor and mutator methods for elements and attributes declared in the XML schema. Access to XML data stored in the database, using Java beans, offers better performance for manipulating the XML data when the XML schema is well known and mostly fixed by avoiding run-time name translation.
  • the Java bean class corresponding to the XML schema PO . xsd has the following accessor and mutator methods: public class PurchaseOrder extends XMLTypeBean ⁇ public BigDecimal getPONumO
  • Java Bean support in Oracle XML DB is only for XML schema-based XML documents.
  • Non-schema-based XML documents can be manipulated using Oracle XML DB DOM API.
  • An XML schema can be generated from an object-relational type automatically using a default mapping.
  • the generateSchema ( ) and generateSchemas () functions in the DBMS_XMLSCHEMA package take in a string that has the object type name and another that has the Oracle XML DB XMLschema.
  • ⁇ generateSchema returns an XMLType containing an XML schema. It can optionally generate XML schema for all types referenced by the given object type or restricted only to the top-level types.
  • ⁇ generateSchemas ( ) is similar, except that it returns an XMLSequenceType of XML schemas, each corresponding to a different namespace. It also takes an additional optional argument, specifying the root URL of the preferred XML schema location: http : / /xmlns . oracle . com/xdb/schemas/ ⁇ schema> . xsd
  • They can also optionally generate annotated XML schemas that can be used to register the XML schema with Oracle XML DB.
  • EMPLOYEEJT declares an ELEMENT named EMPLOYEEJT and a CCMPLEXTYPE called EMPLOYEEJIType .
  • Table 5-1 lists the XMLType API's XML schema-related methods.
  • XMLType API Method Description isSchemaBasedO Returns TRUE if the XMLType instance is based on an XML schema, FALSE otherwise.
  • getSchemaURLO Returns the XML schema URL, name of root element, and the namespace for an getRootElementO ⁇ L schema-based XMLType instance.
  • getNamespace ⁇ schemaValidateQ An XMLType instance can be validated against a registered XML schema using isSchemaValid() the validation methods. is SchemaValidated() setSchemaValidated()
  • XML schema documents are themselves stored in Oracle XML DB as XMLType instances.
  • XML schema-related XMLType types and tables are created as part of the Oracle XML DB installation script, catxdbs . sgl .
  • the XML schema for XML schemas is called the root XML schema, XDBSchema . xsd.
  • XDBSchema . xsd describes any valid XML schema document that can be registered by Oracle XML DB. You can access XDBSchema . xsd through Oracle XML DB Repository at:
  • XML Schema-based XMLType structures are stored in one of the following ways: ⁇ In underlying object type columns. This is the default storage mechanism.
  • - SQL object types can be created optionally during the XML schema registration process.
  • Non-XML schema-based XML data can be stored in tables using CLOBs. However you do not obtain benefits such as indexing, query-rewrite, and so on.
  • DOM fidelity is the concept of retaining the structure of a retrieved XML document, compared to the original XML document, for DOM traversals. DOM fidelity is needed to ensure the accuracy and integrity of XML documents stored in Oracle XML DB.
  • Oracle XML DB uses a data integrity mechanism called DOM fidelity.
  • DOM fidelity refers to how identical the returned XML documents are compared to the original XML documents, particularly for purposes of DOM traversals.
  • Oracle XML DB adds a system binary attribute, SYS_XDBPD$, to each created object type.
  • This attribute stores all pieces of information that cannot be stored in any of the other attributes, thereby ensuring the DOM fidelity of all XML documents stored in Oracle XML DB. Examples of such pieces of information include: ordering information, comments, processing instructions, namespace prefices, and so on.
  • Oracle XML DB Creates XMLType Tables and Columns Based on XML Schema
  • SYS_XDBPD$ is omitted in many examples here for clarity. However, the attribute is always present as a Positional Descriptor (PD) column in all SQL object types generated by the XML schema registration process.
  • PD Positional Descriptor
  • Oracle XML DB Creates XMLType Tables and Columns Based on XML Schema
  • Oracle XML DB creates XML Schema-based XMLType tables and columns by referencing:
  • Figure 3 shows the syntax for creating an XMLType table:
  • a subset of the XPointer notation, shown in the following example, can also be used to provide a single URL containing the XML schema location and element name.
  • This example creates the XMLType table po_tab using the XML schema at the given URL:
  • Oracle XML DB creates the appropriate SQL object types that enable structured storage of XML documents that conform to this XML schema. All SQL object types are created based on the current registered XML schema, by default.
  • is a 3-digit integer.
  • this name is used as the object attribute's name.
  • the name is derived from the XML name, unless it cannot be used because of length or conflict reasons.
  • Oracle XML DB attempts to create the object type using the specified database schema. The current user must have the necessary privileges to perform this.
  • SQL objects generated include the attributes SQLName and SQLType in the XML schema definition prior to registering the XML schema.
  • Oracle XML DB creates the SQL object types using these names.
  • Oracle XML DB uses system-generated names.
  • Oracle XML DB fills in appropriate values during the XML schema registration process. However, it is recommended that you specify the names of at least the top-level SQL types so that you can reference them later.
  • Table 5-2 lists Oracle XML DB attributes that you can specify in element and attribute declarations.
  • SQLName Any SQL identifier Element name Specifies the name of the attribute within the SQL object that maps to this XML element.
  • SQLType Any SQL type name Name generated Specifies the name of the SQL type from element name corresponding to this XML element declaration.
  • SQLCollType Any SQL collection Name generated Specifies the name of the SQL collection type name from element name type corresponding to this XML element that has maxOccurs > 1.
  • SQLSchema Any SQL usemame User registering Name of database user owning the type XML schema specified by SQLType.
  • SQLCollSchema Any SQL usemame User registering Name of database user owning the type XML schema specified by SQLCollType. maintainOrder true
  • false hue If true, the collection is mapped to a VARRAY. If false, the collection is mapped to a NESTED TABLE.
  • SQLInline true I false true If true this element is stored inline as an embedded attribute (or a collection if maxOccurs > 1). If false, a REF (or collection of REFs if maxOccurs > 1) is stored. This attribute will be forced to false in certain situations (like cyclic references) where SQL will not support inlining. MaintainDOM true I false true If true, instances of this element are stored such that they retain DOM fidelity on output. This implies that all comments, processing instructions, namespace declarations, and so on are retained in addition to the ordering of elements. If false, the output need not be guaranteed to have the same DOM behavior as the input.
  • Default Description columnProps Any valid column NULL Specifies the column storage clause that is storage clause inserted into the default CREATE TABLE statement. It is useful mainly for elements that get mapped to tables , namely top-level element declarations and out-of-line element declarations.
  • tableProps Any valid table NULL Specifies the TABLE storage clause that is storage clause appended to the default CREATE TABLE statement. This is meaningful mainly for global and out-of-line elements.
  • defaultTable Any table name Based on element Specifies the name of the table into which name. XML instances of this schema should be stored. This is most useful in cases when the XML is being inserted from APIs where table name is not specified, for example, FTP and HTTP.
  • beanClassname Any Java class name Generated from Can be used within element declarations. element name. If the element is based on a global complexType, this name must be identical to the beanClassname value within the complexType declaration. If a name is specified by the user, the bean generation will generate a bean class with this name instead of generating a name from the element name.
  • JavaClassname Any Java class name None Used to specify the name of a Java class that is derived from the corresponding bean class to ensure that an object of this class is instantiated during bean access. If a JavaClassname is not specified, Oracle XML DB will instantiate an object of the bean class directly.
  • SQLSchema Any SQL usemame User registering XML Name of database user owning the type schema specified by SQLType beanClassname Any Java class name Generated from Can be used within element declarations element name If the element is based on a global complexType, this name must be identical to the beanClassname value within the complexType declaration If a name is specified by the user, the bean generation will generate a bean class with this name, instead of generating a name from the element name maintainDOM true I false true If true, instances of this element are stored such that they retain DOM fidelity on output This implies that all comments, processmg instructions, namespace declarations, and so on, are retained in addition to the ordering of elements If false, the output need not be guaranteed to have the same DOM behavior as the mput
  • the registration process generates the SQL types, and adds annotations to the XML schema document to store the mapping information.
  • Annotations are in the form of new attributes.
  • Figure 4 shows how Oracle XML DB creates XML schema-based XMLType tables using an XML document and mapping specified in an XML schema.
  • An XMLType table is first created and depending on how the storage is specified in the XML schema, the XMl document is mapped and stored either as a CLOB in one XMLType column, or stored object-relationaUy and spread out across several columns in the table.
  • An XMLType table is first created and depending on how the storage is specified in the XML schema, the XMl document is mapped and stored either as a CLOB in one XMLType column, or stored object-relationally and spread out across several columns in the table.
  • An attribute declaration can have its type specified in terms of one of the following:
  • the SQL type and associated information (length and precision) as well as the memory mapping information are derived from the simpIeType on which the attribute is based.
  • An element declaration can specify its type in terms of one of the following:
  • An element based on a complexType is, by default, mapped to an object type containing attributes corresponding to each of the sub-elements and attributes. However, you can override this mapping by explicitly specifying a value for SQLType attribute in the input XML schema.
  • the following values for SQLType are permitted in this case:
  • VARRAY type is either explicitly specified by the user using SQLCollType attribute or obtained by mangling the element name.
  • a default table needs to be created. It is added to the table creation context. The name of the default table has either been specified by the user, or derived by mangling the element name.
  • This section describes how XML schema definitions are used to map XML schema s impleType to SQL object types.
  • Table 5-5 through Table 5-8 list the defaidt mapping of XML schema simpIeType to SQL, as specified in the XML schema definition. For example:
  • An XML primitive type is mapped to the closest SQL datatype. For example, DECIMAL, POSmVEINTEGER, and FLOAT are all mapped to SQL NUMBER.
  • An XML enumeration type is mapped to an object type with a single RAW(n) attribute.
  • the value of n is determined by the number of possible values in the enumeration declaration.
  • An XML list or a union datatype is mapped to a string (VARCHAR2/CLOB) datatype in SQL.
  • Type Facet string VARCHAR2(n) if n ⁇ 4000, CHAR,VARCHAR2, else VARCHAR2(4000) CLOB string VARCHAR2(4000) if CHAR, VARCHAR2, CLOB mapUnboundedStringToLo b "true", CLOB
  • simpIeType Mapping XML Strings to SQL VARCHAR2 Versus CLOBs
  • the XML schema specifies the datatype to be string with a maxLength value of less than 4000, it is mapped to a VARCHAR2 attribute of the specified length. However, if maxLength is not specified in the XML schema, it can only be mapped to a LOB. This is sub-optimal when most of the string values are small and only a small fraction of them are large enough to need a LOB. See Figure 5.
  • a complexType is mapped to an SQL object type as follows:
  • ⁇ XML attributes declared within the complexType are mapped to object attributes.
  • the simpIeType defining the XML attribute determines the SQL datatype of the corresponding attribute.
  • ⁇ XML elements declared within the complexType are also mapped to object attributes.
  • the datatype of the object attribute is determined by the simpIeType or complexType defining the XML element.
  • the XML element is declared with attribute maxOccurs > 1, it is mapped to a collection attribute in SQL.
  • the collection could be a VARRAY (default) or nested table if the maintainOrder attribute is set to false. Further, the default storage of the VARRAY is in Ordered Collections in Tables (OCTs) instead of LOBs. You can choose LOB storage by setting the s oreAsLob attribute to true.
  • a sub-element is mapped to an embedded object attribute.
  • the SQLInline attribute can be set to false, and Oracle XML DB generates an object type with an embedded REF attribute.
  • REF points to another instance of XMLType that corresponds to the XML fragment that gets stored out-of-line.
  • Default XMLType tables are also created to store the out-of-line fragments.
  • Figure 6 illustrates the mapping of a complexType to SQL for out-of-line storage.
  • Example 5-15 Oracle XML DB XML Schema: complexType Mapping - Setting SQLInLine Attribute to False for Out-of-Line Storage
  • the resulting object type 0BJ_T2 has a column of type XMLType with an embedded
  • REF attribute points to another XMLType instance created of
  • Addr_tab has columns Street and City. The latter
  • Oracle XML DB On registering this XML schema, Oracle XML DB generates the following types and XMLType tables:
  • Mapping complexType to SQL Mapping XML Fragments to Large Objects (LOBs)
  • the XML schema specifies that the XML fragment's element
  • Oracle XML DB On registering this XML schema, Oracle XML DB generates the following types and XMLType tables:
  • complexTypes are declared based on complexContent and simpleContent.
  • ⁇ simpleContent is declared as an extension of simpIeType.
  • ⁇ complexContent is declared as one of the following: - Base type complexType extension complexType restriction.
  • Oracle XML DB handles inheritance in the XML schema as follows:
  • the SQL type corresponding to the base type is specified as the supertype for the current SQL type. Only the additional attributes and elements declared in the sub-complextype are added as attributes to the sub-object-type.
  • the SQL type for the sub-complex type is set to be the same as the SQL type for its base type. This is because SQL does not support restriction of object types through the inheritance mechanism. Any constraints are imposed by the restriction in XML schema.
  • Type INILADDR_T is created as a final type because the
  • a complexType based on a simpleContent declaration is mapped to an object type with attributes corresponding to the XML attributes and an extra SYS_ XDBBODY attribute corresponding to the body value.
  • the datatype of the body attribute is based on simpIeType which defines the body's type.
  • Oracle XML DB On registering this XML schema, Oracle XML DB generates the following types and XMLType tables : create type OBJ T as object (
  • Oracle XML DB maps the element declaration, any, and the attribute declaration, anyAttribute, to VARCHAR2 attributes (or optionally to Large Objects (LOBs)) in the created object type.
  • the object attribute stores the text of the XML fragment that matches the any declaration.
  • the namespace attribute can be used to restrict the contents so that they belong to a specified namespace.
  • Cycles in the XML schema are broken while generating the object types, because object types do not allow cycles, by introducing a REF attribute at the point at which the cycle gets completed.
  • part of the data is stored out-of-line yet still belongs to the parent XML document when it is retrieved.
  • XML schemas permit cycling between definitions of complexTypes.
  • Figure 5-6 shows this example, where the definition of complexType CT1 can reference another complexType CT2, whereas the definition of CT2 references the first type CT1.
  • the section attribute is declared as a varray of REFs to XMLType
  • the attribute is a VARRAY. And it's a VARRAY of REFs to XMLTypes in order to
  • Figure 9 illustrates schematically how a complexTypes can reference or cycle itself.
  • Hidden columns are created. These correspond to the object type to which the PurchaseOrder element has been mapped.
  • an XMLExtra object column is created to store the top-level instance data such as namespace declarations.
  • XMLDATA is a pseudo-attribute of XMLType that enables
  • the imderlying columns can be referenced in the XMLType storage clauses using either Object or XML notation:
  • Constraints can also be specified for imderlying XMLType columns, using either the object or XML notation:
  • New instances can be inserted into an XMLType columns as follows:
  • XMLType When the XMLType is stored in structured storage (object-relationally) using an XML schema and queries using XPath are used, they are rewritten to go directly to the imderlying object-relational columns. This enables the use of BTree or other indexes, if present on the column, to be used in query evaluation by the Optimizer.
  • This query rewrite mechanism is used for XPath's in SQL functions such as existsNode ( ) , extrac ( ) , extractValue ( ) , and updateXML ( ) . This enables the XPath to be evaluated against the XML document without having to ever construct the XML document in memory.
  • a query such as:
  • the index is turned into a BTree or a domain index on the column, rather than a function-based index.
  • XPath involving simple expressions with no wild cards or descendant axes get rewritten.
  • the XPath may select an element or an attribute node. Predicates are supported and get rewritten into SQL predicates.
  • Table 5-10 lists the kinds of XPath expressions that can be translated into underlying SQL queries in this release.
  • /PurchaseOrder/@PurchaseDate are simple scalar or object types themselves. The only axes supported are the child and the attribute axes.
  • Collection traversal expressions Involves traversal of collection expressions. The only axes supported are / PurchaseOrder / 1 tern /Part child and attribute axes. Collection traversal is not supported if the SQL operator is used during CREATE INDEX or updateXML ( ) .
  • ⁇ XPath expressions accessing children of elements containing open content, namely any content.
  • nodes contain any content, then the expression cannot be rewritten, except when the any targets a namespace other than the namespace specified in the XPath. any attributes are handled in a similar way.
  • Non-default mapping of scalar types For example, number types mapped to native storage, such as native integers, and so on.
  • Non-coercible datatype operations such as a boolean added with a number.
  • the defaidt is to maintain the ordering and DOM fidelity.
  • the types have SYS_ XDBPD$ attribute to store the extra information needed to maintain the ordering of nodes and to capture extra items such as comments, processing instructions and so on.
  • the SYS_XDBPD$ attribute also maintains the existential information for the elements (that is, whether the element was present or not in the input document). This is needed for elements with scalar content, since they map to simple relational columns. In this case, both empty and missing scalar elements map to NULL values in the column and only the SYS_XDBPD$ attribute can help distinguish the two cases.
  • the query rewrite mechanism takes into account the presence or absence of the SYS_XDBPD$ attribute and rewrites queries appropriately.
  • this table has a hidden XMLData column that is of type "PurchaseOrder T" which stores the actual data.
  • An XPath expression can contain a text ( ) operator which maps to the scalar content in the XML document. When rewriting, this maps directly to the underlying relational columns.
  • a NULL value in the PONum column implies that the text value is not available, either because the text node was not present in the input document or the element itself was missing. This is more efficient than accessing the scalar element, since we do not need to check for the existence of the element in the SYS_XBDPD$ attribute.
  • the XPath "/ PurchaseOrder/ PONum” also maps to the SQL attribute XMLData . " PONum”,
  • query reqrite also has to check for the existence of the element itself, using the SYS_XDBPD$ in the XMLData column.
  • XPath expressions may involve relational operators with collection expressions.
  • conditions involving collections are existential checks. In other words, even if one member of the collection satisfies the condition, the expression is true.
  • Purchaseorder has Items such that the price of an item is the same as

Abstract

A method and system are provided for allowing users to register XML schemas in a database system. The database system determines, based on a registered XML schema, how to store within the database system XML documents that conform to the XML schema. This determination involves mapping constructs defined in the XML schema to constructs supported by the database system. Such constructs may include datatypes, hierarchical relationship between elements, constraints, inheritances, etc. Once the mapping has been determined, it is stored and used by the database system to determine how to store subsequently received XML documents that conform to the registered XML schema.

Description

MECHANISM FOR MAPPING XML SCHEMAS TO OBJECT-RELATIONAL
DATABASE SYSTEMS
RELATED APPLICATIONS
The present application claims priority from the following U.S. Provisional Patent Applications, the entire contents of which are incorporated herein by reference for all purposes:
U.S. Provisional Patent Application No. 60/326,052, filed on September 28, 2001, entitled File Based Access Provided With a Database System, by Eric Sedlar and Viswanathan Krishnamurthy;
U.S. Provisional Patent Application No. 60/378,800, filed on May 7, 2002, entitled SQL Access to Data that Provides a File System Abstraction, by Nipun Agarwal, Ravi Murthy, Eric Sedlar, Sivasankaran Chandrasekar, Fei Ge, Syam Pannala, Neema Jalali and Muralidhar Krishnaprasad.
The present application is also related to the following U.S. Patent Applications, the entire contents of which are incoφorated herein by reference for all purposes:
U.S. Patent Application Serial No. , filed on the equal day herewith, entitled OPERATORS FOR ACCESSING HIERARCHICAL DATA IN A RELATIONAL SYSTEM, by Nipun Agarwal, Ravi Murthy, Eric Sedlar, Sivasankaran Chandrasekar and Fei Ge (Attorney Docket No. 50277-1975);
U.S. Patent Application Serial No. , filed on the equal day herewith, entitled PROVIDING A CONSISTENT HIERARCHICAL ABSTRACTION OF RELATIONAL DATA, by Nipun Agarwal, Eric Sedlar, Ravi Murthy and Namit Jain (Attorney Docket No. 50277-1976);
U.S. Patent Application Serial No. , filed on the equal day herewith, entitled INDEXING TO EFFICIENTLY MANAGE VERSIONED DATA IN A DATABASE SYSTEM , by Nipun Agarwal, Eric Sedlar and Ravi Murthy (Attorney Docket No. 50277-1978);
U.S. Patent Application Serial No. , filed on the equal day herewith, entitled MECHANISMS FOR STORING CONTENT AND PROPERTIES OF HIERARCHICALLY ORGANIZED RESOURCES, by Ravi Murthy, Eric Sedlar, Nipun Agarwal, and Neema Jalali (Attorney Docket No. 50277-1979); U.S. Patent Application Serial No. , filed on the equal day herewith, entitled MECHANISM FOR UNIFORM ACCESS CONTROL IN A DATABASE SYSTEM, by Ravi Murthy, Eric Sedlar, Nipun Agarwal, Sam Idicula, and Nicolas Montoya (Attorney Docket No. 50277-1980);
U.S. Patent Application Serial No. , filed on the equal day herewith, entitled LOADABLE UNITS FOR LAZY MANIFESTATION OF XML DOCUMENTS by Syam Pannala, Eric Sedlar, Bhushan Khaladkar, Ravi Murthy, Sivasankaran Chandrasekar, and Nipun Agarwal (Attorney Docket No. 50277-1981);
U.S. Patent Application Serial No. , filed on the equal day herewith, entitled MECHANISM TO EFFICIENTLY INDEX STRUCTURED DATA THAT PROVIDES HIERARCHICAL ACCESS IN A RELATIONAL DATABASE SYSTEM, by Neema Jalali, Eric Sedlar, Nipun Agarwal, and Ravi Murthy (Attorney Docket No. 50277-1982).
FIELD OF THE INVENTION The present invention relates to techniques for storing XML data in a database system.
BACKGROUND OF THE INVENTION
Within a relational database system, data is stored in various types of data containers. Such data containers typically have a structure. The structure of a container is imposed on the data it contains. For example, tables are organized into rows and columns. When data is stored in a table, individual data items within the data are stored in the specific rows and columns, thus imposing a structure on the data.
Typically, the structure imposed on the data corresponds to logical relationships within the data. For example, all values stored within a given row of a table will typically have some logical relationship to each other. For example, all values within a given row of an employee table may correspond to the same employee.
Outside of database systems, the degree to which electronic data is structured may vary widely based on the nature of the data. For example, data stored in spreadsheets is generally highly structured, while data representing visual images is generally highly unstructured.
XML (extensible Markup Language) is becoming increasingly popular as the format for describing and storing all forms of data. Thus, providing support for storing, searching and manipulating XML documents is an extremely important problem for data management systems today.
Information about the structure of specific types of XML documents may be specified in documents referred to as "XML schemas". For example, the XML schema for a particular type of XML document may specify the names for the data items contained in that particular type of XML document, the hierarchical relationship between the data items contained in that type of XML document, datatypes of the data items contained in that particular type of XML document, etc.
Unfortunately, although XML documents are structured, the structure of XML documents is largely ignored by database systems when database systems are used to store XML documents. For example, a highly structured XML document, containing multiple values for multiple attributes, may simply be stored as if it were an atomic undifferentiated piece of data in a single CLOB column of a table. When XML documents are stored in this fashion, the performance and scalability features of the database cannot be fully exploited to access the XML data.
BRIEF DESCRIPTION OF THE DRAWINGS
The present invention is illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which like reference numerals refer to similar elements and in which:
FIG. 1 is a block diagram of a database system that includes a mechanism for mapping constructs contained in XML schemas to object-relational constructs, according to an embodiment of the invention;
FIG. 2 is a block diagram illustrating a computer system on which embodiments of the present invention may be implemented;
FIG. 3 is a block diagram showing syntax for creating an XML type table, according to an embodiment of the invention;
FIG. 4 is a block diagram showing a database system configured to create database objects for an appropriate database representation for documents conform to a particular XML schema, according to an embodiment of the invention;
FIG. 5 is a block diagram showing that XML strings are selectively mapped to two alternative database-supported datatypes;
FIG. 6 shows a complexType being mapped to SQL for out-of-line storage; FIG. 7 shows complexType XML fragments mapped to character large objects (CLOBs);
FIG. 8 showis cross-referencing between complexTypes in the same XML schema;
FIG. 9 is a block diagram showing complexType self-referencing within an XML schema; and
FIG. 10 is a block diagram showing cyclical references between XML schema.
DETAILED DESCRIPTION OF EMBODIMENTS OF THE INVENTION
A method and system are described for mapping XML schemas to object- relational database systems. In the following description, for the purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the present invention. It will be apparent, however, that the present invention may be practiced without these specific details. In other instances, well-known structures and devices are shown in block diagram form in order to avoid unnecessarily obscuring the present invention.
FUNCTIONAL OVERVIEW Various techniques are described herein for managing XML data within a database system in a manner that increases the correlation between the structure imposed on the data by the database containers used to hold the data, and the structure of the XML documents from which the data originates. According to one aspect, a mechanism is provided to allow users of a database system to register XML schemas with the database system. An XML schema may be registered explicitly (via an API call) or implicitly (when an instance document conforming to the XML schema is first inserted into the database).
During the registration process for a given XML schema, the database system determines (1) an appropriate database representation for the XML schema and (2) mapping information. The "appropriate database representation" determination is a determination about how data that conforms to the XML schema should be managed by the database system. Determining the appropriate database representation for a given XML schema may involve, for example, determining the database objects, collection types, constraints, and even the indexes that are to be used by the database system to store data from XML documents that conform to the given XML schema. The mapping information indicates the mapping between the constructs included in the XML schema and the constructs included in the appropriate database representation. The mapping information may indicate, for example, that data associated with a specific element of the XML schema should be stored in a particular column of a table that is generated as part of the appropriate database representation. Typically, the appropriate database representation and the mapping information are generated so as to create a high correlation between the structure described in the XML schema and the structure imposed on the data by the database containers in which the XML data is stored.
SYSTEM OVERVIEW
FIG. 1 is a block diagram of a system that includes a mechanism for mapping XML schemas to object-relational database systems. Specifically, a database server 104 (also referred to herein as "XDB") includes an XML schema mapper 106. When an XML schema 102 is registered with database server 104, XML schema mapper 106 determines the appropriate database representation 108 for documents that conform to the XML schema 102, and generates mapping information 110 that indicates the correlation between the elements of the XML schema and the elements of the appropriate database representation 108.
According to one embodiment, database server 104 is configured to:
• Register any W3C compliant XML schema
• Perform validation of XML documents against a registered XML schema
• Register both local and global schemas
• Generate XML schemas from object types
• Support re-registering a XML schema (as a mechanism for manual schema evolution)
• Support implicit registration of XML schema when documents are inserted via certain APIs (e.g. FTP, HTTP)
• Allow a user to reference a schema owned by another user
• Allow a user to explicitly reference a global schema when a local schema exists with the same name. • Support XML schema evolution
According to one embodiment, XML schema mapper 106 is configured to:
• Generate structured database mapping from XML Schemas (typically during schema registration) - this may include, for example, generation of SQL object types, collection types, etc and capturing the mapping information via schema annotations.
• Allow a user to specify a particular SQL type mapping when there are multiple legal mappings
• Create XMLType tables and columns based on registered XML schemas
• DML and query support for schema-based XMLType tables
XML SCHEMA REGISTRATION According to one embodiment, an XML schema has to be first registered with database server 104 before it can be used or referenced within database server 104. After the registration process is completed, XML documents conforming to this schema (and referencing it via the schema URL within the document) can be handled by database server 104. Tables and/or columns can be created for root XML elements defined by this schema to store the conforming documents.
According to one embodiment, a schema is registered using a DBMS_XMLSCHEMA package by specifying the schema document and its URL (also known as schema location). Note that the URL used here is simply a name that uniquely identifies the registered schema within the database - and need not be the physical URL at which the schema document is located. Further, the target namespace of the schema is another URL (different from the schema location URL) that specifies an "abstract" namespace within which the elements and types get declared. An instance document should specify both the namespace of the root element and the location (URL) of the schema that defines this element.
For example consider the XML Schema shown below. It declares a complexType called "PurchaseOrderType" and an element "PurchaseOrder" of this type.
<schema xmlns= "http : //www. w3 . org/2001/XMLSchema " targetNamespace="http: //www. oracle .com/PO.xsd"> <complexType name = "PurchaseOrderType"> ottribute name = "PurchaseDate" type = "date"/> <sequence> <element name = "PONum" type = "decimal "/>
<element name = "Company" type = "string" maxLength = "100"/> <element name = "Item" maxOccurs = "1000"> <complexType> <sequence>
<element name = "Part" type = "string" maxLength = "1000"/> <element name = "Price" type = " float "/> </sequence> </complex ype> </element> </seguence> </complexType>
<element name="PurchaseOrder" type="PurchaseOrderType" /> </schema>
The following statement registers this schema at URL "http://www.oracle.com/PO.xsd". (doc is a variable holding the above schema text). dbms_xmlschema . registerSchema ( ' http : / /ww . oracle . com/P0. xsd ' , doc) ;
As shall be described in greater detail hereafter, a registered XML Schema can be used to create schema-based XMLType tables and columns. The following is an XMLType instance that conforms to the above XML schema. The schemaLocation attribute specifies the schema URL.
<PurchaseOrder xmlns= "http : / /www . oracle . com/PO . xsd" xmlns :xsi="http: //www.w3. org/2001/XMLSchema- instance" xsi: schema ocations"http://www.oracle.com/PO.xsd htt : //www.oracle . com/PO.xsd"
PurchaseDate= " 01-JAN-2001 " > <P0Num>1001</P0Num> <Company>Oracle Corp</Company> <Item>
<Part>9i Doc Set</Part> <Price>2550< / Price> < / Item>
< /PurchaseOrder>
According to one embodiment of the invention, XML schema registration includes (1) schema validation, (2) determination of appropriate data structures, and (3) generation of mapping information. Each of these phases shall be described in greater detail hereafter.
XML SCHEMA VALIDATION
XML schemas describe the structure of a particular type of XML document. However, XML schemas are themselves XML documents that must conform to the structure specified in an XML schema. Specifically, each XML schema must conform to the structure described in the XML schema document associated with the XML schema document type. During the schema validation phase of XML schema registration, the XML schema that is being registered is inspected to verify that the XML schema conforms to the structure specified in the XML schema associated with the XML schema document type.
DETERMINATION OF APPROPRIATE DATABASE REPRESENTATION As mentioned above, the appropriate database representation determination is a determination about how data that conforms to an XML schema should be managed by the database system. According to one embodiment, the appropriate database representation is selected to achieve a high correlation between (1) the structure imposed on data by the XML document in which the data is contained, and the (2) the structure imposed on the data by a database system.
The ability to achieve a high correlation depends, at least in part, on the capabilities of the database system. The specific capabilities of database systems vary from vendor to vendor and version to version. While certain capabilities are common to most database systems, other capabilities are not. Thus, while embodiments of the present invention shall be described herein in the context of a database system with a specific set of capabilities, the invention is not limited to database systems that possess those specific capabilities. According to one embodiment, the determination of the appropriate database representation is performed based on a set of general rules, governing the operation of XML schema mapper 106, about how to map each type of construct that may be encountered in an XML schema to a corresponding construct supported by the target object-relational database system. The rules may be hard-coded into the logic of XML schema mapper 106, or represented in metadata that is used by XML schema mapper 106. According to one embodiment, the general rules address the following issues:
• How to map datatypes supported by XML to datatypes supported by the target object-relational database system;
• How to map the structure defined by an XML schema to a database object with a similar structure;
• How to map constraints supported by XML to constraint enforcing mechanisms supported by the target object-relational database system;
• How to reflect, in the target object-relational database system, that the XML schema inherits from another XML schema; and
• How to reflect, in the target object-relational database system, other constructs supported by XML, such as substitution groups, simple content, wildcards, external references via include and import elements, etc.
MAPPING XML DATATYPES TO OBJECT-RELATIONAL DATATYPES An XML schema declares a set of primitive types. According to one embodiment, the rules used by the XML schema mapper 106 define the datatypes, supported by the target database system, to which each of the XML datatypes correspond. For example, in one embodiment, the XML datatype "string" maps to either of VARCHAR or CLOB SQL datatypes. In this example, the XML schema mapper 106 may choose whether to map a particular string element to a VCHAR or CLOB based, for example, on any length constraints that could be declared, for the string element, in the XML schema. Numerous examples of the datatype-to-datatype mapping rules that XML schema mapper 106 may use are presented hereafter, and described in Appendix I.
MAPPING XML STRUCTURE TO DATABASE OBJECTS SQL schemas describe the structure of an element in terms of the elements and attributes that can appear within it. The rules that map XML structure to database objects indicate how to map an SQL object type with attributes corresponding to the XML attributes and elements defined within the XML schema. For example, an XML element A containing attribute X and elements Y and Z, will map to an object type with three attributes: X, Y and Z.
MAPPING XML CONSTRAINTS TO DATABASE CONSTRAINTS
XML schemas can specify various forms of constraints. Such constraints, when encountered by XML schema mapper 106, are mapped to the appropriate constraint mechanisms in SQL. For example, the length constraint for a "string" attribute defined in an XML schema may be maxLength="20". According to one embodiment, such a constraint would cause the string attribute to be mapped to the data type VARCHAR2(20).
Another type of constraint that can be applied to XML elements is a constraint that specifies a maximum number of occurrences of the element. When the maximum number is greater than one, the element can be mapped to an array type supported by the target database system (e.g. VARRAY). The number of occurrences specified for the XML constraint dictates the cardinality of the VARRAY.
Other types of constraints that may be specified for elements of an XML schema, and reflected in corresponding constraints in the appropriate database representation, include uniqueness constraints, referential integrity constraints, not null constraints, etc.
MAPPING INHERITANCE The XML schema model allows for inheritance of complex types. According to one embodiment, when an XML schema makes use of the inheritance construct, the inheritance is mapped to the SQL object inheritance mechanisms supported by the target database system. For example, within an XML schema, an XML complexType "USAddress" can be declared as an extention of another complexType "Address". In response, within the appropriate database representation, an SQL object type "USAddress" is declared as a subtype of the SQL object type that corresponds to "Address".
LOCAL AND GLOBAL SCHEMAS By default, an XML schema belongs to the user performing the registration. A reference to the XML schema document is stored within the XDB hierarchy within the directory /sys/schemas/<username>/.... For example, if the user SCOTT registered the above schema, it gets mapped to the file
/sys/schemas/SCOTT/www.oracle. com/PO. xsd
Such schemas are referred to as local schemas. In general, they are usable only by the user to whom it belongs. Note that there is no notion of qualifying the schema URL with a database user name, because the schema location appearing in instance XML documents are simply URLs. Thus, only the owner of the schema can use it in defining
XMLType tables, columns or views, validating documents, etc.
In contrast to local schemas, privileged users can register a XML schema as a global schema - by specifying an argument to dbms_xmlschema registration function. Global schemas are visible to all users and are stored under /sys/schemas/PUBLIC/.... directory within the XDB hierarchy. Note that the access to this directory is controlled by ACLs - and by default, is write-able only by DBA. A user needs to have write privileges on this directory to be able to register global schemas.
A user can register a local schema with the same URL as an existing global schema. A local schema always hides any global schema with the same name(URL).
A user can register a link to an existing schema - potentially owned by some other user. The schema link is identified by its URL. The schema link URL can then be used wherever a schema URL is expected, e.g. creating a xmltype table. The reference to the schema link gets translated to the underlying schema at the time of reference. If a user has a local schema with the same name as a global schema, there is a mechanism that allows the user to explicitly reference the global schema. The user can register a link (with a different name) to the global schema.
DELETING XML SCHEMAS According to one embodiment, an XML Schema can be deleted by using the dbms_xmlschema.deleteSchema procedure. When a user tries to delete a schema, the database server first checks for its dependents. If there are any dependents, the database server raises an error and the deletion operation fails. A FORCE option is provided while deleting schemas - if the user specifies the FORCE option, the schema deletion will proceed even though it fails the dependency check. In this mode, schema deletion will mark all its dependents as invalid. DEPENDENCY MODEL FOR XML SCHEMAS
According to one embodiment, the following objects "depend" on a registered XML schema:
• Tables/Views that have a XMLType column that conforms to some element in this schema.
• XML schemas that include or import this schema as part of their definition
• Cursors that reference the schema name for eg. within XMLGEN operators. (Note:These are purely transient objects)
The following operations result in dependencies being added on a XML schema object :
• Schema registration : Add dependencies on all included/imported schemas Table/View/Cursor creation : Add dependency from table/view/cursor on the referenced xml schema object.
TRANSACTIONAL BEHAVIOR
According to one embodiment, the registration of a schema is non-transactional and auto-committed similar to other SQL DDL operations. If the registration is successful, the operation is auto-committed. However, if the registration fails, the database is rolled back to the state before the registration began. Since the schema registration process potentially involve creating object types and tables, the error recovery involves dropping any such created tables and types. Thus, the entire schema registration is guaranteed to be atomic i.e. it either succeeds or else the database is restored to the state before the start of registration.
XML SCHEMA EVOLUTION A user may evolve a registered XML schema by re-registering it and providing the new XML schema document. The dbms_xmlschema.registerSchema function can be used to re-register the XML schema. This operation always succeeds if there are no XMLType tables that depend on this schema (XMLType views are okay). According to one embodiment, if there are any dependent XMLType tables, database server 104 requires that the input schema document contain the complete SQL mapping annotations - and that they represent a valid mapping applicable to all such XMLType tables.
Example - Changing the names of elements or attributes: The user retrieves the registered schema document, makes the needed modifications and re -registers it. Note that this alteration does not affect the underlying tables.
Example - Adding a new element or attribute: Since this alteration affects underlying tables, it has to be performed in multiple steps. The user first uses the ALTER TYPE and/or ALTER TABLE commands to evolve the underlying tables. This marks the XML schema as invalid. The user then modifies the XML schema document as appropriate and re-registers it.
According to one embodiment, a 1-step XML schema evolution is provided, i.e. a user simply inputs a new XML schema and all underlying type and table alterations are determined implicitly.
IMPLICIT REGISTRATION OF XML SCHEMAS When instance documents are inserted into XDB via protocols such as HTTP or FTP, the schemas to which they conform (if specified) are registered implicitly - if not already registered. Since the schema registration is always auto-committed, the implicit registration is performed within an autonomous transaction.
XMLTYPE TABLES Tables and columns that are part of the "appropriate database representation" of an XML schema are referred to herein as "schema-based" tables and columns. According to one embodiment, Schema-based XMLType tables and columns can be created by referencing the schema URL (of a registered schema) and the name of the root element. A subset of the XPointer notation (shown below) can also be used in providing a single URL containing both the schema location and the element name.
CREATE TABLE po_tab OF xmltype
XMLSCHEMA "http://www.oracle.com/PO.xsd" ELEMENT " PurchaseOrder"
An equivalent definition is
CREATE TABLE po_tab of xmltype element "http: //www. oracle. com/PO.xsd#PurchaseOrder" ; By default, schema-based XMLType is stored in an underlying (hidden) object type column. The SQL object types can be created (optionally) during the schema registration process. The mapping from XML to SQL object types and attributes is itself stored within the XML schema document as extra annotations i.e. new attributes defined by XDB.
Schema-based XMLType can also be stored in a single underlying LOB column.
CREATE TABLE po_tab OF xmltype STORE AS CLOB ELEMENT "http: //www. oracle . com/PO.xsd#PurchaseOrder" ;
Creation of SQL object types According to one embodiment, when an XML schema is registered, database server 104 creates the appropriate SQL object types that enable a structured storage of XML documents conforming to this schema. All SQL object types are created in the current user's schema (by default). For example, when PO.xsd is registered, the following SQL types are created. create type Item_t as object ( part varchar2 ( 1000 ) , price number ) ; create type Item_varray_t as varray ( lOOO ) of OBJ_Tl ; create type PurchaseOrder_t as object ( purchasedate date, ponum number, company varchar2 ( 100 ) , item Item_varray_t ) ;
The names of the object types and attributes above may actually be system- generated. If the schema already contains the SQLName attribute filled in, this name is used as the object attribute's name. Else, the name is derived from the XML name - unless it cannot be used because of length, or conflict reasons. If the SQLSchema attribute is filled in, Oracle will attempt to create the type in the specified schema. The current user must have any necessary privileges to perform this operation. MAPPING XML SCHEMAS TO OBJECT TYPES - A DETAILED EXAMPLE The following sections provide the details on how the SQL object types may be generated from the XML schema information. As was mentioned above, the actual mapping rules may vary from implementation to implementation based on a variety of factors. One such factor is the capabilities of the target database system. In the following detailed example, it is assumed that the target database system supports the data types and object typing mechanisms currently available in the Oracle 9iR2, currently available from Oracle Corporation.
MAPPING SIMPLE TYPES According to one embodiment, an XML primitive type is mapped to the closest SQL datatype. For example, decimal, positive Integer and float are all mapped to SQL NUMBER. An XML enumeration type is mapped to an object type with a single RAW(n) attribute - the value of n is determined by the number of possible values in the enumeration declaration. An XML list or union datatype is mapped to a string (VARCHAR2/CLOB) datatype in SQL.
Default mapping of XML simple types to SOL
Figure imgf000017_0001
Figure imgf000018_0001
Figure imgf000019_0001
Figure imgf000019_0002
Figure imgf000020_0001
MAPPING COMPLEX TYPES
According to one embodiment, a complextype is mapped to an object type. XML attributes declared within the complexType map to object attributes - the simpIeType defining the XML attribute determines the SQL datatype of the corresponding attribute. XML elements declared within the complexType are also mapped to object attributes. The datatype of the object attribute is determined by the simpIeType or complexType defining the XML element.
If the XML element is declared with maxOccurs attribute's value > 1, it is mapped to a collection attribute in SQL. The collection could be either a VARRAY (default) or nested table (if the maintainOrder attribute is set to FALSE). Further, the default storage of the VARRAY is in tables (OCTs) [OCT-FS] instead of LOBs - the user can choose the LOB storage by setting the storeAsLob attribute to TRUE.
In general, the name of the SQL attribute is generated from the XML element or attribute name using the following algorithm :
1. use XML element/attribute name (truncated to 30 chars)
2. if an illegal SQL character is found, map it to underscore ('_')
3. if this name is not unique, append a sequence number (note: this may require further truncating the name before appending the number) However, the user can explicitly specify the SQL attribute name by providing a value for the SQLName attribute within the schema DOM FIDELITY
All elements and attributes declared within the XML schema get mapped to separate attributes within the corresponding SQL object type. However, there are some pieces of information in the XML instance documents that are not represented directly by such element/attributes. Examples are :
• Comments
• Namespace declaration
• Prefix information
In order to guarantee that the returned XML documents are identical to the original document for purposes of DOM traversals (referred to as DOM fidelity), a binary attribute called SYS_XDBPD$ is added to all generated SQL object types. This attribute stores all pieces of information that cannot be stored in any of the other attributes - thereby ensuring DOM fidelity of XML documents stored in the database system. Note : The SYS_XDBPD$ attribute is omitted in many examples for reasons of clarity. However, the attribute is may be present in all SQL object types generated by the schema registration process.
SQL OUT OF LINE STORAGE According to one embodiment, by default, a sub-element is mapped to an embedded object attribute. However, there may be scenarios where an out-of-line storage offers better performance. In such cases the SQLInline attribute can be set to FALSE - and the XML schema mapper 106 generates an object type with an embedded REF attribute. The REF points at another instance of XMLType that corresponds to the XML fragment that gets stored out-of-line. Default tables (of XMLType) are also created to store the out-of-line fragments. Example
<complexType name = " Employee " > -- OBJ_T2 <sequence>
<element name = "Name " type = " string" maxLength = " 1000 " />
<element name = "Age " type = " decimal " / >
<element name = "Addr" SQLInline = " false*^ <complexType> -- OBJ_Tl <sequence>
<element name = "Street" type = "string" maxLength = "100"/>
<element name = "City" type = "string" maxLength = "100" />
</sequence> </complexType> </element> </sequence> </complexType> create type OBJ_Tl as object (
Street varchar2 (100) , City varchar2 (100)
); create type OBJ_T2 as object
(
Name varchar2 (100) ,
Age number,
Addr REF XMLType ) ;
MAPPING XML FRAGMENTS TO LOBS
A user can specify the SQLType for a complex element as LOB(CLOB/BLOB) in which case, the entire XML fragment gets stored in a LOB attribute. This is useful in scenarios where some portions of the XML document are seldom queried upon, but are mostly retrieved and stored as a single piece. By storing the fragment as a LOB, the parsing/decomposition/recomposition overhead is reduced. Exampl e
<complexType name = " Employee " > -- 0BJ_T <sequence>
<element name = "Name " type = " string " maxLength = " 1000 " /> <element name = "Age" type = " decimal " /> <element name = "Addr " SQLType = "CLOB"> <complexType> <sequence>
<element name = " Street " type = " string " maxLength = " 100 " /> <element name = "City" type = "string" maxLength = "100"/>
</sequence> </complexType> </element> </sequence> </complexType> create type OBJ_T as object ( Name varchar2 (100) , Age number, Addr CLOB );
MAPPING SIMPLE CONTENT A complexType based on a simpleContent declaration is mapped to an object type with attributes that correspond to the XML attributes and an extra SYS_XDBBODY$ attribute corresponding to the body value. The datatype of the body attribute is based on the simpIeType which defines the body's type.
Exampl e
<complexType> <simpleContent>
<restriction base = "string" maxLength = "1000">
<attribute name = "al" type = "string" maxLength = "100"/> </restriction> </simpleContent> </comp1exType create type OBJ_T as object ( al varchar2 (100) , SYS_XDBBODY$ varchar2 (1000) ) ;
MAPPING ANY/ANY ATTRIBUTE any element declarations and anyAttribute attribute declarations are mapped to LOBs in the object type. The LOB stores the text of the XML fragment that matches the any declaration. The namespace attribute can be used to restrict the contents to belong to a specified namespace. The processContents attπbute withm the any element declaration indicates the level of validation required for the contents matching the any declaration.
Example
<complexType name = " Employee"> <sequence>
<element name = "Name" type = "string" maxLength = "1000"/> <element name = "Age" type = "decimal" /> <any namespace = "http: //ww /w3.org/2001/xhtml" processContents = "skip"/>
</sequence> </complexType> create type 0BJ_T as object ( Name varchar2 (100) , Age number, SYS_XDBANY$ blob ) ,
MAPPING STRINGS TO SQL VARCHAR2 VS CLOB
If the XML schema specifies the datatype to be "stnng" and a maxLength value of less than 4000, it gets mapped to a varchar2 attπbute of the specified length However, if the maxLength value is not specified in the XML schema, it can only be mapped to a LOB. This is sub-optimal in cases when the majoπty of stnng values are actually small - and a very small fraction of them is large enough to necessitate a LOB. The ideal SQL datatype would be varchar2(*) that would perform like varchars for small stπngs but can accommodate larger stπngs as well. Further, such columns should support all varchar functionality such as indexing, SQL functions, etc. A similar case can be made for needing a raw(*) datatype to hold unbounded binary values without loss of performance and/or functionality for the small cases.
According to an alternative embodiment, all unbounded stπngs are mapped to CLOBs and all unbounded binary elements/attπbutes are mapped to BLOBs
MAPPING STRINGS TO SQL VARCHAR2 VS NVARCHAR2 By default, the XML stnng datatype is mapped to SQL varchar2. However, the user can overπde this behavior in a couple of ways : 1. The user can specify SQLType to be NVARCHAR2 for a particular string element or attribute. This ensures that NVARCHAR2 is chosen as the SQL type for the particular element/attribute.
2. The user can set the mapStringToNCHAR attribute to "true" at the top of the schema declaration. This ensures that all XML strings get mapped to NVARCHAR2 (or NCLOB) datatype, unless explicitly overridden at the element level.
CREATING SCHEMA-BASED XML TABLES Assuming that the XML schema identified by "http://www.oracle.com/PO.xsd" has already been registered. A XMLType table can be created to store instances conforming to the PurchaseOrder element of this schema - in an object-relational format as follows : create table MyPOs of xmltype element "http: //www. oracle . com/PO. sd#PurchaseOder" ;
Hidden columns are created corresponding to the object type to which the PurchaseOrder element has been mapped. In addition, a XMLExtra object column is created to store the top-level instance data such as namespaces declarations, etc. Note : XMLDATA is a pseudo-attribute of XMLType that allows directly accessing the underlying object column.
SPECIFYING STORAGE CLAUSES
The underlying columns can be referenced in the storage clauses by
1. object notation : XMLDATA.<attrl>.<attr2>....
2. XML notation : ExtractValue(xmltypecol, Vattrl/attr2') create table MyPOs of xmltype element "http: //www. oracle . com/PO.xsd#PurchaseOrder" lob (xmldata.lobattr) store as (tablespace ... ) ; create table MyPOs of xmltype element "http: //www. oracle . com/PO. xsd#PurchaseOrder" lob (ExtractValue(MyPθs, '/lobattr')) store as (tablespace ... ) ; CREATING INDEXES
As shown above, columns underlying a XMLType column can be referenced using either a object notation or a XML notation in the CREATE INDEX statements. create index ponum_idx on MyPOs (xmldata.ponum) ; create index ponum_idx on MyPOs p (ExtractValue(p, 1 /ponu ' ) ;
CONSTRAINTS Constraints can be specified for underlying columns by using either the object or the XML notation. create table MyPOs of xmltype element "http: //www. oracle . com/PO.xsd#PurchaseOrder"
(unique (xmldata.ponum) ) ; create table MyPOs p of xmltype element
"http: //www. oracle. com/PO.xsd#PurchaseOrder" (unique (ExtractV alue (p , ' /ponum' ) ) ;
DMLS
New instances can be inserted into a XMLType table as : insert into MyPOs values
(xmltype. createxml ( '<PurchaseOrder> </PurchaseOrder> ' ) ) ;
The XMLType table can be queried using the XPath-based SQL operators. select value (p) from MyPOs where extractValue (value (p) , '/Company) = 'Oracle';
The query rewrite mechanism rewrites queries involving existsNode and extract operators to directly access the underlying attribute columns - thereby avoiding construction of the XML followed by subsequent XPath evaluation. For example, the above query gets rewritten to : select value (p) from MyPOs where p . xmldata . company = Oracle ' ; QUERY REWRITE
XPath based operators (Extract, ExistNode,ExtractValue) operating on schema- based XMLType columns are rewritten to go against the underlying SQL columns. This enables further SQL optimizations that fully exploit the object-relational storage of the XML. The following kinds of XPath expressions can be translated into the underlying SQL queries :
1. Simple XPath expressions - involving traversals over object type attributes only, where the attributes are simple scalars or object types themselves. The only axes supported are the child and the attribute axes.
2. Collection traversal expressions - involve traversal of collection expressions. Only axes supported are child and attribute axes.
3. Expressions involving * axes - Transform those expressions involving the wildcard axes provided the datatypes of the resulting nodes are all coercible, (e.g. CUST/*/CUSTNAME must point to CUSTNAMEs which are all of the same or coercible datatypes).
4. Expressions involving descendant axis (//) - Transform these expressions provided the datatypes of the resulting nodes are the same or coercible.
5. All of these expressions must work with the type cache, which includes "hidden" traversals like REFs to XMLTypes etc.. (for instance xdb$schema_t stores a vaπay of REFs to xdb$element_t and this is not directly apparent in the XPath expression or the resulting XML document).
Transformations of these XPath expressions are supported in the ExistsNode, ExtractValue and Extract usage scenarios.
Examples of query rewrite of XPath.
Original Query select * from MyPOs p where ExistsNode (p , ? / PO [ PNAME= ?P01 ? ] PONO? ) = 1 After Rewrite of ExistsNode select * from MyPOs p where (CASE WHEN (p. mldata.pono IS NOT NULL)
AND (p.xmldata. PNAME = ?P01?)) THEN 1 ELSE 0 ) = 1
Original Statement select ExtractValue (p, ?/ [PNAME=?P01 ' ] /PONO?) from MyPOs p After Rewrite of Extract select (select p.xmldata.pono from dual where p .xmldata .pname = ?P01?) from MyPOs ;
FUNCTION REWRITE RULES EXTRACT, EXTRACTVALUE and EXISTSNODE can appear in the following positions
• In the select list, where clause predicate, group by and order by expressions in a SQL query.
• In the Index clause of a CREATE INDEX statement. create index foo_mdex on foo_tab ( extractvalue (xml_col , ' /PO/PONO 1 ) ) ;
In all these cases, the EXISTSNODE and EXTRACT operator get replaced by their definining underlying expressions. The XPath expressions must satisfy the conditions listed in the previous section for them to be rewritten.
In the index case, if replacing the whole operator tree results in a single column, then the index is turned into a BTree or a domain index on the column, rather than being a functional index.
REWRITE FOR OBJECT/SCALAR ATTRIBUTE TRAVERSALS
Simple XPath traversals are rewritten into object type accessors. Predicates are handled by putting them in the where clause. Any XPath child access over an object type is translated to an object attribute access on the underlying object type. For example A/B maps to a.b where A maps to the object type a and the XPath node B maps to the attribute of "a" named "b".
This rewrite is consistent at any level of the XPath expression, i.e. whether the XPath traversal occurs within a predicate, or a location path variable.
For example,
PO/CUSTOMER/CUSTOMERNAME becomes "po". "cust". "custname" (assuming PO maps to "po" etc..) Predicates are handled by rewriting the predicate expression in the underlying object expressions.
In the simple case, for EXISTSNODE, the main location path traversal becomes a IS NOT NULL predicate, whereas for the EXTRACT case, this becomes the actual node being extracted.
EXISTSNODE(po_col, 'PO/CUSTOMER/CUSTOMERNAME') becomes
CASE (WHEN ( "po"."cust"."custname" IS NOT NULL) then 1 else 0)
Predicates are handled in a similar manner.For example, in the operator given below,
EXISTSNODE(po_col, 'PO/CUSTOMER[CUSTOMERNO=20]/CUSTOMERNAME')
the predicate, D = 20 is treated as if the user specified, (A/B/D = 20)
Thus the whole expression becomes,
CASE (WHEN ( "PO"."CUST"."CUSTNAME" IS NOT NULL AND ("PO"."CUST"."CUSTNO" = 20)) THEN 1 ELSE 0)
COLLECTION TRAVERSALS
The XPath expressions may also span collection constructs and the queries are still rewritten by using subqueries on the collection tables. For example,
EXISTSNODE(po_col, 7PO/lineitems[lineitemno=20]') is checking for the existance of lineitems in a purchase order where the lineitem number is 20. This becomes, case(when ( exists(select * from TABLE("po". "lineitems") where lineitemno = 20)) then 1 else 0)
DEFAULT TABLES As part of schema registration, default tables can also be created. The default table is most useful in cases when XML instance documents conforming to this schema are inserted through APIs that do not have any table specification e.g. FTP, HTTP. In such case, the XML instance is inserted into the default table. If the user has given a value for defaultTable attribute, the XMLType table is created with that name. Else, it gets created with some internally generated name. Further, any text specified as the tableStorage attribute is appended to the generated CREATE TABLE statement.
SPECIFYING THE INTERNAL MEMORY DATATYPE
The XML data is stored in a C structure within RDBMS memory. In general, the in-memory representation of the XML data is such that it tries to avoid datatype conversions at load time, and converts data only when accessed, since many parts of the document may not be accessed at all. As part of schema registration, the in-memory datatype is chosen based on the XML datatype - and this information is stored within the schema document using the memDatatype attribute. However, there are some scenarios in which an application may wish to override the default memory type in favor of a different in-memory representation.
Eg. the default memory representation of strings is "char" which keeps the string data in the database session character set. However, if this data is only consumed by a Java application that requires it in Fixed Width UCS-2 Unicode, it may be more performant to set the memDatatype to "JavaString". This ensures that database server 104 keeps the data directly in Java memory in Unicode format - thereby avoiding any format conversions or copies.
Figure imgf000030_0001
Figure imgf000031_0001
GENERATION OF MAPPING INFORMATION Once the appropriate database representation has been determined for a particular XML schema, mapping information is generated to indicate the coπelation between the elements of the appropriate database representation and the elements identified in the particular XML schema. For example, if the appropriate database representation for an XML schema for type "person" includes a table PERSON for storing the data items contained in person XML documents, then the mapping information would indicate a coπelation between person XML documents and table PERSON.
In addition to the general coπelation between an XML schema and a database schema object (such as a table), the mapping information may reflect coπelations at much finer levels of granularity. For example, the mapping information may indicate which specific column of the PERSON table should be used to store each specific data item within person XML documents.
According to one embodiment, the information regarding the SQL mapping is itself stored within the XML schema document. During the registration process, the XML schema mapper 106 generates the SQL types (as shown above). In addition it adds annotations to the XML schema document to store the mapping information. Annotations are in form of new attributes. Example : The schema below shows the SQL mapping information captured via SQLType and SQLName attributes. <schema xmlns= "http : / /www . w3 . org/2001 /XMLSchema " targe tNamespace= " http : / /www . oracle . com/PO . xsd" > <complexType name = " PurchaseOrder" > ottribute name = " PurchaseDate " type = " date " SQLName="PURCHASΞDATE" SQLType= " DATE " / > <sequence> <element name = " PONum" type = " decimal " SQLName="PONU " SQLType= "NUMBER" / > <element name = "Company" type = "string" maxLength = "100" SQLName =" COMPANY" SQLType="VARCHAR2"/>
<element name = "Item" maxOccurs = "1000" SQLName="ITEM" SQLType= " ITEM_T " SQLCol lType= " ITEM_VARRAY_T " > < c omp 1 exTyp e > <sequence>
<element name = "Part" type = "string" maxLength = "1000" SQLName="PART" SQLType="VARCHAR2"/>
<element name = "Price" type = "float" SQLName=" RICE" SQLType = " UMBER " / > </sequence> </complexType> </element> </sequence> </complexType>
<element name="PO" type=" PurchaseOrder" SQLType="PURCHASEORDER_T"/> </schema>
USER-SPECIFIED NAMES IN INPUT SCHEMA DOCUMENT The user can specify the names of the SQL object types and its attributes by filling in the SQLName and SQLType attributes prior to registering the schema. If the SQLName and SQLType values are specified by the user, then the XML schema mapper 106 creates the SQL object types using these names. If these attributes are not specified by the user, an internal name-generation algorithm is used to generate the names. See Appendix for details on the name generation algorithm.
The table below lists all the annotations used within the schema to capture the SQL mapping information. Note that the user need not specify values for any of these attributes. The XML schema mapper 106 will fill in the appropriate values during the schema registration process. However, it is recommended that user specify the names of at least the top level SQL types - in order to be able to reference them later. All annotations are in form of attributes that can be specified within attribute and element declarations. These attributes belong to the XDB namespace : http://xmlns.oracle.com/xdb/XDBSchema.xsd
Table 1 : XDB attributes specifiable within element and attribute declarations
Attribute Values I Default I Description
Figure imgf000033_0001
Figure imgf000034_0001
Figure imgf000035_0001
HYBRID STORAGE MODELS
According to one embodiment, the XML schema mapper 106 is implemented to support hybrid storage models in which the structure of some elements defined within the XML schema is maintained in the appropriate database representation, and the structure of other elements is not. For example, the most-often queried/updated portions of an XML document type may be mapped to object type attributes, while the rest of the portions of the XML document are stored together in a CLOB. According to one embodiment, the specific portions for with structure is to be maintained or not to be maintained are designated by pre-annotating the XML schema with appropriate mapping directives.
TRANSACTIONAL NATURE OF XML SCHEMA REGISTRATION According to one embodiment, the XML schema registration is performed using the transaction support of database server 104 in a manner that allows executing compensating action to undo partial effects when eπors are encountered during the schema registration operation.
HANDLING CYCLIC DEFINITIONS IN XML SCHEMAS It is possible for XML schemas to include cycles. According to one embodiment, XML schema mapper 106 is configured to detect such cycles and break them by using REFs while mapping to SQL object types. A detailed description of how REFs may be used to break cycles is provided in Appendix I.
STORING XML DOCUMENTS BASED ON THE MAPPING INFORMATION
After an XML schema for a particular document type has been registered with database server 104, XML documents that conform with the schema can be intelligently managed by database server 104. According to one embodiment, when a protocol indicates that a resource must be stored in a database managed by database server 104, database server 104 checks the document's file name extension for .xml, .xsl, .xsd, and so on. If the document is XML, a pre-parse step is performed, where enough of the resource is read to determine the XML schemaLocation and namespace of the root element in the document. This location is used to look for a registered schema with that schemaLocation URL. If a registered schema is located with a definition for the root element of the cuπent document, then the default table specified for that element is used to store that resource's contents.
According to one embodiment, when an XML document is stored in a database server that supports the XML schema registration techniques described herein, the database server is able to validate the documents to verify that they confirm to the coπesponding XML schema. The validation may include validation of both the structure and the datatypes used by the XML document.
Various other benefits are achieved through the use of the techniques described herein. For example, the schema registration process allows the database server to enforce the integrity constraints and other forms of constraints on the XML documents and the tables used to store them. In addition, the database server is able to create indexes on and partition XML tables based on XML data.
Because the structure of the XML documents is reflected in how the data from the XML documents are stored within the database, the tag information typically used to reflect the structure does not need to be stored along with the data. The ability to avoid storing some or all of the XML tags can result in a significant decrease in storage overhead, since the XML tags often form a large portion of the size of XML documents.
Other performance benefits are also made possible. For example, query performance may be improved by rewriting XPath queries to directly access the underlying columns. In addition, update performance may be improved by rewriting updates to directly update the underlying columns. Consequently, updating a portion of the XML data from a stored document would not always require the rewriting the entire XML data for the stored document.
HARDWARE OVERVIEW
Figure 2 is a block diagram that illustrates a computer system 200 upon which an embodiment of the invention may be implemented. Computer system 200 includes a bus 202 or other communication mechanism for communicating information, and a processor 204 coupled with bus 202 for processing information. Computer system 200 also includes a main memory 206, such as a random access memory (RAM) or other dynamic storage device, coupled to bus 202 for storing information and instructions to be executed by processor 204. Main memory 206 also may be used for storing temporary variables or other intermediate information during execution of instructions to be executed by processor 204. Computer system 200 further includes a read only memory (ROM) 208 or other static storage device coupled to bus 202 for storing static information and instructions for processor 204. A storage device 210, such as a magnetic disk or optical disk, is provided and coupled to bus 202 for storing information and instructions.
Computer system 200 may be coupled via bus 202 to a display 212, such as a cathode ray tube (CRT), for displaying information to a computer user. An input device 214, including alphanumeric and other keys, is coupled to bus 202 for communicating information and command selections to processor 204. Another type of user input device is cursor control 216, such as a mouse, a trackball, or cursor direction keys for communicating direction information and command selections to processor 204 and for controlling cursor movement on display 212. This input device typically has two degrees of freedom in two axes, a first axis (e.g., x) and a second axis (e.g., y), that allows the device to specify positions in a plane.
The invention is related to the use of computer system 200 for implementing the techniques described herein. According to one embodiment of the invention, those techniques are performed by computer system 200 in response to processor 204 executing one or more sequences of one or more instructions contained in main memory 206. Such instructions may be read into main memory 206 from another computer-readable medium, such as storage device 210. Execution of the sequences of instructions contained in main memory 206 causes processor 204 to perform the process steps described herein. In alternative embodiments, hard-wired circuitry may be used in place of or in combination with software instructions to implement the invention. Thus, embodiments of the invention are not limited to any specific combination of hardware circuitry and software.
The term "computer-readable medium" as used herein refers to any medium that participates in providing instructions to processor 204 for execution. Such a medium may take many forms, including but not limited to, non-volatile media, volatile media, and transmission media. Non-volatile media includes, for example, optical or magnetic disks, such as storage device 210. Volatile media includes dynamic memory, such as main memory 206. Transmission media includes coaxial cables, copper wire and fiber optics, including the wires that comprise bus 202. Transmission media can also take the form of acoustic or light waves, such as those generated during radio-wave and infra-red data communications.
Common forms of computer-readable media include, for example, a floppy disk, a flexible disk, hard disk, magnetic tape, or any other magnetic medium, a CD-ROM, any other optical medium, punchcards, papertape, any other physical medium with patterns of holes, a RAM, a PROM, and EPROM, a FLASH-EPROM, any other memory chip or cartridge, a carrier wave as described hereinafter, or any other medium from which a computer can read.
Various forms of computer readable media may be involved in caπying one or more sequences of one or more instructions to processor 204 for execution. For example, the instructions may initially be carried on a magnetic disk of a remote computer. The remote computer can load the instructions into its dynamic memory and send the instructions over a telephone line using a modem. A modem local to computer system 200 can receive the data on the telephone line and use an infra-red transmitter to convert the data to an infra-red signal. An infra-red detector can receive the data carried in the infra-red signal and appropriate circuitry can place the data on bus 202. Bus 202 carries the data to main memory 206, from which processor 204 retrieves and executes the instructions. The instructions received by main memory 206 may optionally be stored on storage device 210 either before or after execution by processor 204.
Computer system 200 also includes a communication interface 218 coupled to bus 202. Communication interface 218 provides a two-way data communication coupling to a network link 220 that is connected to a local network 222. For example, communication interface 218 may be an integrated services digital network (ISDN) card or a modem to provide a data communication connection to a coπesponding type of telephone line. As another example, communication interface 218 may be a local area network (LAN) card to provide a data communication connection to a compatible LAN. Wireless links may also be implemented. In any such implementation, communication interface 218 sends and receives electrical, electromagnetic or optical signals that cany digital data streams representing various types of information.
Network link 220 typically provides data communication through one or more networks to other data devices. For example, network link 220 may provide a connection through local network 222 to a host computer 224 or to data equipment operated by an Internet Service Provider (ISP) 226. ISP 226 in turn provides data communication services through the world wide packet data communication network now commonly refeπed to as the "Internet" 228. Local network 222 and Internet 228 both use electrical, electromagnetic or optical signals that cany digital data streams. The signals through the various networks and the signals on network link 220 and through communication interface 218, which cany the digital data to and from computer system 200, are exemplary forms of carrier waves transporting the information.
Computer system 200 can send messages and receive data, including program code, through the network(s), network link 220 and communication interface 218. In the Internet example, a server 230 might transmit a requested code for an application program through Internet 228, ISP 226, local network 222 and communication interface 218.
The received code may be executed by processor 204 as it is received, and/or stored in storage device 210, or other non-volatile storage for later execution. In this manner, computer system 200 may obtain application code in the form of a carrier wave.
In the foregoing specification, embodiments of the invention have been described with reference to numerous specific details that may vary from implementation to implementation. Thus, the sole and exclusive indicator of what is the invention, and is intended by the applicants to be the invention, is the set of claims that issue from this application, in the specific form in which such claims issue, including any subsequent coπection. Any definitions set forth herein for terms contained in such claims shall govern the meaning of such terms as used in the claims. Hence, no limitation, element, property, feature, advantage or attribute that is not expressly recited in a claim should limit the scope of such claim in any way. The specification and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense.
Appendix I
Introducing XML Schema
Introducing XML Schema and Oracle XML DB
Using Oracle XML DB and XML Schema
Introducing DBMS_XMLSCHEMA
Registering Your XML Schema Before Using Oracle XML DB
Deleting Your XML Schema Using DBMS_XMLSCHEMA
Guidelines for Using Registered XML Schemas
Java Bean Generation During XML Schema Registration
Generating XML Schema from Object-Relational Types Using DBMS_ XMLSCHEMA.generateSchemaO
XML Schema-Related Methods of XMLType
Managing and Storing XML Schema
DOM Fidelity
Oracle XML DB Creates XMLType Tables and Colunms Based on XML Schema
Using SQLName and SQLType Attributes to Specify SQL Object Type Names Before Registering XML Schema
Mapping of Types Using DBMS_XMLSCHEMA
XML Schema: Mapping SimpleTypes to SQL
XML Schema: Mapping ComplexTypes to SQL
Object-Relational Mapping of XMLTyp A-1 Oracle XML DB complexType Extensions and Restrictions Further Guidelines for Creating XML Schema-Based XML Tables Query Rewrite with XML Schema-Based Object-Relational Storage Creating Default Tables During XML Schema Registration Ordered Collections in Tables (OCTs) Cyclical References Between XML Schemas
base Developer's Guide - Oracle XML DB Introducing XML Schema and Oracle XML DB
Introducing XML Schema
The XML Schema recommendation was created by the World Wide Web Consortium (W3C) to describe the content and structure of XML documents in XML. It includes the full capabilities of Document Type Definitions (DTDs) so that existing DTDs can be converted to XML schema. XML schemas have additional capabilities compared to DTDs.
Introducing XML Schema and Oracle XML DB
XML Schema is a schema definition language written in XML. It can be used to describe the structure and various other semantics of conforming instance dociunents. For example, the following XML schema definition, po.xsd, describes the structure and other properties of purchase order XML documents.
This manual refers to XML schema definitions as XML schema.
Example 5-1 XML Schema Definition, po.xsd
— The following is an example of an XML schema definition, po.xsd: <schema targetNamespace="http : //www. oracle . com/PO. xsd" xmlns :po="http: //www. oracle . com/ PO.xsd" xmlns="http: //www.w3.org/2001/XMLSchema"> <corπplexType name="PurcbaseOrderType"> <sequence> <element name="PONum" tγpe="decimal"/> <element name=" Company "> <siιrpleType> ■ restriction base=" string" > <maxLength value="100" /> </restriction </siιrpleType> </element>
<elem=nt name="Item" maxOccurs="1000"> <coπplexiype> <sequence> <element naπe="Part"> <siπpleType> <restriction base=" string" > <maxLength value="1000" /> </restriction> </siπpleType>
Object-Relational Mapping of XMLType A-3 Introducing XML Schema and Oracle XML DB
</element>
<element naιre="Price" tγpe=" floa "/> </sequence> < /coπplexType> </eleιrent> </sequence> < / coπplexType>
<element nams=" PurchaseOrder" tγpe="po: PurchaseOrderType"/> </schema>
Example 5-2 XML Document, po.xml Conforming to XML Schema, po.xsd
— The following is an exaπple of an XML document that conforms to XML schema po .xsd:
<PurchaseOrder xmlns= "http : / /ww . oracle . com/PO . xsd" x lns :xsi="http: //www. w3.org/2001/XMLScherra- instance" xsi : schemaLocation= "http : / /ww . oracle . com/PO . xsd http: //www. oracle .com/PO . xsd"> <PO um 1001</PO urre> <Coιrpany>Oracle Corp</Cαrrpaπ > <Item> <Part>9i Doc Set</Part> <Price>2550</Price> </Item> < / PurchaseOrder>
A-4 Oracle9/XML Database Developer's Guide - Oracle XML DB Using Oracle XML DB and XML Schema
Note:
The URL ' http : / /www. oracle . com/PO . xsd' used here is simply a name that uniquely identifies the registered XML schema within the database and need not be the physical URL at the which the XML schema document is located. Also, the target namespace of the XML schema is another URL, different from the XML schema location URL, that specifies an abstract namespace within which elements and types get declared.
An XML schema can optionally specify the target namespace URL. If this attribute is omitted, the XML schema has no target namespace. Note: The targetnamespace is commonly the same as XML schema's URL.
An XML instance document must specify both the namespace of the root element (same as the XML schema's target namespace) and the location (URL) of the XML schema that defines this root element. The location is specified with attribute xsi : schemaLocation. When the XML schema has no target namespace, use attribute xsi : noNamespaceSchemaLocation to specify the XML schema URL.
Using Oracle XML DB and XML Schema
Oracle XML DB uses annotated XML schema as metadata, that is, the standard XML Schema definitions along with several Oracle XML DB-defined attributes. These attributes are in a different namespace and control how instance documents get mapped into the database. Since these attributes are in a different namespace from the XML schema namespace, such annotated XML schemas are still legal XML schema documents:
When using Oracle XML DB, you must first register your XML schema. You can then use the XML schema URLs while creating XMLType tables, columns, and views.
Oracle XML DB provides XML schema support for the following tasks:
■ Registering any W3C compliant XML Schema.
Object-Relational Mapping of XMLType A -5 Using Oracle XML DB and XML Schema
■ Validating your XML documents against a registered XML schema definitions.
■ Registering local and global XML schemas.
■ Generating XML schema from object types.
■ Referencing an XML schema owned by another user.
■ Explicitly referencing a global XML schema when a local XML schema exists with the same name.
■ Generating a structured database mapping from your XML schemas during XML schema registration. This includes generating SQL object types, collection types, and default tables, and capturing the mapping information using XML schema attributes.
■ Specifying a particular SQL type mapping when there are multiple legal mappings.
■ Creating XMLType tables, views and columns based on registered XML schemas.
■ Performing manipulation (DML) and queries on XML schema-based XMLType tables.
■ Automatically inserting data into default tables when schema-based XML instances are inserted into Oracle XML DB Repository using FTP, HTTP/ WebDav protocols and other languages.
Why Do We Need XML Schema?
XMLType is a datatype that facilitates storing XML in columns and tables in the database. XML schemas further facilitate storing XML columns and tables in the database, and they offer you more storage and access options for XML data along with space- performance-saving options.
For example, you can use XML schema to declare which elements and attributes can be used and what kinds of element nesting, and datatypes are allowed in the XML documents being stored or processed.
XML Schema Provide Flexible XML-to-SQL Mapping Set Up
Using XML schema with Oracle XML DB provides a flexible set up for XML storage mapping. For example:
■ If your data is highly structured (mostly XML), each element in the XML documents can be stored as a column in a table.
A-6 Oracle9/XML Database Developer's Guide - Oracle XML DB Introducing DBMS_XMLSCHEMA
■ If your data is unstructured (all or mostly non-XML data), the data can be stored in a Character Large Object (CLOB).
Which storage method you choose depends on how your data will be used and depends on the queriability and yotu: requirements for querying and updating your data. In other words. Using XML schema gives you more flexibility for storing highly structured or unstructured data.
XML Schema Allows XML Instance Validation
Another advantage for using XML schema with Oracle XML DB is that you can perform XML instance validation according to the XML schema and with respect to Oracle XML Repository requirements for optimal performance. For example,an XML schema can check that all incoming XML documents comply with definitions declared in the XML schema, such as allowed structure, type, number of allowed item occurences, or allowed length of items.
Also, by registering XML schema in Oracle XML DB, when inserting and storing XML instances using Protocols, such as FTP or HTTP, the XML schema information can influence how efficiently XML instances are inserted.
When XML instances must be handled without any prior information about them, XML schema can be useful in predicting optimum storage, fidelity, and access.
Introducing DBMS_XMLSCHEMA
Oracle XML DB's XML schema functionality is available through the PL/SQL supplied package, DBMS_XML SCHEMA, a server-side component that handles the registration of XML schema definitions for use by Oracle XML DB applications.
Two of the main DBMS_XMLSCHEMA functions are:
■ rβgisterSchβ a ( ) . This registers an XML schema given:
■ XML schema source, which can be in a variety of formats, including string, LOB, XMLType, and URIType
■ Its schema URL or XMLSchema name
■ dβlθteSchema ( ) . This deletes a previously registered XML schema, identified by its URL or XMLSchema name.
Object-Relational Mapping of XMLType A-7 Registering Your XML Schema Before Using Oracle XML DB
Registering Your XML Schema Before Using Oracle XML DB
An XML schema must be registered before it can be used or referenced in any context by Oracle XML DB. XML schema are registered by using DBMS_ XMLSCHEMA . registerSchema ( ) and specifying the following:
■ The XML schema source document as a VARCHAR, CLOB, XMLType, or URIType.
■ The XML schema URL. This is a name for the XML schema that is used within XML instance dociunents to specify the location of the XML schema to which they conform.
After registration has completed:
■ XML dociunents conforming to this XML schema, and referencing it using the XML schema's URL within the XML document, can be processed by Oracle XML DB.
■ Tables and columns can be created for root XML elements defined by this XML schema to store the conforming XML documents.
Registering Your XML Schema using DBMS_XMLSCHEMA
Use DBMS_XMLSCHEMA to register your XML schema. This involves specifying the XML schema document and its URL, also known as the XML schema location.
Example 5-3 Registering an XML Schema That Declares a complexType Using DBMS_XMLSCHEMA
— Consider the XML schema shown below. It declares a complexType called PurchaseOrderType
— and an element PurchaseOrder of this type. The schema is stored in the
— PL/SQL variable doc . The following registers the XML schema at URL:
— http: //www.oracle.com/PO.xsd. declare doc varchar2(1000) := '<schema targetNamespace="http://ww .oracle.com/PO.xsd" xmlns :po="htt : //www.oracle.com/PO.xsd" xmlns="http: //wωw.w3.org/2001/XMLSchema"> <coπplexType name="PurchaseOrderType"> <sequence> <element name="PO um" type="decimal"/> <elemant name="Company"> <simpleType>
A-8 Oracleθ/XML Database Developer's Guide - Oracle XML DB Registering Your XML Schema Before Using Oracle XML DB
■^restriction base="string">
<maxLength value="100"/> </restriction> </siπpleType> </element>
<element name="Item" maxOccurs="1000"> <coπplexType> <sequence> <element name="Part"> <siπpleType> <restriction base="string">
<maxLength value="1000"/> </restriction> </simpleType> </element>
<element name="Price" type="float"/> </sequence> </cαrrplexτype> </element> </sequence> </cαπplexType>
<elemsnt name="PurchaseOrder" type="po:PurchaseOrderType"/> </schema>' ; begin dbms_xmlscheι .registerSchema( 'http: //www.oracle.com/PO.xsd' , doc) ; end;
— The registered schema can be used to created XMLSchema-Based tables, or
— XMLSchema-based columns. For exairple, the following statement creates an
— a table with an XMLSchema-based column, create table po_tab( id number, po sys. MLType ) xmltype column po
XMLSCHEMA "http://www.oracle.com/PO.xsd" elemant "PurchaseOrder";
— The following shows an XMLType instance that conforms to the preceding XML
— schema being inserted into the above table. The schemaLocation attribute
— specifies the schema URL: insert into po_tab values (1, xmltype ( '<PurchaseOrder xmlns="http: //www.oracle.com/PO.xsd" xmlns :xsi="http: //www.w3.org/2001/XMLSchema-instance"
Object-Relational Mapping of XMLType A-9 ••"" " " •■■" ""*• •'••i* » .«..« II.-U ,,i' c:ι> „::;iι
Registering Your XML Schema Before Using Oracle XML DB
xsi:schemaLocation="htt : //ww .oracle.com/PO.xsd http: //ww .oracle.com/PO.xsd"> <PQNum>1001</PONum> <Coπpany>Oracle Corp</Cαrrpany> <Item>
<Part>9i Doc Set</Part> <Price>2550</Price> </Item <Item
<Part>8i Doc Set</Part> <Price>350</Price> </Item> </PurchaseOrder>' ) ) ;
Local and Global XML Schemas
XML schemas can be registered as local or global:
■ Local XML schema: An XML schema registered as a local schema is, by default, visible only to the owner.
■ Global XML schema: An XML schema registered as a global schema is, by default, visible and usable by all database users.
When you register an XML schema, DBMS_XMLSCHEMA adds an Oracle XML DB resource corresponding to the XML schema into the Oracle XML DB Repository. The XML schema URL determines the path name of the resource in Oracle XML DB Repository according to the following rules:
Local XML Schema
In Oracle XML DB, local XML schema resources are created under
/ sys / schemas /<username> directory. The rest of the path name is derived from the schema URL.
Example 5-4 A Local XML Schema
For example, a local XML schema with schema URL: http: //www. πryco. com/ PO.xsd registered by SCOTT, is given the path name:
/sys/schemas/SCOTT/www.myco . com/PO . xsd.
A-10 Oracle9/XML Database Developer's Guide - Oracle XML DB Registering Your XML Schema Before Using Oracle XML DB
Database users need appropriate permissions (ACLs) to create a resource with this path name in order to register the XML schema as a local XML schema.
By default, an XML schema belongs to you after registering the XML schema with Oracle XML DB. A reference to the XML schema document is stored in Oracle XML DB Repository, in directory:
/sys/schemas/<usemame>/ . . . .
For example, if you, SCOTT, registered the preceding XML schema, it is mapped to the file:
/sys/sche as/SCOTT/www. oracle . com/PO . xsd
Such XML schemas are referred to as local. In general, they are usable only by you to whom they belong.
Note: Typically, only the owner of the XML schema can use it to define XMLType tables, columns, or views, validate documents, and so on. However, Oracle supports fully qualified XML schema URLs which can be specified as: http: //xmlns . oracle.com/xdb/schemas/SCOTT/www.orac le.com/PO.xsd
This extended URL can be used by privileged users to specify XML schema belonging to other users.
Global XML Schema
In contrast to local schema, privileged users can register an XML schema as a global XML schema by specifying an argument in the DBMS_XMLSCHEMA registration function.
Global schemas are visible to all users and stored under the
/sys /schemas /PUBLIC/ directory in Oracle XML DB Repository.
Object-Relational Mapping of XMLType A-11 Registering Your XML Schema Before Using Oracle XML DB
Note: Access to this directory is controlled by Access Control Lists (ACLs) and, by default, is writeable only by a DBA. You need WRITE privileges on this directory to register global schemas.
XDB Admin role also provides WRITE access to this directory, assuming that it is protected by the default "protected" ACL.
You can register a local schema with the same URL as an existing global schema. A local schema always hides any global schema with the same name (URL).
Example 5-5 A Global XML Schema
For example, a global schema registered by SCOTT with the URL: www.rtryco .com/PO.xsd is mapped to Oracle XML DB Repository at:
/sys/sche as/PUBLIC/www.rπyco . com/ PO.xsd
Database users need appropriate permissions (ACLs) to create this resource in order to register the XML schema as global.
Registering Your XML Schema: Oracle XML DB Sets Up the Storage and Access Infrastructure
As part of registering an XML schema, Oracle XML DB also performs several other steps to facilitate storing, accessing, and manipulating XML instances that conform to the XML schema. These steps include:
■ Creating types: When an XML schema is registered, Oracle creates the appropriate SQL object types that enable the structured storage of XML documents that conform to this XML schema. You can use Oracle XML DB-defined attributes in XML schema documents to control how these object types are generated.
5-12 Oracle9/XML Database Developer's Guide - Oracle XML DB Deleting Your XML Schema Using DBMS_XMLSCHEMA
Creating default tables: As part of XML schema registration, Oracle XML DB generates default XMLType tables for all root elements. You can also specify any column and table level constraints for use during table creation.
■ Creating Java beans: Java beans can be optionally generated during XML schema registration. These Java classes provide accessor and mutator methods for elements and attributes declared in the schema. Access using Java beans offers better performance for manipulating XML when the XML schema is well known. This helps avoid run-time name translation.
Deleting Your XML Schema Using DBMS_XMLSCHEMA
You can delete your registered XML schema by using the DBMS_ XMLSCHEMA . deleteSchema procedure. When you attempt to delete an XML schema, DBMS_XMLSCHEMA checks:
■ That the current user has the appropriate privileges (ACLs) to delete the resource corresponding to the XML schema within Oracle XML DB Repository. You can thus control which users can delete which XML schemas by setting the appropriate ACLs on the XML schema resources.
■ For dependents. If there are any dependents, it raises an error and the deletion operation fails. This is referred to as the RESTRICT mode of deleting XML schemas.
FORCE Mode
A FORCE mode option is provided while deleting XML schemas. If you specify the FORCE mode option, the XML schema deletion proceeds even if it fails the dependency check. In this mode, XML schema deletion marks all its dependents as invalid.
CASCADE Mode
The CASCADE mode option drops all generated types, default tables, and Java beans as part of a previous call to register schema.
See Also: Oracle9i XML API Reference - XDK and XDB chapter on DBMS_XMLSCHEMA
Object-Relational Mapping of XMLType 5-13 Guidelines for Using Registered XML Schemas
Example 5-6 Deleting the XML Schema Using DBMS_XMLSCHEMA
-- The following example deletes XML schema PO.xsd. First, the dependent table
— po_tab is dropped. Then, the schema is deleted using the FORCE and CASCADE
— modes with DBMS_XMI^CHEMA.DELETESCHEMA. drop table po_tab;
EXEC dbms_xmlschema.deleteSchema ( 'htt : //www.oracle.com/PO.xsd' , dtms_xlschema.DELETE_CASCADE_FORCE) ;
Guidelines for Using Registered XML Schemas
The following sections describe guidelines for registering XML schema with Oracle XML DB.
Objects That Depend on Registered XML Schemas
The following objects depend on a registered XML schemas:
■ Tables or views that have an XMLType column that conforms to some element in the XML schema.
■ XML schemas that include or import this schema as part of their definition. a Cursors that reference the XML schema name, for example, within DBMS_ XMLGEN operators. Note that these are purely transient objects.
Creating XMLType Tables, Views, or Columns
After an XML schema has been registered, it can be used to create XML schema-based XMLType tables, views, and columns by referencing the following:
■ The XML schema URL of a registered XML schema
■ The name of the root element
Example 5-7 Post-Registration Creation of an XMLType Table
— For exarrple you can create an XMLSchema-based XMLType table as follows : CREATE TABLE po_tab OF XMLTYPE
XMLSCHEMA "http: //www. oracle .com/PO.xsd" ELEMENT "PurchaseOrder" ;
— The following statement inserts schema-conformant data, insert into po_tab values ( xmltype ( ' <PurchaseQrder xmlns= "http: //www. oracle . com/PO. xsd"
5-14 Oracle9/XML Database Developer's Guide - Oracle XML DB Guidelines for Using Registered XML Schemas
xmlns :xsi="http://ww .w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.oracle.com/PO.xsd http://www.oracle.com/PO.xsd"> <PONum>1001</PGNum> <Corrpany>Oracle Corp</Coπpany> <Item>
<Part>9i Doc Set</Part> <Price>2550</Frice> </Item> <Item>
<Part>8i Doc Set</Part> <Price>350</Price> </Iterκ> </PurchaseGrder>' ) ) ;
Validating XML Instances Against the XML Schema: schemaValidate()
You can validate an XMLType instance against a registered XML schema by using one of the validation methods.
Example 5-8 Validating XML Using schema ValidateQ
— The following PL/SQL exaπple validates an XML instance against XML schema
PO.xsd: declare xmldoc xmltype; begin
— populate xmldoc (by fetching from table) select value(p) into xmldoc from po_tab p; validate against XML schema xmldoc.schemavalidate ( ) ; if xmldoc .isschemavalidated( ) = 1 then dhτe_output.put_line( 'Data is valid' ) ; else dtms_output .put_line ( 'Data is invalid' ) ; end if; end;
Object-Relational Mapping of XMLType 5-15 Guidelines for Using Registered XML Schemas
Fully Qualified XML Schema URLs
By default, XML schema URL names are always referenced within the scope of the current user. In other words, when database users specify XML schema URLs, they are first resolved as the names of local XML schema owned by the current user.
■ If there are no such XML schemas, then they are resolved as names of global XML schema.
■ If there are no global XML schema, then Oracle XML DB raises an error.
XML Schema That Users Cannot Reference
These rules imply that, by default, users cannot reference the following kinds of XML schemas:
■ XML schemas owned by a different database user
■ Global XML schemas that have the same name as local XML schemas
Fully Qualified XML Schema URLs Permit Explicit Reference to XML Schema URLs
To permit explicit reference to XML schemas in these cases, Oracle XML DB supports a notion of hdly qualified XML schema URLs. In this form, the name of the database user owning the XML schema is also specified as part of the XML schema
URL, except that such XML schema URLs belong to the Oracle XML DB namespace as follows: http: //xmlns. oracle.com/xdb/schemas/<database-user-name>/<schemaURL- minus-protocol>
Example 5-9 Using Fully Qualified XML Schema URL
— For exaπple, consider the global XML schema with the following URL: http: //ww .example.com/po .xsd
— Assume that database user SCOTT has a local XML schema with the same URL: http: //ww .example.com/po.xsd
— User JOE can reference the local XML schema owned by SCOTT as follows: http://xmlns.oracle.com/xdb/schemas/SCOTT/www.exanple.com/po.xsd
— Similarly, the fully qualified URL for the global XML schema is: http: //xmlns .oracle.com/xdb/scheπas/PUBLIC/www.exaπple.com/po.xsd
5-16 Oracle9/ XML Database Developer's Guide - Oracle XML DB Java Bean Generation During XML Schema Registration
Transactional Behavior of XML Schema Registration
Registration of an XML schema is non transactional and auto committed as with other SQL DDL operations, as follows:
■ If registration succeeds, the operation is auto committed. a If registration fails, the database is rolled back to the state before the registration began.
Since XML schema registration potentially involves creating object types and tables, error recovery involves dropping any such created types and tables. Thus, the entire XML schema registration is guaranteed to be atomic. That is, either it succeeds or the database is restored to the state before the start of registration.
Java Bean Generation During XML Schema Registration
Java beans can be optionally generated during XML schema registration and provide accessor and mutator methods for elements and attributes declared in the XML schema. Access to XML data stored in the database, using Java beans, offers better performance for manipulating the XML data when the XML schema is well known and mostly fixed by avoiding run-time name translation.
Example 5-10 Generating Java Bean Classes During XMI Schema Registration
For example, the Java bean class corresponding to the XML schema PO . xsd has the following accessor and mutator methods: public class PurchaseOrder extends XMLTypeBean { public BigDecimal getPONumO
{
} public void setPQNum(BigDecimal val)
{
} public String getCompaπyO
{
} public void setCoπpany(String val)
{
Object-Relational Mapping of XMLType 5-17 Generating XML Schema from Object-Relational Types Using DBMS_XMLSCHEMA.generateSchema()
Note: Java Bean support in Oracle XML DB is only for XML schema-based XML documents. Non-schema-based XML documents can be manipulated using Oracle XML DB DOM API.
Generating XML Schema from Object-Relational Types Using DBMS_ XMLSCHEMA.generateSchemaf)
An XML schema can be generated from an object-relational type automatically using a default mapping. The generateSchema ( ) and generateSchemas () functions in the DBMS_XMLSCHEMA package take in a string that has the object type name and another that has the Oracle XML DB XMLschema.
■ generateSchema ( ) returns an XMLType containing an XML schema. It can optionally generate XML schema for all types referenced by the given object type or restricted only to the top-level types.
■ generateSchemas ( ) is similar, except that it returns an XMLSequenceType of XML schemas, each corresponding to a different namespace. It also takes an additional optional argument, specifying the root URL of the preferred XML schema location: http : / /xmlns . oracle . com/xdb/schemas/<schema> . xsd
They can also optionally generate annotated XML schemas that can be used to register the XML schema with Oracle XML DB.
Example 5-11 Generating XML Schema: Using generateSchemaQ
— For exaπple, given the object type: connect tl/tl
CREATE TYPE eπployee_t AS OBJECT ( etrpno NUMBER(IO) , ena e VARCHAR2 (200) , salary NUMBER(10, 2)
) ;
We can generate the schema for this type as follows
-18 Oracle9/ XML Database Developer's Guide - Oracle XML DB Generating XML Schema from Object-Relational Types Using DBMS_XMLSCHEMA.generateSchema()
select dfcms_xmlschem . generateschema ( ' TI ' , ' EMPLOYEE_T ' ) from dual ;
— This returns a schema corresponding to the type EMPLOYEE T. The schema
— declares an ELEMENT named EMPLOYEEJT and a CCMPLEXTYPE called EMPLOYEEJIType .
— The schema includes other annotation from http: //xmlns . oracle .com/xdb.
DBMS_XMLSCHEMA. GENERATESCHEMA ( 'TI ' , ' EMPLOYEEJT' )
<xsd : schema targetNamespace= "http : / /ns . oracle . cαm/xdb/Tl " xmlns= "http : / /ns . oracl e.com/xdb/Tl" xmlns :xsd="http: //www. w3.org/2001/XMLSchema" xmlns :xdb=" http: //xml ns . oracle . com/xdb" xmlns :xsi="http : //www. 3 . org/2001/XMLSchema-instance" xsi : sch ettaLocation= "http : / /xmlns . oracle . com/xdb http : //xmlns . oracle . com/xdb/XDBSchema . sd">
<xsd: element name=" EMPLOYEEJT" type="EMPLOYEEJIType" xdb:SQLType=" EMPLOYEEJT" xdb : SQLSchema= " TI " /> <xsd:cαπplexType name="EMPLOYEE_TType"> <xsd : sequence>
<xsd:element name="EMENO" type=" xsd: double" xdb:SQLName="EMPNO" xdb:SQLTyp e= "NUMBER" />
<xsd: element name="ENAME" type="xsd: string" xdb:SQLName="ENAME" xdb:SQLiyp e="VARCHAR2 " />
<xsd: element name="SALARY" type="xsd:double" xdb :SQLName=" SALARY" xdb:SQLT ype= "NUMBER" />
</xsd: sequence> </xsd : coπpleXType> </xsd: schema>
Object-Relational Mapping of XMLType 5-19 XML Schema-Related Methods of XMLType
XML Schema-Related Methods of XMLType
Table 5-1 lists the XMLType API's XML schema-related methods.
Table 5-1 XMLType API XML Schema-Related Methods
XMLType API Method Description isSchemaBasedO Returns TRUE if the XMLType instance is based on an XML schema, FALSE otherwise. getSchemaURLO Returns the XML schema URL, name of root element, and the namespace for an getRootElementO ^L schema-based XMLType instance. getNamespaceø schemaValidateQ An XMLType instance can be validated against a registered XML schema using isSchemaValid() the validation methods. is SchemaValidated() setSchemaValidated()
Managing and Storing XML Schema
XML schema documents are themselves stored in Oracle XML DB as XMLType instances. XML schema-related XMLType types and tables are created as part of the Oracle XML DB installation script, catxdbs . sgl .
Root XML Schema, XDBSchema.xsd
The XML schema for XML schemas, is called the root XML schema, XDBSchema . xsd. XDBSchema . xsd describes any valid XML schema document that can be registered by Oracle XML DB. You can access XDBSchema . xsd through Oracle XML DB Repository at:
/sys/schemas/PUBLIC/xmlns . oracle . com/xdb/XDBSchema .xsd
-20 Oracle9/' XML Database Developer's Guide - Oracle XML DB DOM Fidelity
chema-Based XMLType Structures Stored?
XML Schema-based XMLType structures are stored in one of the following ways: ■ In underlying object type columns. This is the default storage mechanism.
- SQL object types can be created optionally during the XML schema registration process.
- Mappings from XML to SQL object types and attributes, is stored in the XML schema document as extra annotations, that is, as attributes defined by Oracle XML DB and defined in http://xmlns.oracle.com/xdb.
In a single underlying LOB column. Here the storage choice is specified in the STORE AS clause of the CREATE TABLE statement:
CREATE TABLE po_tab OF xmltype STORE AS CLOB ELEMENT "http://www.oracle.eom/PO.xsd#PurchaseOrder" ;
Specifying the Storage Mechanism
Instead of using the STORE AS clause, you can specify that the table and column be stored according to a mapping based on a particular XML schema. You can specify the URL for the XML schema used for the mapping.
Non-XML schema-based XML data can be stored in tables using CLOBs. However you do not obtain benefits such as indexing, query-rewrite, and so on.
Document Object Model (DOM) fidelity is the concept of retaining the structure of a retrieved XML document, compared to the original XML document, for DOM traversals. DOM fidelity is needed to ensure the accuracy and integrity of XML documents stored in Oracle XML DB.
Object-Relational Mapping of XMLType 5-21 L DB Ensures DOM Fidelity with XML Schema
All elements and attributes declared in the XML schema are mapped to separate attributes in the corresponding SQL object type. However, some pieces of information in XML instance documents are not represented directly by these element or attributes, such as:
■ Comments
■ Namespace declarations
■ Prefix information
To ensure the integrity and accuracy of this data, for example, when regenerating XML documents stored in the database, Oracle XML DB uses a data integrity mechanism called DOM fidelity.
DOM fidelity refers to how identical the returned XML documents are compared to the original XML documents, particularly for purposes of DOM traversals.
nd SYS_XDBPD$
To guarantee that DOM fidelity is maintained and that the returned XML documents are identical to the original XML document for DOM traversals, Oracle XML DB adds a system binary attribute, SYS_XDBPD$, to each created object type.
This attribute stores all pieces of information that cannot be stored in any of the other attributes, thereby ensuring the DOM fidelity of all XML documents stored in Oracle XML DB. Examples of such pieces of information include: ordering information, comments, processing instructions, namespace prefices, and so on.
This is mapped to a Positional Descriptor (PD) column.
Note: In generaLit is not a good idea to set this information because the extra pieces of information, such as, comments, processing instructions, and so on, could be lost if there is no PD column.
How to Suppress SYS_XDBPD$
If DOM fidelity is not required, you can suppress SYS_XDBPD$ in the XML schema definition by setting the attribute, maintainDOM=FALSE.
Database Developer's Guide - Oracle XML DB Oracle XML DB Creates XMLType Tables and Columns Based on XML Schema
Note: The attribute SYS_XDBPD$ is omitted in many examples here for clarity. However, the attribute is always present as a Positional Descriptor (PD) column in all SQL object types generated by the XML schema registration process.
Oracle XML DB Creates XMLType Tables and Columns Based on XML Schema
Oracle XML DB creates XML Schema-based XMLType tables and columns by referencing:
■ The XML schema URL of a registered XML schema
■ The name of the root element
Figure 3 shows the syntax for creating an XMLType table:
CREATE TABLE [schema.] table OF XMLTYPE
[XMLTYPE XMLiype_storage] [XMLScheιra_spec] ;
A subset of the XPointer notation, shown in the following example, can also be used to provide a single URL containing the XML schema location and element name.
Example 5-12 Creating XML Schema-Based XMLType Table
This example creates the XMLType table po_tab using the XML schema at the given URL:
CREATE TABLE po_tab OF XMLTYPE
XMLSCHEMA "http: //www.oracle.com/PO.xsd" ELEMENT "PurchaseOrder" ;
An equivalent definition is:
Object-Relational Mapping of XMLType 5-23 Oracle XML DB Creates XMLType Tables and Columns Based on XML Schema
CREATE TABLE po_tab OF XMLTYPE
ELEMENT "htt : //www.oracle.com/PO.xsd#PurchaseOrder" ;
SQL Object-Relational Types Store XML Schema-Based XMLType Tables
When an XML schema is registered, Oracle XML DB creates the appropriate SQL object types that enable structured storage of XML documents that conform to this XML schema. All SQL object types are created based on the current registered XML schema, by default.
Example 5-13 Creating SQL Object Types to Store XMLType Tables
— For exairple, when PO.xsd is registered with Oracle XML DB, the following SQL types
— are created. Note that the names of the types are generated names, and will not
— nescessarily match Itemxxx_t, Itemxxx_C0LL and PurchaseOrderTypexxx_T, where xxx
— is a 3-digit integer.
CREATE TYPE "Itemxxx T" as object ( part varchar2 (1000) , price number );
CREATE TYPE "Itemxxx_COLL" AS varray(lOOO) OF "Item_T";
CREATE TYPE "PurchaseOrderTypexxx T" AS OBJECT
( ponum nuirber, company varchar2 (100) , item Item_varray_COLL ) ;
5-24 Oracle9 XML Database Developer's Guide - Oracle XML DB Using SQLName and SQLType Attributes to Specify SQL Object Type Names Before Registering XML Schema
Note: The names of the object types and attributes in the preceding example can be system-generated.
■ If the XML schema already contains the SQLName , SQLType , or SQLColType attribute filled in
, this name is used as the object attribute's name.
■ If the XML schema does not contain the SQLName attribute, the name is derived from the XML name, unless it cannot be used because of length or conflict reasons.
If the SQLSchema attribute is used, Oracle XML DB attempts to create the object type using the specified database schema. The current user must have the necessary privileges to perform this.
Using SQLName and SQLType Attributes to Specify SQL Object Type Names Before Registering XML Schema
To specify specific names of SQL objects generated include the attributes SQLName and SQLType in the XML schema definition prior to registering the XML schema.
■ If you specify the SQLName and SQLType values, Oracle XML DB creates the SQL object types using these names.
■ If you do not specify these attributes, Oracle XML DB uses system-generated names.
Note: You do not have to specify values for any of these attributes. Oracle XML DB fills in appropriate values during the XML schema registration process. However, it is recommended that you specify the names of at least the top-level SQL types so that you can reference them later.
All annotations are in the form of attributes that can be specified within attribute and element declarations. These attributes belong to the Oracle XML DB namespace: htt : / /xmlns . oracle . com/xdb
Table 5-2 lists Oracle XML DB attributes that you can specify in element and attribute declarations.
Object-Relational Mapping of XMLType 5-25 Using SQLName and SQLType Attributes to Specify SQL Object Type Names Before Registering XML Schema
Table 5-2 AttributesYou Can Specify in Elements
Attribute Values Default Description
SQLName Any SQL identifier Element name Specifies the name of the attribute within the SQL object that maps to this XML element.
SQLType Any SQL type name Name generated Specifies the name of the SQL type from element name corresponding to this XML element declaration.
SQLCollType Any SQL collection Name generated Specifies the name of the SQL collection type name from element name type corresponding to this XML element that has maxOccurs > 1.
SQLSchema Any SQL usemame User registering Name of database user owning the type XML schema specified by SQLType.
SQLCollSchema Any SQL usemame User registering Name of database user owning the type XML schema specified by SQLCollType. maintainOrder true | false hue If true, the collection is mapped to a VARRAY. If false, the collection is mapped to a NESTED TABLE.
SQLInline true I false true If true this element is stored inline as an embedded attribute (or a collection if maxOccurs > 1). If false, a REF (or collection of REFs if maxOccurs > 1) is stored. This attribute will be forced to false in certain situations (like cyclic references) where SQL will not support inlining. maintainDOM true I false true If true, instances of this element are stored such that they retain DOM fidelity on output. This implies that all comments, processing instructions, namespace declarations, and so on are retained in addition to the ordering of elements. If false, the output need not be guaranteed to have the same DOM behavior as the input.
5-26 Oracle9/ XML Database Developer's Guide - Oracle XML DB Using SQLName and SQLType Attributes to Specify SQL Object Type Names Before Registering XML Schema
Table 5-2 AttributesYou Can Specify in Elements(Cont)
Attribute Values Default Description columnProps Any valid column NULL Specifies the column storage clause that is storage clause inserted into the default CREATE TABLE statement. It is useful mainly for elements that get mapped to tables , namely top-level element declarations and out-of-line element declarations. tableProps Any valid table NULL Specifies the TABLE storage clause that is storage clause appended to the default CREATE TABLE statement. This is meaningful mainly for global and out-of-line elements. defaultTable Any table name Based on element Specifies the name of the table into which name. XML instances of this schema should be stored. This is most useful in cases when the XML is being inserted from APIs where table name is not specified, for example, FTP and HTTP. beanClassname Any Java class name Generated from Can be used within element declarations. element name. If the element is based on a global complexType, this name must be identical to the beanClassname value within the complexType declaration. If a name is specified by the user, the bean generation will generate a bean class with this name instead of generating a name from the element name.
JavaClassname Any Java class name None Used to specify the name of a Java class that is derived from the corresponding bean class to ensure that an object of this class is instantiated during bean access. If a JavaClassname is not specified, Oracle XML DB will instantiate an object of the bean class directly.
Object-Relational Mapping of XMLType 5-27 Using SQLName and SQLType Attributes to Specify SQL Object Type Names Before Registering XML Schema
Table 5-3 Attributes You Can Specify in Elements Declaring Global complexTypes
Attribute Values Default Description
SQLType Any SQL type name Name generated from Specifies the name of the SQL type element name corresponding to this XML element declaration
SQLSchema Any SQL usemame User registering XML Name of database user owning the type schema specified by SQLType beanClassname Any Java class name Generated from Can be used within element declarations element name If the element is based on a global complexType, this name must be identical to the beanClassname value within the complexType declaration If a name is specified by the user, the bean generation will generate a bean class with this name, instead of generating a name from the element name maintainDOM true I false true If true, instances of this element are stored such that they retain DOM fidelity on output This implies that all comments, processmg instructions, namespace declarations, and so on, are retained in addition to the ordering of elements If false, the output need not be guaranteed to have the same DOM behavior as the mput
Table 5-4 Attributes You Can Specify in XML Schema Declarations
Attribute Values Default Description mapUnboundedStπngToLob true | false false If true, unbounded strings are mapped to CLOB by default Similarly, unbounded binary data gets mapped to BLOB, by default If false, unbounded strings are mapped to VARCHAR2(4000) and unbounded binary components are mapped to RAW(2000) storeVarrayAsTabie true I false false If true, the VARRAY is stored as a table (OCT) If false, the VARRAY is stored in a LOB
5-28 Oracle9/ XML Database Developer's Guide - Oracle XML DB Using SQLName and SQLType Attributes to Specify SQL Object Type Names Before Registering XML Schema
ing Is Specified in the XML Schema During Registration
Information regarding the SQL mapping is stored in the XML schema document.
The registration process generates the SQL types, and adds annotations to the XML schema document to store the mapping information. Annotations are in the form of new attributes.
Example 5-14 Capturing SQL Mapping Using SQLType and SQLName Attributes
— The following XML schema definition shows how SQL mapping information
— is captured using SQLType and SQLName attributes: declare doc varchar2(3000) := '<schema targetNamespace="http://ww .oracle.co /PO.xsd" xmlns :po="http: //www.oracle.com/PO.xsd" xmlns :xdb="http: //xmlns.oracle.com/xdb" xmlns="http: //www.w3.org/2001/XMLSchema"> <cαmplexType name="PurchaseOrderType"> <sequence> <element name="PONum" type="decimal" xdb:SQ Name="PONUM" xdb:SQLType="NUMBER"/>
<element name="Company" xdb:SQLName="COMPANY" xdb:SQLType="VARCHAR2"> <sitrpleType restriction base="string">
<maxLength value="100"/> </restriction> </simpleType> </element>
<element name="Item" xdb:SQLNanB="ITEM" xdb:SQLType="ITEM_T" maxOccurs="1000"> <coπplexType> <sequence> <element name="Part" xdb:SQIJName="PART" xdb:SQLType="VARCHAR2"> <siιηpleType> <restriction base="string">
<maxLength value="1000"/> </restriction </siπpleType> </element>
<element name="Price" type="float" xdb:SQLNams=" RICE" xdb:SQLType="NUMBER" /> </sequence> </cσmplexType> </elertent>
Object-Relational Mapping of XMLType 5-29 Using SQLName and SQLType Attributes to Specify SQL Object Type Names Before Registering XML Schema
</sequence> < /cαπplexType>
<elemsnt
Figure imgf000069_0001
: PurchaseOrderType" /> </scherra>' ; begin dbππs_xmlschema .registerScheπa ( ' ttp: //www. oracle . com/PO. xsd' , doc) ; end;
Figure 4 shows how Oracle XML DB creates XML schema-based XMLType tables using an XML document and mapping specified in an XML schema. An XMLType table is first created and depending on how the storage is specified in the XML schema, the XMl document is mapped and stored either as a CLOB in one XMLType column, or stored object-relationaUy and spread out across several columns in the table.
-30 Oracle9/XML Database Developer's Guide - Oracle XML DB Using SQLName and SQLType Attributes to Specify SQL Object Type Names Before Registering XML Schema
An XMLType table is first created and depending on how the storage is specified in the XML schema, the XMl document is mapped and stored either as a CLOB in one XMLType column, or stored object-relationally and spread out across several columns in the table.
Object-Relational Mapping of XMLType 5-31 Mapping of Types Using DBMS_XMLSCHEMA
Mapping of Types Using DBMS_XMLSCHEMA
Use DBMS_XMLSCHEMA to set the mapping of type information for attributes and elements.
Setting Attribute Mapping Type Information
An attribute declaration can have its type specified in terms of one of the following:
■ Primitive type
■ Global s impl eType, declared within this XML schema or in an external XML schema
■ Reference to global attribute (ref = " . . "), declared within this XML schema or in an external XML schema
■ Local simpIeType
In all cases, the SQL type and associated information (length and precision) as well as the memory mapping information, are derived from the simpIeType on which the attribute is based.
Overriding SQL Types
You can explicitly specify an SQLType value in the input XML schema document. In this case, your specified type is validated. This allows for the following specific forms of overrides:
■ If the default type is a STRING, you can override it with any of the following: CHAR, VARCHAR, or CLOB.
■ If the default type is RAW, you can override it with RAW or BLOB.
Setting Element Mapping Type Information
An element declaration can specify its type in terms of one of the following:
■ Any of the ways for specifying type for an attribute declaration.
■ Global complexType, specified within this XML schema document or in an external XML schema.
■ Reference to a global element (ref = " . . . "), which could itself be within this XML schema document or in an external XML schema.
5-32 Oracle9/XML Database Developer's Guide - Oracle XML DB Mapping of Types Using DBMS_XMLSCHEMA
■ Local complexType.
Overriding SQL Type
An element based on a complexType is, by default, mapped to an object type containing attributes corresponding to each of the sub-elements and attributes. However, you can override this mapping by explicitly specifying a value for SQLType attribute in the input XML schema. The following values for SQLType are permitted in this case:
. VARCHAR2
■ RAW
. CLOB
. BLOB
These represent storage of the XML in a text or unexploded form in the database. The following special cases are handled:
■ If a cycle is detected, as part of processing the complexTypes used to declare elements and elements declared within the omplexType), the SQLInline attribute is forced to be "false" and the correct SQL mapping is set to REF
XMLTYPE.
■ If maxOccurs > 1, a VARRAY type may need to be created.
- If SQLInline = " true ", a varray type is created whose element type is the SQL type previously determined.
* Cardinality of the VARRAY is determined based on the value of maxOccurs attribute.
* The name of the VARRAY type is either explicitly specified by the user using SQLCollType attribute or obtained by mangling the element name.
- If SQLInline^ " false ", the SQL type is set to XDB . XDB$XMLTYPE_REF_ LIST_T, a predefined type representing an array of REFs to XMLType.
■ If the element is a global element, or if SQLInl ine= " false " , a default table needs to be created. It is added to the table creation context. The name of the default table has either been specified by the user, or derived by mangling the element name.
Object-Relational Mapping of XMLType 5-33 XML Schema: Mapping SimpleTypes to SQL
XML Schema: Mapping SimpleTypes to SQL
This section describes how XML schema definitions are used to map XML schema s impleType to SQL object types.
Table 5-5 through Table 5-8 list the defaidt mapping of XML schema simpIeType to SQL, as specified in the XML schema definition. For example:
■ An XML primitive type is mapped to the closest SQL datatype. For example, DECIMAL, POSmVEINTEGER, and FLOAT are all mapped to SQL NUMBER.
■ An XML enumeration type is mapped to an object type with a single RAW(n) attribute. The value of n is determined by the number of possible values in the enumeration declaration.
■ An XML list or a union datatype is mapped to a string (VARCHAR2/CLOB) datatype in SQL.
Table 5-5 Mapping XML String Datatypes to SQL
XML Length or Default Mapping Compatible Datatype
Primitive MaxLength
Type Facet string VARCHAR2(n) if n < 4000, CHAR,VARCHAR2, else VARCHAR2(4000) CLOB string VARCHAR2(4000) if CHAR, VARCHAR2, CLOB mapUnboundedStringToLo b="true", CLOB
Table 5-6 Mapping XML Binary Datatypes (hexBinary/base64Binary) to SQL
Length or
XML Primitive MaxLength Type Facet Default Mapping Compatible Datatypes hexBinary, n RAW(n) if n < 2000, else RAW(2000) RAW, BLOB base64Binary hexBinary, RAW(2000) if RAW, BLOB base64Binary mapUnboundedStringToLob="true",
BLOB
5-34 Oracle9/' XML Database Developer's Guide - Oracle XML DB XML Schema: Mapping SimpleTypes to SQL
Table 5-7 Default Mapping of Numeric XML Primitive Types to SQL
XML Simple Type Default , , ,„. ., , , , „ _. . . Compatible Datatypes Oracle totalDigits (m), fracttonDιgιts(n) DataType Specified float NUMBER NUMBER(m,n) NUMBER, FLOAT, DOUBLE double NUMBER NUMBER(m,n) NUMBER, FLOAT, DOUBLE decimal NUMBER NUMBER(m,n) NUMBER, FLOAT, DOUBLE integer NUMBER NUMBER(m,n) NUMBER, FLOAT, DOUBLE nonNegativelnteger NUMBER NUMBER(m,n) NUMBER, FLOAT, DOUBLE positivelnteger NUMBER NUMBER(m,n) NUMBER, FLOAT, DOUBLE nonPositivelnteger NUMBER NUMBER(m,n) NUMBER, FLOAT, DOUBLE negativelnteger NUMBER NUMBER(m,n) NUMBER, FLOAT, DOUBLE long NUMBER(20; ) NUMBER(m,n) NUMBER, FLOAT, DOUBLE unsignedLong NUMBER(20; ) NUMBER(m,n) NUMBER, FLOAT, DOUBLE int NUMBER(10; ) NUMBER(m,n) NUMBER, FLOAT, DOUBLE unsignedlnt NUMBER(10; ) NUMBER(m,n) NUMBER, FLOAT, DOUBLE short NUMBER(5) NUMBER(m,n) NUMBER, FLOAT, DOUBLE unsignedShort NUMBER(5) NUMBER(m,n) NUMBER, FLOAT, DOUBLE byte NUMBER(3) NUMBER(m,n) NUMBER, FLOAT, DOUBLE unsignedByte NUMBER(3) NUMBER(m,n) NUMBER, FLOAT, DOUBLE
Table 5-8 Mapping XML Date Datatypes to SQL
XML Primitive Type Default Mapping Compatible Datatypes datetime TIMESTAMP DATE time TIMESTAMP DATE date DATE DATE gDay DATE DATE gMonth DATE DATE gYear DATE DATE
Object-Relational Mapping of XMLType 5-35 XML Schema: Mapping ! SimpleTypes to SQL
Table 5-8 Mapping XML Date Datatypes to SQL (Cont.)
XML Primitive Type Default Mapping Compatible Datatypes gYearMonth DATE DATE gMonthDay DATE DATE duration VARCHAR2(4000) none
Table 5-9 Default Mapping of Other XML Primitive Datatypes to SQL
XML Simple Type Default Oracle DataType Compatible Datatypes boolean RAW(l) VARCHAR2
Language(string) VARCHAR2(4000) CLOB, CHAR
NMTOKEN(string) VARCHAR2(4000) CLOB, CHAR
NMTOKENS(string) VARCHAR2(4000) CLOB, CHAR
Name(string) VARCHAR2(4000) CLOB, CHAR
NCName(string) VARCHAR2(4000) CLOB, CHAR
ID VARCHAR2(4000) CLOB, CHAR
IDREF VARCHAR2(4000) CLOB, CHAR
IDREFS VARCHAR2(4000) CLOB, CHAR
ENTITY VARCHAR2(4000) CLOB, CHAR
ENTITIES VARCHAR2(4000) CLOB, CHAR
NOTATION VARCHAR2(4000) CLOB, CHAR anyURI VARCHAR2(4000) CLOB, CHAR anyType VARCHAR2(4000) CLOB, CHAR anySimpleType VARCHAR2(4000) CLOB, CHAR
QName XDB.XDB$QNAME -
simpIeType: Mapping XML Strings to SQL VARCHAR2 Versus CLOBs
If the XML schema specifies the datatype to be string with a maxLength value of less than 4000, it is mapped to a VARCHAR2 attribute of the specified length. However, if maxLength is not specified in the XML schema, it can only be mapped to a LOB. This is sub-optimal when most of the string values are small and only a small fraction of them are large enough to need a LOB. See Figure 5.
5-36 Oracle9/ XML Database Developer's Guide - Oracle XML DB XML Schema: Mapping ComplexTypes to SQL
Figure 5-3 Oracle XML DB: Mapping XML Strings to SQL VARCHAR2 or CLOBs
XML Schema: Mapping ComplexTypes to SQL
Using XML schema, a complexType is mapped to an SQL object type as follows:
■ XML attributes declared within the complexType are mapped to object attributes. The simpIeType defining the XML attribute determines the SQL datatype of the corresponding attribute.
■ XML elements declared within the complexType are also mapped to object attributes. The datatype of the object attribute is determined by the simpIeType or complexType defining the XML element.
If the XML element is declared with attribute maxOccurs > 1, it is mapped to a collection attribute in SQL. The collection could be a VARRAY (default) or nested table if the maintainOrder attribute is set to false. Further, the default storage of the VARRAY is in Ordered Collections in Tables (OCTs) instead of LOBs. You can choose LOB storage by setting the s oreAsLob attribute to true.
See Also: "Ordered Collections in Tables (OCTs)" on page 5-70
Object-Relational Mapping of XMLType 5-37 XML Schema: Mapping ComplexTypes to SQL
Mapping complexType to SQL: Setting the SQLInLine Attribute to FALSE for Out-of-Line Storage
By default, a sub-element is mapped to an embedded object attribute. However, there may be scenarios where out-of-line storage offers better performance. In such cases the SQLInline attribute can be set to false, and Oracle XML DB generates an object type with an embedded REF attribute. REF points to another instance of XMLType that corresponds to the XML fragment that gets stored out-of-line. Default XMLType tables are also created to store the out-of-line fragments.
Figure 6 illustrates the mapping of a complexType to SQL for out-of-line storage.
Example 5-15 Oracle XML DB XML Schema: complexType Mapping - Setting SQLInLine Attribute to False for Out-of-Line Storage
— Attribute to False for Out-of-Line Storage
-- In this exairple element Addr's attribute, xdb:SQLInLine, is set to false.
— The resulting object type 0BJ_T2 has a column of type XMLType with an embedded
-- REF attribute. The REF attribute points to another XMLType instance created of
— object type 0E_T1 in table Addr_tab. Addr_tab has columns Street and City. The latter
-38 Oracle9/'XML Database Developer's Guide - Oracle XML DB XML Schema: Mapping ComplexTypes to SQL
— XMLType instance is stored out-of-line. declare doc varchar2 (3000) := '<schema xmlns="http: //www.w3.org/2001/XMLSchema" targetNamespace="http: //www.oracle.com/em .xsd" xmlns :erπp="htt : //www.oracle.com/em .xsd" xmlns :xdb="http: //xmlns.oracle.com/xdb">
<complexType name = "Employee" xdb:SQLType="OBJ_T2"> <sequence>
<element name = "Name" type = "string"/> <element name = "Age" type = "deciπal"/> <elemsnt name = "Addr" xdb:SQLInline = "false"> <cαrtplexType xdb:SQLTyps="OBJ_Tl"> <sequence>
<element name = "Street" type = "string"/> <elenπent name = "City" type = "string" /> </sequence> </complexType> </element> </sequence> </complexType> </scherta>' ; begin dtms_xmlscherta.registerSchema('http: //www.oracle.com/PO.xsd' , doc) ; end;
— On registering this XML schema, Oracle XML DB generates the following types and XMLType tables:
CREATE TYPE 0BJ_T1 AS OBJECT (
SYS_XDBPD$ XDB.XDB$RAW_LIST_T,
Street VARCHAR2 (4000) ,
City VARCHAR2(4000) );
CREATE TYPE 0BJ_T2 AS OBJECT (
SYS_XDBPD$ XDB.XDB$RAW_LIST_T,
Name VARCHAR2 (4000) ,
Age NUMBER,
Addr REF XMLType
Object-Relational Mapping of XMLType 5-39 XML Schema: Mapping ComplexTypes to SQL
Mapping complexType to SQL: Mapping XML Fragments to Large Objects (LOBs)
You can specify the SQLType for a complex element as a Character Large Object (CLOB) or Binary Large Object (BLOB). Here the entire XML fragment is stored in a LOB attribute. This is useful when parts of the XML document are seldom queried but are mostly retrieved and stored as single pieces. By storing XML fragments as LOBs, you can save on parsing/decomposition/recomposition overheads.
Example 5-16 Oracle XML DB XML Schema: complexType Mapping XML Fragments to LOBs
— In the following exairple, the XML schema specifies that the XML fragment's element
--- Addr is using the attribute SQLType="CLOB" : declare doc varchar2(3000) := '<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="htt : //ww .oracle.com/em .xsd" xmlns :erπp="http: //ww .oracle.com/em .xsd" xmlns :xdb="http://xmlns .oracle.com/xdb">
<corrplexType name = "Qηployee" xdb:SQLType="OBJ_T2"> <sequence>
<element name = "Name" type = "string"/> <element name = "Age" type = "decimal"/> <element name = "Addr" xdb:SQLType = "CLOB"> <coπplexType > <sequence>
<element name = "Street" type = "string"/> <element name = "City" type = "string"/> </sequence> </cαπplexType> </element> </sequence> </complexType> </schema>' ; begin dbtιs_jσnlschema.registerSchema('http: //www.oracle.com/PO.xsd', doc) ; end;
— On registering this XML schema, Oracle XML DB generates the following types and XMLType tables:
CREATE TYPE 0BJ_T AS OBJECT (
SYS_XDBPD$ XDB.XDB$RA_LIST_T,
Name VARCHAR2 (4000) ,
Age NUMBER,
-40 Oracleθ; XML Database Developer's Guide - Oracle XML DB Oracle XML DB complexType Extensions and Restrictions
Addr CLOB
Figure 7 Mapping complexType XML Fragments to Character Large Objects (CLOBs)
Oracle XML DB complexType Extensions and Restrictions
In XML schema, complexTypes are declared based on complexContent and simpleContent.
■ simpleContent is declared as an extension of simpIeType.
■ complexContent is declared as one of the following: - Base type complexType extension complexType restriction.
complexType Declarations in XML Schema: Handling Inheritance
For complexType, Oracle XML DB handles inheritance in the XML schema as follows:
■ For complexTypes declared to extend other complexTypes, the SQL type corresponding to the base type is specified as the supertype for the current SQL type. Only the additional attributes and elements declared in the sub-complextype are added as attributes to the sub-object-type.
Object-Relational Mapping of XMLType 5-41 Oracle XML DB complexType Extensions and Restrictions
■ For complexTypes declared to restrict other complexTypes, the SQL type for the sub-complex type is set to be the same as the SQL type for its base type. This is because SQL does not support restriction of object types through the inheritance mechanism. Any constraints are imposed by the restriction in XML schema.
Example 5-17 Inheritance in XML Schema: complexContent as an Extension of complexTypes
— Consider an XML schema that defines a base complexType "Address" and two extensions
— "USAddress" and "IntlAddress" . declare doc varchar2(3000) := '<xs:schema xmlns :xs="http: //www.w3.org/2001/XMLSchema" xmlns :xdb="http://xmlns .oracle.com/xdb"> <xs :corrplexType name="Address" xdb:SQLType="ADDR_T"> <xs :sequence>
<xs :element name="street" type="xs:string"/> <xs:element name="city" type="xs:string"/> </xs :sequence> </xs :cαmplexType>
<xs:cαπplexType name="USAddress" xdb:SQLType="UΞADDR_T"> <xs :complexContent> <xs :extension base="Address"> <xs : sequence>
<xs:element name="zip" type="xs: string"/> </xs :sequence> </xs:extension> </xs :coπplexContent> </xs:coπplexType>
<xs:cαπplexTYPe
Figure imgf000081_0001
<xs :cortplexContent> <xs:extension base="Address"> <xs :sequence>
<xs:element name="country" type="xs:string"/> </xs:sequence> </xs :extension> </xs:complexContent> </xs :cαmplexType> </xs:schema>' ; begin dπιs_xmlschema.registerSchema( 'http://www.oracle.com/PO.xsd' , doc) ;
-42 Oracleθ XML Database Developer's Guide - Oracle XML DB Oracle XML DB complexType Extensions and Restrictions
end;
~ Note: Type INILADDR_T is created as a final type because the
— corresponding complexType specifies the "final" attribute.
— By default, all complexTypes can be extended and restricted by
— other types, and hence, all SQL object types are created as not
— final types . create type ADDR_T as ob ect (
SYΞ_XDBPD$ XDB.XDB$RA _LIST_T,
"street" varchar2 (4000) ,
"city" varchar2 (4000) ) not final; create type USADDR_T under ADDR_T (
"zip" varchar2 (4000) ) not final; create type INTLADDR T under ADDR_T (
"country" varchar2 (4000) ) final;
Example 5-18 Inheritance in XML Schema: Restrictions in complexTypes
— Consider an XML schema that defines a base complexType Address and a restricted
— type LocalAddress that prohibits the specification of country attribute , declare doc varchar2 (3000) : = ' <xs : schema xmlns :xs="http: //www. w3 . org/2001 /XMLSchema" xmlns : xdb= " htt : / /xmlns . oracle . com/xdb" > <xs :cortplexType name=" Address" xdb: SQLType="ADDR_T"> <xs : sequence>
<xs :elem≥nt name=" street" type="xs : string" /> <xs :element name="city" type="xs : string" /> <xs :element name="zip" type="xs : string" />
<xs :element name="country" type="xs : string" minOccurs="0" maxOccurs="l"/> </xs : sequence> </xs : coπplexType>
<xs :coπplexiype name=" LocalAddress" xdb:SQL'iype="USADDR_T"> <xs : corrplexContent> <xs restriction base="Address"> <xs : sequence>
<xs :element naπe="street" type="xs : string" />
Object-Relational Mapping of XMLType 5-43 Oracle XML DB complexType Extensions and Restrictions
<xs:element name="city" type="xs:string"/> <xs:element name="zip" type="xs: string"/> <xs:element name="country" type="xs: string" minOccurs="0" maxOccurs="0"/> </xs :sequence> </xs:restriction </xs:coπplexContent> </xs:cαrπplexType> </xs:schema>' ; begin dhms_xmlscherra.registerScherra( 'http://www.oracle.com/PO.xsd' , doc) ; end;
— Since inheritance support in SQL does not support a notion of restriction,
— the SQL type corresponding to the restricted complexType is a empty subtype
— of the parent object type.For the above XML schema, the following SQL types
— are generated: create type ADDR_T as object (
SYS_XDBPD$ XDB.XDB$RA_LIST_T,
"street" varchar2 (4000) ,
"city" varchar2 (4000) ,
"zip" varchar2 (4000) ,
"country" varchar2(4000) ) not final; create type USADDR_T under ADDR_T;
Mapping complexType: simpleContent to Object Types
A complexType based on a simpleContent declaration is mapped to an object type with attributes corresponding to the XML attributes and an extra SYS_ XDBBODY attribute corresponding to the body value. The datatype of the body attribute is based on simpIeType which defines the body's type.
Example 5-19 XML Schema complexType: Mapping complexType to simpleContent declare doc varchar2 (3000) : = ' <schema xmlns=" http: //www.w3 . org/2001/XMLSchema" targetNamespace="http: / /www. oracle .cam/ emp. sd" xmlns : emp= "http : / /www. oracle . com/emp .xsd" xmlns : xdb= "htt : / /xmlns . oracle . com/xdb " > <cαmplexType name="name" xdb:SQLType="OBJ_T"> <siπpleContent>
• restriction base = " string" > </restriction>
5-44 Oracle9/XML Database Developer's Guide - Oracle XML DB Oracle XML DB complexType Extensions and Restrictions
</suτpleContent> </coπplexType> </schema>' ; begin dtms_xmlschema .regιsterSchema ( 'http: //www. oracle.com/erp.xsd' , doc) ; end;
— On registering this XML schema, Oracle XML DB generates the following types and XMLType tables : create type OBJ T as object (
SYS_XDBPD$ xdb.xdb$raw_lιst_t,
SYS_XDBBODY$ VARCHAR2 (4000) ) ;
Mapping complexType: Any and AnyAttributes
Oracle XML DB maps the element declaration, any, and the attribute declaration, anyAttribute, to VARCHAR2 attributes (or optionally to Large Objects (LOBs)) in the created object type. The object attribute stores the text of the XML fragment that matches the any declaration.
■ The namespace attribute can be used to restrict the contents so that they belong to a specified namespace.
■ The processContents attribute withm the any element declaration, indicates the level of validation required for the contents matching the any declaration.
Example 5-20 Oracle XML DB XML Schema: Mapping complexType to Any/AnyAttributes
— This XML schema exairple declares an any element and maps it to the column
— SYS_XDBANY$, ιn object type OBJJT. This element also declares that the
— attribute, processContents , skips validating contents that natch the any
— declaration, declare doc varchar2 (3000) : = ' <schema xmlns="http: //www w3.org/2001/XMLSchema" targetNamespace= "http : / /www . oracle . com/an . xsd" xmlns : eπp= "http : / /www . oracle . com/an . xsd" xmlns :xdb="http: //xmlns .oracle.com/xdb"> <cαπplexType name = "Etiployee" xdb: SQLType="0BJ_T"> <sequence>
<element name = "Name" type = "string" />
<element name = "Age" type = "decimal " />
<any namespace = "http: //www/w3 .org/2001/xhtml" processContents = "skιp" />
Object-Relational Mapping of XMLType 5-45 Oracle XML DB complexType Extensions and Restrictions
</seguence> </cαmplexType> </schema>' ; begin dbms_xmlschema.registerSchema ( 'http: //www. oracle .com/eπp. xsd' , doc) ; end;
— It results in the following statement : CREATE TYPE OBJ_T AS OBJECT
(
SYS_XDBPD$ xdb.xdb$raw_list_t,
Name VARCHAR2 (4000) ,
Age NUMBER,
SYS_XDBANY$ VARCHAR2(4000) );
Handling Cycling Between complexTypes in XML Schema
Cycles in the XML schema are broken while generating the object types, because object types do not allow cycles, by introducing a REF attribute at the point at which the cycle gets completed. Thus part of the data is stored out-of-line yet still belongs to the parent XML document when it is retrieved.
Example 5-21 XML Schema: Cycling Between complexTypes
XML schemas permit cycling between definitions of complexTypes. Figure 5-6 shows this example, where the definition of complexType CT1 can reference another complexType CT2, whereas the definition of CT2 references the first type CT1.
— XML schemas permit cycling between definitions of corrplexTypes.'This is an example of cycle of length 2 : declare doc varchar2 (3000) : = ' <xs : schema xmlns :xs=" http: //www. w3 .org/2001/XMLSchena" xmlns :xdb= "http: //xmlns .oracle.com/xdb"> <xs : complexType name="CTl" xdb: SQLType="CTl"> <xs : sequence>
<xs :element name="el" type="xs : string" /> <xs : element name="e2 " type="CT2 " /> </xs : sequence> </xs : complexType>
<xs : complexType name="CT2" xdb:SQLType="CT2 "> <xs : sequence>
<xs : element name="el" type="xs : string" />
-46 Oracleθ/' XML Database Developer's Guide - Oracle XML DB Oracle XML DB complexType Extensions and Restrictions
<xs :element naιre="e2" type="CTl"/> </xs :sequence> </xs : coπplexType> </xs : schema>' ; begin dbms_xmlscheι .registerSchema ( 'http: //www. oracle . com/eπp. xsd' , doc) ; end;
SQL types do not allow cycles in type definitions. However, they support weak cycles, that is, cycles involving REF (references) attributes. Therefore, cyclic XML schema definitions are mapped to SQL object types such that any cycles are avoided by forcing SQLlnline= " false" at the appropriate poin. This creates a weak cycle.
— For the preceding XML schem, the following SQL types are generated : create type CT1 as object
(
SYS_XDBPD$ xdb.xdb$raw_list_t,
"el" varchar2(4000),
"e2" ref xmltype; ) not final; create type CT2 as object (
SYS_XDBPD$ xdb.xdb$raw_list_t,
"el" varchar2 (4000) ,
"e2 " CTl ) not final;
Figure 8 Cross Referencing Between Different complexTypes in the Same XML Schema
Object-Relational Mapping of XMLType 5-47 Oracle XML DB complexType Extensions and Restrictions
Example 5-22 XML Schema: Cycling Between complexTypes, Self-Referencing
— Another exartple of a cyclic complexType involves the declaration of the
— complexType having a reference to itself . The following is an
— exairple of type <SectionT> that references itself : declare doc varchar2(3000) := '<xs:schema xmlns:xs="http: //www.w3.org/2001/XMLSchema" xmlns:xdb="http: //xmlns .oracle.com/xdb">
<xs:complexType name="SectionT" xdb:SQLType="SECTION_T"> <xs:sequence>
<xs:element name="title" type="xs: string"/> <xs:choice maxOccurs="unbounded">
<xs:element naιre="boαy" type="xs:string" xdb:SQLCollType="BODY_COLL"/> <xs:element name="section" type="SectionT"/> </xs:choice> </xs :sequence> </xs :complexType> </xs:schema>' ; begin dfaτιs_xmlschema.registerSche a( 'http: //www.oracle.com/section.xsd' , doc) ; end;
— The following SQL types are generated.
— Note: The section attribute is declared as a varray of REFs to XMLType
— instances. Since there can be more than one occurrence of embedded sections,
— the attribute is a VARRAY. And it's a VARRAY of REFs to XMLTypes in order to
— avoid forming a cycle of SQL objects. create type B0DY_C0LL as varray(32767) of VARCHAR2(4000) ; create type SECTIONT as object (
SYS_XDBPD$ xdb.xdb$raw_list_t,
"title" varchar2(4000) ,
"body" BODY_COLL,
"section" XDB.XDB$REF_LIST_T ) not final;
Further Guidelines for Creating XML Schema-Based XML Tables
Assume that your XML schema, identified by "http://www.oracle.com/PO.xsd", has been registered. An XMLType table, myPOs, can then be created to store instances conforming to element, PurchaseOrder, of this XML schema, in an object-relational format as follows:
CREATE TABLE MyPOs OF XMLTYPE
-48 0racle9/XML Database Developer's Guide - Oracle XML DB Further Guidelines for Creating XML Schema-Based XML Tables
ELEMENT " http : / /www . oracle . com/PO . xsd# PurchaseOrder " ;
Figure 9 illustrates schematically how a complexTypes can reference or cycle itself.
Figure 9 complexType Self Referencing Within an XML Schema
Further Guidelines for Creating XML Schema-Based XML Tables
Assume that your XML schema, identified by
"http : / /www. oracle . com/PO . xsd", has been registered. An XMLType table, myPOs, can then be created to store instances conforming to element, PurchaseOrder, of this XML schema, in an object-relational format as follows:
CREATE TABLE MyPOs OF XMLTYPE
ELEMENT "http : //www . oracle . com/PO . sd#PurchaseOder " ;
Hidden columns are created. These correspond to the object type to which the PurchaseOrder element has been mapped. In addition, an XMLExtra object column is created to store the top-level instance data such as namespace declarations.
Object-Relational Mapping of XMLType 5-49 Further Guidelines for Creating XML Schema-Based XML Tables
Note: XMLDATA is a pseudo-attribute of XMLType that enables
Specifying Storage Clauses in XMLType CREATE TABLE Statements
To specify storage, the imderlying columns can be referenced in the XMLType storage clauses using either Object or XML notation:
■ Object notation: XMLDATA. <attrl> . <attr2> . . . . For example:
CREATE TABLE MyPOs OF XMLTYPE
ELEMENT "http: //www.oracle.eom/PO.xsd#PurchaseOrder" lob (xmldata. lobattr) STORE AS (tablespace . . . ) ;
■ XML notation: extractValue f ml typecol , ' /attrl/attr2 ' ) For example:
CREATE TABLE MyPOs OF XMLTYPE
ELEMENT "http: //www.oracle.com/PO.xsd#PurchaseOrder" lob (ExtractValue (MyPOs, '/lobattr')) STORE AS (tablespace ...);
Referencing XMLType Columns Using CREATE INDEX
As shown in the preceding examples, columns underlying an XMLType column can be referenced using either an object or XML notation in the CREATE TABLE statements. The same is true in CREATE INDEX statements:
CREATE INDEX ponum_idx ON MyPOs (xmldata . onum) ;
CREATE INDEX ponum_idx ON MyPOs p (ExtractValue (p, ' /ponum' ) ;
Specifying Constraints on XMLType Columns
Constraints can also be specified for imderlying XMLType columns, using either the object or XML notation:
■ Object notation
CREATE TABLE MyPOs OF XMLTYPE
ELEMENT " http : / /www . oracle . com/ PO . xsd#PurchaseOrder "
(unique (xmldata . ponum) ) ;
-50 Oracle9/XML Database Developer's Guide - Oracle XML DB Query Rewrite with XML Schema-Based Object-Relational Storage
■ XML notation
CREATE TABLE MyPOs P OF XMLTYPE
ELEMENT
"http://www.oracle.eom/PO.xsd#PurchaseOrder" (unique (ExtractValue (p, '/ponum' )
);
Inserting New Instances into XMLType Columns
New instances can be inserted into an XMLType columns as follows:
INSERT INTO MyPOs VALUES
(xmltype . createxml ( ' <PurchaseOrder> </ PurchaseOrder > ' ) ) ;
Query Rewrite with XML Schema-Based Object-Relational Storage
What is Query Rewrite?
When the XMLType is stored in structured storage (object-relationally) using an XML schema and queries using XPath are used, they are rewritten to go directly to the imderlying object-relational columns. This enables the use of BTree or other indexes, if present on the column, to be used in query evaluation by the Optimizer. This query rewrite mechanism is used for XPath's in SQL functions such as existsNode ( ) , extrac ( ) , extractValue ( ) , and updateXML ( ) . This enables the XPath to be evaluated against the XML document without having to ever construct the XML document in memory.
Example 5-23 Query Rewrite
For example a query such as:
SELECT VALUE (p) FRCM MyPOs p
WHERE extractValue (value (p) , ' /PurchaseOrder /Company' ) = 'Oracle ' ; is trying to get the value of the Company element and compare it with the literal 'Oracle'. Since the MyPOs table has been created with XML schema-based object-relational storage, the extractValue operator gets rewritten to the underlying relational column which stores the company information for the purchaseorder.
Thus the preceding query is rewritten to the following:
SELECT VALUE(p) FRCM MyPOs p
Object-Relational Mapping of XMLType 5-51 Query Rewrite with XML Schema-Based Object-Relational Storage
WHERE p. mldata . company = ' Oracle '
If there was a regular index created on the Company column, such as:
CREATE INDEX cσπpany_index ON MyPos e
(extractvalue (value (e) , ' /PurchaseOrder/Coπpany' ) ) ; then the preceding query woidd use the index for its evaluation.
When Does Query Rewrite Occur?
Query rewrite happens for the following SQL functions,
■ extract ( )
■ existsNode ( )
■ extractValue
■ updateXML
The rewrite happens for these SQL functions which may be present in any expression in a query, DML, or DDL statements. For example, you can use the extractValue ( ) to create indexes on the underlying relational columns.
Example 5-24 SELECT Statement and Query Rewrites
— This example gets the existing purchase orders
SELECT EXTRACTVALUE (value (x) , ' /PurchaseOrder/Coπpany ' ) FRCM MYPOs x WHERE EXISTSNODE (value (x) , ' /PurchaseOrder/Item[l] /Part' ) = 1;
Here are some examples of statements that get rewritten to use the imderlying columns:
Example 5-25 DML Statement and Query Rewrites
— This exaπple deletes all purchaseorders where the coirpany is not Oracle :
DELETE FROM MYPOs x WHERE EXTRACTVALUE (value (x) , ' /PurchaseOrder /Cαπpany' ) = 'Oracle Corp' ;
5-52 Oracleθ/ XML Database Developer's Guide - Oracle XML DB Query Rewrite with XML Schema-Based Object-Relational Storage
Example 5-26 CREATE INDEX Statement and Query Rewrites
— This exairple creates an index on the Coirpany column - since this is stored
— object relationally and the query rewrite happens, a regular index on the
— underlying relational column will be created:
CREATE INDEX coπpany_index ON MyPos e
(extract alue (value (e) , ' /PurchaseOrder /Coirpany' ) ) ;
In this case, if the rewrite of the SQL fimctions results in a simple relational column, then the index is turned into a BTree or a domain index on the column, rather than a function-based index.
What XPath Expressions are Rewritten?
XPath involving simple expressions with no wild cards or descendant axes get rewritten. The XPath may select an element or an attribute node. Predicates are supported and get rewritten into SQL predicates.
Table 5-10 lists the kinds of XPath expressions that can be translated into underlying SQL queries in this release.
Table 5-10 Supported XPath Expressions For Translation to Underlying SQL Queries XPath Expression for Translation Description
Simple XPath expressions: Involves traversals over object type attributes only, where the attributes
/PurchaseOrder/@PurchaseDate are simple scalar or object types themselves. The only axes supported are the child and the attribute axes.
/PurchaseOrder/Company
Collection traversal expressions: Involves traversal of collection expressions. The only axes supported are / PurchaseOrder / 1 tern /Part child and attribute axes. Collection traversal is not supported if the SQL operator is used during CREATE INDEX or updateXML ( ) .
Predicates: Predicates in the XPath are rewritten into SQL predicates. Predicates are not rewritten for updateXML ( ) [Company="Oracle"]
List indexe: Indexes are rewritten to access the n'th item in a collection. These are lineitem[l] not rewritten for updateXML ( ) .
Unsupported XPath Constructs The following XPath constructs do not get rewritten:
■ XPath Functions
■ XPath Variable references
Object-Relational Mapping of XMLType 5-53 Query Rewrite with XML Schema-Based Object-Relational Storage
■ All axis other than child and attribute axis
■ Wild card and descendant expressions
■ UNION operations
Unsupported XMLSchema Constructs The following XML Schema constructs are not supported. This means that if the XPath expression includes nodes with the following XML Schema construct then the entire expression will not get rewritten:
■ XPath expressions accessing children of elements containing open content, namely any content. When nodes contain any content, then the expression cannot be rewritten, except when the any targets a namespace other than the namespace specified in the XPath. any attributes are handled in a similar way.
■ CLOB storage. If the XML schema maps part of the element definitions to an SQL CLOB, then XPath expressions traversing such elements are not supported.
■ Enumeration types.
■ Substitutable elements.
Non-default mapping of scalar types. For example, number types mapped to native storage, such as native integers, and so on.
■ Child access for inherited complexTypes where the child is not a member of the declared complexType.
For example, consider the case where we have a address complexType which has a street element. We can have a derived type called shipAddr which contains shipmentNumber element. If the PurchaseOrder had an address element of type address, then an XPath like " /PurchaseOrder/address/ street " would get rewritten whereas " / PurchaseOrder/address / shipmentNumber " would not.
■ Non-coercible datatype operations, such as a boolean added with a number.
How are the XPaths Rewritten?
The following sections use the same purchaseorder schema explained earlier in the chapter to explain how functions get rewritten.
Example 5-27 Rewrting XPaths During Object Type Generation
— Consider the following purchaseorder schema: declare
5-54 Oracle9/XML Database Developer's Guide - Oracle XML DB Query Rewrite with XML Schema-Based Object-Relational Storage
doc varchar2(1000) := '<schema targetNaιrespace="http: //ww .oracle.com/PO■xsd" xmlns :po="http: //www.oracle .com/PO.xsd" xmlns="http: //www.w3.org/2001/XMLSchema" elementForrriDefault="qualified"> <coπplexType name="PurchaseOrderType"> <sequence> <element name="PONum" type="decimal"/> <element name="Ccπpany"> <sinpleτype> <restriction base="string">
-emaxLength value="100"/> </restriction </sirrpleiype> </element>
<element name="Item" maxOccurs="1000"> <complexType> <sequence> <element nane="Part"> <simpleType> <restriction base="string"> <maxLength value="1000"/> </restriction> </simpleType> </element>
<element name="Price" type="float"/> </sequence> </cαmplexType> </element> </sequence> </cαmplexType>
<element name="PurchaseOrder" type="po: PurchaseOrderType" /> </schema>' ; begin dlms_xmlschema.registerSchema( 'http://www.oracle.com/PO.xsd' , doc) ; end;
— A table is created conforming to this schema CREATE TABLE MyPOs OF XMLTYPE
ELEMENT "http: //www.oracle.com/PO.xsd#PurchaseOrder" ;
— The inserted XML document is partially validated against the schema before
— it is inserted. insert into MyPos values (xmltype ( ' <PurchaseOrder xmlns="http: //www. oracle. com/ PO.xsd"
Object-Relational Mapping of XMLType 5-55 Query Rewrite with XML Schema-Based Object-Relational Storage
xmlns : xs i =" http : / /ww . w3 . org/ 2001 /XMLSchema- ins tance " xsi : schemaLocation= "http : / /www . oracle . com/PO . xsd http: //www.oracle .com/PO .xsd"> <FONum>1001</PONuπt> <Corrpaπy>Oracle Corp</Company> <Item> <Part>9i Doc Set</Part> <Price>2550</Frice> </Item> <Item> <Part>8i Doc Set</Part> <Price>350</Price> </Item> </ PurchaseOrder >' ) ) ;
Since the XML schema did not specify anything about maintaining the ordering, the defaidt is to maintain the ordering and DOM fidelity. Hence the types have SYS_ XDBPD$ attribute to store the extra information needed to maintain the ordering of nodes and to capture extra items such as comments, processing instructions and so on.
The SYS_XDBPD$ attribute also maintains the existential information for the elements (that is, whether the element was present or not in the input document). This is needed for elements with scalar content, since they map to simple relational columns. In this case, both empty and missing scalar elements map to NULL values in the column and only the SYS_XDBPD$ attribute can help distinguish the two cases. The query rewrite mechanism takes into account the presence or absence of the SYS_XDBPD$ attribute and rewrites queries appropriately.
Assuming that this XML schema is registered with the schema URL: http: //www. oracle. com/PO. xsd you can create the po_tab table with that schema:
CREATE TABLE po_tab OF XMLTYPE
XMLSCHEMA "http: //www.oracle .com/PO.xsd" ELEMENT "PurchaseOrder" ;
Now, this table has a hidden XMLData column that is of type "PurchaseOrder T" which stores the actual data.
Rewriting XPath Expressions: Mapping Types and Issues
XPath expression mapping types and topics are described in the following sections: ■ "Mapping for Simple XPath"
5-56 Oracle9/XML Database Developer's Guide - Oracle XML DB Query Rewrite with XML Schema-Based Object-Relational Storage
"Mapping for Scalar Nodes" "Mapping of Predicates" "Mapping of Collection Predicates" "Document Ordering with Collection Traversals" "Collection Index" "Non-Satisfiable XPath Expressions" "Namespace Handling" "Date Format Conversions"
Mapping for Simple XPath A rewrite for a simple XPath involves accessing the attribute corresponding to the XPath expression. Table 5-11 lists the XPath map:
Table 5-11 Simple XPath Mapping for purchaseOrder XML Schema
XPath Expression Maps to
/PurchaseOrder column XMLData
/PurchaseOrder/® PurchaseDate column XMLData. urchaseDate"
/PurchaseOrder/PONum column XMLData.'PONum"
/PurchaseOrder/ltem elements of the collection XMLData.'ϊtem"
/PurchaseOrder/ltem/Part attirbute "Part" in the collection XMLData."ltem"
Mapping for Scalar Nodes An XPath expression can contain a text ( ) operator which maps to the scalar content in the XML document. When rewriting, this maps directly to the underlying relational columns.
For example, the XPath expression "/PurchaseOrder/PONu /text ( ) " maps to the SQL column XMLData. "PONum" directly.
A NULL value in the PONum column implies that the text value is not available, either because the text node was not present in the input document or the element itself was missing. This is more efficient than accessing the scalar element, since we do not need to check for the existence of the element in the SYS_XBDPD$ attribute.
For example, the XPath "/ PurchaseOrder/ PONum" also maps to the SQL attribute XMLData . " PONum",
Object-Relational Mapping of XMLType 5-57 Query Rewrite with XML Schema-Based Object-Relational Storage
However,in this case, query reqrite also has to check for the existence of the element itself, using the SYS_XDBPD$ in the XMLData column.
Mapping of Predicates Predicates are mapped to SQL predicate expressions.
Example 5-28 Maping Predicates
— For example the predicate in the XPath expression:
/PurchaseOrder[PONum=1001 and Coirpany = "Oracle Corp"]
— maps to the SQL predicate:
( XMLData. "PONum" = 20 and XMLData. "Company" = "Oracle Corp")
— For example, the following query will get rewritten to the object-relational
— equivalent, and will not require Functional evaluation of the XPath. select extract (value (p) , ' /PurchaseOrder/Item' ) .getClobvalf) from mypos p where existsNode (value (p) , ' /PurchaseOrder [PONum=1001 and Coirpany = "Oracle Corp" ] ' ) =1;
Mapping of Collection Predicates XPath expressions may involve relational operators with collection expressions. In Xpath 1.0, conditions involving collections are existential checks. In other words, even if one member of the collection satisfies the condition, the expression is true.
Example 5-29 Mapping Collection Predicates
— For example the collection predicate in the XPath: /PurchaseOrder[Items/Price > 200]
— maps to a SQL collection egression: EXISTS ( SELECT null
FRCM TABLE (XMLDATA."Item" ) x WHERE x. "Price" > 200 )
— For exairple, the following query will get rewritten to the object-relational
— equivalent . select extract (value (p) , ' /PurchaseOrder/Item' ) .getClobval ( ) from mypos p where existsNode (value (p) , ' /PurchaseOrder [Item/Price > 400] ' ) = 1;
More complicated rewrites occur when you have a collection <condition> collection. In this case, if at least one combination of nodes from these two collection arguments satisfy the condition, then the predicate is deemed to be satisfied.
5-58 Oracleθ/ XML Database Developer's Guide - Oracle XML DB Query Rewrite with XML Schema-Based Object-Relational Storage
Example 5-30 Mapping Collection Predicates, Using existsNodeQ
— For exairple, consider a fictitious XPath which checks to see if a
— Purchaseorder has Items such that the price of an item is the same as
— same part number:
/PurchaseOrder[Items/Price = Items/Part]
— naps to a SQL collection expression: EXISTS ( SELECT null
FROM TABLE (XMLDATA. "Item") x WHERE EXISTS ( SELECT null
FRCM TABLE(XMLDATA. "Item") y
WHERE y."Part" = x. "Price"))
— For example, the following query will get rewritten to the object-relational
— equivalent . select extract (value (p) , ' /PurchaseOrder/Item' ) . getclobval ( ) from mypos p where existsNode (value (p) , ' /PurchaseOrder [Item/Price = Item/Part] ' ) = 1;
Document Ordering with Collection Traversals Most of the rewrite preserves the original document ordering. However, since the SQL system does not guarantee ordering on the results of subqueries, when selecting elements from a collection using the extract ( ) function, the resultant nodes may not be in document order.
Example 5-31 Document Ordering with Collection Traversals
— For example :
SELECT extract (value (p) , ' /PurchaseQrder/Item[Price>2100] /Part' ) FROM ypos p;
— gets rewritten to use subqueries as shown below: SELECT (SELECT XMLAgg( XMLForest(x. "Part" AS "Part"))
FROM TABLE (XMLData. "Item" ) x WHERE x. "Price" > 2100 ) FROM po_tab p;
Though in most cases, the resiύt of the aggregation would be in the same order as the collection elements, this is not guaranteed and hence the results may not be in document order. This is a limitation that may be fixed in future releases.
Collection Index An XPath expression can also access a particular index of a collection For example, " /PurchaseOrder/ Item [ l ] /Part" is rewritten to extract out the first Item of the collection and then access the Part attribute within that.
Object-Relational Mapping of XMLType 5-59 Query Rewrite with XML Schema-Based Object-Relational Storage
If the collection has been stored as a VARRAY, then this operation retrieves the nodes in the same order as present in the original document. If the mapping of the collection is to a nested table, then the order is undetermined. If the VARRAY is stored as an Ordered Collection Table (OCT) , (the default for the tables created by the schema compiler, if s oreVarrayAsTable= " true " is set), then this collection index access is optimized to use the IOT index present on the VARRAY.
Non-Satisfiable XPath Expressions An XPath expression can contain references to nodes that cannot be present in the input document. Such parts of the expression map to SQL NULLs during rewrite. For example the XPath expression: " /PurchaseOrder/ShipAddress " cannot be satisified by any instance document conforming to the PO . xsd XML schema, since the XML schema does not allow for ShipAddress elements under PurchaseOrder. Hence this expression would map to a SQL NULL literal.
Namespace Handling Namespaces are handled in the same way as the function-based evaluation. For schema based documents, if the function (like
EXISTSNODE /EXTRACT) does not specify any namespace parameter, then the target namespace of the schema is used as the default namespace for the XPath expression.
Example 5-32 Handling Namespaces
— For exairple, the XPath expression /PurchaseQrder/PONum is treated as
— /a: PurchaseOrder/a : PONum with xmlns :a= "http: //www. oracle . com/PO. xsd" if
— the SQL function does not explicitly specify the namespace prefix and mapping. In other words :
SELECT * FROM po_tab p
WHERE EXISTSNODE (value (p) , ' /PurchaseQrder/PONum' ) = 1;
— is equivalent to the query: SELECT * FROM po_tab p
WHERE EXISTSNODE (value (p) , ' /PurchaseOrder /PONum' , 'xmlns="http: //www. oracle . com/PO. xsd' ) = 1;
When performing query rewrite, the namespace for a particular element is matched with that of the XML schema definition. If the XML schema contains elementFormDef ault= "qualified" then each node in the XPath expression must target a namespace (this can be done using a default namespace specification or by prefixing each node with a namespace prefix).
If the elementFormDef ault is unqualified (which is the default), then only the node that defines the namespace should contain a prefix. For instance if the PO . xsd
5-60 Oracle9/ XML Database Developer's Guide - Oracle XML DB Query Rewrite with XML Schema-Based Object-Relational Storage
had the element form to be unqualified, then the existsNode ( ) function shoidd be rewritten as:
EXISTSNODE (value (p) , ' /a : PurchaseOrder/ PONum' ,
'xmlns :a="http: //www. oracle . com/PO. xsd" ) = 1;
Note: For the case where elementFormDef ault is unqualified, omitting the namespace parameter in the SQL function existsNode ( ) in hte preceding example, would cause each node to default to the target namespa. This would not match the XMLSchema definition and consequently would not return any result. This is true whether the function is rewritten or not.
Date Format Conversions The default date formats are different for XML schema and SQL. Consequently, when rewriting XPath expressions involving comparsions with dates, you need to use XML formats.
Example 5-33 Date Format Conversions
— For exairple, the expression: [@PurchaseDate= " 2002-02-01 " ]
— cannot be simply rewritten as : XMLData. "PurchaseEate" = "2002-02-01"
— since the default date format for SQL is not YYYY-MM-DD. Hence during
— rewrite, the XML format string is added to convert text values into date
— datatypes correctly.
— Thus the preceding predicate would be rewritten as :
XMLData. "PurchaseDate" = TO_DATE ( "2002-02-01" , "SYYYY-MM-DD" ) ;
Similarly when converting these columns to text values (needed for extract ( ) , and so on), XML format strings are added to convert them to the same date format as XML.
XPath Expression Rewrites for existsNode() existsNode ( ) returns a numerical value 0 or 1 indicating if the XPath returns any nodes (text ( ) or element nodes). Based on the mapping discussed in the earlier section, an existsNode simply checks if a scalar element is non-null in the case
Object-Relational Mapping of XMLType 5-61 Query Rewrite with XML Schema-Based Object-Relational Storage
where the XPath targets a text ( ) node or a non- scalar node and checks for the existance of the element using the SYS_XDBPD$ otherwise. If the SYS_XDBPD$ attribute is absent, then the existance of a scalar node is determined by the null information for the scalar column. existsNode Mapping with Document Order Maintained Table 5-12 shows the mapping of various XPaths in the case of existsNode ( ) when document ordering is preserved, that is, when SYS_XDBPD$ exists and maintainDOM= " true" in the schema document.
Table 5-12 XPath Mapping for existsNodeβ with Document Ordering Preserved
XPath Expression Maps to
/PurchaseOrder CASE WHEN XMLData IS NOT NULL THEN 1 ELSE 0 END
/PurchaseOrder/§ PurchaseDate CASE WHEN Check_Node_Exists(XMLData.SYS_XDBPD$, 'PurchaseDate') = 1 THEN 1 ELSE 0 END
/PurchaseOrder/PONum CASE WHEN Check_Node_Exists(XMLData.SYS_XDBPD$, 'PONum') = 1 THEN 1 ELSE 0 END
/Purchase0rder[PONum = 2100] CASE WHEN XMLData/PONum" = 2100 THEN 1 ELSE 0
/PurchaseOrder[PONum = CASE WHEN XMLData."PONum" = 2100 AND 2100]/® PurchaseDate Check_Node_Exists(XMLData.SYS_XDBPD$, 'PurchaseDate') = 1 THEN 1 ELSE 0 END
/PurchaseOrder/PONum/text() CASE WHEN XMLData. ONum" IS NOT NULL THEN 1 ELSE 0
/PurchaseOrder/Item CASE WHEN EXISTS (
SELECT NULL FROM TABLE ( XMLData.'ltem" ) x WHERE value(x) IS NOT NULL ) THEN 1 ELSE 0 END
/PurchaseOrder/ltem/Part CASE WHEN EXISTS (
SELECT NULL FROM TABLE ( XMLData."ltem" ) x WHERE Check_Node_Exists(x.SYS_XDBPD$, 'Part') = 1 ; THEN 1 ELSE 0 END
/PurchaseOrder/ltem/Part/textQ CASE WHEN EXISTS (
SELECT NULL FROM TABLE ( XMLData."ltem" ) x WHERE x.Tart" IS NOT NULL) THEN 1 ELSE 0 END
5-62 Oracle9/XML Database Developer's Guide - Oracle XML DB Query Rewrite with XML Schema-Based Object-Relational Storage
Example 5-34 existsNode Mapping with Document Order Maintained
— Using the preceding mapping, a query which checks whether the purchaseorder
— with number 2100 contains a part with price greater than 2000 : SELECT count (*)
FROM mypos p
WHERE EXISTSNODE(value (p), '/PurchaseOrder[PONum=1001 and Item/Price > 2000]')=
1;
— would become: SELECT count (*) FRCM irrypos p WHERE CASE WHEN p.XMLData. "PONum" = 1001 AND
EXISTS ( SELECT NULL
FROM TABLE ( XMLData."Item" ) p
WHERE p. "Price" > 2000 )) THEN 1 ELSE 0 END = 1;
— The CASE expression gets further optimized due to the constant relational
— equality expressions and this query becomes: SELECT count (*)
FRCM rrypos p
WHERE p.XMLData. "PONum" = 1001 AND EXISTS ( SELECT NULL
FRCM TABLE ( p.XMLData."Item" ) x
WHERE x. "Price" > 2000 ) ;
— vd ich would use relational indexes for its evaluation, if present on the Part and PONum columns . existsNode Mapping Without Maintaining Document Order If the SYS_XDBPD$ does not exist (that is, if the XML schema specifies maintainDOM^ " false " ) then NULL scalar columns map to non-existant scalar elements. Hence you do not need to check for the node existance using the SYS_XDBPD$ attribute. Table 5-13 shows the mapping of existsNode ( ) in the absence of the SYS_XDBPD$ attribute.
Table 5-13 XPath Mapping for existsNode Without Document Ordering XPath Expression Maps to
/PurchaseOrder CASE WHEN XMLData IS NOT NULL THEN 1 ELSE 0 END
/PurchaseOrder/® PurchaseDate CASE WHEN XMLData.'PurchaseDate' IS NOT NULL THEN 1 ELSE 0 END
/PurchaseOrder/PONum CASE WHEN XMLData."PONum" IS NOT NULL THEN 1 ELSE 0 END
/PurchaseOrder[PONum = 2100] CASE WHEN XMLData."PONum" = 2100 THEN 1 ELSE 0 END
Object-Relational Mapping of XMLType 5-63 Query Rewrite with XML Schema-Based Object-Relational Storage
Table 5-13 XPath Mapping for existsNode Without Document Ordering (Cont.)
XPath Expression Maps to
/PurchaseOrder[PONum = CASE WHEN XMLData."PONum" = 2100 AND 2100]/@PurchaseOrderDate XMLData."PurchaseDate" NOT NULL THEN 1 ELSE 0 END
/PurchaseOrder/PONum/text() CASE WHEN XMLData."P0Num" IS NOT NULL THEN 1 ELSE 0 END
/PurchaseOrder/Item CASE WHEN EXISTS ( SELECT NULL FROM TABLE ( XMLData."ltem" ) x WHERE value(x) IS NOT NULL ) THEN 1 ELSE 0 END
/PurchaseOrder/ltem/Part CASE WHEN EXISTS (
SELECT NULL FROM TABLE ( XMLData."ltem" ) x WHERE x.'Part" IS NOT NULL) THEN 1 ELSE 0 END
/PurchaseOrder/ltem/Part/text() CASE WHEN EXISTS (
SELECT NULL FROM TABLE ( XMLData.'ϊtem" ) x WHERE x."Part" IS NOT NULL) THEN 1 ELSE 0 END
Rewrite for extractValue() extractValue ( ) is a shortcut for extracting text nodes and attributes using extract ( ) and then using a getStringVal ( ) or getNumberVal ( ) to get the scalar content. extractValue returns the text nodes for scalar elements or the values of attribute nodes. extractValue ( ) cannot handle returning multiple values or non-scalar elements.
Table 5-14 shows the mapping of various XPath expressions in the case of extractValue(). If an XPath expression targets an element, extractValue retrieves the text node child of the element. Thus the two XPath expressions, /PurchaseOrder/PONu and / PurchaseOrder/ PONum/ text ( ) are handled identically by extractValue and both of them retrieve the scalar content of PONum.
Table 5-14 XPath Mapping for extractValueβ
XPath Expression Maps to
/PurchaseOrder Not supported - ExtractValue can only retrieve values for scalar elements and attributes
/PurchaseOrder/® PurchaseDate XMLData.'PurchaseDate"
/PurchaseOrder/PONum XMLData."P0Num"
5-64 Oracle9/XML Database Developer's Guide - Oracle XML DB Query Rewrite with XML Schema-Based Object-Relational Storage
Table 5-14 XPath Mapping for extractValueQ (Cont.)
XPath Expression Maps to
/PurchaseOrder[PONum = 2100] (SELECT TO XML(x XMLData) FROM Dual WHERE x.' ONum" = 2100)
/PurchaseOrderfPONum = (SELECT x.XMLData "PurchaseDate") 2100]/® PurchaseDate FROM Dual WHERE x "PONum" = 2100)
/PurchaseOrder/PONum/text() XMLData "PONum"
/PurchaseOrder/Item Not supported - ExtractValue can only retrieve values for scalar elements and attributes
/PurchaseOrder/ltem/Part Not supported - ExtractValue cannot retireve multiple scalar values
/PurchaseOrder/ltem/Part/text() Not supported - ExtractValue cannot retireve multiple scalar values
Example 5-35 Rewriting extractValueQ
— For exairple, an SQL query such as:
SELECT ExtractValue (value (p) , ' /PurchaseQrder/PQNum' ) FROM ypos p WHERE ExtractValue (value (p) ,' /PurchaseOrder/PONum' ) = 1001;
— would become: SELECT p.XMLData. "PONum"
FROM mypos p
WHERE p. XMLData. "PONum" = 1001;
Since it gets rewritten to simple scalar columns, indexes if any, on the PONum attribute may be used to satisfy the query.
Creating Indexes ExtractValue can be used in index expressions. If the expression gets rewritten into scalar columns, then the index is turned into a BTree index instead of a function-based index.
Example 5-36 Creating Indexes
— For exaπple : create index πτ _po_index on mypos x
(Extract (value (x) , ' /PurchaseOrder/PQNum/text ( ) ' ) . getnumberval ( ) ) ;
— would get rewritten into : create index my_po_ιndex on mypos x ( x.XMLData. "PONum" ) ;
Object-Relational Mapping of XMLType 5-65 Query Rewrite with XML Schema-Based Object-Relational Storage
— and thus becomes a regular BTree index. This is useful, since
— unlike a functional index, the same index can now satisfy queries which target the column such as:
EXISTSNODE(value (x) , ' /PurchaseOrder[PONum=1001] ' ) = 1;
— and thus becomes a regular B*Tree index. This is useful, since
— unlike a functional index, the same index can now satisfy queries which target the column such as:
EXISTSNODE(value (x) , ' /PurchaseOrder [PONum=1001] ' ) = 1;
Rewrite for extract() extract ( ) retrieves the results of XPath as XML. The rewrite for extrac ( ) is similar to that of extractValue ( ) for those Xpath expressions involving text nodes.
Extract Mapping with Document Order Maintained Table 5-15 shows the mapping of various XPath in the case of extract ( ) when document order is preserved (that is, when SYS_XDBPD$ exists and maintainDOM= " true " in the schema document).
Note: The examples show XMLElement and XMLForest with an empty alias string "" to indicate that you create a XML instance with only text values. This is shown for illustration only.
Table 5-15 XPath Mapping for extractQ with Document Ordering Preserved
XPath Maps to
/PurchaseOrder XMLForest(XMLData as "PurchaseOrder")
/PurchaseOrder/® PurchaseDate CASE WHEN Check_Node_Exists(XMLData.SYS_XDBPD$, 'PurchaseDate') = 1 THEN XMLEIementf'" , XMLData. urchaseDate") ELSE NULL END
/PurchaseOrder/PONum CASE WHEN Check_Node_Exists(XMLData.SYS_XDBPD$, 'PONum') = 1 THEN XMLEIementC'PONum" , XMLData/PONum") ELSE NULL END
/PurchaseOrder[PONum = 2100] ( SELECT XMLForest(XMLData as "PurchaseOrder") FROM Dual WHERE x."P0Num" = 2100)
5-66 Oracle9/XML Database Developer's Guide - Oracle XML DB Query Rewrite with XML Schema-Based Object-Relational Storage
Table 5-15 XPath Mapping for extractQ with Document Ordering Preserved (Cont.)
XPath Maps to
/PurchaseOrderjPONum = 2100]/@PurchaseDate ( SELECT CASE WHEN Check_Node_Exists(x.XMLData.SYS_XDBPD$,'PurchaseDate") = 1
THEN XMLEIementC", XMLData."PurchaseDate")
ELSE NULL END FROM Dual WHERE x."P0Num" = 2100)
/PurchaseOrder/PONum/textO XMLEIementC", XMLData.PONum)
/PurchaseOrder/Item I SELECT XMLAgg(XMLForest(value(p) as "Item"); FROM TABLE ( x.XMLData."ltem" ) p WHERE value(p) IS OT NULL)
/PurchaseOrder/ltem/Part ( SELECT XMLAgg(
CASE WHEN Check_Node_Exists(p.SYS_XDBPD$,'Part") = 1 THEN XMLForest(p."Part" as "Part") ELSE NULL END) FROM TABLE ( x.XMLData.'ϊtem" ) p)
/PurchaseOrder/ltem/Part/text() ( SELECT XMLAgg(XMLEIement(" ", p.' art") FROM TABLE ( x.XMLData.'ltem" ) x )
Example 5-37 XPath Mapping for extractQ with Document Ordering Preserved
— Using the mapping in Table 5-15, a query that extracts the PONum element
— vitere the purchaseorder contains a part with price greater than 2000: SELECT Extract (value(p), '/PurchaseOrder[Item/Part > 2000] /PONum' )
FROM po_tab p;
— would becorre:
SELECT (SELECT CASE WHEN Check_Node_ExistS (p.XMLData.SYS_XDBPD$, 'PONum') = 1 THEN XMLElement ( "PONum" , p.XMLData. "PONum" ) ELSE NULL END) FRCM DUAL WHERE EXISTS ( SELECT NULL
FROM TABLE ( XMLData. "Item") p WHERE p. "Part" > 2000) ) FRCM po_tab p;
— Check_Node_Exists is an internal function that is for illustration purposes
Object-Relational Mapping of XMLType 5-67 Query Rewrite with XML Schema-Based Object-Relational Storage
— only.
Extract Mapping Without Maintaining Document Order If the SYS_XDBPD$ does not exist, that is, if the XML schema specifies maintainDOM= " f lse", then NULL scalar columns map to non-existant scalar elements. Hence you do not need to check for the node existance using the SYS_XDBPD$ attribute. Table 5-16 shows the mapping of existsNode ( ) in the absence of the SYS_XDBPD$ attribute.
Table 5-16 XPath Mapping for extractQ Without Document Ordering Preserved
XPath Equivalent to
/PurchaseOrder XMLForest(XMLData AS "PurchaseOrder")
/PurchaseOrder/® PurchaseDate XMLForest(XMLData."PurchaseDate" AS "")
/PurchaseOrder/PONum XMLForest(XMLData."PONum" AS "PONum")
/PurchaseOrder[PONum = 2100] ( SELECT XMLForest(XMLData AS "PurchaseOrder")
FROM Dual
WHERE x."PONum" = 2100)
/PurchaseOrder[PONum = ( SELECT XMLForest(XMLData."PurchaseDate" AS "") 2100]/@PurchaseDate FROM Dual
WHERE x."PONum" = 2100)
/PurchaseOrder/PONum/textO XMLForest(XMLData.PONum AS "")
/PurchaseOrder/Item ( SELECT XMLAgg(XMLForest(value(p) as "Item")
FROM TABLE ( x.XMLData.'ltem" ) p
WHERE value(p) IS NOT NULL )
/PurchaseOrder/ltem/Part ( SELECT XMLAgg(XMLForest(p."Part" AS "Part")
FROM TABLE ( x.XMLData."ltem" ) p)
/PurchaseOrder/ltem/Part/text() ( SELECT XMLAgg( XMLForest(p. "Part" AS "Part") )
FROM TABLE ( x.XMLData.'ltem" ) p )
Optimizing Updates Using updateXML()
A regular update using updateXML ( ) involves updating a value of the XML document and then replacing the whole document with the newly updated document.
When XMLType is stored object relationally, using XML schema mapping, updates are optimized to directly update pieces of the document. For example, updating the
5-68 Oracleθ/ XML Database Developer's Guide - Oracle XML DB Query Rewrite with XML Schema-Based Object-Relational Storage
PONum element value can be rewritten to directly update the XMLData.PONum column instead of materializing the whole document in memory and then performing the update. updateXML ( ) must satisfy the following conditions for it to use the optimization:
■ The XMLType column supplied to updateXML ( ) must be the same column being updated in the SET clause. For example:
UPDATE po_tab p SET value (p) = updatexml (value (p) , . . . ) ;
■ The XMLType column must have been stored object relationally using Oracle XML DB's XML schema mapping.
■ The XPath expressions must not involve any predicates or collection traversals.
■ There must be no duplicate scalar expressions.
■ All XPath arguments in the updateXML ( ) function must target only scalar content, that is, text nodes or attributes - For example:
UPDATE po_tab p SET value (p) = updatexml (value (p) , ' /PurchaseOrder/@PurchaseDate' , ' 2002-01-02 ' , ' /PurchaseOrder/PONum/text ( ) ' , 2200) ;
If all the preceding conditions are satisfied, then the updateXML is rewritten into a simple relational update. For example,
UPDATE po_tab p SET value (p) = updatexml (value (p) , ' /PurchaseOrder/ΘPurchaseDate' , ' 2002-01-02 ' , ' /PurchaseOrder/PONum/tex ( ) ' , 2200) ; becomes,
UPDATE po_tab p
SET p . XMLData. "PurchaseDate" = TO_DATE( ' 2002-01-02 ' , ' SYYYY-MM-DD' ) , p . XMLData . "PONum" = 2100;
DATE Conversions Date datatypes such as Date, gMonth, gDate etc., have different format in the XMLSchema and SQL system. In such cases, if the updateXML has a string value for these columns, the rewrite automatically puts the XML format string to convert the string value correctly. Thus string value specified for date columns, must match the XML date format and not the SQL date format.
Object-Relational Mapping of XMLType 5-69 Creating Default Tables During XML Schema Registration
Creating Default Tables During XML Schema Registration
As part of XML schema registration, you can also create default tables. Default tables are most useful when XML instance documents conforming to this XML schema are inserted through APIs that do not have any table specification, such as with FTP or HTTP. In such cases, the XML instance is inserted into the default table.
If you have given a value for attribute def aultTable, the XMLType table is created with that name. Otherwise it gets created with an internally generated name.
Further, any text specified using the tableProps and columnProps attribute are appended to the generated CREATE TABLE statement.
Ordered Collections in Tables (OCTs)
Arrays in XML schemas (elements with maxOccurs > 1) are usually stored in VARRAYs, which can be stored either in a Large Object (LOB) or in a separate store table, similar to a nested table.
Note: When elements of a VARRAY are stored in a separate table, the VARRAY is referred to as an Ordered Collection in Tables (OCT). In the following paragraphs, references to OCT also assume that you are using Index Organized Table (IOT) storage for the "store" table.
This allows the elements of a VARRAY to reside in a separate table based on an IOT. The primary key of the table is (NESTED_TABLE_ID, ARRAY_INDEX). NESTED_ TABLE_ID is used to link the element with their containing parents while the ARRAY NDEX column keeps track of the position of the element within the collection.
Using OCT for VARRAY Storage
There are two ways to specify an OCT storage:
■ By means of the schema attribute " storeVarrayAsTable " . By default this is "false" and VARRAYs are stored in a LOB. If this is set to " true ", all VARRAYs, all elements that have maxOccurs > 1, will be stored as OCTs.
5-70 Oracleθ/ XML Database Developer's Guide - Oracle XML DB Cyclical References Between XML Schemas
■ By explicitly specifying the storage using the "tableProps" attribute. The exact SQL needed to create an OCT can be used as part of the tableProps attribute:
"VARRAY xmldata.<array STORE AS TABLE <myTable> ((PRIMARY KEY (NESTED_ TABLE_ID, ARRAY_INDEX) ) ORGANIZATION INDEX) "
The advantages of using OCTs for VARRAY storage include faster access to elements and better queriability. Indexes can be created on attributes of the element and these can aid in better execution for query rewrite.
Cyclical References Between XML Schemas
XML schema documents can have cyclic dependencies that can prevent them from being registered one after the other in the usual manner. Examples of such XML schemas follow:
Example 5-38 Cyclic Dependencies
— A schema thats including another schema cannot be created
— if the included schema does not exist , begin dfcrτ\s_xmlschema . registerSchema ( ' xm 0. xsd' ,
Figure imgf000110_0001
targe tNamespace= " xm40 " >
<include schemaLocation="xm40a .xsd"/> < ! — Define a global coirplextype here — > <complexType name=" Coirpany "> <sequence>
<element name="Name" type="strrng" /> <element name= "Address" type=" string" /> </sequence> </cαmplexType>
< ! — Define a global element depending on included schema — > <element
Figure imgf000110_0002
</schema>' , true, true, false, true) ; end; /
— It can however be created with the FORCE option begin dhms_xmlschema . registerSchema ( ' xm40. xsd' ,
'<schema xmlns="http: //www. w3 .org/2001/XMLScheιra" xmlns :iry="xm40" targetNamespace= "xm40 " >
<include schemaLocation= "xm40a . xsd" />
Object-Relational Mapping of XMLType 5-71 Cyclical References Between XML Schemas
<! — Define a global ccmplextype here —> <cαmplexType narre="Company"> <sequence>
<element name="Name" type="string"/> <element name="Address" type="string"/> </sequence> </cαmplexType>
<! — Define a global element depending on included schema —> <element naιrB="Emp" type="ιrτy:Employee" /> </schema>' , true, true, false, true, true) ; end; /
— Atteirpt to use this schema will try recompiling
— and fail. create table foo of sys . xmltype xmlschema "xm40.xsd" element "Etrp" ;
— Now create the 2nd schema with FORCE option
— This should also make the 1st schema VALID. begin d)3ns_xrrιlschema .registerScheιra ( 'xm40a .xsd' , '<schema xmlns="http: //www. w3 .org/2001/XMLSchera" xmlns :my="xm40" targetNamespace= "xm40 " > <include schemaLocation= "xm40. xsd" /> < ! — Define a global ccmplextype here — > <cαmplexType name=" Employee "> <sequence> <element name="Name" type= " string" /> <element name="Age" type="positiveInteger" /> <element name="Phone" type="string" /> </sequence> </corrplexType>
< ! — Define a global element depending on included schema — > <element name="Cαmp" type= "my: Company" /> </schema>' , true, true, false, true, true) ; end; /
— Both can be used to create tables etc . create table foo of sys . mltype xmlschema "xm40.xsd" element "E p" ; create table foo2 of sys. xmltype xmlschema "xm40a.xsd" element "Camp" ;
To register both these XML schemas which have a cyclic dependency on each other, you must use the FORCE parameter in DBMS_XMLSCHEMA . registerSchema as follows:
5-72 Oracle9/XML Database Developer's Guide - Oracle XML DB Cyclical References Between XML Schemas
1. Step 1 : Register "sl.xsd" in FORCE mode: dfcms_xmlscherra. registerSchema ("si. xsd", "<schema ...", ..., force => true)
At this point, sl.xsd is invalid and cannot be used.
2. Step 2 : Register "s2.xsd" in FORCE mode: dhms_xmlschema. registerSchema ("s2. sd", "<schema ..", ..., force => true)
The second operation automatically compiles si .xsd and makes both XML schemas valid.
Object-Relational Mapping of XMLType 5-73

Claims

CLAIMSWhat is claimed is:
1. A method for managing data in a database system, the method comprising the steps of: determining, within a database system, an appropriate database representation for storing within said database system documents that conform to an XML schema; generating mapping data that indicates correlations between elements of said XML schema and elements of said appropriate database representation.
2. The method of Claim 1 wherein: the step of determining an appropriate database representation includes determining, based on user-specified information, that an element of said XML schema is to be mapped to a single CLOB without generating other object types within said database system for said element; and the step of generating mapping data includes generating data that maps said element to said single CLOB.
3. The method of Claim 2 further comprising the step of receiving said user- specified information in the form of user-specified annotations to said XML schema.
4. The method of Claim 1 wherein: the step of determining an appropriate database representation includes determining, based on user-specified information, that a first set of subelements of an element of said XML schema is to be mapped to a single CLOB; and the step of generating mapping data includes generating data that maps said first set of subelements to said single CLOB, and generating data that maps a second set of subelements of said element to one or more objects other than said CLOB.
5. The method of Claim 1 wherein the step of determining an appropriate database representation includes mapping datatypes associated with elements in said XML schema to datatypes supported by said database system.
Ill
6. The method of Claim 1 wherein the step of determining an appropriate database representation includes defining an SQL object type that includes attributes that correspond to elements in said XML schema.
7. The method of Claim 5 wherein the step of mapping datatypes includes the steps of: if a particular datatype associated with an element in said XML schema is associated with a first length, then mapping said particular datatype to a first database datatype; and if said particular datatype is associated with a second length, then mapping said particular datatype to a second database datatype, wherein the first database datatype is different than said second database datatype.
8. The method of Claim 5 wherein the step of determining an appropriate database representation includes mapping a particular element of said XML schema to a collection type supported by the database system if the particular element is defined to have a maximum number of occurrences greater than one.
9. The method of Claim 8 wherein the collection type is an array type, wherein the cardinality of the array type is selected based on the maximum number of occurrences specified for said particular database element.
10. The method of Claim 1 wherein the step of constraint determining an appropriate database representation includes defining a constraint in said appropriate database representation based upon a constraint specified in said XML schema for an element of said XML schema.
11. The method of Claim 10 wherein the step of defining a constraint includes defining a constraint from a set consisting of: a uniqueness constraint, a referential constraint, and a not null constraint.
12. The method of Claim 1 wherein: a first datatype is associated with an element in the XML schema; the XML schema specifies that said first datatype inherits from a second datatype; and the step of determining an appropriate database representation includes defining within said database system a subtype of an object type, wherein said object type corresponds to said second datatype.
13. The method of Claim 1 wherein the step of determining appropriate database representation includes: mapping a first set of elements in said XML schema to database structures that maintain each element separate in the first set separate from the other elements in the first set; and mapping a second set of elements in said XML schema to a database structure in which all elements in said second set of elements are combined as a single undifferentiated database element.
14. The method of Claim 13 wherein the database system determines membership of said first set and membership of said second set based on directives associated with said XML schema.
15. The method of Claim 13 wherein elements in the first set of elements are selected to be in said first set based on a likelihood that said elements will be accessed more frequently than the elements selected to be in said second set of elements.
16. The method of Claim 1 wherein: the steps of determining an appropriate database representation and generating mapping data are preformed as part of an XML schema registration operation that causes modifications within said database system; and the method further comprises the step of automatically removing all modifications caused by said XML schema registration operation in response to encountering a particular error during said XML schema registration operation.
17. The method of Claim 1 wherein the step of determining an appropriate database representation includes determining how to break cycles in said XML schema.
18. The method of Claim 1 wherein: said XML schema includes a cycle involving a plurality of components; and the step of determining how to break cycles includes causing each component of the cyclic definition to holds pointers to all of its children components.
19. The method of Claim 1 wherein the step of determining how to break cycles includes causing an entire cyclic definition to be mapped for storage as a single CLOB within the database system.
20. The method of Claim 1 wherein the step of generating mapping data includes adding annotations to said XML schema, and storing said annotated XML schema within said database system.
21. The method of Claim 1 further comprising the steps of: creating structures within a database based on said appropriate database representation; and storing in said structures data from XML documents that conform to said XML schema.
22. The method of Claim 21 wherein the step of storing data from XML documents includes the steps of: receiving an XML document at said database system; identifying data, from said XML document, that is associated with individual elements of said XML schema; storing the data associated with individual elements at locations within said structures based on the elements associated with the data, and the mapping data.
23. The method of Claim 1 further comprising the step of validating, within said database system, said XML schema to determine whether the XML schema conforms to an XML schema for XML schemas.
24. The method of Claim 1 wherein the step of determining is performed as part of an XML schema registration operation that is initiated in response to receiving, at said database server, said XML schema.
25. The method of Claim 1 wherein the step of determining is performed as part of an XML schema registration operation that is initiated in response to receiving, at said database server, an XML document that conforms to said XML schema.
26. The method of Claim 24 wherein: the XML schema includes user-specified annotations that indicate how the database system should map at least one element of the XML schema; and at least a portion of the mapping data reflects said user-specified annotations.
27. A computer-readable medium carrying instructions for managing data in a database system, the instructions comprising instructions which, when executed by one or more processors, cause the processors to perform the steps of: determining, within a database system, an appropriate database representation for storing within said database system documents that conform to an XML schema; generating mapping data that indicates correlations between elements of said XML schema and elements of said appropriate database representation.
28. The computer-readable medium of Claim 27 wherein the step of determining an appropriate database representation includes mapping datatypes associated with elements in said XML schema to datatypes supported by said database system.
29. The computer-readable medium of Claim 27 wherein the step of determining an appropriate database representation includes defining an SQL object type that includes attributes that correspond to elements in said XML schema.
30. The computer-readable medium of Claim 28 wherein the step of mapping datatypes includes the steps of: if a particular datatype associated with an element in said XML schema is associated with a first length, then mapping said particular datatype to a first database datatype; and if said particular datatype is associated with a second length, then mapping said particular datatype to a second database datatype, wherein the first database datatype is different than said second database datatype.
31. The computer-readable medium of Claim 28 wherein the step of determining an appropriate database representation includes mapping a particular element of said XML schema to a collection type supported by the database system if the particular element is defined to have a maximum number of occurrences greater than one.
32. The computer-readable medium of Claim 31 wherein the collection type is an array type, wherein the cardinality of the array type is selected based on the maximum number of occurrences specified for said particular database element.
33. The computer-readable medium of Claim 27 wherein the step of constraint determining an appropriate database representation includes defining a constraint in said appropriate database representation based upon a constraint specified in said XML schema for an element of said XML schema.
34. The computer-readable medium of Claim 33 wherein the step of defining a constraint includes defining a constraint from a set consisting of: a uniqueness constraint, a referential constraint, and a not null constraint.
35. The computer-readable medium of Claim 27 wherein: a first datatype is associated with an element in the XML schema; the XML schema specifies that said first datatype inherits from a second datatype; and the step of determining an appropriate database representation includes defining within said database system a subtype of an object type, wherein said object type corresponds to said second datatype.
36. The computer-readable medium of Claim 27 wherein the step of determining appropriate database representation includes: mapping a first set of elements in said XML schema to database structures that maintain each element separate in the first set separate from the other elements in the first set; and mapping a second set of elements in said XML schema to a database structure in which all elements in said second set of elements are combined as a single undifferentiated database element.
37. The computer-readable medium of Claim 36 wherein the database system determines membership of said first set and membership of said second set based on directives associated with said XML schema.
38. The computer-readable medium of Claim 36 wherein elements in the first set of elements are selected to be in said first set based on a likelihood that said elements will be accessed more frequently than the elements selected to be in said second set of elements.
39. The computer-readable medium of Claim 27 wherein: the steps of determining an appropriate database representation and generating mapping data are preformed as part of an XML schema registration operation that causes modifications within said database system; and the computer-readable medium further comprises instructions for performing the step of automatically removing all modifications caused by said XML schema registration operation in response to encountering a particular error during said XML schema registration operation.
40. The computer-readable medium of Claim 27 wherein the step of determining an appropriate database representation includes determining how to break cycles in said XML schema.
41. The computer-readable medium of Claim 27 wherein the step of generating mapping data includes adding annotations to said XML schema, and storing said annotated XML schema within said database system.
42. The computer-readable medium of Claim 27 further comprising instructions for performing the steps of: creating structures within a database based on said appropriate database representation; and storing in said structures data from XML documents that conform to said XML schema.
43. The computer-readable medium of Claim 42 wherein the step of storing data from XML documents includes the steps of: receiving an XML document at said database system; identifying data, from said XML document, that is associated with individual elements of said XML schema; storing the data associated with individual elements at locations within said structures based on the elements associated with the data, and the mapping data.
44. The computer-readable medium of Claim 27 further comprising instructions for performing the step of validating, within said database system, said XML schema to determine whether the XML schema conforms to an XML schema for XML schemas.
45. The computer-readable medium of Claim 27 wherein the step of determining is performed as part of an XML schema registration operation that is initiated in response to receiving, at said database server, said XML schema.
46. The computer-readable medium of Claim 27 wherein the step of determining is performed as part of an XML schema registration operation that is initiated in response to receiving, at said database server, an XML document that conforms to said XML schema.
47. The computer-readable medium of Claim 45 wherein: the XML schema includes user-specified annotations that indicate how the database system should map at least one element of the XML schema; and at least a portion of the mapping data reflects said user-specified annotations.
-45-
PCT/US2002/030783 2001-09-28 2002-09-27 Mechanism for mapping xml schemas to object-relational database systems WO2003030031A2 (en)

Priority Applications (5)

Application Number Priority Date Filing Date Title
AU2002334706A AU2002334706B2 (en) 2001-09-28 2002-09-27 Mechanism for mapping XML schemas to object-relational database systems
EP02800376A EP1440394A2 (en) 2001-09-28 2002-09-27 Mechanism for mapping xml schemas to object-relational database systems
CN028223470A CN1585945B (en) 2001-09-28 2002-09-27 Mechanism for mapping XML schemas to object-relational database systems
JP2003533163A JP2005505058A (en) 2001-09-28 2002-09-27 Mechanism for mapping XML schemas to object-relational database systems
CA2461854A CA2461854C (en) 2001-09-28 2002-09-27 Mechanism for mapping xml schemas to object-relational database systems

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
US32605201P 2001-09-28 2001-09-28
US60/326,052 2001-09-28
US37880002P 2002-05-07 2002-05-07
US60/378,800 2002-05-07

Publications (2)

Publication Number Publication Date
WO2003030031A2 true WO2003030031A2 (en) 2003-04-10
WO2003030031A3 WO2003030031A3 (en) 2004-02-12

Family

ID=26985223

Family Applications (2)

Application Number Title Priority Date Filing Date
PCT/US2002/031168 WO2003027908A2 (en) 2001-09-28 2002-09-27 Providing a consistent hierarchical abstraction of relational data
PCT/US2002/030783 WO2003030031A2 (en) 2001-09-28 2002-09-27 Mechanism for mapping xml schemas to object-relational database systems

Family Applications Before (1)

Application Number Title Priority Date Filing Date
PCT/US2002/031168 WO2003027908A2 (en) 2001-09-28 2002-09-27 Providing a consistent hierarchical abstraction of relational data

Country Status (7)

Country Link
US (3) US7051033B2 (en)
EP (2) EP1440394A2 (en)
JP (2) JP2005505058A (en)
CN (2) CN1585945B (en)
AU (3) AU2002334721B2 (en)
CA (2) CA2462300C (en)
WO (2) WO2003027908A2 (en)

Cited By (47)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006085717A (en) * 2004-09-17 2006-03-30 Microsoft Corp Durable storage of .net data type and instance
EP1647905A1 (en) * 2004-10-15 2006-04-19 Microsoft Corporation Method and system for mapping of XML schema data into relational data structures
JP2007534036A (en) * 2003-08-25 2007-11-22 オラクル・インターナショナル・コーポレイション Field development of XML schema in database
JP2008507008A (en) * 2004-06-16 2008-03-06 オラクル・インターナショナル・コーポレイション Efficient extraction of XML content stored in a LOB
US7433940B2 (en) 2004-01-21 2008-10-07 International Business Machines Corporation Schema management
CN100435143C (en) * 2004-03-22 2008-11-19 微软公司 System and method for modeless data mapping with nested tables
US7478102B2 (en) * 2005-03-28 2009-01-13 Microsoft Corporation Mapping of a file system model to a database object
CN100458793C (en) * 2007-05-10 2009-02-04 浪潮集团山东通用软件有限公司 Mapping conversion method between data access level Xml format data and relational data
US7792866B2 (en) 2003-08-25 2010-09-07 International Business Machines Corporation Method and system for querying structured documents stored in their native format in a database
US7814047B2 (en) 2003-08-25 2010-10-12 Oracle International Corporation Direct loading of semistructured data
US7870163B2 (en) 2006-09-28 2011-01-11 Oracle International Corporation Implementation of backward compatible XML schema evolution in a relational database system
US8001127B2 (en) 2004-04-09 2011-08-16 Oracle International Corporation Efficient extraction of XML content stored in a LOB
US8145668B2 (en) 2003-08-25 2012-03-27 International Business Machines Corporation Associating information related to components in structured documents stored in their native format in a database
US8145859B2 (en) 2009-03-02 2012-03-27 Oracle International Corporation Method and system for spilling from a queue to a persistent store
US8150818B2 (en) 2003-08-25 2012-04-03 International Business Machines Corporation Method and system for storing structured documents in their native format in a database
US8250093B2 (en) 2003-08-25 2012-08-21 International Business Machines Corporation Method and system for utilizing a cache for path-level access control to structured documents stored in a database
US8321450B2 (en) 2009-07-21 2012-11-27 Oracle International Corporation Standardized database connectivity support for an event processing server in an embedded context
US8352517B2 (en) 2009-03-02 2013-01-08 Oracle International Corporation Infrastructure for spilling pages to a persistent store
US8387076B2 (en) 2009-07-21 2013-02-26 Oracle International Corporation Standardized database connectivity support for an event processing server
US8386466B2 (en) 2009-08-03 2013-02-26 Oracle International Corporation Log visualization tool for a data stream processing server
US8447744B2 (en) 2009-12-28 2013-05-21 Oracle International Corporation Extensibility platform using data cartridges
US8498956B2 (en) 2008-08-29 2013-07-30 Oracle International Corporation Techniques for matching a certain class of regular expression-based patterns in data streams
US8527458B2 (en) 2009-08-03 2013-09-03 Oracle International Corporation Logging framework for a data stream processing server
US8713049B2 (en) 2010-09-17 2014-04-29 Oracle International Corporation Support for a parameterized query/view in complex event processing
US8775468B2 (en) 2003-08-29 2014-07-08 International Business Machines Corporation Method and system for providing path-level access control for structured documents stored in a database
US20140214215A1 (en) * 2013-01-29 2014-07-31 Electronics And Telecommunications Research Institute Building information model-based building energy management apparatus and method
US8805868B2 (en) 2007-08-03 2014-08-12 Electronics And Telecommunications Research Institute Apparatus and method for a query express
US8959106B2 (en) 2009-12-28 2015-02-17 Oracle International Corporation Class loading using java data cartridges
US8990416B2 (en) 2011-05-06 2015-03-24 Oracle International Corporation Support for a new insert stream (ISTREAM) operation in complex event processing (CEP)
US9047249B2 (en) 2013-02-19 2015-06-02 Oracle International Corporation Handling faults in a continuous event processing (CEP) system
US9098587B2 (en) 2013-01-15 2015-08-04 Oracle International Corporation Variable duration non-event pattern matching
US9189280B2 (en) 2010-11-18 2015-11-17 Oracle International Corporation Tracking large numbers of moving objects in an event processing system
US9256646B2 (en) 2012-09-28 2016-02-09 Oracle International Corporation Configurable data windows for archived relations
US9329975B2 (en) 2011-07-07 2016-05-03 Oracle International Corporation Continuous query language (CQL) debugger in complex event processing (CEP)
US9390135B2 (en) 2013-02-19 2016-07-12 Oracle International Corporation Executing continuous event processing (CEP) queries in parallel
US9430494B2 (en) 2009-12-28 2016-08-30 Oracle International Corporation Spatial data cartridge for event processing systems
US9558252B2 (en) 2011-05-24 2017-01-31 Nec Corporation Information processing system, data management method, information processing apparatus, and control method and control program therefor
US9712645B2 (en) 2014-06-26 2017-07-18 Oracle International Corporation Embedded event processing
US9773028B2 (en) 2010-09-29 2017-09-26 International Business Machines Corporation Manipulating non-schema attributes for objects in a schema based directory
US9805095B2 (en) 2012-09-28 2017-10-31 Oracle International Corporation State initialization for continuous queries over archived views
US9886486B2 (en) 2014-09-24 2018-02-06 Oracle International Corporation Enriching events with dynamically typed big data for event processing
US9934279B2 (en) 2013-12-05 2018-04-03 Oracle International Corporation Pattern matching across multiple input data streams
US9972103B2 (en) 2015-07-24 2018-05-15 Oracle International Corporation Visually exploring and analyzing event streams
CN108228604A (en) * 2016-12-14 2018-06-29 北京国双科技有限公司 Model building method, information query method and device based on memory object
US10120907B2 (en) 2014-09-24 2018-11-06 Oracle International Corporation Scaling event processing using distributed flows and map-reduce operations
US10298444B2 (en) 2013-01-15 2019-05-21 Oracle International Corporation Variable duration windows on continuous data streams
US10956422B2 (en) 2012-12-05 2021-03-23 Oracle International Corporation Integrating event processing with map-reduce

Families Citing this family (392)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7293228B1 (en) 1997-01-31 2007-11-06 Timebase Pty Limited Maltweb multi-axis viewing interface and higher level scoping
AUPO489297A0 (en) * 1997-01-31 1997-02-27 Aunty Abha's Electronic Publishing Pty Ltd A system for electronic publishing
US6158010A (en) * 1998-10-28 2000-12-05 Crosslogix, Inc. System and method for maintaining security in a distributed computer network
US7062456B1 (en) 1999-02-09 2006-06-13 The Chase Manhattan Bank System and method for back office processing of banking transactions using electronic files
US7366708B2 (en) * 1999-02-18 2008-04-29 Oracle Corporation Mechanism to efficiently index structured data that provides hierarchical access in a relational database system
US7770102B1 (en) 2000-06-06 2010-08-03 Microsoft Corporation Method and system for semantically labeling strings and providing actions based on semantically labeled strings
US7788602B2 (en) 2000-06-06 2010-08-31 Microsoft Corporation Method and system for providing restricted actions for recognized semantic categories
US7712024B2 (en) 2000-06-06 2010-05-04 Microsoft Corporation Application program interfaces for semantically labeling strings and providing actions based on semantically labeled strings
US7716163B2 (en) 2000-06-06 2010-05-11 Microsoft Corporation Method and system for defining semantic categories and actions
US8972717B2 (en) * 2000-06-15 2015-03-03 Zixcorp Systems, Inc. Automatic delivery selection for electronic content
US6961900B1 (en) * 2000-08-28 2005-11-01 Microsoft Corporation Rendering data according to a present schema from an origin response message
US7873649B2 (en) 2000-09-07 2011-01-18 Oracle International Corporation Method and mechanism for identifying transaction on a row of data
US7031962B2 (en) * 2001-03-27 2006-04-18 Bea Systems, Inc. System and method for managing objects and resources with access rights embedded in nodes within a hierarchical tree structure
US20030217333A1 (en) * 2001-04-16 2003-11-20 Greg Smith System and method for rules-based web scenarios and campaigns
US7778816B2 (en) 2001-04-24 2010-08-17 Microsoft Corporation Method and system for applying input mode bias
US7146399B2 (en) * 2001-05-25 2006-12-05 2006 Trident Company Run-time architecture for enterprise integration with transformation generation
US7877421B2 (en) * 2001-05-25 2011-01-25 International Business Machines Corporation Method and system for mapping enterprise data assets to a semantic information model
US8412746B2 (en) 2001-05-25 2013-04-02 International Business Machines Corporation Method and system for federated querying of data sources
US20030101170A1 (en) * 2001-05-25 2003-05-29 Joseph Edelstein Data query and location through a central ontology model
US7099885B2 (en) * 2001-05-25 2006-08-29 Unicorn Solutions Method and system for collaborative ontology modeling
US20060064666A1 (en) 2001-05-25 2006-03-23 Amaru Ruth M Business rules for configurable metamodels and enterprise impact analysis
US7895173B1 (en) * 2001-06-27 2011-02-22 Microsoft Corporation System and method facilitating unified framework for structured/unstructured data
US20030041305A1 (en) * 2001-07-18 2003-02-27 Christoph Schnelle Resilient data links
US7363310B2 (en) * 2001-09-04 2008-04-22 Timebase Pty Limited Mapping of data from XML to SQL
US7028037B1 (en) 2001-09-28 2006-04-11 Oracle International Corporation Operators for accessing hierarchical data in a relational system
US7047250B1 (en) 2001-09-28 2006-05-16 Oracle International Corporation Indexing to efficiently manage versioned data in a database system
AU2002334721B2 (en) 2001-09-28 2008-10-23 Oracle International Corporation An index structure to access hierarchical data in a relational database system
US7047253B1 (en) 2001-09-28 2006-05-16 Oracle Interntional Corporation Mechanisms for storing content and properties of hierarchically organized resources
US7051039B1 (en) 2001-09-28 2006-05-23 Oracle International Corporation Mechanism for uniform access control in a database system
US7092967B1 (en) 2001-09-28 2006-08-15 Oracle International Corporation Loadable units for lazy manifestation of XML documents
EP1298539A1 (en) * 2001-10-01 2003-04-02 Sun Microsystems, Inc. Method and device for marking and filtering data elements in a database
US7472342B2 (en) * 2001-10-24 2008-12-30 Bea Systems, Inc. System and method for portal page layout
US7281206B2 (en) * 2001-11-16 2007-10-09 Timebase Pty Limited Maintenance of a markup language document in a database
US7107522B1 (en) 2001-12-21 2006-09-12 Bellsouth Intellectual Property Corp. System and method for creating extensible content
US7343585B1 (en) * 2002-01-30 2008-03-11 Oracle International Corporation Operator approach for generic dataflow designs
JP4039484B2 (en) * 2002-02-28 2008-01-30 インターナショナル・ビジネス・マシーンズ・コーポレーション XPath evaluation method, XML document processing system and program using the same
JP3624186B2 (en) * 2002-03-15 2005-03-02 Tdk株式会社 Control circuit for switching power supply device and switching power supply device using the same
US6965903B1 (en) 2002-05-07 2005-11-15 Oracle International Corporation Techniques for managing hierarchical data with link attributes in a relational database
US7707496B1 (en) 2002-05-09 2010-04-27 Microsoft Corporation Method, system, and apparatus for converting dates between calendars and languages based upon semantically labeled strings
US7548935B2 (en) * 2002-05-09 2009-06-16 Robert Pecherer Method of recursive objects for representing hierarchies in relational database systems
US7742048B1 (en) 2002-05-23 2010-06-22 Microsoft Corporation Method, system, and apparatus for converting numbers based upon semantically labeled strings
US7987246B2 (en) 2002-05-23 2011-07-26 Jpmorgan Chase Bank Method and system for client browser update
US7707024B2 (en) 2002-05-23 2010-04-27 Microsoft Corporation Method, system, and apparatus for converting currency values based upon semantically labeled strings
US6920460B1 (en) * 2002-05-29 2005-07-19 Oracle International Corporation Systems and methods for managing partitioned indexes that are created and maintained by user-defined indexing schemes
US8200622B2 (en) 2002-05-31 2012-06-12 Informatica Corporation System and method for integrating, managing and coordinating customer activities
US7827546B1 (en) 2002-06-05 2010-11-02 Microsoft Corporation Mechanism for downloading software components from a remote source for use by a local software application
US7356537B2 (en) * 2002-06-06 2008-04-08 Microsoft Corporation Providing contextually sensitive tools and help content in computer-generated documents
US7716676B2 (en) * 2002-06-25 2010-05-11 Microsoft Corporation System and method for issuing a message to a program
US20040001099A1 (en) * 2002-06-27 2004-01-01 Microsoft Corporation Method and system for associating actions with semantic labels in electronic documents
US7209915B1 (en) 2002-06-28 2007-04-24 Microsoft Corporation Method, system and apparatus for routing a query to one or more providers
US7120645B2 (en) * 2002-09-27 2006-10-10 Oracle International Corporation Techniques for rewriting XML queries directed to relational database constructs
US7051041B1 (en) * 2002-10-21 2006-05-23 Hewlett-Packard Development Company, L.P. Simplified relational database extension to DBM hash tables and method for using same
DE10250641A1 (en) * 2002-10-30 2004-05-13 Siemens Ag Upward and downward compatible schema evolution
US6947950B2 (en) 2002-11-06 2005-09-20 Oracle International Corporation Techniques for managing multiple hierarchies of data from a single interface
US7308474B2 (en) 2002-11-06 2007-12-11 Oracle International Corporation Techniques for scalably accessing data in an arbitrarily large document by a device with limited resources
US7020653B2 (en) 2002-11-06 2006-03-28 Oracle International Corporation Techniques for supporting application-specific access controls with a separate server
US20040103199A1 (en) * 2002-11-22 2004-05-27 Anthony Chao Method and system for client browser update from a lite cache
US7451158B1 (en) * 2002-11-27 2008-11-11 Microsoft Corporation System and method for creating, appending and merging a work management file
US20040148272A1 (en) * 2003-01-29 2004-07-29 Raman Balan Sethu Logical pathname as a reference mechanism for data
US7783614B2 (en) * 2003-02-13 2010-08-24 Microsoft Corporation Linking elements of a document to corresponding fields, queries and/or procedures in a database
US7653930B2 (en) * 2003-02-14 2010-01-26 Bea Systems, Inc. Method for role and resource policy management optimization
US7591000B2 (en) 2003-02-14 2009-09-15 Oracle International Corporation System and method for hierarchical role-based entitlements
US8831966B2 (en) 2003-02-14 2014-09-09 Oracle International Corporation Method for delegated administration
US7415478B2 (en) * 2003-02-20 2008-08-19 Bea Systems, Inc. Virtual repository complex content model
US7840614B2 (en) 2003-02-20 2010-11-23 Bea Systems, Inc. Virtual content repository application program interface
US7483904B2 (en) * 2003-02-20 2009-01-27 Bea Systems, Inc. Virtual repository content model
US7293286B2 (en) 2003-02-20 2007-11-06 Bea Systems, Inc. Federated management of content repositories
US20040230557A1 (en) * 2003-02-28 2004-11-18 Bales Christopher E. Systems and methods for context-sensitive editing
US7810036B2 (en) 2003-02-28 2010-10-05 Bea Systems, Inc. Systems and methods for personalizing a portal
US20040230917A1 (en) * 2003-02-28 2004-11-18 Bales Christopher E. Systems and methods for navigating a graphical hierarchy
US7711550B1 (en) 2003-04-29 2010-05-04 Microsoft Corporation Methods and system for recognizing names in a computer-generated document and for providing helpful actions associated with recognized names
US7386568B2 (en) * 2003-05-01 2008-06-10 Oracle International Corporation Techniques for partial rewrite of XPath queries in a relational database
US7103611B2 (en) * 2003-05-01 2006-09-05 Oracle International Corporation Techniques for retaining hierarchical information in mapping between XML documents and relational data
US6836778B2 (en) 2003-05-01 2004-12-28 Oracle International Corporation Techniques for changing XML content in a relational database
US7051042B2 (en) * 2003-05-01 2006-05-23 Oracle International Corporation Techniques for transferring a serialized image of XML data
US20040230602A1 (en) * 2003-05-14 2004-11-18 Andrew Doddington System and method for decoupling data presentation layer and data gathering and storage layer in a distributed data processing system
US7366722B2 (en) * 2003-05-15 2008-04-29 Jp Morgan Chase Bank System and method for specifying application services and distributing them across multiple processors using XML
CA2428821C (en) * 2003-05-15 2009-03-17 Ibm Canada Limited - Ibm Canada Limitee Accessing a platform independent input method editor from an underlying operating system
US7331014B2 (en) * 2003-05-16 2008-02-12 Microsoft Corporation Declarative mechanism for defining a hierarchy of objects
US7739588B2 (en) 2003-06-27 2010-06-15 Microsoft Corporation Leveraging markup language data for semantically labeling text strings and data and for providing actions based on semantically labeled text strings and data
US20050010896A1 (en) * 2003-07-07 2005-01-13 International Business Machines Corporation Universal format transformation between relational database management systems and extensible markup language using XML relational transformation
US7519952B2 (en) * 2003-07-28 2009-04-14 International Business Machines Corporation Detecting an integrity constraint violation in a database by analyzing database schema, application and mapping and inserting a check into the database and application
US7069278B2 (en) 2003-08-08 2006-06-27 Jpmorgan Chase Bank, N.A. System for archive integrity management and related methods
US7747580B2 (en) 2003-08-25 2010-06-29 Oracle International Corporation Direct loading of opaque types
US7395271B2 (en) * 2003-08-25 2008-07-01 Oracle International Corporation Mechanism to enable evolving XML schema
US7490093B2 (en) 2003-08-25 2009-02-10 Oracle International Corporation Generating a schema-specific load structure to load data into a relational database based on determining whether the schema-specific load structure already exists
US8694510B2 (en) * 2003-09-04 2014-04-08 Oracle International Corporation Indexing XML documents efficiently
US8229932B2 (en) * 2003-09-04 2012-07-24 Oracle International Corporation Storing XML documents efficiently in an RDBMS
US20050060345A1 (en) * 2003-09-11 2005-03-17 Andrew Doddington Methods and systems for using XML schemas to identify and categorize documents
US7516139B2 (en) * 2003-09-19 2009-04-07 Jp Morgan Chase Bank Processing of tree data structures
US20050091191A1 (en) * 2003-09-24 2005-04-28 Greg Miller System and method for managing and utilizing information
US20050071805A1 (en) * 2003-09-30 2005-03-31 Johannes Lauterbach Developing applications using a metamodel
US8255888B2 (en) * 2003-09-30 2012-08-28 Sap Ag API derivation and XML schema derivation for developing applications
US7543268B2 (en) * 2003-09-30 2009-06-02 Sap Ag Development environment for developing applications using a metamodel and a metadata API
US7877390B2 (en) * 2003-10-20 2011-01-25 International Business Machines Corporation Systems and methods for providing autonomous persistent storage systems
US20050091231A1 (en) * 2003-10-24 2005-04-28 Shankar Pal System and method for storing and retrieving XML data encapsulated as an object in a database store
US7634498B2 (en) * 2003-10-24 2009-12-15 Microsoft Corporation Indexing XML datatype content system and method
US9690811B1 (en) 2003-11-05 2017-06-27 Hewlett Packard Enterprise Development Lp Single repository manifestation of a multi-repository system
US7877400B1 (en) * 2003-11-18 2011-01-25 Adobe Systems Incorporated Optimizations of XPaths
US7882146B2 (en) * 2003-12-01 2011-02-01 Microsoft Corporation XML schema collection objects and corresponding systems and methods
US7313756B2 (en) * 2003-12-15 2007-12-25 Microsoft Corporation Schema editor extensions
US8949220B2 (en) * 2003-12-19 2015-02-03 Oracle International Corporation Techniques for managing XML data associated with multiple execution units
US7219102B2 (en) * 2003-12-22 2007-05-15 International Business Machines Corporation Method, computer program product, and system converting relational data into hierarchical data structure based upon tagging trees
US7689542B2 (en) * 2004-01-13 2010-03-30 Oracle International Corporation Dynamic return type generation in a database system
US7418456B2 (en) * 2004-01-16 2008-08-26 International Business Machines Corporation Method for defining a metadata schema to facilitate passing data between an extensible markup language document and a hierarchical database
JP4227033B2 (en) * 2004-01-20 2009-02-18 富士通株式会社 Database integrated reference device, database integrated reference method, and database integrated reference program
US7346617B2 (en) * 2004-01-23 2008-03-18 Oracle International Corporation Multi-table access control
US8037102B2 (en) 2004-02-09 2011-10-11 Robert T. and Virginia T. Jenkins Manipulating sets of hierarchical data
CN1560763B (en) * 2004-02-19 2010-05-05 北京大学 Method for translating expandable mark language path inquiry into structure inquiry
US8311974B2 (en) * 2004-02-20 2012-11-13 Oracle International Corporation Modularized extraction, transformation, and loading for a database
US20050188295A1 (en) * 2004-02-25 2005-08-25 Loren Konkus Systems and methods for an extensible administration tool
US20050203931A1 (en) * 2004-03-13 2005-09-15 Robert Pingree Metadata management convergence platforms, systems and methods
US7873685B2 (en) * 2004-05-13 2011-01-18 Pixar System and method for flexible path handling
US7774601B2 (en) 2004-04-06 2010-08-10 Bea Systems, Inc. Method for delegated administration
US7761461B2 (en) * 2004-04-08 2010-07-20 International Business Machines Corporation Method and system for relationship building from XML
US20050234844A1 (en) * 2004-04-08 2005-10-20 Microsoft Corporation Method and system for parsing XML data
US7499915B2 (en) 2004-04-09 2009-03-03 Oracle International Corporation Index for accessing XML data
US7603347B2 (en) * 2004-04-09 2009-10-13 Oracle International Corporation Mechanism for efficiently evaluating operator trees
US7493305B2 (en) * 2004-04-09 2009-02-17 Oracle International Corporation Efficient queribility and manageability of an XML index with path subsetting
WO2005101246A1 (en) * 2004-04-09 2005-10-27 Oracle International Corporation Index for accessing xml data
US7398265B2 (en) * 2004-04-09 2008-07-08 Oracle International Corporation Efficient query processing of XML data using XML index
US7440954B2 (en) 2004-04-09 2008-10-21 Oracle International Corporation Index maintenance for operations involving indexed XML data
US7236989B2 (en) 2004-04-13 2007-06-26 Bea Systems, Inc. System and method for providing lifecycles for custom content in a virtual content repository
US7246138B2 (en) 2004-04-13 2007-07-17 Bea Systems, Inc. System and method for content lifecycles in a virtual content repository that integrates a plurality of content repositories
US20050251512A1 (en) * 2004-04-13 2005-11-10 Bea Systems, Inc. System and method for searching a virtual content repository
US7236990B2 (en) 2004-04-13 2007-06-26 Bea Systems, Inc. System and method for information lifecycle workflow integration
US20050228816A1 (en) * 2004-04-13 2005-10-13 Bea Systems, Inc. System and method for content type versions
US7236975B2 (en) * 2004-04-13 2007-06-26 Bea Systems, Inc. System and method for controlling access to anode in a virtual content repository that integrates a plurality of content repositories
US20060028252A1 (en) * 2004-04-13 2006-02-09 Bea Systems, Inc. System and method for content type management
US7930277B2 (en) * 2004-04-21 2011-04-19 Oracle International Corporation Cost-based optimizer for an XML data repository within a database
US7469256B1 (en) 2004-04-29 2008-12-23 Sap Ag Cached persistent data management through state tracking
US7590639B1 (en) 2004-04-29 2009-09-15 Sap Ag System and method for ordering a database flush sequence at transaction commit
US7653651B1 (en) 2004-04-29 2010-01-26 Sap Ag System and method for transparent persistence management
US9646107B2 (en) 2004-05-28 2017-05-09 Robert T. and Virginia T. Jenkins as Trustee of the Jenkins Family Trust Method and/or system for simplifying tree expressions such as for query reduction
US7516121B2 (en) 2004-06-23 2009-04-07 Oracle International Corporation Efficient evaluation of queries using translation
JP4709213B2 (en) 2004-06-23 2011-06-22 オラクル・インターナショナル・コーポレイション Efficient evaluation of queries using transformations
US7308453B2 (en) * 2004-06-29 2007-12-11 Nokia Corporation Meta-data approach to indexing, retrieval and management of stored messages in a portable communication device
US7882147B2 (en) * 2004-06-30 2011-02-01 Robert T. and Virginia T. Jenkins File location naming hierarchy
US7620632B2 (en) * 2004-06-30 2009-11-17 Skyler Technology, Inc. Method and/or system for performing tree matching
US7885980B2 (en) 2004-07-02 2011-02-08 Oracle International Corporation Mechanism for improving performance on XML over XML data using path subsetting
US8566300B2 (en) 2004-07-02 2013-10-22 Oracle International Corporation Mechanism for efficient maintenance of XML index structures in a database system
US20070208946A1 (en) * 2004-07-06 2007-09-06 Oracle International Corporation High performance secure caching in the mid-tier
US7668806B2 (en) 2004-08-05 2010-02-23 Oracle International Corporation Processing queries against one or more markup language sources
US7685137B2 (en) * 2004-08-06 2010-03-23 Oracle International Corporation Technique of using XMLType tree as the type infrastructure for XML
US7366974B2 (en) * 2004-09-03 2008-04-29 Jp Morgan Chase Bank System and method for managing template attributes
US20060075074A1 (en) * 2004-09-07 2006-04-06 Microsoft Corporation Adaptor migration tool
US20060059210A1 (en) * 2004-09-16 2006-03-16 Macdonald Glynne Generic database structure and related systems and methods for storing data independent of data type
US7657894B2 (en) * 2004-09-29 2010-02-02 Intel Corporation Detecting lock acquisition hierarchy violations in multithreaded programs
US20060072626A1 (en) * 2004-09-29 2006-04-06 Lucent Technologies Inc. Data synchronization in a telecommunication management network
US20090132466A1 (en) * 2004-10-13 2009-05-21 Jp Morgan Chase Bank System and method for archiving data
US7627591B2 (en) 2004-10-29 2009-12-01 Skyler Technology, Inc. Method and/or system for manipulating tree expressions
US7801923B2 (en) 2004-10-29 2010-09-21 Robert T. and Virginia T. Jenkins as Trustees of the Jenkins Family Trust Method and/or system for tagging trees
US7730114B2 (en) * 2004-11-12 2010-06-01 Microsoft Corporation Computer file system
US7627547B2 (en) * 2004-11-29 2009-12-01 Oracle International Corporation Processing path-based database operations
US7882149B2 (en) * 2004-11-30 2011-02-01 Canon Kabushiki Kaisha System and method for future-proofing devices using metaschema
US7636727B2 (en) 2004-12-06 2009-12-22 Skyler Technology, Inc. Enumeration of trees from finite number of nodes
US7630995B2 (en) 2004-11-30 2009-12-08 Skyler Technology, Inc. Method and/or system for transmitting and/or receiving data
US7849106B1 (en) 2004-12-03 2010-12-07 Oracle International Corporation Efficient mechanism to support user defined resource metadata in a database repository
US20060123020A1 (en) * 2004-12-07 2006-06-08 Microsoft Corporation Computer file system allowing ambiguous names
US7392259B2 (en) * 2004-12-14 2008-06-24 Electronics And Telecommunications Research Institute Method and system for supporting XQuery trigger in XML-DBMS based on relational DBMS
US7921076B2 (en) 2004-12-15 2011-04-05 Oracle International Corporation Performing an action in response to a file system event
US8131766B2 (en) * 2004-12-15 2012-03-06 Oracle International Corporation Comprehensive framework to integrate business logic into a repository
US7509359B1 (en) * 2004-12-15 2009-03-24 Unisys Corporation Memory bypass in accessing large data objects in a relational database management system
US7620641B2 (en) * 2004-12-22 2009-11-17 International Business Machines Corporation System and method for context-sensitive decomposition of XML documents based on schemas with reusable element/attribute declarations
US20060136483A1 (en) * 2004-12-22 2006-06-22 International Business Machines Corporation System and method of decomposition of multiple items into the same table-column pair
US7559020B2 (en) * 2004-12-30 2009-07-07 Microsoft Corporation Methods and systems for preserving unknown markup in a strongly typed environment
US8316059B1 (en) 2004-12-30 2012-11-20 Robert T. and Virginia T. Jenkins Enumeration of rooted partial subtrees
US8615530B1 (en) 2005-01-31 2013-12-24 Robert T. and Virginia T. Jenkins as Trustees for the Jenkins Family Trust Method and/or system for tree transformation
US7523131B2 (en) 2005-02-10 2009-04-21 Oracle International Corporation Techniques for efficiently storing and querying in a relational database, XML documents conforming to schemas that contain cyclic constructs
US7444345B2 (en) * 2005-02-15 2008-10-28 International Business Machines Corporation Hierarchical inherited XML DOM
US7681177B2 (en) 2005-02-28 2010-03-16 Skyler Technology, Inc. Method and/or system for transforming between trees and strings
US8356040B2 (en) 2005-03-31 2013-01-15 Robert T. and Virginia T. Jenkins Method and/or system for transforming between trees and arrays
US7305414B2 (en) 2005-04-05 2007-12-04 Oracle International Corporation Techniques for efficient integration of text searching with queries over XML data
WO2006108069A2 (en) * 2005-04-06 2006-10-12 Google, Inc. Searching through content which is accessible through web-based forms
US8458201B2 (en) * 2005-04-08 2013-06-04 International Business Machines Corporation Method and apparatus for mapping structured query language schema to application specific business objects in an integrated application environment
US8145653B2 (en) * 2005-04-08 2012-03-27 International Business Machines Corporation Using schemas to generate application specific business objects for use in an integration broker
US20060230048A1 (en) * 2005-04-08 2006-10-12 International Business Machines Corporation Method and apparatus for object discovery agent based mapping of application specific markup language schemas to application specific business objects in an integrated application environment
US7685150B2 (en) * 2005-04-19 2010-03-23 Oracle International Corporation Optimization of queries over XML views that are based on union all operators
US20060235839A1 (en) * 2005-04-19 2006-10-19 Muralidhar Krishnaprasad Using XML as a common parser architecture to separate parser from compiler
US7949941B2 (en) 2005-04-22 2011-05-24 Oracle International Corporation Optimizing XSLT based on input XML document structure description and translating XSLT into equivalent XQuery expressions
US7899821B1 (en) 2005-04-29 2011-03-01 Karl Schiffmann Manipulation and/or analysis of hierarchical data
US7454435B2 (en) * 2005-05-03 2008-11-18 Microsoft Corporation Systems and methods for granular changes within a data storage system
US7496588B2 (en) 2005-06-27 2009-02-24 Siperian, Inc. Method and apparatus for data integration and management
US7930680B2 (en) * 2005-07-08 2011-04-19 Microsoft Corporation XML schema design for environment-specific types based on base types
US8166059B2 (en) * 2005-07-08 2012-04-24 Oracle International Corporation Optimization of queries on a repository based on constraints on how the data is stored in the repository
US20070016605A1 (en) * 2005-07-18 2007-01-18 Ravi Murthy Mechanism for computing structural summaries of XML document collections in a database system
US8762410B2 (en) * 2005-07-18 2014-06-24 Oracle International Corporation Document level indexes for efficient processing in multiple tiers of a computer system
US7406478B2 (en) * 2005-08-11 2008-07-29 Oracle International Corporation Flexible handling of datetime XML datatype in a database system
US7814065B2 (en) * 2005-08-16 2010-10-12 Oracle International Corporation Affinity-based recovery/failover in a cluster environment
US8065606B1 (en) 2005-09-16 2011-11-22 Jpmorgan Chase Bank, N.A. System and method for automating document generation
US20070067343A1 (en) * 2005-09-21 2007-03-22 International Business Machines Corporation Determining the structure of relations and content of tuples from XML schema components
US7818344B2 (en) 2005-09-26 2010-10-19 Bea Systems, Inc. System and method for providing nested types for content management
US20070073638A1 (en) * 2005-09-26 2007-03-29 Bea Systems, Inc. System and method for using soft links to managed content
US7752205B2 (en) 2005-09-26 2010-07-06 Bea Systems, Inc. Method and system for interacting with a virtual content repository
US7788590B2 (en) 2005-09-26 2010-08-31 Microsoft Corporation Lightweight reference user interface
US7917537B2 (en) 2005-09-26 2011-03-29 Oracle International Corporation System and method for providing link property types for content management
US7953734B2 (en) 2005-09-26 2011-05-31 Oracle International Corporation System and method for providing SPI extensions for content management system
US7992085B2 (en) 2005-09-26 2011-08-02 Microsoft Corporation Lightweight reference user interface
US7877379B2 (en) * 2005-09-30 2011-01-25 Oracle International Corporation Delaying evaluation of expensive expressions in a query
CN100407199C (en) * 2005-09-30 2008-07-30 南京大学 Lookup method of protecting consistency of contour based on information technology products of relational database
US8554789B2 (en) * 2005-10-07 2013-10-08 Oracle International Corporation Managing cyclic constructs of XML schema in a rdbms
US9367642B2 (en) * 2005-10-07 2016-06-14 Oracle International Corporation Flexible storage of XML collections within an object-relational database
US8024368B2 (en) * 2005-10-07 2011-09-20 Oracle International Corporation Generating XML instances from flat files
US8073841B2 (en) 2005-10-07 2011-12-06 Oracle International Corporation Optimizing correlated XML extracts
US8356053B2 (en) 2005-10-20 2013-01-15 Oracle International Corporation Managing relationships between resources stored within a repository
US8949455B2 (en) 2005-11-21 2015-02-03 Oracle International Corporation Path-caching mechanism to improve performance of path-related operations in a repository
US20070118503A1 (en) * 2005-11-22 2007-05-24 Connelly Stephen P Methods and systems for providing data to a database
JP4328762B2 (en) * 2005-12-06 2009-09-09 キヤノン株式会社 Information processing apparatus, information processing method, program, and storage medium
US7774300B2 (en) * 2005-12-09 2010-08-10 International Business Machines Corporation System and method for data model and content migration in content management applications
US7933928B2 (en) * 2005-12-22 2011-04-26 Oracle International Corporation Method and mechanism for loading XML documents into memory
US20070214179A1 (en) * 2006-03-10 2007-09-13 Khanh Hoang Searching, filtering, creating, displaying, and managing entity relationships across multiple data hierarchies through a user interface
US8150803B2 (en) 2006-01-03 2012-04-03 Informatica Corporation Relationship data management
US7523121B2 (en) * 2006-01-03 2009-04-21 Siperian, Inc. Relationship data management
US7730032B2 (en) 2006-01-12 2010-06-01 Oracle International Corporation Efficient queriability of version histories in a repository
US7849091B1 (en) * 2006-01-25 2010-12-07 At&T Intellectual Property Ii, L.P. Meta-data indexing for XPath location steps
US7519606B2 (en) * 2006-01-31 2009-04-14 International Business Machines Corporation Schema mapping specification framework
US8010909B1 (en) * 2006-02-06 2011-08-30 Microsoft Corporation Derived hierarchy methods and system for definition, visualization and editing of data
US7617198B2 (en) * 2006-02-09 2009-11-10 Sap Ag Generation of XML search profiles
US7529758B2 (en) * 2006-02-10 2009-05-05 International Business Machines Corporation Method for pre-processing mapping information for efficient decomposition of XML documents
US9229967B2 (en) * 2006-02-22 2016-01-05 Oracle International Corporation Efficient processing of path related operations on data organized hierarchically in an RDBMS
US9495356B2 (en) * 2006-03-30 2016-11-15 International Business Machines Corporation Automated interactive visual mapping utility and method for validation and storage of XML data
US20070239762A1 (en) * 2006-03-30 2007-10-11 International Business Machines Corporation Automated interactive visual mapping utility and method for transformation and storage of XML data
US8880506B2 (en) * 2009-10-16 2014-11-04 Oracle International Corporation Leveraging structured XML index data for evaluating database queries
US20070250527A1 (en) * 2006-04-19 2007-10-25 Ravi Murthy Mechanism for abridged indexes over XML document collections
US7711755B2 (en) * 2006-05-17 2010-05-04 Topcoder, Inc. Dynamic XSD enumeration
US8510292B2 (en) * 2006-05-25 2013-08-13 Oracle International Coporation Isolation for applications working on shared XML data
US10318752B2 (en) * 2006-05-26 2019-06-11 Oracle International Corporation Techniques for efficient access control in a database system
US7730080B2 (en) * 2006-06-23 2010-06-01 Oracle International Corporation Techniques of rewriting descendant and wildcard XPath using one or more of SQL OR, UNION ALL, and XMLConcat() construct
US7499909B2 (en) * 2006-07-03 2009-03-03 Oracle International Corporation Techniques of using a relational caching framework for efficiently handling XML queries in the mid-tier data caching
US7801856B2 (en) * 2006-08-09 2010-09-21 Oracle International Corporation Using XML for flexible replication of complex types
US7856415B2 (en) * 2006-09-01 2010-12-21 Dell Products L.P. System and method for mapping events into a data structure
CN101512523A (en) 2006-09-12 2009-08-19 国际商业机器公司 System and method for dynamic context-sensitive integration of content into a web portal application
US8346725B2 (en) * 2006-09-15 2013-01-01 Oracle International Corporation Evolution of XML schemas involving partial data copy
US8484326B2 (en) * 2006-09-28 2013-07-09 Rockstar Bidco Lp Application server billing
US8463852B2 (en) 2006-10-06 2013-06-11 Oracle International Corporation Groupware portlets for integrating a portal with groupware systems
US7827177B2 (en) * 2006-10-16 2010-11-02 Oracle International Corporation Managing compound XML documents in a repository
US7933935B2 (en) * 2006-10-16 2011-04-26 Oracle International Corporation Efficient partitioning technique while managing large XML documents
US7797310B2 (en) * 2006-10-16 2010-09-14 Oracle International Corporation Technique to estimate the cost of streaming evaluation of XPaths
US20080092037A1 (en) * 2006-10-16 2008-04-17 Oracle International Corporation Validation of XML content in a streaming fashion
US9183321B2 (en) 2006-10-16 2015-11-10 Oracle International Corporation Managing compound XML documents in a repository
US8010889B2 (en) * 2006-10-20 2011-08-30 Oracle International Corporation Techniques for efficient loading of binary XML data
US8104076B1 (en) 2006-11-13 2012-01-24 Jpmorgan Chase Bank, N.A. Application access control system
US20080120283A1 (en) * 2006-11-17 2008-05-22 Oracle International Corporation Processing XML data stream(s) using continuous queries in a data stream management system
US8478760B2 (en) * 2006-11-17 2013-07-02 Oracle International Corporation Techniques of efficient query over text, image, audio, video and other domain specific data in XML using XML table index with integration of text index and other domain specific indexes
US9436779B2 (en) * 2006-11-17 2016-09-06 Oracle International Corporation Techniques of efficient XML query using combination of XML table index and path/value index
US8307348B2 (en) * 2006-12-05 2012-11-06 Microsoft Corporation Simplified representation of XML schema structures
US20080147615A1 (en) * 2006-12-18 2008-06-19 Oracle International Corporation Xpath based evaluation for content stored in a hierarchical database repository using xmlindex
US7840590B2 (en) * 2006-12-18 2010-11-23 Oracle International Corporation Querying and fragment extraction within resources in a hierarchical repository
US7934207B2 (en) * 2006-12-19 2011-04-26 Microsoft Corporation Data schemata in programming language contracts
US8522255B2 (en) * 2006-12-29 2013-08-27 Sap Ag Multi-tiered message parsing
US20080163197A1 (en) * 2006-12-30 2008-07-03 Sap Ag Multi-product installation tool database architecture
CN101216824B (en) * 2007-01-05 2010-04-21 冯卫国 Method for publishing tree -type structure database as distributed XML database
US20080189311A1 (en) * 2007-02-01 2008-08-07 Microsoft Corporation Visual controls for stored procedure and object relational class development
US8214797B2 (en) * 2007-02-01 2012-07-03 Microsoft Corporation Visual association creation for object relational class development
US7979476B2 (en) * 2007-02-07 2011-07-12 Canon Kabushiki Kaisha Information processing apparatus, control method therefor, program, and storage medium
US7631003B2 (en) * 2007-02-20 2009-12-08 Microsoft Corporation Automated transformation for style normalization of schemas
US20080222515A1 (en) * 2007-02-26 2008-09-11 Microsoft Corporation Parameterized types and elements in xml schema
US7883014B2 (en) * 2007-03-26 2011-02-08 Robert Kevin Runbeck Acceptance tray for an election ballot printing system
US7860899B2 (en) * 2007-03-26 2010-12-28 Oracle International Corporation Automatically determining a database representation for an abstract datatype
US8024701B2 (en) * 2007-03-27 2011-09-20 Microsoft Corporation Visual creation of object/relational constructs
US7668860B2 (en) * 2007-04-02 2010-02-23 Business Objects Software Ltd. Apparatus and method for constructing and using a semantic abstraction for querying hierarchical data
US8396909B1 (en) * 2007-04-12 2013-03-12 United Services Automobile Association (Usaa) Electronic file management hierarchical structure
US8375072B1 (en) 2007-04-12 2013-02-12 United Services Automobile Association (Usaa) Electronic file management hierarchical structure
US7765241B2 (en) * 2007-04-20 2010-07-27 Microsoft Corporation Describing expected entity relationships in a model
US20090081545A1 (en) * 2007-06-28 2009-03-26 Ultralife Corporation HIGH CAPACITY AND HIGH RATE LITHIUM CELLS WITH CFx-MnO2 HYBRID CATHODE
US7904809B2 (en) * 2007-06-29 2011-03-08 Microsoft Corporation Model-based editors for dynamic validation
US7836066B2 (en) * 2007-07-12 2010-11-16 Oracle International Corporation Using SQL extensibility for processing dynamically typed XML data in XQuery queries
US7836098B2 (en) 2007-07-13 2010-11-16 Oracle International Corporation Accelerating value-based lookup of XML document in XQuery
US8271477B2 (en) * 2007-07-20 2012-09-18 Informatica Corporation Methods and systems for accessing data
US9760839B1 (en) 2007-07-25 2017-09-12 United Services Automobile Association (Usaa) Electronic recording statement management
US7840609B2 (en) * 2007-07-31 2010-11-23 Oracle International Corporation Using sibling-count in XML indexes to optimize single-path queries
US7979420B2 (en) * 2007-10-16 2011-07-12 Oracle International Corporation Handling silent relations in a data stream management system
US8296316B2 (en) * 2007-10-17 2012-10-23 Oracle International Corporation Dynamically sharing a subtree of operators in a data stream management system operating on existing queries
US7991768B2 (en) 2007-11-08 2011-08-02 Oracle International Corporation Global query normalization to improve XML index based rewrites for path subsetted index
US8543898B2 (en) * 2007-11-09 2013-09-24 Oracle International Corporation Techniques for more efficient generation of XML events from XML data sources
US8250062B2 (en) * 2007-11-09 2012-08-21 Oracle International Corporation Optimized streaming evaluation of XML queries
US9842090B2 (en) * 2007-12-05 2017-12-12 Oracle International Corporation Efficient streaming evaluation of XPaths on binary-encoded XML schema-based documents
US9330149B2 (en) * 2007-12-18 2016-05-03 Oracle International Corporation Techniques for query and DML over relational tables using spreadsheet applications
US20090182703A1 (en) * 2008-01-16 2009-07-16 Microsoft Corporation Exposing relational database interfaces on xml data
US8527867B2 (en) * 2008-01-18 2013-09-03 Oracle International Corporation Enabling users to edit very large XML data
US7996444B2 (en) * 2008-02-18 2011-08-09 International Business Machines Corporation Creation of pre-filters for more efficient X-path processing
US8515946B2 (en) * 2008-02-28 2013-08-20 Microsoft Corporation Location description for federation and discoverability
US8868482B2 (en) * 2008-03-20 2014-10-21 Oracle International Corporation Inferring schemas from XML document collections
US20090248716A1 (en) * 2008-03-31 2009-10-01 Caterpillar Inc. Hierarchy creation and management tool
US8224873B1 (en) 2008-05-22 2012-07-17 Informatica Corporation System and method for flexible security access management in an enterprise
US8166071B1 (en) 2008-05-22 2012-04-24 Informatica Corporation System and method for efficiently securing enterprise data resources
US8429196B2 (en) * 2008-06-06 2013-04-23 Oracle International Corporation Fast extraction of scalar values from binary encoded XML
US8024325B2 (en) 2008-06-25 2011-09-20 Oracle International Corporation Estimating the cost of XML operators for binary XML storage
US8972463B2 (en) * 2008-07-25 2015-03-03 International Business Machines Corporation Method and apparatus for functional integration of metadata
US9110970B2 (en) * 2008-07-25 2015-08-18 International Business Machines Corporation Destructuring and restructuring relational data
US8943087B2 (en) * 2008-07-25 2015-01-27 International Business Machines Corporation Processing data from diverse databases
US8073843B2 (en) * 2008-07-29 2011-12-06 Oracle International Corporation Mechanism for deferred rewrite of multiple XPath evaluations over binary XML
US20100030727A1 (en) * 2008-07-29 2010-02-04 Sivasankaran Chandrasekar Technique For Using Occurrence Constraints To Optimize XML Index Access
US7958112B2 (en) 2008-08-08 2011-06-07 Oracle International Corporation Interleaving query transformations for XML indexes
US8145806B2 (en) 2008-09-19 2012-03-27 Oracle International Corporation Storage-side storage request management
US8949285B2 (en) * 2008-09-19 2015-02-03 Ciena Corporation Systems and methods for handling performance monitoring data
CN101727465B (en) * 2008-11-03 2011-12-21 中国移动通信集团公司 Methods for establishing and inquiring index of distributed column storage database, device and system thereof
US8904276B2 (en) 2008-11-17 2014-12-02 At&T Intellectual Property I, L.P. Partitioning of markup language documents
US9495475B2 (en) * 2008-11-21 2016-11-15 Sap Se Method of representing an XML schema definition and data within a relational database management system using a reusable custom-defined nestable compound data type
US8126932B2 (en) * 2008-12-30 2012-02-28 Oracle International Corporation Indexing strategy with improved DML performance and space usage for node-aware full-text search over XML
US8219563B2 (en) * 2008-12-30 2012-07-10 Oracle International Corporation Indexing mechanism for efficient node-aware full-text search over XML
US8935293B2 (en) * 2009-03-02 2015-01-13 Oracle International Corporation Framework for dynamically generating tuple and page classes
US8380702B2 (en) * 2009-03-10 2013-02-19 Oracle International Corporation Loading an index with minimal effect on availability of applications using the corresponding table
US8176063B2 (en) * 2009-03-12 2012-05-08 Siemens Product Lifecycle Management Software Inc. System and method for non-overwriting extensible mapping
US20100250591A1 (en) * 2009-03-30 2010-09-30 Morris Robert P Methods, Systems, And Computer Program Products For Providing Access To Metadata For An Identified Resource
US20100250729A1 (en) * 2009-03-30 2010-09-30 Morris Robert P Method and System For Providing Access To Metadata Of A Network Accessible Resource
US8560941B2 (en) * 2009-04-08 2013-10-15 Microsoft Corporation Schema based user interface mechanisms
US8478801B2 (en) * 2009-05-20 2013-07-02 Vmware, Inc. Efficient reconstruction of virtual disk hierarchies across storage domains
US9497248B2 (en) 2009-06-02 2016-11-15 International Business Machines Corporation System for enabling rich network applications
US8423512B2 (en) * 2009-09-08 2013-04-16 Oracle International Corporation Leveraging XML capabilities of a database to enhance handling of document data
CN102043802B (en) * 2009-10-16 2013-09-25 上海飞机制造有限公司 Method for searching XML (Extensive Makeup Language) key words based on structural abstract
US9424365B2 (en) * 2009-10-30 2016-08-23 Oracle International Corporation XPath-based creation of relational indexes and constraints over XML data stored in relational tables
US8244735B2 (en) 2010-05-03 2012-08-14 International Business Machines Corporation Efficient and scalable data evolution with column oriented databases
US8296326B1 (en) * 2010-08-20 2012-10-23 Cellco Partnership Grid-based user interface techniques for interacting with nested hierarchical data structures
US20120071155A1 (en) 2010-09-17 2012-03-22 Oracle International Corporation Method and Apparatus for Binding Mobile Device Functionality to an Application Definition
US9741060B2 (en) 2010-09-17 2017-08-22 Oracle International Corporation Recursive navigation in mobile CRM
US9229947B2 (en) 2010-09-27 2016-01-05 Fisher-Rosemount Systems, Inc. Methods and apparatus to manage process data
US8818963B2 (en) 2010-10-29 2014-08-26 Microsoft Corporation Halloween protection in a multi-version database system
CN102467607A (en) * 2010-11-11 2012-05-23 江苏大学 Medical advice and drug administration reminding device
US8583652B2 (en) 2010-11-30 2013-11-12 Oracle International Corporation Efficiently registering a relational schema
US9038177B1 (en) 2010-11-30 2015-05-19 Jpmorgan Chase Bank, N.A. Method and system for implementing multi-level data fusion
US8489649B2 (en) 2010-12-13 2013-07-16 Oracle International Corporation Extensible RDF databases
US9182757B2 (en) 2011-03-30 2015-11-10 Fisher-Rosemount Systems, Inc. Methods and apparatus to transmit device description files to a host
US9292588B1 (en) 2011-07-20 2016-03-22 Jpmorgan Chase Bank, N.A. Safe storing data for disaster recovery
CN102323956B (en) * 2011-09-29 2014-12-17 用友软件股份有限公司 Data management device and method
US9020981B2 (en) * 2011-09-30 2015-04-28 Comprehend Systems, Inc. Systems and methods for generating schemas that represent multiple data sources
WO2013096887A1 (en) 2011-12-23 2013-06-27 Amiato, Inc. Scalable analysis platform for semi-structured data
US8676788B2 (en) * 2012-03-13 2014-03-18 International Business Machines Corporation Structured large object (LOB) data
CN102662997B (en) * 2012-03-15 2015-09-16 播思通讯技术(北京)有限公司 A kind of storing X ML data are to the method for relational database
US8812542B1 (en) * 2012-03-30 2014-08-19 Emc Corporation On-the-fly determining of alert relationships in a distributed system
US9251181B2 (en) * 2012-06-18 2016-02-02 International Business Machines Corporation Dynamic map template discovery and map creation
US9646028B2 (en) * 2012-08-31 2017-05-09 Facebook, Inc. Graph query logic
JP6505600B2 (en) * 2012-09-07 2019-04-24 アメリカン ケミカル ソサイエティ Automatic configuration evaluator
CN104969221B (en) * 2013-02-07 2018-05-11 慧与发展有限责任合伙企业 Semi-structured data in formatted data base
US10540373B1 (en) 2013-03-04 2020-01-21 Jpmorgan Chase Bank, N.A. Clause library manager
US9195712B2 (en) 2013-03-12 2015-11-24 Microsoft Technology Licensing, Llc Method of converting query plans to native code
US10489365B2 (en) * 2013-03-14 2019-11-26 Oracle International Corporation Predicate offload of large objects
US10642837B2 (en) 2013-03-15 2020-05-05 Oracle International Corporation Relocating derived cache during data rebalance to maintain application performance
CA3078018C (en) 2013-03-15 2023-08-22 Amazon Technologies, Inc. Scalable analysis platform for semi-structured data
US11074231B1 (en) * 2013-03-15 2021-07-27 Informatica Llc Validating modifications to mapping statements for processing hierarchical data structures
US10528590B2 (en) 2014-09-26 2020-01-07 Oracle International Corporation Optimizing a query with extrema function using in-memory data summaries on the storage server
EP2992447A4 (en) 2013-04-30 2016-09-21 Hewlett Packard Entpr Dev Lp Database table column annotation
US9418113B2 (en) 2013-05-30 2016-08-16 Oracle International Corporation Value based windows on relations in continuous data streams
GB2521198A (en) * 2013-12-13 2015-06-17 Ibm Refactoring of databases to include soft type information
JP5764226B2 (en) * 2014-02-17 2015-08-12 前田建設工業株式会社 Information processing apparatus, information processing method, program, and medium
US10474645B2 (en) 2014-02-24 2019-11-12 Microsoft Technology Licensing, Llc Automatically retrying transactions with split procedure execution
US10248682B2 (en) 2015-02-20 2019-04-02 Scality, S.A. Object storage system capable of performing snapshots, branches and locking
US9524302B2 (en) * 2014-03-05 2016-12-20 Scality, S.A. Distributed consistent database implementation within an object store
US10261960B2 (en) 2014-09-12 2019-04-16 Scality, S.A. Snapshots and forks of storage systems using distributed consistent databases implemented within an object store
US10366070B2 (en) 2015-02-20 2019-07-30 Scality S.A. Locking and I/O improvements of systems built with distributed consistent database implementations within an object store
US9779118B2 (en) * 2014-03-17 2017-10-03 Kenshoo Ltd. Live database schema tree change
US10635645B1 (en) * 2014-05-04 2020-04-28 Veritas Technologies Llc Systems and methods for maintaining aggregate tables in databases
US10599860B2 (en) * 2014-05-22 2020-03-24 Tata Consultancy Services Limited Accessing enterprise data
US9244978B2 (en) 2014-06-11 2016-01-26 Oracle International Corporation Custom partitioning of a data stream
US9754048B1 (en) * 2014-10-06 2017-09-05 Google Inc. Storing semi-structured data
US10333696B2 (en) 2015-01-12 2019-06-25 X-Prime, Inc. Systems and methods for implementing an efficient, scalable homomorphic transformation of encrypted data with minimal data expansion and improved processing efficiency
US10067953B2 (en) * 2015-05-08 2018-09-04 International Business Machines Corporation Indexing a chameleon schema
US9916359B2 (en) * 2015-06-01 2018-03-13 Sap Se Indexing dynamic hierarchical data
US10872065B1 (en) * 2015-08-03 2020-12-22 Intelligence Designs, LLC System for managing relational databases using XML objects
US10169351B2 (en) * 2015-08-19 2019-01-01 International Business Machines Corporation Merging directory information from a user directory to a common directory
CN105930474A (en) * 2016-04-26 2016-09-07 南京国电南自电网自动化有限公司 Database technology-based dynamic model construction method
US10733562B2 (en) * 2016-06-03 2020-08-04 Arkadiusz Binder Method, device, system of model-driven engineering of efficient industrial automation process and business process modeling with BPMN using native computation of XML schemas and objects
US11657056B2 (en) * 2016-09-15 2023-05-23 Oracle International Corporation Data serialization in a distributed event processing system
GB201615963D0 (en) * 2016-09-20 2016-11-02 Ibm Relational operations between db tables and application tables
US10891273B2 (en) 2016-11-11 2021-01-12 Sap Se Database container delivery infrastructure
US10025568B2 (en) * 2016-11-11 2018-07-17 Sap Se Database object lifecycle management
US10558529B2 (en) 2016-11-11 2020-02-11 Sap Se Database object delivery infrastructure
US10909090B2 (en) 2016-11-11 2021-02-02 Sap Se Database proxy object delivery infrastructure
CN106802938A (en) * 2016-12-30 2017-06-06 厦门南讯软件科技有限公司 Client's hierarchical attribute dynamic creation method based on modularization
CN106909673A (en) * 2017-03-01 2017-06-30 国电南瑞科技股份有限公司 A kind of implementation method of the data memory module for following database interface standard
RU2650032C1 (en) * 2017-03-20 2018-04-06 Алексей Петрович Семенов Electronic database and method of its formation
US11120027B2 (en) 2017-09-06 2021-09-14 Rovi Guides, Inc. Systems and methods for identifying a category of a search term and providing search results subject to the identified category
CN107657036A (en) * 2017-09-29 2018-02-02 北京酷我科技有限公司 A kind of production method of database object placement model
US11086876B2 (en) 2017-09-29 2021-08-10 Oracle International Corporation Storing derived summaries on persistent memory of a storage device
JP6890557B2 (en) * 2018-01-17 2021-06-18 株式会社日立製作所 Analytical model creation system, programming device and analytical model creation method
CN108804346A (en) * 2018-05-30 2018-11-13 广东思诺伟智能技术有限公司 A kind of method that battery SOC data are stored in FLASH memory
CN108875077B (en) * 2018-07-10 2021-02-09 上海达梦数据库有限公司 Column storage method and device of database, server and storage medium
US11423060B2 (en) * 2018-10-04 2022-08-23 Oracle International Corporation Storing and versioning hierarchical data in a binary format
US11204940B2 (en) * 2018-11-16 2021-12-21 International Business Machines Corporation Data replication conflict processing after structural changes to a database
US11550785B2 (en) 2019-04-19 2023-01-10 Oracle International Corporation Bidirectional mapping of hierarchical data to database object types
CN110232063A (en) * 2019-04-19 2019-09-13 平安科技(深圳)有限公司 Hierarchical data querying method, device, computer equipment and storage medium
TWI780333B (en) * 2019-06-03 2022-10-11 緯創資通股份有限公司 Method for dynamically processing and playing multimedia files and multimedia play apparatus
US10990596B2 (en) 2019-06-14 2021-04-27 Oracle International Corporation Non-disruptive referencing of special purpose operators for database management systems
US11200234B2 (en) 2019-06-14 2021-12-14 Oracle International Corporation Non-disruptive dynamic ad-hoc database catalog services
CN110471650B (en) * 2019-07-11 2022-08-09 新华三大数据技术有限公司 Web Service publishing method, device and server
US11086829B2 (en) * 2020-01-02 2021-08-10 International Business Machines Corporation Comparing schema definitions using sampling
CN111241065B (en) * 2020-01-13 2024-01-30 大汉软件股份有限公司 Database adaptation development and operation method supporting domestic database
CN111708772A (en) * 2020-06-18 2020-09-25 辽宁振兴银行股份有限公司 Operation method for reducing database redundancy and improving operation efficiency
CN111813555B (en) * 2020-07-21 2022-02-15 国网湖南省电力有限公司 Super-fusion infrastructure layered resource management system based on internet technology
CN112115125A (en) * 2020-09-27 2020-12-22 北京人大金仓信息技术股份有限公司 Database access object name resolution method and device and electronic equipment
CN113505269B (en) * 2021-07-02 2024-03-29 卡斯柯信号(成都)有限公司 Binary file detection method and device based on XML
US20240037074A1 (en) * 2022-07-29 2024-02-01 Oracle International Corporation Method and system to implement directory reads for a database file system

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2001059602A1 (en) 2000-02-11 2001-08-16 Acta Technologies, Inc. Nested relational data model
WO2001061566A1 (en) 2000-02-16 2001-08-23 Verizon Laboratories Inc. System and method for automatic loading of an xml document defined by a document-type definition into a relational database including the generation of a relational schema therefor

Family Cites Families (114)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US93672A (en) * 1869-08-17 Improved clothes-pin
US65659A (en) * 1867-06-11 evinger
JPS6386026A (en) * 1986-09-30 1988-04-16 Matsushita Electric Ind Co Ltd Construction of relational data base
JPH0194429A (en) * 1987-10-06 1989-04-13 Nec Corp Hierarchical retrieving system in relational-type data base
JPH03238535A (en) * 1990-02-15 1991-10-24 Nec Corp Table and data relation management system for relational data base management system
US5257365A (en) 1990-03-16 1993-10-26 Powers Frederick A Database system with multi-dimensional summary search tree nodes for reducing the necessity to access records
US5295261A (en) 1990-07-27 1994-03-15 Pacific Bell Corporation Hybrid database structure linking navigational fields having a hierarchial database structure to informational fields having a relational database structure
US5317742A (en) * 1991-06-21 1994-05-31 Racal-Datacom, Inc. Dynamic translation of network management primitives to queries to a database
JPH05233393A (en) * 1992-02-21 1993-09-10 Nippon Denki Joho Service Kk System for processing hierarchical structure data
JPH0667951A (en) * 1992-05-20 1994-03-11 Nec Corp Database management system
US5467471A (en) 1993-03-10 1995-11-14 Bader; David A. Maintaining databases by means of hierarchical genealogical table
US5956715A (en) 1994-12-13 1999-09-21 Microsoft Corporation Method and system for controlling user access to a resource in a networked computing environment
CA2167790A1 (en) 1995-01-23 1996-07-24 Donald S. Maier Relational database system and method with high data availability during table data restructuring
US5724577A (en) 1995-06-07 1998-03-03 Lockheed Martin Corporation Method for operating a computer which searches a relational database organizer using a hierarchical database outline
SE504472C2 (en) 1995-06-22 1997-02-17 Abb Flexible Automation As Color feeding system for spray painting robot
US5960194A (en) 1995-09-11 1999-09-28 International Business Machines Corporation Method for generating a multi-tiered index for partitioned data
US5734887A (en) 1995-09-29 1998-03-31 International Business Machines Corporation Method and apparatus for logical data access to a physical relational database
US5893109A (en) 1996-03-15 1999-04-06 Inso Providence Corporation Generation of chunks of a long document for an electronic book system
US5893104A (en) 1996-07-09 1999-04-06 Oracle Corporation Method and system for processing queries in a database system using index structures that are not native to the database system
US6208993B1 (en) 1996-07-26 2001-03-27 Ori Software Development Ltd. Method for organizing directories
US5950188A (en) * 1996-11-14 1999-09-07 Sybase, Inc. Database system with methods for executing system-created internal SQL command statements
US5987506A (en) 1996-11-22 1999-11-16 Mangosoft Corporation Remote access and geographically distributed computers in a globally addressable storage environment
US5878415A (en) 1997-03-20 1999-03-02 Novell, Inc. Controlling access to objects in a hierarchical database
US5983215A (en) 1997-05-08 1999-11-09 The Trustees Of Columbia University In The City Of New York System and method for performing joins and self-joins in a database system
JPH10307743A (en) * 1997-05-09 1998-11-17 Nippon Telegr & Teleph Corp <Ntt> Method and device for flexible retrieval from plural data bases
JP3777025B2 (en) 1997-08-20 2006-05-24 インターナショナル・ビジネス・マシーンズ・コーポレーション System resource display device and method thereof
GB2329044B (en) * 1997-09-05 2002-10-09 Ibm Data retrieval system
US6141655A (en) 1997-09-23 2000-10-31 At&T Corp Method and apparatus for optimizing and structuring data by designing a cube forest data structure for hierarchically split cube forest template
US5974407A (en) 1997-09-29 1999-10-26 Sacks; Jerome E. Method and apparatus for implementing a hierarchical database management system (HDBMS) using a relational database management system (RDBMS) as the implementing apparatus
JPH11102369A (en) * 1997-09-29 1999-04-13 Fujitsu Ltd Data base retrieval device and program storage medium
US6038563A (en) 1997-10-31 2000-03-14 Sun Microsystems, Inc. System and method for restricting database access to managed object information using a permissions table that specifies access rights corresponding to user access rights to the managed objects
US5999941A (en) 1997-11-25 1999-12-07 Micron Electronics, Inc. Database access using active server pages
US6003040A (en) 1998-01-23 1999-12-14 Mital; Vijay Apparatus and method for storing, navigating among and adding links between data items in computer databases
US6012067A (en) 1998-03-02 2000-01-04 Sarkar; Shyam Sundar Method and apparatus for storing and manipulating objects in a plurality of relational data managers on the web
US6356920B1 (en) 1998-03-09 2002-03-12 X-Aware, Inc Dynamic, hierarchical data exchange system
JPH11296541A (en) 1998-04-14 1999-10-29 Fujitsu Ltd Structured data management system, and computer-readable recording medium recorded with structured data managing program
JPH11306071A (en) * 1998-04-16 1999-11-05 Fujitsu Ltd Hierarchy data management system and hierarchy data management program storage medium
US6240407B1 (en) 1998-04-29 2001-05-29 International Business Machines Corp. Method and apparatus for creating an index in a database system
US6772350B1 (en) 1998-05-15 2004-08-03 E.Piphany, Inc. System and method for controlling access to resources in a distributed environment
US6263332B1 (en) 1998-08-14 2001-07-17 Vignette Corporation System and method for query processing of structured documents
US6487546B1 (en) 1998-08-27 2002-11-26 Oracle Corporation Apparatus and method for aggregate indexes
US6269380B1 (en) * 1998-08-31 2001-07-31 Xerox Corporation Property based mechanism for flexibility supporting front-end and back-end components having different communication protocols
US6718322B1 (en) 1998-10-02 2004-04-06 Ncr Corporation SQL-based analytic algorithm for rule induction
US6584459B1 (en) 1998-10-08 2003-06-24 International Business Machines Corporation Database extender for storing, querying, and retrieving structured documents
US6366934B1 (en) * 1998-10-08 2002-04-02 International Business Machines Corporation Method and apparatus for querying structured documents using a database extender
US6279007B1 (en) 1998-11-30 2001-08-21 Microsoft Corporation Architecture for managing query friendly hierarchical values
US6918082B1 (en) 1998-12-17 2005-07-12 Jeffrey M. Gross Electronic document proofing system
US6704739B2 (en) * 1999-01-04 2004-03-09 Adobe Systems Incorporated Tagging data assets
US6370537B1 (en) 1999-01-14 2002-04-09 Altoweb, Inc. System and method for the manipulation and display of structured data
US6154741A (en) 1999-01-29 2000-11-28 Feldman; Daniel J. Entitlement management and access control system
US6427123B1 (en) 1999-02-18 2002-07-30 Oracle Corporation Hierarchical indexing for accessing hierarchically organized information in a relational system
US7366708B2 (en) * 1999-02-18 2008-04-29 Oracle Corporation Mechanism to efficiently index structured data that provides hierarchical access in a relational database system
HK1020419A2 (en) * 1999-03-16 2000-03-17 Shi Piu Joseph Fong Frame model for universal database in database reengineering and integration
JP2000267906A (en) * 1999-03-19 2000-09-29 Mitsubishi Electric Corp Database model converting method
US6341289B1 (en) 1999-05-06 2002-01-22 International Business Machines Corporation Object identity and partitioning for user defined extents
US6343287B1 (en) 1999-05-19 2002-01-29 Sun Microsystems, Inc. External data store link for a profile service
US20020124100A1 (en) 1999-05-20 2002-09-05 Jeffrey B Adams Method and apparatus for access to, and delivery of, multimedia information
US6496842B1 (en) 1999-05-28 2002-12-17 Survol Interactive Technologies Navigating heirarchically organized information
US6470344B1 (en) 1999-05-29 2002-10-22 Oracle Corporation Buffering a hierarchical index of multi-dimensional data
US7472349B1 (en) 1999-06-01 2008-12-30 Oracle International Corporation Dynamic services infrastructure for allowing programmatic access to internet and other resources
US6574655B1 (en) 1999-06-29 2003-06-03 Thomson Licensing Sa Associative management of multimedia assets and associated resources using multi-domain agent-based communication between heterogeneous peers
US6199195B1 (en) * 1999-07-08 2001-03-06 Science Application International Corporation Automatically generated objects within extensible object frameworks and links to enterprise resources
US6754661B1 (en) 1999-07-13 2004-06-22 Microsoft Corporation Hierarchical storage systems for holding evidentiary objects and methods of creating and operating upon hierarchical storage systems
US6438562B1 (en) 1999-08-24 2002-08-20 Oracle Corporation Parallel index maintenance
US6665684B2 (en) 1999-09-27 2003-12-16 Oracle International Corporation Partition pruning with composite partitioning
US6826727B1 (en) 1999-11-24 2004-11-30 Bitstream Inc. Apparatus, methods, programming for automatically laying out documents
US6721727B2 (en) 1999-12-02 2004-04-13 International Business Machines Corporation XML documents stored as column data
US20020116371A1 (en) 1999-12-06 2002-08-22 David Dodds System and method for the storage, indexing and retrieval of XML documents using relation databases
US6418448B1 (en) 1999-12-06 2002-07-09 Shyam Sundar Sarkar Method and apparatus for processing markup language specifications for data and metadata used inside multiple related internet documents to navigate, query and manipulate information from a plurality of object relational databases over the web
US6510434B1 (en) 1999-12-29 2003-01-21 Bellsouth Intellectual Property Corporation System and method for retrieving information from a database using an index of XML tags and metafiles
US6785673B1 (en) * 2000-02-09 2004-08-31 At&T Corp. Method for converting relational data into XML
US6604100B1 (en) 2000-02-09 2003-08-05 At&T Corp. Method for converting relational data into a structured document
US6449620B1 (en) 2000-03-02 2002-09-10 Nimble Technology, Inc. Method and apparatus for generating information pages using semi-structured data stored in a structured manner
US20020056025A1 (en) 2000-11-07 2002-05-09 Qiu Chaoxin C. Systems and methods for management of memory
US6934712B2 (en) 2000-03-21 2005-08-23 International Business Machines Corporation Tagging XML query results over relational DBMSs
US6516322B1 (en) * 2000-04-28 2003-02-04 Microsoft Corporation XML-based representation of mobile process calculi
US20030158897A1 (en) 2000-05-09 2003-08-21 Viryanet Ltd. Networked platform for creating and supporting communities
US6845507B2 (en) 2000-05-18 2005-01-18 Ss & C Technologies, Inc. Method and system for straight through processing
US6915304B2 (en) 2000-05-23 2005-07-05 Kenneth A. Krupa System and method for converting an XML data structure into a relational database
US6704024B2 (en) 2000-08-07 2004-03-09 Zframe, Inc. Visual content browsing using rasterized representations
US7917602B2 (en) 2000-08-08 2011-03-29 The Directv Group, Inc. Method and system for remote television replay control
US6708186B1 (en) 2000-08-14 2004-03-16 Oracle International Corporation Aggregating and manipulating dictionary metadata in a database system
US6675230B1 (en) 2000-08-22 2004-01-06 International Business Machines Corporation Method, system, and program for embedding a user interface object in another user interface object
US20030154266A1 (en) 2000-09-01 2003-08-14 Mark Bobick Server system and method for discovering digital assets in enterprise information systems
US6871204B2 (en) 2000-09-07 2005-03-22 Oracle International Corporation Apparatus and method for mapping relational data and metadata to XML
WO2002025500A2 (en) * 2000-09-20 2002-03-28 A2I, Inc. Method and apparatus for dynamically formatting and displaying tabular data in real time
WO2002046916A2 (en) 2000-10-20 2002-06-13 Polexis, Inc. Extensible information system (xis)
US6785718B2 (en) 2000-10-23 2004-08-31 Schneider Logistics, Inc. Method and system for interfacing with a shipping service
US20020099738A1 (en) * 2000-11-22 2002-07-25 Grant Hugh Alexander Automated web access for back-end enterprise systems
US7917888B2 (en) 2001-01-22 2011-03-29 Symbol Technologies, Inc. System and method for building multi-modal and multi-channel applications
US6964025B2 (en) 2001-03-20 2005-11-08 Microsoft Corporation Auto thumbnail gallery
JP4529063B2 (en) 2001-03-30 2010-08-25 ルネサスエレクトロニクス株式会社 System simulator, simulation method, and simulation program
US6778977B1 (en) 2001-04-19 2004-08-17 Microsoft Corporation Method and system for creating a database table index using multiple processors
US6968334B2 (en) 2001-05-15 2005-11-22 Nokia Corporation Method and business process to maintain privacy in distributed recommendation systems
US7197764B2 (en) 2001-06-29 2007-03-27 Bea Systems Inc. System for and methods of administration of access control to numerous resources and objects
US6795821B2 (en) 2001-07-17 2004-09-21 Trendium, Inc. Database systems, methods and computer program products including primary key and super key indexes for use with partitioned tables
US6725212B2 (en) 2001-08-31 2004-04-20 International Business Machines Corporation Platform-independent method and system for graphically presenting the evaluation of a query in a database management system
AU2002334721B2 (en) 2001-09-28 2008-10-23 Oracle International Corporation An index structure to access hierarchical data in a relational database system
US7487168B2 (en) 2001-11-01 2009-02-03 Microsoft Corporation System and method for loading hierarchical data into relational database systems
US6826568B2 (en) 2001-12-20 2004-11-30 Microsoft Corporation Methods and system for model matching
US7523127B2 (en) * 2002-01-14 2009-04-21 Testout Corporation System and method for a hierarchical database management system for educational training and competency testing simulations
US6732222B1 (en) 2002-02-01 2004-05-04 Silicon Motion, Inc. Method for performing flash memory file management
US9374451B2 (en) 2002-02-04 2016-06-21 Nokia Technologies Oy System and method for multimodal short-cuts to digital services
US7127700B2 (en) 2002-03-14 2006-10-24 Openwave Systems Inc. Method and apparatus for developing web services using standard logical interfaces to support multiple markup languages
US7570943B2 (en) 2002-08-29 2009-08-04 Nokia Corporation System and method for providing context sensitive recommendations to digital services
US7120645B2 (en) 2002-09-27 2006-10-10 Oracle International Corporation Techniques for rewriting XML queries directed to relational database constructs
US6826857B1 (en) 2002-11-14 2004-12-07 Anders Bachmann Perpetual calendar
US7103611B2 (en) 2003-05-01 2006-09-05 Oracle International Corporation Techniques for retaining hierarchical information in mapping between XML documents and relational data
US6836778B2 (en) 2003-05-01 2004-12-28 Oracle International Corporation Techniques for changing XML content in a relational database
US7634480B2 (en) 2003-05-08 2009-12-15 Microsoft Corporation Declarative rules for metadirectory
US20050010896A1 (en) 2003-07-07 2005-01-13 International Business Machines Corporation Universal format transformation between relational database management systems and extensible markup language using XML relational transformation
US7814047B2 (en) 2003-08-25 2010-10-12 Oracle International Corporation Direct loading of semistructured data
US7747580B2 (en) 2003-08-25 2010-06-29 Oracle International Corporation Direct loading of opaque types
US7685137B2 (en) 2004-08-06 2010-03-23 Oracle International Corporation Technique of using XMLType tree as the type infrastructure for XML

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2001059602A1 (en) 2000-02-11 2001-08-16 Acta Technologies, Inc. Nested relational data model
WO2001061566A1 (en) 2000-02-16 2001-08-23 Verizon Laboratories Inc. System and method for automatic loading of an xml document defined by a document-type definition into a relational database including the generation of a relational schema therefor

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
J. SHANMUGASUNDARAM ET AL.: "Querying XML views of relational data", PROCEEDINGS OF THE 27TH INTERNATIONAL CONFERENCE ON VERY LARGE DATABASES, September 2001 (2001-09-01)
R. BOURRET ET AL.: "A generic load/extract utility for data transfer between XML documents and relational databases", IEEE SECOND INTERNATIONAL WORKSHOP ON ADVANCED ISSUES OF E-COMMERCE AND WEB-BASED INFORMATION SYSTEMS, June 2000 (2000-06-01), pages 134 - 143, XP002169780, DOI: doi:10.1109/WECWIS.2000.853868
See also references of EP1440394A2

Cited By (77)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7792866B2 (en) 2003-08-25 2010-09-07 International Business Machines Corporation Method and system for querying structured documents stored in their native format in a database
US8150818B2 (en) 2003-08-25 2012-04-03 International Business Machines Corporation Method and system for storing structured documents in their native format in a database
US8250093B2 (en) 2003-08-25 2012-08-21 International Business Machines Corporation Method and system for utilizing a cache for path-level access control to structured documents stored in a database
JP2007534036A (en) * 2003-08-25 2007-11-22 オラクル・インターナショナル・コーポレイション Field development of XML schema in database
US8219569B2 (en) 2003-08-25 2012-07-10 Oracle International Corporation In-place evolution of XML schemes
US8145668B2 (en) 2003-08-25 2012-03-27 International Business Machines Corporation Associating information related to components in structured documents stored in their native format in a database
US7814047B2 (en) 2003-08-25 2010-10-12 Oracle International Corporation Direct loading of semistructured data
US8775468B2 (en) 2003-08-29 2014-07-08 International Business Machines Corporation Method and system for providing path-level access control for structured documents stored in a database
US9495553B2 (en) 2003-08-29 2016-11-15 International Business Machines Corporation Providing path-level access control for structured documents stored in a database
US7433940B2 (en) 2004-01-21 2008-10-07 International Business Machines Corporation Schema management
US7921191B2 (en) 2004-01-21 2011-04-05 International Business Machines Corporation Schema management
CN100435143C (en) * 2004-03-22 2008-11-19 微软公司 System and method for modeless data mapping with nested tables
US8001127B2 (en) 2004-04-09 2011-08-16 Oracle International Corporation Efficient extraction of XML content stored in a LOB
JP2008507008A (en) * 2004-06-16 2008-03-06 オラクル・インターナショナル・コーポレイション Efficient extraction of XML content stored in a LOB
JP4866844B2 (en) * 2004-06-16 2012-02-01 オラクル・インターナショナル・コーポレイション Efficient extraction of XML content stored in a LOB
JP2006085717A (en) * 2004-09-17 2006-03-30 Microsoft Corp Durable storage of .net data type and instance
JP2006114045A (en) * 2004-10-15 2006-04-27 Microsoft Corp Mapping of schema data into data structure
EP1647905A1 (en) * 2004-10-15 2006-04-19 Microsoft Corporation Method and system for mapping of XML schema data into relational data structures
US7478102B2 (en) * 2005-03-28 2009-01-13 Microsoft Corporation Mapping of a file system model to a database object
US7870163B2 (en) 2006-09-28 2011-01-11 Oracle International Corporation Implementation of backward compatible XML schema evolution in a relational database system
CN100458793C (en) * 2007-05-10 2009-02-04 浪潮集团山东通用软件有限公司 Mapping conversion method between data access level Xml format data and relational data
US8805868B2 (en) 2007-08-03 2014-08-12 Electronics And Telecommunications Research Institute Apparatus and method for a query express
US9305238B2 (en) 2008-08-29 2016-04-05 Oracle International Corporation Framework for supporting regular expression-based pattern matching in data streams
US8498956B2 (en) 2008-08-29 2013-07-30 Oracle International Corporation Techniques for matching a certain class of regular expression-based patterns in data streams
US8676841B2 (en) 2008-08-29 2014-03-18 Oracle International Corporation Detection of recurring non-occurrences of events using pattern matching
US8589436B2 (en) 2008-08-29 2013-11-19 Oracle International Corporation Techniques for performing regular expression-based pattern matching in data streams
US8145859B2 (en) 2009-03-02 2012-03-27 Oracle International Corporation Method and system for spilling from a queue to a persistent store
US8352517B2 (en) 2009-03-02 2013-01-08 Oracle International Corporation Infrastructure for spilling pages to a persistent store
US8387076B2 (en) 2009-07-21 2013-02-26 Oracle International Corporation Standardized database connectivity support for an event processing server
US8321450B2 (en) 2009-07-21 2012-11-27 Oracle International Corporation Standardized database connectivity support for an event processing server in an embedded context
US8527458B2 (en) 2009-08-03 2013-09-03 Oracle International Corporation Logging framework for a data stream processing server
US8386466B2 (en) 2009-08-03 2013-02-26 Oracle International Corporation Log visualization tool for a data stream processing server
US9430494B2 (en) 2009-12-28 2016-08-30 Oracle International Corporation Spatial data cartridge for event processing systems
US8447744B2 (en) 2009-12-28 2013-05-21 Oracle International Corporation Extensibility platform using data cartridges
US8959106B2 (en) 2009-12-28 2015-02-17 Oracle International Corporation Class loading using java data cartridges
US9305057B2 (en) 2009-12-28 2016-04-05 Oracle International Corporation Extensible indexing framework using data cartridges
US9058360B2 (en) 2009-12-28 2015-06-16 Oracle International Corporation Extensible language framework using data cartridges
US8713049B2 (en) 2010-09-17 2014-04-29 Oracle International Corporation Support for a parameterized query/view in complex event processing
US9773028B2 (en) 2010-09-29 2017-09-26 International Business Machines Corporation Manipulating non-schema attributes for objects in a schema based directory
US9189280B2 (en) 2010-11-18 2015-11-17 Oracle International Corporation Tracking large numbers of moving objects in an event processing system
US9756104B2 (en) 2011-05-06 2017-09-05 Oracle International Corporation Support for a new insert stream (ISTREAM) operation in complex event processing (CEP)
US8990416B2 (en) 2011-05-06 2015-03-24 Oracle International Corporation Support for a new insert stream (ISTREAM) operation in complex event processing (CEP)
US9535761B2 (en) 2011-05-13 2017-01-03 Oracle International Corporation Tracking large numbers of moving objects in an event processing system
US9804892B2 (en) 2011-05-13 2017-10-31 Oracle International Corporation Tracking large numbers of moving objects in an event processing system
US9558252B2 (en) 2011-05-24 2017-01-31 Nec Corporation Information processing system, data management method, information processing apparatus, and control method and control program therefor
US9329975B2 (en) 2011-07-07 2016-05-03 Oracle International Corporation Continuous query language (CQL) debugger in complex event processing (CEP)
US9256646B2 (en) 2012-09-28 2016-02-09 Oracle International Corporation Configurable data windows for archived relations
US10042890B2 (en) 2012-09-28 2018-08-07 Oracle International Corporation Parameterized continuous query templates
US9292574B2 (en) 2012-09-28 2016-03-22 Oracle International Corporation Tactical query to continuous query conversion
US9286352B2 (en) 2012-09-28 2016-03-15 Oracle International Corporation Hybrid execution of continuous and scheduled queries
US9563663B2 (en) 2012-09-28 2017-02-07 Oracle International Corporation Fast path evaluation of Boolean predicates
US9703836B2 (en) 2012-09-28 2017-07-11 Oracle International Corporation Tactical query to continuous query conversion
US11288277B2 (en) 2012-09-28 2022-03-29 Oracle International Corporation Operator sharing for continuous queries over archived relations
US9715529B2 (en) 2012-09-28 2017-07-25 Oracle International Corporation Hybrid execution of continuous and scheduled queries
US11093505B2 (en) 2012-09-28 2021-08-17 Oracle International Corporation Real-time business event analysis and monitoring
US10102250B2 (en) 2012-09-28 2018-10-16 Oracle International Corporation Managing continuous queries with archived relations
US9805095B2 (en) 2012-09-28 2017-10-31 Oracle International Corporation State initialization for continuous queries over archived views
US10025825B2 (en) 2012-09-28 2018-07-17 Oracle International Corporation Configurable data windows for archived relations
US9852186B2 (en) 2012-09-28 2017-12-26 Oracle International Corporation Managing risk with continuous queries
US9990401B2 (en) 2012-09-28 2018-06-05 Oracle International Corporation Processing events for continuous queries on archived relations
US9990402B2 (en) 2012-09-28 2018-06-05 Oracle International Corporation Managing continuous queries in the presence of subqueries
US9946756B2 (en) 2012-09-28 2018-04-17 Oracle International Corporation Mechanism to chain continuous queries
US9953059B2 (en) 2012-09-28 2018-04-24 Oracle International Corporation Generation of archiver queries for continuous queries over archived relations
US10956422B2 (en) 2012-12-05 2021-03-23 Oracle International Corporation Integrating event processing with map-reduce
US9098587B2 (en) 2013-01-15 2015-08-04 Oracle International Corporation Variable duration non-event pattern matching
US10298444B2 (en) 2013-01-15 2019-05-21 Oracle International Corporation Variable duration windows on continuous data streams
US20140214215A1 (en) * 2013-01-29 2014-07-31 Electronics And Telecommunications Research Institute Building information model-based building energy management apparatus and method
US10083210B2 (en) 2013-02-19 2018-09-25 Oracle International Corporation Executing continuous event processing (CEP) queries in parallel
US9390135B2 (en) 2013-02-19 2016-07-12 Oracle International Corporation Executing continuous event processing (CEP) queries in parallel
US9047249B2 (en) 2013-02-19 2015-06-02 Oracle International Corporation Handling faults in a continuous event processing (CEP) system
US9934279B2 (en) 2013-12-05 2018-04-03 Oracle International Corporation Pattern matching across multiple input data streams
US9712645B2 (en) 2014-06-26 2017-07-18 Oracle International Corporation Embedded event processing
US10120907B2 (en) 2014-09-24 2018-11-06 Oracle International Corporation Scaling event processing using distributed flows and map-reduce operations
US9886486B2 (en) 2014-09-24 2018-02-06 Oracle International Corporation Enriching events with dynamically typed big data for event processing
US9972103B2 (en) 2015-07-24 2018-05-15 Oracle International Corporation Visually exploring and analyzing event streams
CN108228604A (en) * 2016-12-14 2018-06-29 北京国双科技有限公司 Model building method, information query method and device based on memory object
CN108228604B (en) * 2016-12-14 2021-11-23 北京国双科技有限公司 Model construction method based on memory object, information query method and device

Also Published As

Publication number Publication date
CN1585945A (en) 2005-02-23
CA2461854A1 (en) 2003-04-10
CN1585945B (en) 2011-05-18
EP1433089A2 (en) 2004-06-30
US7096224B2 (en) 2006-08-22
AU2002334747B2 (en) 2008-10-30
CN1299223C (en) 2007-02-07
US7158981B2 (en) 2007-01-02
AU2002334706B2 (en) 2007-11-22
CA2462300C (en) 2014-01-21
WO2003027908A3 (en) 2004-02-12
CA2462300A1 (en) 2003-04-03
JP4443221B2 (en) 2010-03-31
US20060101041A1 (en) 2006-05-11
EP1440394A2 (en) 2004-07-28
US20030140308A1 (en) 2003-07-24
WO2003027908A2 (en) 2003-04-03
CA2461854C (en) 2010-11-23
US7051033B2 (en) 2006-05-23
AU2002334721B2 (en) 2008-10-23
US20030065659A1 (en) 2003-04-03
JP2005505058A (en) 2005-02-17
WO2003030031A3 (en) 2004-02-12
JP2005505042A (en) 2005-02-17
CN1561497A (en) 2005-01-05

Similar Documents

Publication Publication Date Title
US7096224B2 (en) Mechanism for mapping XML schemas to object-relational database systems
AU2002334706A1 (en) Mechanism for mapping XML schemas to object-relational database systems
US7523131B2 (en) Techniques for efficiently storing and querying in a relational database, XML documents conforming to schemas that contain cyclic constructs
US6836778B2 (en) Techniques for changing XML content in a relational database
US7644066B2 (en) Techniques of efficient XML meta-data query using XML table index
US6643633B2 (en) Storing fragmented XML data into a relational database by decomposing XML documents with application specific mappings
US7120645B2 (en) Techniques for rewriting XML queries directed to relational database constructs
US7577642B2 (en) Techniques of XML query optimization over static and dynamic heterogeneous XML containers
US7406478B2 (en) Flexible handling of datetime XML datatype in a database system
AU2004268324B2 (en) In-place evolution of XML schemas in databases
US7020648B2 (en) System and method for identifying and utilizing a secondary index to access a database using a management system without an internal catalogue of online metadata
AU2001290693B2 (en) Method and apparatus for XML data storage, query rewrites, visualization, mapping and references
US20050050056A1 (en) Mechanism to enable evolving XML schema
AU2001290693A1 (en) Method and apparatus for XML data storage, query rewrites, visualization, mapping and references
US7849106B1 (en) Efficient mechanism to support user defined resource metadata in a database repository
Zhang et al. Clock: Synchronizing internal relational storage with external xml documents
US20080016088A1 (en) Techniques of XML query optimization over dynamic heterogeneous XML containers
US8095501B1 (en) Automatic enforcement or relationships in a database schema

Legal Events

Date Code Title Description
AK Designated states

Kind code of ref document: A2

Designated state(s): AE AG AL AM AT AU AZ BA BB BG BY BZ CA CH CN CO CR CU CZ DE DM DZ EC EE ES FI GB GD GE GH HR HU ID IL IN IS JP KE KG KP KR LC LK LR LS LT LU LV MA MD MG MN MW MX MZ NO NZ OM PH PL PT RU SD SE SG SI SK SL TJ TM TN TR TZ UA UG UZ VC VN YU ZA ZM

AL Designated countries for regional patents

Kind code of ref document: A2

Designated state(s): GH GM KE LS MW MZ SD SL SZ UG ZM ZW AM AZ BY KG KZ RU TJ TM AT BE BG CH CY CZ DK EE ES FI FR GB GR IE IT LU MC PT SE SK TR BF BJ CF CG CI GA GN GQ GW ML MR NE SN TD TG

121 Ep: the epo has been informed by wipo that ep was designated in this application
DFPE Request for preliminary examination filed prior to expiration of 19th month from priority date (pct application filed before 20040101)
WWE Wipo information: entry into national phase

Ref document number: 2461854

Country of ref document: CA

WWE Wipo information: entry into national phase

Ref document number: 2003533163

Country of ref document: JP

WWE Wipo information: entry into national phase

Ref document number: 2002334706

Country of ref document: AU

WWE Wipo information: entry into national phase

Ref document number: 00550/KOLNP/2004

Country of ref document: IN

Ref document number: 550/KOLNP/2004

Country of ref document: IN

REEP Request for entry into the european phase

Ref document number: 2002800376

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 2002800376

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 20028223470

Country of ref document: CN

WWP Wipo information: published in national office

Ref document number: 2002800376

Country of ref document: EP

ENP Entry into the national phase

Ref document number: 2002334706

Country of ref document: AU

Date of ref document: 20020927

Kind code of ref document: B