Added a utility script for validating W3C XML Schema documents via XMLStarlet.
Made all defaultCollectionObject elements required, although their values may be blank (empty).
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
-
- collectionObject-full-ns.rng
-
- A schema defining the structure of an CollectionObject entity.
-
- This schema includes all of its components, rather than referring
- to them via 'externalRef' references. As such, it can be used as the
- basis for generating a W3C XML Schema (XSD) schema, via
- James Clark's Trang utility (http://http://www.thaiopensource.com/relaxng/trang.html).
- (Trang version 20081028 can't resolve such references.)
-
- As a convenience, a 'rng-to-xsd.sh' script file, which trivially wraps Trang
- to generate XSD from a RELAX NG schema, is provided elsewhere in this distribution.
-
- This schema also includes one rudimentary root namespace, scoped for the Release 0.1
- "Hello World" demo. We'll need to determine whether, and if so how, we can
- accommodate multiple namespaces to compose entity objects from various schemas,
- such as service metadata, and declarations for the default entity, a domain- or community-
- provided entity, and site- or instance-specific version of an entity.
-
- This schema was created for the CollectionSpace system,
- http://www.collectionspace.org/
-
- It is written in the XML syntax of the RELAX NG schema language,
- http://relaxng.org/
-
- $Author: aron $
- $Revision: 57 $
- $Date: 2009-03-05 16:06:06 -0800 (Thu, 05 Mar 2009) $
-
--->
-
-<element
- name="collectionObject"
- ns="http://collectionspace.org/hello"
- xmlns="http://relaxng.org/ns/structure/1.0"
- datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
-
-
- <!-- ######################################################################## -->
- <!-- Service Metadata -->
- <!-- ######################################################################## -->
-
- <!--
- Data elements common to every entity object in the CollectionSpace system.
-
- This is an quickly conceived-of list for the Release 0.1 "Hello World" demo,
- and is not intended to be definitive going forward; further definition
- will be required.
- -->
-
- <element
- name="serviceMetadata">
-
- <!--
- A unique CollectionSpace system identifier (ID) for this
- entity record. This is distinguished from any museum-created
- or other identifiers that might also be associated with it.
-
- Note: We may wish to think further about what this element name should be.
- -->
- <element name="collectionSpaceId">
- <!--
- Note: We may potentially wish to specify a regex-type pattern
- here for further validating these IDs.
- -->
- <data type="string" />
- </element>
-
- <!--
- All of the data elements after this point are fully optional.
-
- It's possible we may never want or need to pass these in
- routine message payloads, and if so, this merely constitutes
- notes/documentation on a few representative types of data that
- we might additionally store as system metadata, beyond an identifier.
-
- It's also possible that we might offer a service to provide this
- system metadata for any object, so that, for instance, a client
- might be able to retrieve the full modification history for an object.
- This *may* even already be envisioned for an already defined or
- candidate service ...
- -->
-
- <!-- ######################### -->
- <!-- Creation -->
- <!-- ######################### -->
-
- <!--
- A timestamp for the creation of this entity record, as specified in
- http://www.w3.org/TR/xmlschema-2/#dateTime
- -->
- <optional>
- <element name="created">
- <choice>
- <data type="dateTime" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <!-- The system Principal that created this entity record -->
- <optional>
- <element name="createdBy">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <!--
- Note: Do we also need 'acting as designate for' information here,
- for cases where one system Principal created this entity while
- acting as a designate for another Principal?
- -->
-
- <!-- ######################### -->
- <!-- Last modification -->
- <!-- ######################### -->
-
- <!--
- A timestamp for the last modification of this entity record, as specified in
- http://www.w3.org/TR/xmlschema-2/#dateTime
- -->
- <optional>
- <element name="lastModified">
- <choice>
- <data type="dateTime" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <!-- The system Principal that created this entity record -->
- <optional>
- <element name="lastModifiedBy">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <!--
- Note: Do we also need 'acting as designate for' information here,
- for cases where one system Principal modified this entity while
- acting as a designate for another Principal?
- -->
-
- <!-- ######################### -->
- <!-- Valid from/to -->
- <!-- ######################### -->
-
- <!--
- Patrick mentioned the concept of 'valid to/from' timestamps.
- If this applied to entity objects, not to schema, we might
- explore that further as another possible type of system metadata.
- -->
-
- </element>
-
-
- <!-- ######################################################################## -->
- <!-- Default CollectionObject -->
- <!-- ######################################################################## -->
-
- <!-- The default CollectionSpace schema for an entity object (extremely simplified). -->
-
- <element
- name="defaultCollectionObject">
-
- <!--
- The following data elements are taken from the Basic section,
- Object ID Information sub-section, of the Object Data Entry wireframe
-
- See:
-
- http://wiki.collectionspace.org/display/collectionspace/Wireframes+-+Object+Data+Entry
- and
- http://wiki.collectionspace.org/display/collectionspace/Hello+World+(Release+0.1)+Functionality+Requirements
-
- -->
-
- <!-- Allows child elements to appear in any order -->
- <interleave>
-
- <element name="objectNumber">
- <!--
- This declaration specifies that the value of this element must never be empty (blank).
- If that's not accurate, it should be redefined, perhaps to match other elements below.
-
- Note: In a site- or instance-specific declaration - not in the default
- definition here - we might wish to specify a regex-type pattern here for
- further constraining valid object numbers.
- -->
- <data type="normalizedString">
- <param name="minLength">1</param>
- </data>
- </element>
-
- <optional>
- <element name="otherNumber">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <optional>
- <element name="briefDescription">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <optional>
- <element name="comments">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <optional>
- <element name="distinguishingFeatures">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <optional>
- <element name="objectName">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <optional>
- <element name="responsibleDepartment">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <optional>
- <element name="title">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- </interleave>
-
- </element>
-
- <!-- A domain- or community-provided schema, if available, would go here -->
-
- <!-- An site- or instance-provided schema, if available, would go here. -->
-
-
-</element>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
-
- collectionObject-full.rng
-
- A schema defining the structure of an CollectionObject entity.
-
- This schema includes all of its components, rather than referring
- to them via 'externalRef' references. As such, it can be used as the
- basis for generating a W3C XML Schema (XSD) schema, via
- James Clark's Trang utility (http://http://www.thaiopensource.com/relaxng/trang.html).
- (Trang version 20081028 can't resolve such references.)
-
- As a convenience, a 'rng-to-xsd.sh' script file, which trivially wraps Trang
- to generate XSD from a RELAX NG schema, is provided elsewhere in this distribution.
-
- This schema was created for the CollectionSpace system,
- http://www.collectionspace.org/
-
- It is written in the XML syntax of the RELAX NG schema language,
- http://relaxng.org/
-
- $Author: aron $
- $Revision: 57 $
- $Date: 2009-03-05 16:06:06 -0800 (Thu, 05 Mar 2009) $
-
--->
-
-<element
- name="collectionObject"
- xmlns="http://relaxng.org/ns/structure/1.0"
- datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
-
-
- <!-- ######################################################################## -->
- <!-- Service Metadata -->
- <!-- ######################################################################## -->
-
- <!--
- Data elements common to every entity object in the CollectionSpace system.
-
- This is an quickly conceived-of list for the Release 0.1 "Hello World" demo,
- and is not intended to be definitive going forward; further definition
- will be required.
- -->
-
- <element
- name="serviceMetadata">
-
- <!--
- A unique CollectionSpace system identifier (ID) for this
- entity record. This is distinguished from any museum-created
- or other identifiers that might also be associated with it.
-
- Note: We may wish to think further about what this element name should be.
- -->
- <element name="collectionSpaceId">
- <!--
- Note: We may potentially wish to specify a regex-type pattern
- here for further validating these IDs.
- -->
- <data type="string" />
- </element>
-
- <!--
- All of the data elements after this point are fully optional.
-
- It's possible we may never want or need to pass these in
- routine message payloads, and if so, this merely constitutes
- notes/documentation on a few representative types of data that
- we might additionally store as system metadata, beyond an identifier.
-
- It's also possible that we might offer a service to provide this
- system metadata for any object, so that, for instance, a client
- might be able to retrieve the full modification history for an object.
- This *may* even already be envisioned for an already defined or
- candidate service ...
- -->
-
- <!-- ######################### -->
- <!-- Creation -->
- <!-- ######################### -->
-
- <!--
- A timestamp for the creation of this entity record, as specified in
- http://www.w3.org/TR/xmlschema-2/#dateTime
- -->
- <optional>
- <element name="created">
- <choice>
- <data type="dateTime" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <!-- The system Principal that created this entity record -->
- <optional>
- <element name="createdBy">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <!--
- Note: Do we also need 'acting as designate for' information here,
- for cases where one system Principal created this entity while
- acting as a designate for another Principal?
- -->
-
- <!-- ######################### -->
- <!-- Last modification -->
- <!-- ######################### -->
-
- <!--
- A timestamp for the last modification of this entity record, as specified in
- http://www.w3.org/TR/xmlschema-2/#dateTime
- -->
- <optional>
- <element name="lastModified">
- <choice>
- <data type="dateTime" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <!-- The system Principal that created this entity record -->
- <optional>
- <element name="lastModifiedBy">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <!--
- Note: Do we also need 'acting as designate for' information here,
- for cases where one system Principal modified this entity while
- acting as a designate for another Principal?
- -->
-
- <!-- ######################### -->
- <!-- Valid from/to -->
- <!-- ######################### -->
-
- <!--
- Patrick mentioned the concept of 'valid to/from' timestamps.
- If this applied to entity objects, not to schema, we might
- explore that further as another possible type of system metadata.
- -->
-
- </element>
-
-
- <!-- ######################################################################## -->
- <!-- Default CollectionObject -->
- <!-- ######################################################################## -->
-
- <!-- The default CollectionSpace schema for an entity object (extremely simplified). -->
-
- <element
- name="defaultCollectionObject">
-
- <!--
- The following data elements are taken from the Basic section,
- Object ID Information sub-section, of the Object Data Entry wireframe
-
- See:
-
- http://wiki.collectionspace.org/display/collectionspace/Wireframes+-+Object+Data+Entry
- and
- http://wiki.collectionspace.org/display/collectionspace/Hello+World+(Release+0.1)+Functionality+Requirements
-
- -->
-
- <!-- Allows child elements to appear in any order -->
- <interleave>
-
- <element name="objectNumber">
- <!--
- This declaration specifies that the value of this element must never be empty (blank).
- If that's not accurate, it should be redefined, perhaps to match other elements below.
-
- Note: In a site- or instance-specific declaration - not in the default
- definition here - we might wish to specify a regex-type pattern here for
- further constraining valid object numbers.
- -->
- <data type="normalizedString">
- <param name="minLength">1</param>
- </data>
- </element>
-
- <optional>
- <element name="otherNumber">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <optional>
- <element name="briefDescription">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <optional>
- <element name="comments">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <optional>
- <element name="distinguishingFeatures">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <optional>
- <element name="objectName">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <optional>
- <element name="responsibleDepartment">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <optional>
- <element name="title">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- </interleave>
-
- </element>
-
- <!-- A domain- or community-provided schema, if available, would go here -->
-
- <!-- An site- or instance-provided schema, if available, would go here. -->
-
-
-</element>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://collectionspace.org/hello" xmlns="http://collectionspace.org/hello"
-version="0.1">
- <xs:element name="collectionObject">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="serviceMetadata"/>
- <xs:element ref="defaultCollectionObject"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="serviceMetadata">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="collectionSpaceId"/>
- <xs:element minOccurs="0" ref="created"/>
- <xs:element minOccurs="0" ref="createdBy"/>
- <xs:element minOccurs="0" ref="lastModified"/>
- <xs:element minOccurs="0" ref="lastModifiedBy"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="collectionSpaceId" type="xs:string"/>
- <xs:element name="created">
- <xs:simpleType>
- <xs:union memberTypes="xs:dateTime">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:length value="0"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:element>
- <xs:element name="createdBy">
- <xs:simpleType>
- <xs:union memberTypes="xs:string">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:length value="0"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:element>
- <xs:element name="lastModified">
- <xs:simpleType>
- <xs:union memberTypes="xs:dateTime">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:length value="0"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:element>
- <xs:element name="lastModifiedBy">
- <xs:simpleType>
- <xs:union memberTypes="xs:string">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:length value="0"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:element>
- <xs:element name="defaultCollectionObject">
- <xs:complexType>
- <xs:all>
- <xs:element ref="objectNumber"/>
- <xs:element minOccurs="0" ref="otherNumber"/>
- <xs:element minOccurs="0" ref="briefDescription"/>
- <xs:element minOccurs="0" ref="comments"/>
- <xs:element minOccurs="0" ref="distinguishingFeatures"/>
- <xs:element minOccurs="0" ref="objectName"/>
- <xs:element minOccurs="0" ref="responsibleDepartment"/>
- <xs:element minOccurs="0" ref="title"/>
- </xs:all>
- </xs:complexType>
- </xs:element>
- <xs:element name="objectNumber">
- <xs:simpleType>
- <xs:restriction base="xs:normalizedString">
- <xs:minLength value="1"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
- <xs:element name="otherNumber">
- <xs:simpleType>
- <xs:union memberTypes="xs:string">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:length value="0"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:element>
- <xs:element name="briefDescription">
- <xs:simpleType>
- <xs:union memberTypes="xs:string">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:length value="0"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:element>
- <xs:element name="comments">
- <xs:simpleType>
- <xs:union memberTypes="xs:string">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:length value="0"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:element>
- <xs:element name="distinguishingFeatures">
- <xs:simpleType>
- <xs:union memberTypes="xs:string">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:length value="0"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:element>
- <xs:element name="objectName">
- <xs:simpleType>
- <xs:union memberTypes="xs:string">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:length value="0"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:element>
- <xs:element name="responsibleDepartment">
- <xs:simpleType>
- <xs:union memberTypes="xs:string">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:length value="0"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:element>
- <xs:element name="title">
- <xs:simpleType>
- <xs:union memberTypes="xs:string">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:length value="0"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:element>
-</xs:schema>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
-
- collectionObject-ns.xml
-
- A hypothetical, skeletal instance of an CollectionObject payload,
- represented as an XML document, in a rudimentary root namespace,
- scoped for the Release 0.1 "Hello World" demo.
-
- This is created for the CollectionSpace system, http://www.collectionspace.org/
-
- $Author: aron $
- $Revision: 509 $
- $Date: 2008-10-27 13:55:56 -0700 (Mon, 27 Oct 2008) $
-
--->
-
-<collectionObject
- xmlns="http://collectionspace.org/hello">
-
- <serviceMetadata>
-
- <!-- An entirely arbitrary examle -->
- <collectionSpaceId>org.collectionspace.797220effa5fa160</collectionSpaceId>
-
- </serviceMetadata>
-
-
- <!--
- Data below was taken from the following item in the online catalog
- of the Museum of the Moving Image in Astoria, NY:
-
- http://collection.movingimage.us/index.php?g=detail&object_id=64117
-
- The choice of this item was in turn inspired by William Gibson's short story,
- The Gernsback Continuum:
-
- http://www.americanheritage.com/articles/magazine/it/1988/1/1988_1_34.shtml
- -->
-
-
- <defaultCollectionObject>
-
- <objectNumber>1984.021.0049</objectNumber>
-
- <objectName> Radio News, vol. 10, no. 2, August 1928</objectName>
-
- <!-- Linebreaks were added to the following description for readability -->
- <briefDescription>Radio News, August 1928. The cover of this issue features an
-illustration of a man and woman watching an early "radio movie." Text on
-the cover reads, "Radio's Greatest Magazine / Radio News / August 25
-Cents / Over 200 illustrations / Edited by Hugo Gernsback / Radio Movies
-and Television for the Home / Experimenter Publishing Company, 230 Fifth
-Avenue, New York."
-
-In addition to articles about radios and radio technology, the magazine
-also contains several articles about developments in the field of
-television. The issue begins with an editorial about the future of
-television by the magazine's editor, Hugo Gernsback, which is followed
-by an article about the radio movie receiver system invented by C.
-Francis Jenkins. The article includes drawings illustrating the layout
-of the sytem.</briefDescription>
-
- </defaultCollectionObject>
-
-
-<!--
- <sampleMmiCollectionObject>
-
- <artifactClass>Books, literature, and periodicals</artifactClass>
-
- <format>Magazine</format>
-
- <material>Paper</material>
-
- <overallDimensions>
- <height>11.75</height>
- <width>8.75</width>
- <measurementUnit>in</measurementUnit>
- </overallDimensions>
-
- </sampleMmiCollectionObject>
--->
-
-</collectionObject>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://collectionspace.org/hello" xmlns:hello="http://collectionspace.org/hello">
- <xs:element name="collectionObject">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="hello:serviceMetadata"/>
- <xs:element ref="hello:defaultCollectionObject"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="serviceMetadata">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="hello:collectionSpaceId"/>
- <xs:element minOccurs="0" ref="hello:created"/>
- <xs:element minOccurs="0" ref="hello:createdBy"/>
- <xs:element minOccurs="0" ref="hello:lastModified"/>
- <xs:element minOccurs="0" ref="hello:lastModifiedBy"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="collectionSpaceId" type="xs:string"/>
- <xs:element name="created">
- <xs:simpleType>
- <xs:union memberTypes="xs:dateTime">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:length value="0"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:element>
- <xs:element name="createdBy">
- <xs:simpleType>
- <xs:union memberTypes="xs:string">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:length value="0"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:element>
- <xs:element name="lastModified">
- <xs:simpleType>
- <xs:union memberTypes="xs:dateTime">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:length value="0"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:element>
- <xs:element name="lastModifiedBy">
- <xs:simpleType>
- <xs:union memberTypes="xs:string">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:length value="0"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:element>
- <xs:element name="defaultCollectionObject">
- <xs:complexType>
- <xs:all>
- <xs:element ref="hello:objectNumber"/>
- <xs:element minOccurs="0" ref="hello:otherNumber"/>
- <xs:element minOccurs="0" ref="hello:briefDescription"/>
- <xs:element minOccurs="0" ref="hello:comments"/>
- <xs:element minOccurs="0" ref="hello:distinguishingFeatures"/>
- <xs:element minOccurs="0" ref="hello:objectName"/>
- <xs:element minOccurs="0" ref="hello:responsibleDepartment"/>
- <xs:element minOccurs="0" ref="hello:title"/>
- </xs:all>
- </xs:complexType>
- </xs:element>
- <xs:element name="objectNumber">
- <xs:simpleType>
- <xs:restriction base="xs:normalizedString">
- <xs:minLength value="1"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
- <xs:element name="otherNumber">
- <xs:simpleType>
- <xs:union memberTypes="xs:string">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:length value="0"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:element>
- <xs:element name="briefDescription">
- <xs:simpleType>
- <xs:union memberTypes="xs:string">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:length value="0"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:element>
- <xs:element name="comments">
- <xs:simpleType>
- <xs:union memberTypes="xs:string">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:length value="0"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:element>
- <xs:element name="distinguishingFeatures">
- <xs:simpleType>
- <xs:union memberTypes="xs:string">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:length value="0"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:element>
- <xs:element name="objectName">
- <xs:simpleType>
- <xs:union memberTypes="xs:string">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:length value="0"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:element>
- <xs:element name="responsibleDepartment">
- <xs:simpleType>
- <xs:union memberTypes="xs:string">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:length value="0"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:element>
- <xs:element name="title">
- <xs:simpleType>
- <xs:union memberTypes="xs:string">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:length value="0"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:element>
-</xs:schema>
<!--
- collectionObject.rng
+ collectionObject-full-ns.rng
A schema defining the structure of an CollectionObject entity.
+
+ This schema includes all of its components, rather than referring
+ to them via 'externalRef' references. As such, it can be used as the
+ basis for generating a W3C XML Schema (XSD) schema, via
+ James Clark's Trang utility (http://http://www.thaiopensource.com/relaxng/trang.html).
+ (Trang version 20081028 can't resolve such references.)
+
+ As a convenience, a 'rng-to-xsd.sh' script file, which trivially wraps Trang
+ to generate XSD from a RELAX NG schema, is provided elsewhere in this distribution.
+
+ This schema also includes one rudimentary root namespace, scoped for the Release 0.1
+ "Hello World" demo. We'll need to determine whether, and if so how, we can
+ accommodate multiple namespaces to compose entity objects from various schemas,
+ such as service metadata, and declarations for the default entity, a domain- or community-
+ provided entity, and site- or instance-specific version of an entity.
This schema was created for the CollectionSpace system,
http://www.collectionspace.org/
It is written in the XML syntax of the RELAX NG schema language,
http://relaxng.org/
- $Author$
- $Revision$
- $Date$
+ $Author: aron $
+ $Revision: 57 $
+ $Date: 2009-03-05 16:06:06 -0800 (Thu, 05 Mar 2009) $
-->
<element
- name="collectionObject"
- xmlns="http://relaxng.org/ns/structure/1.0">
+ name="collectionObject"
+ ns="http://collectionspace.org/hello"
+ xmlns="http://relaxng.org/ns/structure/1.0"
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+
+
+ <!-- ######################################################################## -->
+ <!-- Service Metadata -->
+ <!-- ######################################################################## -->
- <!-- Data elements common to every entity object in the CollectionSpace system. -->
- <externalRef href="serviceMetadata.rng"/>
+ <!--
+ Data elements common to every entity object in the CollectionSpace system.
+
+ This is an quickly conceived-of list for the Release 0.1 "Hello World" demo,
+ and is not intended to be definitive going forward; further definition
+ will be required.
+ -->
+ <element
+ name="serviceMetadata">
+
+ <!--
+ A unique CollectionSpace system identifier (ID) for this
+ entity record. This is distinguished from any museum-created
+ or other identifiers that might also be associated with it.
+
+ Note: We may wish to think further about what this element name should be.
+ -->
+ <element name="collectionSpaceId">
+ <!--
+ Note: We may potentially wish to specify a regex-type pattern
+ here for further validating these IDs.
+ -->
+ <data type="string" />
+ </element>
+
+ <!--
+ All of the data elements after this point are fully optional.
+
+ It's possible we may never want or need to pass these in
+ routine message payloads, and if so, this merely constitutes
+ notes/documentation on a few representative types of data that
+ we might additionally store as system metadata, beyond an identifier.
+
+ It's also possible that we might offer a service to provide this
+ system metadata for any object, so that, for instance, a client
+ might be able to retrieve the full modification history for an object.
+ This *may* even already be envisioned for an already defined or
+ candidate service ...
+ -->
+
+ <!--
+ A timestamp for the creation of this entity record, as specified in
+ http://www.w3.org/TR/xmlschema-2/#dateTime
+ -->
+ <optional>
+ <element name="created">
+ <choice>
+ <data type="dateTime" />
+ <empty />
+ </choice>
+ </element>
+ </optional>
+
+ <!-- The system Principal that created this entity record -->
+ <optional>
+ <element name="createdBy">
+ <choice>
+ <data type="string" />
+ <empty />
+ </choice>
+ </element>
+ </optional>
+
+ <!--
+ Note: Do we also need 'acting as designate for' information here,
+ for cases where one system Principal created this entity while
+ acting as a designate for another Principal?
+ -->
+
+ <!--
+ A timestamp for the last modification of this entity record, as specified in
+ http://www.w3.org/TR/xmlschema-2/#dateTime
+ -->
+ <optional>
+ <element name="lastModified">
+ <choice>
+ <data type="dateTime" />
+ <empty />
+ </choice>
+ </element>
+ </optional>
+
+ <!-- The system Principal that created this entity record -->
+ <optional>
+ <element name="lastModifiedBy">
+ <choice>
+ <data type="string" />
+ <empty />
+ </choice>
+ </element>
+ </optional>
+
+ <!--
+ Note: Do we also need 'acting as designate for' information here,
+ for cases where one system Principal modified this entity while
+ acting as a designate for another Principal?
+ -->
+
+ <!--
+ Patrick mentioned the concept of 'valid to/from' timestamps.
+ If this applied to entity objects, not to schema, we might
+ explore that further as another possible type of system metadata.
+ -->
+
+ </element>
+
+
+ <!-- ######################################################################## -->
+ <!-- Default CollectionObject -->
+ <!-- ######################################################################## -->
+
<!-- The default CollectionSpace schema for an entity object (extremely simplified). -->
- <externalRef href="defaultCollectionObject.rng"/>
+
+ <element
+ name="defaultCollectionObject">
+
+ <!--
+ The following data elements are taken from the Basic section,
+ Object ID Information sub-section, of the Object Data Entry wireframe
+
+ See:
+
+ http://wiki.collectionspace.org/display/collectionspace/Wireframes+-+Object+Data+Entry
+ and
+ http://wiki.collectionspace.org/display/collectionspace/Hello+World+(Release+0.1)+Functionality+Requirements
+
+ -->
+
+ <!-- Allows child elements to appear in any order -->
+ <interleave>
+
+ <element name="objectNumber">
+ <!--
+ This declaration specifies that the value of this element must never be empty (blank).
+ If that's not accurate, it should be redefined, perhaps to match other elements below.
+
+ Note: In a site- or instance-specific declaration - not in the default
+ definition here - we might wish to specify a regex-type pattern here for
+ further constraining valid object numbers.
+ -->
+ <data type="normalizedString">
+ <param name="minLength">1</param>
+ </data>
+ </element>
+
+ <element name="otherNumber">
+ <choice>
+ <data type="string" />
+ <empty />
+ </choice>
+ </element>
+
+ <element name="briefDescription">
+ <choice>
+ <data type="string" />
+ <empty />
+ </choice>
+ </element>
+
+ <element name="comments">
+ <choice>
+ <data type="string" />
+ <empty />
+ </choice>
+ </element>
+
+ <element name="distinguishingFeatures">
+ <choice>
+ <data type="string" />
+ <empty />
+ </choice>
+ </element>
+
+ <element name="objectName">
+ <choice>
+ <data type="string" />
+ <empty />
+ </choice>
+ </element>
+
+ <element name="responsibleDepartment">
+ <choice>
+ <data type="string" />
+ <empty />
+ </choice>
+ </element>
+
+ <element name="title">
+ <choice>
+ <data type="string" />
+ <empty />
+ </choice>
+ </element>
+
+ </interleave>
+
+ </element>
+
+ <!-- A domain- or community-provided schema, if available, would go here -->
- <!-- A reference to a domain- or community-provided schema, if available, would go here -->
+ <!-- An site- or instance-provided schema, if available, would go here. -->
- <!-- An example of a site- or instance-provided schema (extremely simplified). -->
- <externalRef href="sampleMmiCollectionObject.rng"/>
</element>
<!--
- collectionObject.xml
+ collectionObject-ns.xml
A hypothetical, skeletal instance of an CollectionObject payload,
- represented as an XML document.
+ represented as an XML document, in a rudimentary root namespace,
+ scoped for the Release 0.1 "Hello World" demo.
This is created for the CollectionSpace system, http://www.collectionspace.org/
-->
-<collectionObject>
+<collectionObject
+ xmlns="http://collectionspace.org/hello">
<serviceMetadata>
<!--
Data below was taken from the following item in the online catalog
- of the Museum of the Moving Image in Astoria, NY.
+ of the Museum of the Moving Image in Astoria, NY:
http://collection.movingimage.us/index.php?g=detail&object_id=64117
- and in turn by William Gibson's short story, The Gernsback Continuum.
+ The choice of this item was in turn inspired by William Gibson's short story,
+ The Gernsback Continuum:
+
+ http://www.americanheritage.com/articles/magazine/it/1988/1/1988_1_34.shtml
-->
</defaultCollectionObject>
+<!--
<sampleMmiCollectionObject>
<artifactClass>Books, literature, and periodicals</artifactClass>
</overallDimensions>
</sampleMmiCollectionObject>
-
+-->
</collectionObject>
<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://collectionspace.org/hello" xmlns:hello="http://collectionspace.org/hello">
<xs:element name="collectionObject">
<xs:complexType>
<xs:sequence>
- <xs:element ref="serviceMetadata"/>
- <xs:element ref="defaultCollectionObject"/>
+ <xs:element ref="hello:serviceMetadata"/>
+ <xs:element ref="hello:defaultCollectionObject"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="serviceMetadata">
<xs:complexType>
<xs:sequence>
- <xs:element ref="collectionSpaceId"/>
- <xs:element minOccurs="0" ref="created"/>
- <xs:element minOccurs="0" ref="createdBy"/>
- <xs:element minOccurs="0" ref="lastModified"/>
- <xs:element minOccurs="0" ref="lastModifiedBy"/>
+ <xs:element ref="hello:collectionSpaceId"/>
+ <xs:element ref="hello:created"/>
+ <xs:element ref="hello:createdBy"/>
+ <xs:element ref="hello:lastModified"/>
+ <xs:element ref="hello:lastModifiedBy"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="defaultCollectionObject">
<xs:complexType>
<xs:all>
- <xs:element ref="objectNumber"/>
- <xs:element minOccurs="0" ref="otherNumber"/>
- <xs:element minOccurs="0" ref="briefDescription"/>
- <xs:element minOccurs="0" ref="comments"/>
- <xs:element minOccurs="0" ref="distinguishingFeatures"/>
- <xs:element minOccurs="0" ref="objectName"/>
- <xs:element minOccurs="0" ref="responsibleDepartment"/>
- <xs:element minOccurs="0" ref="title"/>
+ <xs:element ref="hello:objectNumber"/>
+ <xs:element minOccurs="0" ref="hello:otherNumber"/>
+ <xs:element minOccurs="0" ref="hello:briefDescription"/>
+ <xs:element minOccurs="0" ref="hello:comments"/>
+ <xs:element minOccurs="0" ref="hello:distinguishingFeatures"/>
+ <xs:element minOccurs="0" ref="hello:objectName"/>
+ <xs:element minOccurs="0" ref="hello:responsibleDepartment"/>
+ <xs:element minOccurs="0" ref="hello:title"/>
</xs:all>
</xs:complexType>
</xs:element>
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<!--
- Sanjay's used a different naming convention in the Person prototype,
- which would be equivalent here to "collection-object-list-item".
+ Sanjay has used a different naming convention in the Person prototype,
+ which would be equivalent here to "collection-object-list-item", rather than
+ to "collectionObjectListItem", as used below.
We may want to standardize on use of CamelCase or hyphenated lowercase throughout, or
else establish a convention for list items which is distinct from that convention.
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
-
- defaultCollectionObject.rng
-
- A schema defining the structure of an default, "out of the box" CollectionObject.
-
- This schema was created for the CollectionSpace system,
- http://www.collectionspace.org/
-
- It is written in the XML syntax of the RELAX NG schema language,
- http://relaxng.org/
-
- $Author$
- $Revision$
- $Date$
-
--->
-
-<element
- name="defaultCollectionObject"
- xmlns="http://relaxng.org/ns/structure/1.0"
- datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
-
- <!--
- The following data elements are taken from the Basic section,
- Object ID Information sub-section, of the Object Data Entry wireframe
-
- See:
-
- http://wiki.collectionspace.org/display/collectionspace/Wireframes+-+Object+Data+Entry
- and
- http://wiki.collectionspace.org/display/collectionspace/Hello+World+(Release+0.1)+Functionality+Requirements
-
- -->
-
- <!-- Allows child elements to appear in any order -->
- <interleave>
-
- <element name="objectNumber">
- <!--
- This declaration specifies that the value of this element must never be empty (blank).
- If that's not accurate, it should be redefined, perhaps to match other elements below.
-
- Note: In a site- or instance-specific declaration - not in the default
- definition here - we might wish to specify a regex-type pattern here for
- further constraining valid object numbers.
- -->
- <data type="normalizedString">
- <param name="minLength">1</param>
- </data>
- </element>
-
- <optional>
- <element name="otherNumber">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <optional>
- <element name="briefDescription">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <optional>
- <element name="comments">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <optional>
- <element name="distinguishingFeatures">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <optional>
- <element name="objectName">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <optional>
- <element name="responsibleDepartment">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <optional>
- <element name="title">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- </interleave>
-
-</element>
# Simple bash shell script to generate a W3C XML Schema (XSD) document
# from a RELAX NG schema document.
#
+# Uses James Clark's Trang utility, http://www.thaiopensource.com/relaxng/trang.html
+#
+# Assumes Trang's 'trang.jar' file is located in a 'tools' subdirectory of the current directory.
+#
# Requires two arguments:
# - Filename of the RELAX NG schema document.
# (Or the full path to this document, if it is not in the current directory.)
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
-
- sampleMmiCollectionObject.rng
-
- A schema defining the structure of a completely hypothetical CollectionObject
- for the Museum of the Moving Image (MMI) in Astoria, New York.
-
- This is a minimal example created for an early system demo, and represents
- what a site- or instance-specific entity definition might look like.
-
- This schema was created for the CollectionSpace system,
- http://www.collectionspace.org/
-
- It is written in the XML syntax of the RELAX NG schema language,
- http://relaxng.org/
-
- $Author$
- $Revision$
- $Date$
-
--->
-
-<element
- name="sampleMmiCollectionObject"
- xmlns="http://relaxng.org/ns/structure/1.0"
- datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
-
- <!--
- These initial choices for a small subset of site- or instance-specific
- data elements were inspired by the following item in themuseum's online catalog:
-
- http://collection.movingimage.us/index.php?g=detail&object_id=64117
-
- and in turn by William Gibson's short story, The Gernsback Continuum.
- -->
-
- <!-- Allows child elements to appear in any order -->
- <interleave>
-
- <optional>
- <element name="artifactClass">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <optional>
- <element name="format">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <optional>
- <element name="material">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <!--
- The following was constructed somewhat awkwardly, because I
- don't know how yet to make the value of an attribute dependent on
- the value of its corresponding element, as in the case where "if the
- value of the 'height' element is non-empty, then the value of its
- corresponding 'measurementUnit' attribute must also be non-empty." - Aron.
- -->
- <optional>
- <element name="overallDimensions">
- <element name="height">
- <choice>
- <data type="decimal" />
- <empty />
- </choice>
- </element>
- <element name="width">
- <choice>
- <data type="decimal" />
- <empty />
- </choice>
- </element>
- <element name="measurementUnit">
- <choice>
- <value>in</value>
- <value>mm</value>
- <empty />
- </choice>
- </element>
- </element>
- </optional>
-
- </interleave>
-
-</element>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
-
- serviceMetadata.rng
-
- A schema defining the structure of service metadata:
- data elements that are associated with every entity object.
-
- This schema was created for the CollectionSpace system,
- http://www.collectionspace.org/
-
- It is written in the XML syntax of the RELAX NG schema language,
- http://relaxng.org/
-
- $Author$
- $Revision$
- $Date$
-
--->
-
-<element
- name="serviceMetadata"
- xmlns="http://relaxng.org/ns/structure/1.0"
- datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
-
- <!--
- A unique CollectionSpace system identifier (ID) for this
- entity record. This is distinguished from any museum-created
- or other identifiers that might also be associated with it.
-
- Note: We may wish to think further about what this element name should be.
- -->
- <element name="collectionSpaceId">
- <!--
- Note: We may potentially wish to specify a regex-type pattern
- here for further validating these IDs.
- -->
- <data type="string" />
- </element>
-
- <!--
- All of the data elements after this point are fully optional.
-
- It's possible we may never want or need to pass these in
- routine message payloads, and if so, this merely constitutes
- notes/documentation on a few representative types of data that
- we might additionally store as system metadata, beyond an identifier.
-
- It's also possible that we might offer a service to provide this
- system metadata for any object, so that, for instance, a client
- might be able to retrieve the full modification history for an object.
- This *may* even already be envisioned for an already defined or
- candidate service ...
- -->
-
- <!-- ######################### -->
- <!-- Creation -->
- <!-- ######################### -->
-
- <!--
- A timestamp for the creation of this entity record, as specified in
- http://www.w3.org/TR/xmlschema-2/#dateTime
- -->
- <optional>
- <element name="created">
- <choice>
- <data type="dateTime" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <!-- The system Principal that created this entity record -->
- <optional>
- <element name="createdBy">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <!--
- Note: Do we also need 'acting as designate for' information here,
- for cases where one system Principal created this entity while
- acting as a designate for another Principal?
- -->
-
- <!-- ######################### -->
- <!-- Last modification -->
- <!-- ######################### -->
-
- <!--
- A timestamp for the last modification of this entity record, as specified in
- http://www.w3.org/TR/xmlschema-2/#dateTime
- -->
- <optional>
- <element name="lastModified">
- <choice>
- <data type="dateTime" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <!-- The system Principal that created this entity record -->
- <optional>
- <element name="lastModifiedBy">
- <choice>
- <data type="string" />
- <empty />
- </choice>
- </element>
- </optional>
-
- <!--
- Note: Do we also need 'acting as designate for' information here,
- for cases where one system Principal modified this entity while
- acting as a designate for another Principal?
- -->
-
- <!-- ######################### -->
- <!-- Valid from/to -->
- <!-- ######################### -->
-
- <!--
- Patrick mentioned the concept of 'valid to/from' timestamps.
- If this applied to entity objects, not to schema, we might
- explore that further as another possible type of system metadata.
- -->
-
-</element>
# Simple bash shell script to validate an XML instance document
# against a RELAX NG schema.
#
+# Uses James Clark's Jing utility, http://www.thaiopensource.com/relaxng/jing.html
+#
+# Assumes Jing's 'jing.jar' file is located in a 'tools' subdirectory of the current directory.
+#
# Requires two arguments:
# - Filename of the RELAX NG schema document.
# (Or the full path to this document, if it is not in the current directory.)
--- /dev/null
+#!/bin/sh
+#
+# Simple bash shell script to validate an XML instance document
+# against a W3C XML Schema.
+#
+# Uses the XMLStarlet utility, http://xmlstar.sourceforge.net/
+#
+# Assumes the 'xmlstarlet' executable is located within the shell's executable path.
+#
+# Note that XMLStarlet's support for XML Schema is "not yet fully supported", due to
+# incomplete support in a dependency, the XML C toolkit for Gnome (http://xmlsoft.org/).
+#
+# Requires two arguments:
+# - Filename of the W3C XML Schema document.
+# (Or the full path to this document, if it is not in the current directory.)
+# - Filename of the XML instance document.
+# (Or the full path to this document, if it is not in the current directory.)
+#
+# $Author: aron $
+# $Revision: 57 $
+# $Date: 2009-03-05 16:06:06 -0800 (Thu, 05 Mar 2009) $
+
+xmlstarlet val --err --xsd $1 $2
\ No newline at end of file