One of the versatile uses of extensible markup language (XML) is the ability to associate XML Schema Language or XML Schema Definition (XSD) with an XML document. An XML schema defines a structure of an XML document. For example, an XML schema provides descriptions and definitions for data types and elements in the schema. In addition, the XML schema is extensible and can be associated with other schemas or documents. For example, an XML schema can be reused by other schemas or one may also create one's own data types derived from the standard types or reference multiple schemas in the same document.
In reusing a data type or an element defined in the XML schema, current practices define a “composition” for using an element defined by the XML schema. In reusing the data types, the XML Schema Language provides an additional mechanism called derivation. The derivation in XML Schema further includes two separate uses: (1) “extension” of the type or (2) “restriction” of the type. Suppose a data type has defined “personal information” to include data for “first name” and “last name.” The extension in XML schema allows the data type “personal information” to be extended to include “address,” “city,” or “country”. On the other hand, the “restriction” of the “personal information” may be a limitation on the number of characters in the “first name” data.
Because of the current limitation of either “extension” or “restriction,” the XML schema language is unable to provide additional and convenient means to re-use a previously defined data type, such as to associate a previously defined data type with a different type or data than what was originally envisioned or defined. In addition, elements in XML schema are limited to be reused by composition.
Existing practices of creating relationships to associate different data types involve structurally encoding the relationships as properties of the related types, or as new types created specifically to represent the relationship. The first method is intrusive in that the encoded relationship affects the shape and structure of the data. The second method is unwieldy and leads to a proliferation of types that of themselves too restrictive to the specific relationship. For elements, XML schema offers no means of associating the element with other types or elements.
Embodiments of the invention provide association of a type or an element with additional metadata without altering the existing or original schema for the type or element. In addition, aspects of the invention further provide the association of a type or an element with additional types or elements without altering the existing or original schema for the type or element. Alternative embodiments of the invention create an “out-of-line” or parameterized schema in a separate XML document while establishing the relationship without overburdening the need to continue updating or modifying the existing schemas to accommodate or adapt to different data types or elements.
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used as an aid in determining the scope of the claimed subject matter.
Other features will be in part apparent and in part pointed out hereinafter.
Corresponding reference characters indicate corresponding parts throughout the drawings.
Embodiments of the invention enhance the re-usability and extensibility of a given XML schema by providing an “out-of-line” parameterization or annotation to the given schema in a separate document. For example,
In order to re-use the already declared type or element,
The above existing practice in
However, a second developer B would also like to use the type “CustomerType” in the same schema 114 as well. However, he wishes to use it in a database with a descending indexing order. If the developer B modifies the schema 114, the developer A's use of the “CustomerType” in the ascending order would be not be accomplished. Hence, under the existing mechanism of “annotation,” the second developer B not only needs to alter the content of the schema 114 by modifying “ascending” to “descending,” the second developer B also needs to update the version information of the XML document in lieu of this modification due to the version number change. In addition, the second developer B also needs to maintain the proper dependency by updating other XML documents that depend from or refer to the XML document prior to the modification.
As such, embodiments of the invention streamline and ease the reusability of XML schemas by creating a mechanism using an “out-of-line” or external schema to conveniently associate one schema in one XML document with another schema in another XML document. As such, by using an “out-of-line” or external mechanism in combination with XML schema, in the example above, the developer A can use the “CustomerType” defined in the schema 114 in one database with an ascending order while the developer B can use the same “CustomerType” defined in the schema 114 in another database with a descending order without altering the “CustomerType” definition in the schema 114. It is to be understood that embodiments of the invention may be applied to other definitions of data types, elements, attributes, or other characteristics in other markup-based language or expressions without departing from the scope of the invention.
Referring now to
At 206, additional usage properties in the annotation schema in the first document 304 are declared for the identified portion of the schema in the original document 302. The additional usage properties provide additional utilities of the identified portion of the schema in the original document 302. For example, the schema in the first document 304 provides the additional usage, such as providing in what sequence or order does the “string” data type is to be rendered. In alternative embodiments, other uses, such as a “is-a” or “has-a” relationship between two schemas, may be defined. At 208, the additional usage properties are mapped to the identified portion of the schema in the original document 302. For example, the schema in the first document 304 is associated with the schema in the first document 304 so that the data instances derived from each schema may be properly referenced. In one embodiment, a mapping schema is generated so that the schema in the first document 304 may properly identify a target or an identified type or element in the original document 302. For example, the following illustrates an exemplary and simplified mapping XML schema:
At 210, a second document 306 is generated for specifying annotation data based on the defined annotation schema in the first document 304. For example, the second document 306 includes annotation data exemplified by a schema that declares “CustomerAccountNumber” data type be provided in an ascending sequence or order. In another embodiment, the second document 306 may include another schema that declares the same “CustomerAccountNumber” be provided in a descending sequence or order. As such, one or more third documents may be generated which include schemas relating to the schema in the original document 302 without altering or modifying the schema in an XML document.
In an alternative embodiment, the schema in the first document 304 may be associated with more than one original schema, such as the schema in the original document 302. For example, the schema in the first document 304 may declare multiple inheritances from other schemas using the following example:
The data structure 322 also includes a third data field 330 for storing a mapping schema for mapping the parameterized annotation schema in the first data field to the XML schema type or element of the first document. As described above, the mapping schema may properly identify a target or an identified type or element in the first data field 326 in the original document 302.
The computer-readable medium 400 includes a definition component 402 for defining an annotation schema in a second document. The computer-readable medium 400 also includes an identification component 404 for identifying at least a portion of the schema declared in the first document in the annotation schema of the second document. A declaration component 406 is also included in the computer-readable medium 400 for declaring usage properties in the annotation schema for the identified portion of the schema in the original document 302. The declared usage properties provide additional utilities of the identified portion of the schema. An annotation component 408 maps the usage properties to the identified portion of the schema in the original document. The computer-readable medium 400 further includes a parameterization component 410 for specifying annotation data in a third document based on the defined annotation schema in the second document. The specified annotation applies usages of the schema elements or types in the first document according to the usage properties declared in the second document.
In a further alternative embodiment, the computer-readable medium 400 includes a mapping component 412 for defining a mapping schema for mapping the annotation schema in the second document to the schema types or elements of the first document.
The order of execution or performance of the operations in embodiments of the invention illustrated and described herein is not essential, unless otherwise specified. That is, the operations may be performed in any order, unless otherwise specified, and embodiments of the invention may include additional or fewer operations than those disclosed herein. For example, it is contemplated that executing or performing a particular operation before, contemporaneously with, or after another operation is within the scope of aspects of the invention.
Embodiments of the invention may be implemented with computer-executable instructions. The computer-executable instructions may be organized into one or more computer-executable components or modules. Aspects of the invention may be implemented with any number and organization of such components or modules. For example, aspects of the invention are not limited to the specific computer-executable instructions or the specific components or modules illustrated in the figures and described herein. Other embodiments of the invention may include different computer-executable instructions or components having more or less functionality than illustrated and described herein.
When introducing elements of aspects of the invention or the embodiments thereof, the articles “a,” “an,” “the,” and “said” are intended to mean that there are one or more of the elements. The terms “comprising,” “including,” and “having” are intended to be inclusive and mean that there may be additional elements other than the listed elements.
Having described aspects of the invention in detail, it will be apparent that modifications and variations are possible without departing from the scope of aspects of the invention as defined in the appended claims. As various changes could be made in the above constructions, products, and methods without departing from the scope of aspects of the invention, it is intended that all matter contained in the above description and shown in the accompanying drawings shall be interpreted as illustrative and not in a limiting sense.