...
First, we will ammend the schema to support the property "optional" to datastream declarations. The JIRA issue for this is http://fedora-commons.org/jira/browse/FCREPO-531
The semantic meaning of optional is:
1. The datastream can exist in the substribing objects but does not have to
2. If the datastream exist, it must adhere to the specification in the content model
...
Code Block |
---|
<dsCompositeModel xmlns="info:fedora/fedora-system:def/dsCompositeModel#"> <dsTypeModel ID="DC"> <form MIME="text/xml"/> <extension name="SCHEMA"> </extensions>extension> </dsTypeModel> <dsTypeModel ID="ORIGIN"> <form MIME="text/xml"/> <extension name="SCHEMA"> </extensions>extension> </dsTypeModel> </dsCompositeModel> |
...
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 specified URL. <dsTypeModel ID="DC"> <form MIME="text/xml"/> <extension name="SCHEMA"> <reference type="url" value="http://www.openarchives.org/OAI/2.0/oai_dc.xsd"/> </extensions>extension> </dsTypeModel> <!-- The PBCORE datastream is declared. It's mime type must be text/xml. It must adhere to the xml schema residing in the PDCORE_SCHEMA datastream in this content model--> <dsTypeModel ID="PBCORE"> <form MIME="text/xml"/> <extension name="SCHEMA"> <reference type="datastream" value="PDCORE_SCHEMA"/> </extensions>extension> </dsTypeModel> <!-- 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>extension> </dsTypeModel> </dsCompositeModel> |
...
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 object containing the DS-COMPOSITE-MODEL in question.
...