All Downloads are FREE. Search and download functionalities are using the official Maven repository.

schematron.foxmlRules1-0.xml Maven / Gradle / Ivy

Go to download

The Fedora Client is a Java Library that allows API access to a Fedora Repository. The client is typically one part of a full Fedora installation.

The newest version!
<?xml version="1.0" encoding="UTF-8"?>
<!-- **********************************************************************************************************-->
<!-- TITLE: SCHEMATRON  SCHEMA FOR FEDORA DIGITAL OBJECTS-->
<!-- SOURCE:  fedoraRulesFOXML.xml -->
<!-- DESCRIPTION:  This schema expresses validation rules for Fedora digital objects that -->
<!-- are NOT ALREADY EXPRESSED in the FOXML XML Schema.-->
<!-- AUTHOR:  Sandy Payette,  [email protected] -->
<!-- *********************************************************************************************************-->
<sch:schema xmlns:sch="http://www.ascc.net/xml/schematron">
	<!-- FIGURE OUT: how to best deal with validation and namespace prefix declaration-->
	<sch:ns prefix="foxml" uri="info:fedora/fedora-system:def/foxml#"/>
	<sch:ns prefix="xsi" uri="http://www.w3.org/2001/XMLSchema-instance"/>
	<!-- VALIDATION FOR OBJECT INGEST PHASE:  These rules apply to a digital object in its "submission" format for ingest into the repository-->
	<!-- These rules are to be applied upon initial receipt of the object by the repository, before the repository has done any processing of the input.-->
	<sch:phase id="ingest">
		<sch:active pattern="preliminary"/>
	</sch:phase>
	<!-- VALIDATION FOR OBJECT STORAGE PHASE: Rules to ensure that digital object is FULLY valid before being accepted for final storage in the repository-->
	<!-- These rules are to be applied after all processing has been done by the repository, and before it is submitted to low level storage.-->
	<sch:phase id="store">
		<sch:active pattern="preliminary"/>
		<sch:active pattern="completed"/>
	</sch:phase>
	<!-- PRELIMINARY INGEST RULES PATTERN: -->
	<!-- These rules are to be applied to objects no matter what phase of the object lifecycle they are in.-->
	<sch:pattern name="Preliminary Object Checks" id="preliminary">
		<!-- RULE:  check that Behavior Mechanism objects have the proper kinds of datastreams (DSINPUTSPEC, METHODMAP, and WSDL).-->
		<sch:rule context="foxml:property[@NAME='http://www.w3.org/1999/02/22-rdf-syntax-ns#type' and ( @VALUE='FedoraBMechObject' or @VALUE='info:fedora/fedora-system:def/model#FedoraBMechObject')]">
			<sch:assert test="../../foxml:datastream[@ID='DSINPUTSPEC']">Behavior Mechanism Objects must have an inline Datastream representing a Datastream Input Spec (foxml:datastream with ID="DSINPUTSPEC" must exist).</sch:assert>
			<sch:assert test="../../foxml:datastream[@ID='METHODMAP']">Behavior Mechanism Objects must have an inline Datastream representing a Fedora Method Map (foxml:datastream with ID="METHODMAP" must exist).</sch:assert>
			<sch:assert test="../../foxml:datastream[@ID='WSDL']">Behavior Mechanism Objects must have an inline Datastream representing WSDL service bindings (foxml:datastream with ID="WSDL" must exist).</sch:assert>
		</sch:rule>
		<!-- RULE:  check that Behavior Definition objects have the proper kinds of datastreams (METHODMAP).-->
		<sch:rule context="foxml:property[@NAME='http://www.w3.org/1999/02/22-rdf-syntax-ns#type' and (@VALUE='FedoraBDefObject' or @VALUE='info:fedora/fedora-system:def/model#FedoraBDefObject')]">
			<sch:assert test="../../foxml:datastream[@ID='METHODMAP']">Behavior Definition Objects must have an inline Datastream representing a Fedora Method Map (foxml:datastream with ID="METHODMAP" must exist).</sch:assert>
		</sch:rule>
		<!-- RULE:  check that the Fedora object type (fType) contains a valid value (FedoraObject, FedoraBDefObject, or FedoraBMechObject).-->
		<sch:rule context="foxml:property[@NAME='http://www.w3.org/1999/02/22-rdf-syntax-ns#type']">
			<sch:assert test="@VALUE = 'FedoraObject' or @VALUE = 'FedoraBDefObject' or @VALUE = 'FedoraBMechObject' or @VALUE = 'info:fedora/fedora-system:def/model#FedoraObject' or @VALUE = 'info:fedora/fedora-system:def/model#FedoraBDefObject' or @VALUE = 'info:fedora/fedora-system:def/model#FedoraBMechObject'">Object must be of type "FedoraObject|FedoraBDefObject|FedoraBMechObject" (foxml:property NAME="http://www.w3.org/1999/02/22-rdf-syntax-ns#type" has an invalid VALUE).</sch:assert>
		</sch:rule>
		<!-- RULE:  check that the Fedora AUDIT datastream is not versioned.-->
		<sch:rule context="foxml:datastream[@ID='AUDIT']">
			<sch:assert test="count(foxml:datastreamVersion) = 1">The AUDIT Datastream can only have ONE version since it is a non-versionable datastream. (foxml: datastreamVersion)</sch:assert>
		</sch:rule>
		<!-- RULE:  check that non-repeatable object properties do not occur more than once.-->
		<sch:rule context="foxml:objectProperties">
			<sch:assert test="count(foxml:property[@NAME='http://www.w3.org/1999/02/22-rdf-syntax-ns#type']) = 1 or count(foxml:property[@NAME='http://www.w3.org/1999/02/22-rdf-syntax-ns#type']) = 0">DUPLICATE object property: type (foxml:property NAME='http://www.w3.org/1999/02/22-rdf-syntax-ns#type')</sch:assert>
			<sch:assert test="count(foxml:property[@NAME='info:fedora/fedora-system:def/model#label']) = 1 or count(foxml:property[@NAME='info:fedora/fedora-system:def/model#label']) = 0">DUPLICATE object property: label (foxml:property NAME='info:fedora/fedora-system:def/model#label')</sch:assert>
			<sch:assert test="count(foxml:property[@NAME='info:fedora/fedora-system:def/model#state']) = 1 or count(foxml:property[@NAME='info:fedora/fedora-system:def/model#state']) = 0">DUPLICATE object property: state (foxml:property NAME='info:fedora/fedora-system:def/model#state')</sch:assert>
			<sch:assert test="count(foxml:property[@NAME='info:fedora/fedora-system:def/model#createdDate']) = 1 or count(foxml:property[@NAME='info:fedora/fedora-system:def/model#createdDate']) = 0">DUPLICATE object property: creation date (foxml:property NAME='info:fedora/fedora-system:def/model#createdDate' )</sch:assert>
			<sch:assert test="count(foxml:property[@NAME='info:fedora/fedora-system:def/view#lastModifiedDate']) = 1 or count(foxml:property[@NAME='info:fedora/fedora-system:def/view#lastModifiedDate']) = 0">DUPLICATE object property: modification date (foxml:property NAME='info:fedora/fedora-system:def/model#lastModifiedDate' )</sch:assert>
			<sch:assert test="count(foxml:property[@NAME='info:fedora/fedora-system:def/model#contentModel']) = 1 or count(foxml:property[@NAME='info:fedora/fedora-system:def/model#contentModel']) = 0">DUPLICATE object property: content model (foxml:property NAME='info:fedora/fedora-system:def/model#contentModel')</sch:assert>
			<sch:assert test="count(foxml:property[@NAME='info:fedora/fedora-system:def/model#ownerId']) = 1 or count(foxml:property[@NAME='info:fedora/fedora-system:def/model#ownerId']) = 0">DUPLICATE object property: ownerId (foxml:property NAME='info:fedora/fedora-system:def/model#ownerId')</sch:assert>
		</sch:rule>
		<!-- RULE: check that attributes do not exceed length limits and are not missing if required. -->
		<sch:rule context="foxml:property[@NAME='info:fedora/fedora-system:def/model#label']">
            <sch:assert test="string-length(@VALUE) &lt;= 255">Object label must not exceed 255 characters (foxml:property NAME='info:fedora/fedora-system:def/model#label')</sch:assert>
        </sch:rule>
		<sch:rule context="foxml:datastream">
			<sch:assert test="string(@ID)">Datastream must have  a datastream id.  (foxml:datastream: value of ID is missing)</sch:assert>
			<sch:assert test="string-length(@ID) &lt;= 64">Datastream ID must not exceed length of 64 (foxml:datastream ID)</sch:assert>
			<sch:report test="contains(@ID, '+')">Datastream ID must not contain a plus sign (+) (foxml:datastream ID)</sch:report>
			<sch:report test="contains(@ID, ':')">Datastream ID must not contain a colon (:) (foxml:datastream ID)</sch:report>
			<sch:assert test="@CONTROL_GROUP='R' or @CONTROL_GROUP= 'E' or @CONTROL_GROUP= 'M' or @CONTROL_GROUP= 'X' or @CONTROL_GROUP= 'B'">Datastream control group type must be "E" for External-Ref, "M" for Managed-Content, "R" for Redirected, or "X" for Inline-XML-Metadata.  (foxml:datastream: CONTROL_GROUP)</sch:assert>			
		</sch:rule>
		<sch:rule context="foxml:contentLocation">
			<sch:assert test="string(@REF)">Datastream content location must have a URL.   (foxml:contentLocation: value of REF is missing)</sch:assert>
		</sch:rule>
		<sch:rule context="foxml:datastreamVersion">
			<sch:assert test="string(@ID)">Datastream version must have a datastream id.   (foxml:datastreamVersion: value of ID is missing)</sch:assert>
			<sch:assert test="string-length(@ID) &lt;= 69">Datastream version ID must not exceed length of 69 (foxml:datastreamVersion ID)</sch:assert>
			<sch:report test="contains(@ID, '+')">Datastream version ID must not contain a plus sign (+) (foxml:datastreamVersion ID)</sch:report>
			<sch:report test="contains(@ID, ':')">Datastream version ID must not contain a colon (:) (foxml:datastreamVersion ID)</sch:report>
            <sch:assert test="not(@LABEL) or string-length(@LABEL) &lt;= 255">Datastream label must not exceed 255 characters (foxml:datastreamVersion LABEL)</sch:assert>
		</sch:rule>
		<sch:rule context="foxml:contentDigest">
			<sch:assert test="not(@DIGEST) or (@DIGEST and @TYPE)">contentDigest TYPE must be specified if DIGEST is provided (foxml:contentDigest TYPE missing)</sch:assert>			
		</sch:rule>
		<sch:rule context="foxml:disseminator">
			<sch:assert test="string(@ID)">Disseminator must have a disseminator id.   (foxml:disseminator: value of ID is missing)</sch:assert>
			<sch:assert test="string-length(@ID) &lt;= 64">Disseminator ID must not exceed length of 64 (foxml:disseminator ID)</sch:assert>
			<sch:assert test="string(@BDEF_CONTRACT_PID)">Disseminator must have a behavior definition id.   (foxml:disseminator: value of BDEF_CONTRACT_PID is missing)</sch:assert>
		</sch:rule>
		<sch:rule context="foxml:disseminatorVersion">
			<sch:assert test="string(@ID)">Disseminator version must have a disseminator id.  (foxml:disseminatorVersion: value of ID is missing)</sch:assert>
			<sch:assert test="string-length(@ID) &lt;= 69">Disseminator vesrion ID must not exceed length of 69 (foxml:disseminatorVersion ID)</sch:assert>
            <sch:assert test="not(@LABEL) or string-length(@LABEL) &lt;= 255">Disseminator label must not exceed 255 characters (foxml:disseminatorVersion LABEL)</sch:assert>
			<sch:assert test="string(@BMECH_SERVICE_PID)">Disseminator must have a behavior mechanism id.   (foxml:disseminatorVersion: value of BMECH_SERVICE_PID is missing)</sch:assert>
		</sch:rule>
	</sch:pattern>
	<!-- COMPLETED RULES PATTERN: -->
	<!-- These rules are to be applied to objects when they are considered completed and ready to be stored persistently in the repository.-->
	<!-- These are attributes that are optional in the FOXML XML Schema (i.e., to support ingest files), but that ultimately must be assigned by the system. -->
	<!-- This validation may be unnecessary if we accept that the Fedora server will ensure this programmatically. -->
	<sch:pattern name="Completed Object Checks" id="completed">
		<sch:rule context="foxml:digitalObject">
			<sch:assert test="string(@PID)">The digital object must have a PID.  (foxml:digitalObject: value of PID is missing)</sch:assert>
			<sch:assert test="string-length(@PID) &lt;= 64">Digital Object PID must not exceed length of 64 (foxml:digitalObject PID)</sch:assert>
		</sch:rule>
		<sch:rule context="foxml:objectProperties">
			<sch:assert test="foxml:property[@NAME='info:fedora/fedora-system:def/model#createdDate']">The system did not assign a creation date to the object! (foxml:property: NAME='info:fedora/fedora-system:def/model#createdDate' is missing)</sch:assert>
			<sch:assert test="foxml:property[@NAME='info:fedora/fedora-system:def/model#state']">The system did not assign a state to the object!  (foxml:property: NAME='info:fedora/fedora-system:def/model#state' is missing)</sch:assert>
		</sch:rule>
		<sch:rule context="foxml:datastream">
			<sch:assert test="string(@STATE)">The system did not assign a state to the datastream.  (foxml:datastream: value of STATE is missing)</sch:assert>
		</sch:rule>
		<sch:rule context="foxml:datastreamVersion">
			<sch:assert test="string(@CREATED)">The system did not assign a creation date to the datastream version.  (foxml:datastreamVersion: value of CREATED is missing)</sch:assert>
		</sch:rule>
		<sch:rule context="foxml:disseminator">
			<sch:assert test="string(@STATE)">The system did not assign a state to the disseminator.  (foxml:disseminator: value of STATE is missing)</sch:assert>
		</sch:rule>
		<sch:rule context="foxml:disseminatorVersion">
			<sch:assert test="string(@CREATED)">The system did not assign a creation date to the disseminator version.  (foxml:disseminatorVersion: value of CREATED is missing)</sch:assert>
		</sch:rule>
	</sch:pattern>
</sch:schema>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy