Next: Possible Pitfalls and Safety Up: The Horizon Metadata Class Previous: The Horizon Metadata Class

### Reserved Metadatum Names: schema and schemaVersion

The design of the Metadata object tries to be schema-independent so that it can support multiple schemata at once. In keeping with this, the design probably should not include any predefined metadatum names. Nevertheless, there is no escaping the necessicity of a contract between the `Metadata` list and the client objects that use it: they must all agree over what each metadatum name means. To facilitate this contract, our design includes two predefined metadatum name: ``schema'' and ``schemaVersion''.

The ``schema'' metadatum is defined to be of type `String` and whose value identifies the schema that should be used in accessing and interpreting the other metadata in the `Metadata` list. In other words, the value of ``schema'' indicates the name of dictionary that should be used to interpret all the other metadata in the list. This dictionary lists the reserved metadata names, value types, and their logical meanings. It is up to the client objects using the `Metadata` object to conform to the schema. If necessary, one is allowed can make up new metadata names that are not defined by the schema; in this case, one can allow the data to have whatever type and meaning necessary to hold the new information. Thus, the schema-defined names should be consider reserved names with required types.

As an example, the Horizon package defines the ``horizon'' schema whose reserved names are described in Appendix A.2. These names are used by other Horizon classes to present data for browsing, particularly with regard to their world coordinate system. In this schema, ``CoordinateSystem'' is defined to be of type `Metadata` and should contain the metadata that describes the data's coordinate system. The name ``instrument'' is not defined; therefore, one is free to use this name to mean what is necessary for the particular application with no restrictions on its type.

Use of the ``schema'' metadatum suggests that a `Metadata` object can be governed by only one schema at a time. This is a good idea because two schemas can use the same metadatum name but define them to have different types and different meanings. However, the ``horizon'' schema allows one to hold metadata defined by other schema through the use of the ``NativeSchema'' and ``SchemaSet'' metadata (see Appendix A.2 for details). For example, an application may need or prefer to deal directly with metadata of another schema (say the one used by the native format) instead of the horizon equivalents (if they exist).

Schemata have a way of evolving over time, so our design also includes the reserved name, ``schemaVersion''. This is also defined to be of type `String` containing an identification of the version of the schema definition being used. To help encourage type-safety for the ``schema'' and ``schemaVersion'' metadata (that is, to make sure their values are saved as type `String`), two methods are provided for setting their values: `setSchema(String)` and `setSchemaVersion(String)`.

Next: Possible Pitfalls and Safety Up: The Horizon Metadata Class Previous: The Horizon Metadata Class