fedora.server.validation
Class RelsExtValidator
java.lang.Object
org.xml.sax.helpers.DefaultHandler
fedora.server.validation.RelsExtValidator
- All Implemented Interfaces:
- org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler
- public class RelsExtValidator
- extends org.xml.sax.helpers.DefaultHandler
Title: RelsExtValidator.java
Description: This class will validate relationship metadata that
may exist in a digital object. The validator will SAX parse the content
of the RELS-EXT datastream which must be an RDF stream that asserts
object-to-object relationships for a digital object. The validator will
enforce the following restrictions on the RDF stream:
1. The RDF must follow a prescribed RDF/XML authoring style where
there is ONE subject encoded as an RDF with an
RDF 'about' attribute containing a digital object URI.
The sub-elements are the relationship properties of the subject.
Each relationship refers to another digital object URI via an
RDF 'resource' attribute. Relationship assertions can be from
the default Fedora relationship ontology, or from other namespaces.
For example:
2. There must be only ONE RDF in the RELS-EXT datastream.
3. There must be NO nesting of assertions. In terms of XML depth,
the RDF root element is considered depth of 0. Then, the RDF
must be at depth of 1, and the relationship properties
must exist at depth of 2. That's it.
4. The RDF 'about' attribute of the RDF must be the URI
of the digital object in which the RELS-EXT datastream resides. This
means that all relationships are FROM "this" object to other objects.
5. The RDF 'resource' attribute of a relationship assertion
must be the URI of another Fedora digital object. This is because
the RELS-EXT datastream is for object-to-object relationships.
6. The RDF 'resource' attribute of a relationship assertion must NOT
be the URI of the digital object that is the subject of the
relationships. In other words, NO SELF-REFERENTIAL relationships.
7. There must NOT be any assertion of properties from the DC namespace or
from the Fedora object properties namespaces (model and view). This is
because these assertions exist elsewhere in a Fedora digital object and
we do not want duplication. The RELS-EXT datasream is reserved for
relationship metadata.
-----------------------------------------------------------------------------
License and Copyright: The contents of this file are subject to the
Mozilla Public License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of the License
at http://www.mozilla.org/MPL/.
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
the specific language governing rights and limitations under the License.
The entire file consists of original code. Copyright © 2002-2005 by The
Rector and Visitors of the University of Virginia and Cornell University.
All rights reserved.
-----------------------------------------------------------------------------
- Version:
- $Id: RelsExtValidator.java,v 1.3 2005/01/11 20:06:09 cwilper Exp $
- Author:
- payette@cs.cornell.edu
|
Constructor Summary |
RelsExtValidator(java.lang.String characterEncoding,
boolean validate)
|
|
Method Summary |
void |
deserialize(java.io.InputStream relsDS,
java.lang.String doURI)
|
void |
endElement(java.lang.String nsURI,
java.lang.String localName,
java.lang.String qName)
|
RelsExtValidator |
getInstance()
|
void |
startElement(java.lang.String nsURI,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes a)
|
| Methods inherited from class org.xml.sax.helpers.DefaultHandler |
characters, endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RelsExtValidator
public RelsExtValidator(java.lang.String characterEncoding,
boolean validate)
throws javax.xml.parsers.FactoryConfigurationError,
javax.xml.parsers.ParserConfigurationException,
org.xml.sax.SAXException,
java.io.UnsupportedEncodingException
getInstance
public RelsExtValidator getInstance()
throws RepositoryConfigurationException
- Throws:
RepositoryConfigurationException
deserialize
public void deserialize(java.io.InputStream relsDS,
java.lang.String doURI)
throws ObjectIntegrityException,
StreamIOException,
org.xml.sax.SAXException
- Throws:
ObjectIntegrityException
StreamIOException
org.xml.sax.SAXException
startElement
public void startElement(java.lang.String nsURI,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes a)
throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
endElement
public void endElement(java.lang.String nsURI,
java.lang.String localName,
java.lang.String qName)