--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+
+ collectionObject.xml
+
+ A hypothetical, somewhat skeletal instance of an CollectionObject payload,
+ represented as an XML document.
+
+ This is created for the CollectionSpace system, http://www.collectionspace.org/
+
+-->
+
+<collectionObject>
+
+ <entity>
+
+ <usageNotes>
+ <!-- Optional notes about the usage and meaning of this entity go here. -->
+ </usageNotes>
+
+ <!-- Inspired by http://pahma.berkeley.edu/delphi/object/170594 -->
+
+ <coreFields>
+ <id>170594</id>
+ <created></created>
+ <createdBy></createdBy>
+ <lastModified></lastModified>
+ <lastModifiedBy></lastModifiedBy>
+ </coreFields>
+
+ <fields>
+ <field
+ systemName="objectNumber"
+ displayName="object Number"
+ usageNotes="In-depth notes about usage go here"
+ usageHint="Tooltip-type hints go here, such as 'Primary museum ID for this item'"
+ displayed="true"
+ lengthHint="20em">
+ <!-- Field contents go here -->
+ 2-68479
+ </field>
+ <field
+ systemName="otherNumber"
+ displayName="Other number"
+ usageNotes=""
+ usageHint=""
+ displayed="false">
+ <!-- Field contents go here -->
+ </field>
+ <field
+ systemName="briefDescription"
+ displayName="Brief description"
+ usageNotes=""
+ usageHint=""
+ displayed="true">
+ <!-- Field contents go here -->
+ Conical shape, made of willow warp and weft.
+ </field>
+ <field
+ systemName="comments"
+ displayName="Comments"
+ usageNotes=""
+ usageHint=""
+ displayed="true">
+ <!-- Field contents go here -->
+ In very poor condition, flattened and broken.
+ </field>
+ <field
+ systemName="distinguishingFeatures"
+ displayName="Distinguishing features"
+ usageNotes=""
+ usageHint=""
+ displayed="true">
+ <!-- Field contents go here -->
+ Diagonal twining.
+ </field>
+ <field
+ systemName="objectName"
+ displayName="Object name"
+ usageNotes=""
+ usageHint=""
+ displayed="true">
+ <!-- Field contents go here -->
+ Basket
+ </field>
+ <field
+ systemName="responsibleDepartment"
+ displayName="Responsible department"
+ usageNotes=""
+ usageHint=""
+ displayed="true">
+ <!-- Field contents go here -->
+ </field>
+ <field
+ systemName="title"
+ displayName="Title"
+ usageNotes=""
+ usageHint=""
+ displayed="true">
+ <!-- Field contents go here -->
+ </field>
+ </fields>
+
+ </entity>
+
+</collectionObject>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+
+ CollectionObject2.xml
+
+ A hypothetical, somewhat skeletal instance of an CollectionObject payload,
+ represented as an XML document.
+
+ (This instance uses InfoBlocks, that help group related fields into sub-sections
+ of the object schema.)
+
+ This document was created for the CollectionSpace system, http://www.collectionspace.org/
+
+-->
+
+<collectionObject>
+
+ <entity>
+
+ <usageNotes>
+ <!-- Optional notes about the usage and meaning of this entity go here. -->
+ </usageNotes>
+
+ <!-- Inspired by http://pahma.berkeley.edu/delphi/object/170594 -->
+
+ <coreFields>
+ <id>170594</id>
+ <created></created>
+ <createdBy></createdBy>
+ <lastModified></lastModified>
+ <lastModifiedBy></lastModifiedBy>
+ </coreFields>
+
+ <infoBlocks>
+
+ <infoBlock blockName="basic">
+
+ <fields>
+ <field
+ systemName="objectNumber"
+ displayName="object Number"
+ usageNotes="In-depth notes about usage go here"
+ usageHint="Tooltip-type hints go here, such as 'Primary museum ID for this item'"
+ displayed="true"
+ lengthHint="20em">
+ <!-- Field contents go here -->
+ 2-68479
+ </field>
+ <field
+ systemName="otherNumber"
+ displayName="Other number"
+ usageNotes=""
+ usageHint=""
+ displayed="false">
+ <!-- Field contents go here -->
+ </field>
+ <field
+ systemName="briefDescription"
+ displayName="Brief description"
+ usageNotes=""
+ usageHint=""
+ displayed="true">
+ <!-- Field contents go here -->
+ Conical shape, made of willow warp and weft.
+ </field>
+ <field
+ systemName="comments"
+ displayName="Comments"
+ usageNotes=""
+ usageHint=""
+ displayed="true">
+ <!-- Field contents go here -->
+ In very poor condition, flattened and broken.
+ </field>
+ <field
+ systemName="distinguishingFeatures"
+ displayName="Distinguishing features"
+ usageNotes=""
+ usageHint=""
+ displayed="true">
+ <!-- Field contents go here -->
+ Diagonal twining.
+ </field>
+ <field
+ systemName="objectName"
+ displayName="Object name"
+ usageNotes=""
+ usageHint=""
+ displayed="true">
+ <!-- Field contents go here -->
+ Basket
+ </field>
+ <field
+ systemName="responsibleDepartment"
+ displayName="Responsible department"
+ usageNotes=""
+ usageHint=""
+ displayed="true">
+ <!-- Field contents go here -->
+ </field>
+ <field
+ systemName="title"
+ displayName="Title"
+ usageNotes=""
+ usageHint=""
+ displayed="true">
+ <!-- Field contents go here -->
+ </field>
+ </fields>
+ </infoBlock>
+
+ <!--
+ Note: This infoBlock is here to test instances with multiple blocks;
+ it is *not* part of the Release 0.1 schema.
+ -->
+ <infoBlock blockName="locationAndMoveMentControl">
+ <fields>
+ <field
+ systemName="currentLocation"
+ displayName=""
+ usageNotes="In-depth notes about usage go here"
+ usageHint="Tooltip-type hints go here, such as 'Primary museum ID for this item'"
+ displayed="true"
+ lengthHint="20">
+ <!-- Field contents go here -->
+ Room 231, Shelf 5, Box 18
+ </field>
+ </fields>
+ </infoBlock>
+ </infoBlocks>
+
+ </entity>
+
+</collectionObject>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+
+ collectionObject.rng
+
+ A schema defining the structure of an CollectionObject entity,
+ based on the generic entity schema.
+
+ 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/
+
+-->
+
+<element
+ name="collectionObject"
+ xmlns="http://relaxng.org/ns/structure/1.0">
+
+ <!-- Include the generic schema for all entities. -->
+ <externalRef href="entity.rng"/>
+
+</element>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+
+ entity.rng
+
+ A generic schema defining the structure of an entity. An "entity" is a
+ business object; a "noun" within the system.
+
+ 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/
+
+-->
+
+<element
+ name="entity"
+ xmlns="http://relaxng.org/ns/structure/1.0"
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+
+ <!--
+ (Optional) Informational text describing the purpose and usage
+ of this entity. This field may be present or absent, and if
+ present, its value may be empty or contain text.
+ -->
+ <optional>
+ <element name="usageNotes">
+ <choice>
+ <empty/>
+ <text/>
+ </choice>
+ </element>
+ </optional>
+
+ <!-- Include the schema for the core fields common to all entities -->
+ <externalRef href="entityCoreFields.rng"/>
+
+ <choice>
+
+ <!--
+ An entity may either contain one or more infoBlocks,
+ each containing one or more fields ...
+ -->
+ <group>
+ <element name="infoBlocks">
+ <oneOrMore>
+ <element name="infoBlock">
+ <attribute name="blockName">
+ <data type="normalizedString" />
+ </attribute>
+ <element name="fields">
+ <oneOrMore>
+ <!--
+ Include the generic schema for a field (data element)
+ in an entity.
+ -->
+ <externalRef href="entityField.rng"/>
+ </oneOrMore>
+ </element>
+ </element> <!-- end tag for infoBlock element -->
+ </oneOrMore>
+ </element> <!-- end tag for infoBlocks element -->
+ </group>
+
+ <!--
+ ... or may simply contain one or more fields, without any infoBlocks.
+ -->
+ <group>
+ <element name="fields">
+ <oneOrMore>
+ <!--
+ Include the generic schema for a field (data element)
+ in an entity.
+ -->
+ <externalRef href="entityField.rng"/>
+ </oneOrMore>
+ </element>
+ </group>
+
+ <!--
+ Currently, there isn't an option provided to have a mix:
+ some fields contained within infoBlocks, accompanied by
+ other fields that are not contained within InfoBlocks.
+ -->
+
+ </choice>
+
+
+ <!--
+ An entity may optionally contain validation rules.
+
+ The content of those rules is TBD. Conceivably, they can be
+ written in an XML-based rules language, or can reference in-line
+ or external JavaScript code (for use within the UI layer of
+ CollectionSpace), etc.
+
+ One of the possible approaches to specifying validation rules
+ could be to embed Schematron rules within RELAX NG schema.
+ As noted in this article, this can be done by inserting
+ the appropriate XML markup, in the Schematron namespace:
+ either grouped together below the top-level element or,
+ throughout the document, within the elements that define
+ the contexts for the embedded rules:
+ http://www.xml.com/pub/a/2004/02/11/relaxtron.html
+
+ This page describes the support for processing embedded Schematron
+ rules in Jing, James Clark's RELAX NG library for Java:
+ http://www.thaiopensource.com/relaxng/jing-other.html
+
+ Also, we might wish to decide whether to offer rules that are 'attached'
+ to individual fields, rather than (or in addition to being)
+ specified here on a per-entity basis in a 'validationRules' block.
+ -->
+ <optional>
+ <element name="validationRules">
+ <oneOrMore>
+ <element name="validationRule">
+ <!-- Define what goes here -->
+ <text/>
+ </element>
+ </oneOrMore>
+ </element>
+ </optional>
+
+</element>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+
+ entityCoreFields.rng
+
+ A schema defining the structure of the core fields (data elements)
+ of an entity.
+
+ An "entity" is a business object, or a "noun" within the system,
+ defined in a separate, related schema file, "entity.rng".
+
+ 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/
+
+-->
+
+<element
+ name="coreFields"
+ xmlns="http://relaxng.org/ns/structure/1.0"
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+
+
+ <!-- ######################### -->
+ <!-- ID -->
+ <!-- ######################### -->
+
+ <!--
+ A unique system identifier (ID) for this entity record,
+ as 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,
+ to help disambiguate it from other identifiers used within the system.
+ -->
+ <element name="id">
+ <!--
+ Note: We may potentially wish to specify a regex-type pattern
+ here for further validating these IDs.
+ -->
+ <choice>
+ <data type="string" />
+ <empty />
+ </choice>
+ </element>
+
+
+ <!-- ######################### -->
+ <!-- Creation -->
+ <!-- ######################### -->
+
+ <!--
+ A timestamp for the creation of this entity record, as specified in
+ http://www.w3.org/TR/xmlschema-2/#dateTime
+ -->
+ <element name="created">
+ <choice>
+ <data type="dateTime" />
+ <empty />
+ </choice>
+ </element>
+
+ <!-- The system Principal that created this entity record -->
+ <element name="createdBy">
+ <choice>
+ <data type="string" />
+ <empty />
+ </choice>
+ </element>
+
+ <!--
+ 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
+ -->
+ <element name="lastModified">
+ <choice>
+ <data type="dateTime" />
+ <empty />
+ </choice>
+ </element>
+
+ <!-- The system Principal that created this entity record -->
+ <element name="lastModifiedBy">
+ <choice>
+ <data type="string" />
+ <empty />
+ </choice>
+ </element>
+
+ <!--
+ 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?
+ -->
+
+ <!--
+ Do we want multiple modification records here? That would
+ allow us to carry entity payloads with their full (or selected)
+ modification history, with the downside of
+ -->
+
+</element>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+
+ entityField.rng
+
+ A schema defining structure of an individual field (or data element)
+ in an entity.
+
+ One or more of these entityFields may be included within an "entity",
+ a generic business object defined in a separate, related schema, "entity.rng".
+
+ 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/
+
+-->
+
+<element
+ name="field"
+ xmlns="http://relaxng.org/ns/structure/1.0"
+ xmlns:a="http://relaxng.org/ns/annotation/0.9"
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+
+ <!-- Attributes -->
+
+ <!--
+ The name of this field/data element, as used internally by the system.
+ See also "displayName", below.
+ -->
+ <attribute name="systemName">
+ <data type="Name" />
+ </attribute>
+
+ <!--
+ The name of this field/data element, as displayed in the system UI.
+
+ This name may be customized to meet the needs of a deployed instance,
+ internationalized, etc.
+
+ If the value of this field is empty (blank), it is expected that the
+ systemName, above, will be displayed in the system UI.
+ -->
+ <attribute name="displayName">
+ <optional>
+ <data type="normalizedString" />
+ </optional>
+ </attribute>
+
+ <!-- Informational text describing the purpose and usage of this field -->
+ <attribute name="usageNotes">
+ <optional>
+ <data type="string" />
+ </optional>
+ </attribute>
+
+ <!-- Brief, tooltip-type help text describing the purpose and usage of this field -->
+ <attribute name="usageHint">
+ <optional>
+ <data type="string" />
+ </optional>
+ </attribute>
+
+ <!--
+ A Boolean value indicating whether this field is to be displayed in system UI.
+
+ If this attribute's value is empty (blank), its default value is set to "true".
+ Since an entered value for this attribute is currently required, this default
+ value may not be necessary (or ever used), but is included here nonetheless.
+ -->
+ <attribute
+ name="displayed"
+ a:defaultValue="true">
+ <choice>
+ <value>true</value>
+ <value>false</value>
+ </choice>
+ </attribute>
+
+ <!--
+ An optional hint regarding the length of this field.
+
+ This may be used for dynamically laying out fields within a forms-based
+ user interface, or for similar purposes.
+
+ The meaning of this field is instance-dependent, and may refer
+ to a typical length, or an expected maximum length, for instance.
+ It may also refer to any arbitrary measurement system, such as US-ASCII
+ characters, em units or pixels.
+ -->
+ <optional>
+ <attribute name="lengthHint">
+ <data type="normalizedString" />
+ </attribute>
+ </optional>
+
+ <!--
+ A note regarding "required fields"
+
+ A "required field" is a data element into which valid data must be
+ entered before a new entity record, or a modification to an existing
+ entity record, can be accepted and stored. A particular entity may
+ have one required field, or more than one such field. In the latter
+ case, each of the required fields must contain valid data before a
+ new or modified record is stored.
+you're not
+ There isn't currently a 'required' (or similar) attribute for the
+ 'field' element, because at present we're assuming that validation
+ rules will be used to define required fields.
+
+ If this assumption isn't correct, we may wish to add such an attribute
+ to this schema.
+
+ Apropos of this point, Patrick Schmitz wrote on 2009-02-25:
+ "We may have to separate the notion of what the system will require,
+ and what a UI interaction will require. This allows for import of
+ legacy ... data ... but can put more constraints on what folks enter."
+ -->
+
+ <!-- Value -->
+
+ <!--
+ Currently, the values of entity fields are defined as xs:String datatypes.
+ -->
+ <data type="string" />
+
+</element>
+
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+
+ entityFieldAttributes.rng
+
+ A schema defining structure of the attributes of an individual field
+ (or data element) in an entity.
+
+ These entityFieldAttributes may be included within an "entityField",
+ a generic business object defined in a separate, related schema, "entity.rng".
+
+ 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/
+
+-->
+
+<element
+ name="field"
+ xmlns="http://relaxng.org/ns/structure/1.0"
+ xmlns:a="http://relaxng.org/ns/annotation/0.9"
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+
+ <!-- Attributes -->
+
+ <!--
+ The name of this field/data element, as used internally by the system.
+ See also "displayName", below.
+ -->
+ <attribute name="systemName"
+ xmlns="http://relaxng.org/ns/structure/1.0">
+ <data type="Name" />
+ </attribute>
+
+ <!--
+ The name of this field/data element, as displayed in the system UI.
+
+ This name may be customized to meet the needs of a deployed instance,
+ internationalized, etc.
+
+ If the value of this field is empty (blank), it is expected that the
+ systemName, above, will be displayed in the system UI.
+ -->
+ <attribute name="displayName">
+ <optional>
+ <data type="normalizedString" />
+ </optional>
+ </attribute>
+
+ <!-- Informational text describing the purpose and usage of this field -->
+ <attribute name="usageNotes">
+ <optional>
+ <data type="string" />
+ </optional>
+ </attribute>
+
+ <!-- Brief, tooltip-type help text describing the purpose and usage of this field -->
+ <attribute name="usageHint">
+ <optional>
+ <data type="string" />
+ </optional>
+ </attribute>
+
+ <!--
+ A Boolean value indicating whether this field is to be displayed in system UI.
+
+ If this attribute's value is empty (blank), its default value is set to "true".
+ Since an entered value for this attribute is currently required, this default
+ value may not be necessary (or ever used), but is included here nonetheless.
+ -->
+ <attribute
+ name="displayed"
+ a:defaultValue="true">
+ <data type="boolean"/>
+ </attribute>
+
+ <!--
+ An optional hint regarding the length of this field.
+
+ This may be used for dynamically laying out fields within a forms-based
+ user interface, or for similar purposes.
+
+ The meaning of this field is instance-dependent, and may refer
+ to a typical length, or an expected maximum length, for instance.
+ It may also refer to any arbitrary measurement system, such as US-ASCII
+ characters, em units or pixels.
+ -->
+ <optional>
+ <attribute name="lengthHint">
+ <data type="normalizedString" />
+ </attribute>
+ </optional>
+
+ <!--
+ A note regarding "required fields"
+
+ A "required field" is a data element into which valid data must be
+ entered before a new entity record, or a modification to an existing
+ entity record, can be accepted and stored. A particular entity may
+ have one required field, or more than one such field. In the latter
+ case, each of the required fields must contain valid data before a
+ new or modified record is stored.
+you're not
+ There isn't currently a 'required' (or similar) attribute for the
+ 'field' element, because at present we're assuming that validation
+ rules will be used to define required fields.
+
+ If this assumption isn't correct, we may wish to add such an attribute
+ to this schema.
+
+ Apropos of this point, Patrick Schmitz wrote on 2009-02-25:
+ "We may have to separate the notion of what the system will require,
+ and what a UI interaction will require. This allows for import of
+ legacy ... data ... but can put more constraints on what folks enter."
+ -->
+
+ <!-- Value -->
+
+ <!--
+ Currently, the values of entity fields are defined as xs:String datatypes.
+ -->
+ <data type="string" />
+
+</element>
+
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+
+ serviceResponse.rng
+
+ A schema defining the representation of the data returned in
+ response to a request. This may include a result code and
+ message, as well as a block containing any arbitrary XML-based data.
+
+ 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/
+
+-->
+
+<grammar
+ xmlns="http://relaxng.org/ns/structure/1.0"
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+
+ <start>
+
+ <element
+ name="response">
+
+ <!-- ######################### -->
+ <!-- Result -->
+ <!-- ######################### -->
+
+ <!-- The result of the operation. -->
+ <element name="result">
+
+ <!--
+ A service-dependent result code, which must be
+ at least one character in length.
+ -->
+ <element name="resultCode">
+ <data type="normalizedString">
+ <param name="minLength">1</param>
+ </data>
+ </element>
+
+ <!--
+ An (optional) service-dependent message,
+ presumably corresponding to the result code.
+ -->
+ <element name="resultMessage">
+ <choice>
+ <empty/>
+ <data type="normalizedString" />
+ </choice>
+ </element>
+
+ </element>
+
+
+ <!-- ######################### -->
+ <!-- Data -->
+ <!-- ######################### -->
+
+ <!--
+ The data returned to the caller after performing the operation.
+
+ The data may be any one of the following:
+ - Empty (blank);
+ - Any text; or
+ - Any combination of elements, each of which may have attributes,
+ text nodes, and child elements.
+ -->
+
+ <!--
+ Note: we may want to add a MIME type attribute, and to consider how to
+ structure this for potentially returning multipart MIME data or the like,
+ for use cases where we might need to return multiple media objects, etc.
+ -->
+ <element name="data">
+ <choice>
+ <empty/>
+ <text/>
+ <ref name="anyElement"/>
+ </choice>
+ </element>
+
+ </element>
+
+ </start>
+
+ <!--
+ See the "Name Classes" section in the RELAX NG tutorial,
+ http://relaxng.org/tutorial-20011203.html#IDAFLZR
+ -->
+ <define name="anyElement">
+ <element>
+ <anyName/>
+ <zeroOrMore>
+ <choice>
+ <attribute>
+ <anyName/>
+ </attribute>
+ <text/>
+ <ref name="anyElement"/>
+ </choice>
+ </zeroOrMore>
+ </element>
+ </define>
+
+</grammar>
+
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+
+ serviceResponse.xml
+
+ A hypothetical instance of an serviceResponse document.
+
+ This document was created for the CollectionSpace system,
+ http://www.collectionspace.org/
+
+-->
+
+<!-- Note: this root element may require a namespace. -->
+<response>
+ <result>
+ <resultCode>1005</resultCode>
+ <resultMessage></resultMessage>
+ </result>
+ <!--
+ The 'data' element below may be empty, contain any text,
+ or consist of any XML element, which may have attributes,
+ text nodes, and child elements.
+ -->
+ <data>foo</data>
+</response>