Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

What is noteworthy here is that the <dsTypeModel> and the <form> elements are left unchanged. The Fedora code, working with DS-COMPOSITE only looks for these tags, so the new schema will not cause conflicts, and the extensions will be quietly ignored. This is exactly as we want, this change should not make our objects incompatible with an older Fedora.

Reserved extensions in DS-COMPOSITE - the SCHEMA extension

We have reserved two one extention namesname.

  • "SchemaSCHEMA" - used to specify that the datastream content must adhere to a schema"Ontology" - used to specify constraints on the relations from this datastream as defined in RELS-INT

That leaves the question on where to place the content (schema/ontology). ). Currently, three ways are supported.
Embedding it directly in DS-COMPOSITE makes for a very unreadable datastream. Alternatively, you could just specify an URL to the schema, but this approach have problems too. Having the Content Model depend on schemas defined elsewhere, perhaps on remote servers, mean that the content models could break by actions totally unrelated to the repository. The best way, we have found, is to embed the schema in a datastream in the content model. To do this, we make use of the <reference> element, which we added the the schema above.

Code Block
<dsCompositeModel
        xmlns="info:fedora/fedora-system:def/dsCompositeModel#"
        xmlns:schema="http://ecm.sourceforge.net/types/dscompositeschema/0/1/#">

    <!-- The DC datastream is declared. It's mime type must be text/xml. It must adhere to the xml schema residing in on the DC_SCHEMA datastream in this content model. -->specified URL.
    <dsTypeModel ID="DC">
        <form MIME="text/xml"/>
        <extension name="SCHEMA">
            <reference type="datastreamurl" value="DC_SCHEMAhttp://www.openarchives.org/OAI/2.0/oai_dc.xsd"/>
        </extensions>
    </dsTypeModel>


    <!-- The ORIGINPBCORE datastream is declared. It's mime type must be text/xml. It must adhere to the xml schema residing in the ORIGINPDCORE_SCHEMA datastream in this content model-->
    <dsTypeModel ID="ORIGINPBCORE">
        <form MIME="text/xml"/>
        <extension name="SCHEMA">
            <reference type="datastream" value="ORIGINPDCORE_SCHEMA"/>
        </extensions>
    </dsTypeModel>

</dsCompositeModel>

Schema Extension

There are three kinds of datastreams in a Fedora object:

1. xml embedded in the object (inline content)
2. bytes embedded in the object (managed content)
3. external file referenced by URL. (External and Redirect content)

...

    <!-- The ORIGIN datastream is declared. It's mime type must be text/xml. It must adhere to the xml schema inlined here
    <dsTypeModel ID="ORIGIN">
        <form MIME="text/xml"/>
        <extension name="SCHEMA">
            <schema targetNamespace="originNamespace" xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
                <element name="origin" type="string"/>
            </schema>
        </extensions>
    </dsTypeModel>

</dsCompositeModel>

XML schema has a few problems. The most apparent problem here is that one schema can only declare a single namespace. In order to have elements from several namespaces, other schemas must be imported. These cannot be inlined in the schema, they must be residing on some other uri. In effect, this means that we can put one schema in a datastream, but it might still import schemas from remote locations. So, without being able to tell the schema to import from other datastreams, this would serve little purpose. For this purpose, we have defined the $THIS$ keyword, meaning "this object". It is used like this

Code Block

<schema targetNamespace="http://www.openarchives.org/OAI/2.0/oai_dc/"
        xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns="http://www.w3.org/2001/XMLSchema"
        elementFormDefault="qualified" attributeFormDefault="unqualified">

    <annotation>
        <documentation>
            XML Schema 2002-03-18 by Pete Johnston.
            Adjusted for usage in the OAI-PMH.
            Schema imports the Dublin Core elements from the DCMI schema for unqualified Dublin Core.
            2002-12-19 updated to use simpledc20021212.xsd (instead of simpledc20020312.xsd)
        </documentation>
    </annotation>

    <import namespace="http://purl.org/dc/elements/1.1/"
            schemaLocation="$THIS$/SIMPLEDC-SCHEMA"/>

    <element name="dc" type="oai_dc:oai_dcType"/>

    <complexType name="oai_dcType">
        <choice minOccurs="0" maxOccurs="unbounded">
            <element ref="dc:title"/>
            <element ref="dc:creator"/>
            <element ref="dc:subject"/>
            <element ref="dc:description"/>
            <element ref="dc:publisher"/>
            <element ref="dc:contributor"/>
            <element ref="dc:date"/>
            <element ref="dc:type"/>
            <element ref="dc:format"/>
            <element ref="dc:identifier"/>
            <element ref="dc:source"/>
            <element ref="dc:language"/>
            <element ref="dc:relation"/>
            <element ref="dc:coverage"/>
            <element ref="dc:rights"/>
        </choice>
    </complexType>

</schema>

Notice that in the import tag, the schema location is given as "$THIS$/SIMPLEDC-SCHEMA". This means that the schema location is the residing in the SIMPLEDC-SCHEMA datastream in this content model. This functionality only works in schemas, and only when validating with the built-in validate method. It works both for schemas inlined in DS-COMPOSITE-MODEL, and stored in separate datastreams. You can have multiple schemas imported, in a hirachical structure, but the $THIS$ will always refer to the containing the DS-COMPOSITE-MODEL in question.

This setup would not work, or rather, it would attemp the get the SCHEMA2 datastream from content model 1.

Code Block

Content model 1
  * DS-COMPOSITE-MODEL
    * SOMESTREAM
      * URL to http://localhost/fedora/objects/demo:contentmodel2/SOMESTREAM-SCHEMA

Content model 2
  * SOMESTREAM-SCHEMA
     * xml schema
       * import $THIS$/SCHEMA2
  * SCHEMA2
     * xml schema