Internal Object

The internal object is implemented in a Ruby hash and contains all the metadata from the input file and built up by the Reader. The internal object is flexible in that not all elements, arrays and objects must be populated, but changing the basic structure is likely to break many Readers or Writers developed against the original structure, so this should be done with care. New items can be added without breaking a Writer, but changing element names or deleting an element will require changes to all Writers.

The internal object is a collection of nested hash objects assembled in the Reader by instancing and loading hash objects as they are required by the Reader. All the hash objects are defined in the 'internal_metadata_obj.rb' file. A newly instanced hash object always sets initial string and numeric values to nil, arrays to empty [], and objects to empty {}.

When building or reading an internal object, start with the base object 'newBase'.

base object:

    def newBase
        intObj = {
            schema: {
                name: nil,
                version: nil
            contacts: [],
            metadata: {},
            dataDictionary: []

The base object has 4 sections:

schema: object (required) - contains the schema name and version for the metadata input file submitted to the reader.

name: string (required) - name of the encoding schema used by the input metadata file submitted to the reader.

version: string (required) - version of the encoding schema used

contacts: array - holds an array of contact objects. The internal object stores information about a contact in an array so the contact can be stored once and reused multiple times throughout the metadata record.

metadata: object - an object that holds the metadata for the resource being described, generally a project or data resource.

dataDictionary array - an array of dataDictionary objects describing the collection of physical objects or items in a data resource (schema).