All Versions
Fedora 3.8.0 (Current Release)
Fedora 3.7.x
Fedora 3.6.x
Fedora 3.5.x
More..
This guide describes how Service Definition Objects are constructed in detail. For a conceptual overview of these and other special Fedora object types, please see the Fedora Digital Object Model document.
In Fedora, a Service Definition ("SDef") is a special kind of object that defines a set of operations on objects in a repository. As you will see, that set of operations needs to be expressed in a particular way inside the object in order for Fedora to understand it.
Although you may author Fedora objects in other ways (e.g. by making a series of API calls to your repository), we will assume for this guide that the object is being constructed in FOXML format outside the repository, then ingested in a single step.
As with all Fedora objects, Service Definitions must declare a persistent identifier ("PID") that is unique within the repository. There are no special restrictions on the PID beyond those described in the Fedora Identifiers document. In FOXML format, the PID is declared in the root element of the XML document as shown below:
Code Block |
---|
<?xml version="1.0" encoding="UTF-8"?> <foxml:digitalObject xmlns:foxml="info:fedora/fedora-system:def/foxml#" VERSION="1.1" PID="demo:MyServiceDefinition"> <!-- Object Properties --> <!-- Datastreams --> </foxml:digitalObject> |
There are also no special restrictions on the top-level object properties for Service Definitions. In the following FOXML fragment, we assert that the state of the object is Active and the label is My Service Definition.
Code Block |
---|
<foxml:objectProperties> <foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/> <foxml:property NAME="info:fedora/fedora-system:def/model#label" VALUE="My Service Definition"/> </foxml:objectProperties> |
The DC datastream describes the object in human terms using the Dublin Core Metadata Element Set. If you don't provide it yourself, Fedora will automatically add a bare-bones DC datastream for the object at ingest time. For an example DC datastream, please see the FOXML Ingest Example.
The RELS-EXT datastream expresses relationships and properties of the object in RDF. An object asserts that it is a Service Definition Object through a special hasModel relationship to the fedora-system:ServiceDefinition-3.0 object as shown below:
Code Block |
---|
<foxml:datastream ID="RELS-EXT" CONTROL_GROUP="X" STATE="A" VERSIONABLE="true"> <foxml:datastreamVersion ID="RELS-EXT1.0" MIMETYPE="application/rdf+xml" FORMAT_URI="info:fedora/fedora-system:FedoraRELSExt-1.0" LABEL="RDF Statements about this object"> <foxml:xmlContent> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:fedora-model="info:fedora/fedora-system:def/model#"> <rdf:Description rdf:about="info:fedora/demo:MyServiceDefinition"> <fedora-model:hasModel rdf:resource="info:fedora/fedora-system:ServiceDefinition-3.0"/> </rdf:Description> </rdf:RDF> </foxml:xmlContent> </foxml:datastreamVersion> </foxml:datastream> |
The METHODMAP datastream is the heart of the Service Definition object. It defines the set of methods in the Fedora Service Definition Method Map format. Each method may be defined in this datastream as taking zero or more user-supplied parameters. Each parameter may be required or optional, with a default value and optionally, a set of valid values.
In the following example, we define several methods:
Code Block |
---|
<foxml:datastream ID="METHODMAP" CONTROL_GROUP="X" STATE="A" VERSIONABLE="true"> <foxml:datastreamVersion ID="METHODMAP1.0" FORMAT_URI="info:fedora/fedora-system:FedoraSDefMethodMap-1.0" LABEL="Abstract Method Map" MIMETYPE="text/xml"> <foxml:xmlContent> <fmm:MethodMap xmlns:fmm="http://fedora.comm.nsdlib.org/service/methodmap" name="N/A"> <fmm:Method operationName="methodOne"/> <fmm:Method operationName="methodTwo"> <fmm:UserInputParm parmName="parm1" defaultValue="value1" required="false" passBy="VALUE"/> </fmm:Method> <fmm:Method operationName="methodThree"> <fmm:UserInputParm parmName="parm1" defaultValue="value1" required="false" passBy="VALUE"> <fmm:ValidParmValues> <fmm:ValidParm value="value1"/> <fmm:ValidParm value="value2"/> </fmm:ValidParmValues> </fmm:UserInputParm> <fmm:UserInputParm parmName="parm2" defaultValue="" required="true" passBy="VALUE"/> </fmm:Method> </fmm:MethodMap> </foxml:xmlContent> </foxml:datastreamVersion> </foxml:datastream> |