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
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 may refer to any resource (identified by URI) via an
RDF 'resource' attribute, or a literal.
Relationship assertions can be from the default Fedora relationship
ontology, or from other namespaces.
For example:
Bob Smith
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. If the target of the statement is a resource (identified by a URI),
the RDF 'resource' attribute must specify a syntactically valid,
absolute URI.
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.
- Version:
- $Id: RelsExtValidator.java,v 1.5 2005/04/16 18:47:18 cwilper Exp $
- Author:
- payette@cs.cornell.edu
|
Constructor Summary |
RelsExtValidator(java.lang.String characterEncoding,
boolean validate)
|
|
Method Summary |
void |
characters(char[] ch,
int start,
int length)
|
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 |
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
characters
public void characters(char[] ch,
int start,
int length)
endElement
public void endElement(java.lang.String nsURI,
java.lang.String localName,
java.lang.String qName)
throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException