org.fcrepo.server.validation
Class RelsValidator
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.fcrepo.server.validation.RelsValidator
- All Implemented Interfaces:
- Constants, ContentHandler, DTDHandler, EntityResolver, ErrorHandler
public class RelsValidator
- extends DefaultHandler
- implements Constants
Validates the RDF/XML content of the RELS-EXT and RELS-INT datastreams.
The following restrictions are enforced:
- The RDF must follow a prescribed RDF/XML authoring style where there is
ONE (RELS-EXT) or more (RELS-INT) subjects encoded as RDF <Description>
elements with RDF
about attribute containing either a digital
object URI (RELS-EXT) or a datastream URI (RELS-INT). 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.
- RELS-EXT example:
<rdf:Description about="info:fedora/demo:5">
<fedora:isMemberOfCollection resource="info:fedora/demo:100"/>
<nsdl:isAugmentedBy resource="info:fedora/demo:333"/>
<example:source resource="http://example.org/bsmith/article1.html"/>
<example:primaryAuthor>Bob Smith</example:primaryAuthor>
</rdf:Description>
- RELS-INT example:
<rdf:Description about="info:fedora/demo:5/DS1">
<nsdl:isAugmentedBy resource="info:fedora/demo:333"/>
<example:source resource="http://example.org/bsmith/article1.html"/>
<example:primaryAuthor>Bob Smith</example:primaryAuthor>
</rdf:Description>
- For RELS-EXT, there must be only ONE <rdf:Description> element.
- There must be NO nesting of assertions. In terms of XML depth, the RDF
root element is considered depth of 0. Then, the <rdf:Description>
element must be at depth of 1, and the relationship properties must exist at
depth of 2. That's it.
- For RELS-EXT, The RDF
about attribute of the RDF
<Description> 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.
- For RELS-INT, the RDF
about attribute(s) of the RDF
<Description> element(s) must be valid URIs of datastreams for the
digital object in which the RELS-EXT datastream resides. The datastreams do
not actually have to exist, but these URIs must be syntactically valid. This
means that all relationships are FROM datastreams in "this" object to other
objects.
- If the target of the statement is a resource (identified by a URI), the
RDF
resource attribute must specify a syntactically valid,
absolute URI.
- For RELS-EXT, there must NOT be any assertion of properties from the DC
namespace.
- There must NOT be any assertions of properties from the Fedora object
properties namespaces (model and view), with the following exceptions for
RELS-EXT only:
fedora-model:hasService
fedora-model:hasModel
fedora-model:isDeploymentOf
fedora-model:isContractorOf
These assertions are allowed in the RELS-EXT datastream, but all
others from the fedora-model and fedora-view
namespaces are inferred from values expressed elsewhere in the
digital object, and we do not want duplication.
- Author:
- Sandy Payette, Eddie Shin, Chris Wilper, Stephen Bayliss
| Fields inherited from interface org.fcrepo.common.Constants |
ACCESS, ACTION, API, ATOM_APIM1_0, ATOM_ZIP1_1, ATOM1_1, AUDIT, AUDIT1_0, BATCH_MODIFY, BATCH_MODIFY1_1, BE_SECURITY, BE_SECURITY1_0, BINDING_SPEC, DATASTREAM, DC, DISSEMINATOR, DS_COMPOSITE_MODEL, DS_COMPOSITE_MODEL1_0, DS_INPUT_SPEC1_0, DS_INPUT_SPEC1_1, ENVIRONMENT, FCFG, FEDORA, FEDORA_APP_CONTEXT_NAME, FEDORA_DEFAULT_APP_CONTEXT, FEDORA_HOME, FOXML, FOXML1_0, FOXML1_0_LEGACY, FOXML1_1, HTTP_REQUEST, MANAGEMENT, METHOD_MAP, METS, METS_EXT, METS_EXT1_0, METS_EXT1_0_LEGACY, METS_EXT1_1, MODEL, MULGARA, OAI_DC, OAI_DC2_0, OAI_FRIENDS, OAI_FRIENDS2_0, OAI_IDENTIFIER, OAI_IDENTIFIER2_0, OAI_PMH, OAI_PMH2_0, OAI_PROV, OAI_PROV2_0, OBJ_DATASTREAMS1_0, OBJ_HISTORY1_0, OBJ_ITEMS1_0, OBJ_METHODS1_0, OBJ_PROFILE1_0, OBJ_VALIDATION1_0, OBJECT, OLD_XLINK, PID_LIST1_0, RDF, RDF_XSD, RECOVERY, RELS_EXT1_0, RELS_INT1_0, REPO_DESC1_0, RESOURCE, SDEF, SDEF_METHOD_MAP1_0, SDEP, SDEP_METHOD_MAP1_0, SDEP_METHOD_MAP1_1, SERVICE_PROFILE, SOAP, SOAP_ENC, SUBJECT, TYPES, VIEW, WSDL, WSDL_HTTP, WSDL_MIME, XACML_POLICY, XACML_POLICY1_0, XLINK, XML_XSD, XMLNS, XSI |
| 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 |
RelsValidator
public RelsValidator()
validate
public void validate(PID pid,
String dsId,
InputStream content)
throws ValidationException
- Throws:
ValidationException
startElement
public void startElement(String nsURI,
String localName,
String qName,
Attributes a)
throws SAXException
- Specified by:
startElement in interface ContentHandler- Overrides:
startElement in class DefaultHandler
- Throws:
SAXException
characters
public void characters(char[] ch,
int start,
int length)
- Specified by:
characters in interface ContentHandler- Overrides:
characters in class DefaultHandler
endElement
public void endElement(String nsURI,
String localName,
String qName)
throws SAXException
- Specified by:
endElement in interface ContentHandler- Overrides:
endElement in class DefaultHandler
- Throws:
SAXException
Copyright © 2011 DuraSpace. All Rights Reserved.