A single digital object in a Fedora respository, with methods and properties to easy creating, accessing, and updating a Fedora object or any of its component parts.
Add a new relationship to the RELS-EXT for this object. Calls API_M.addRelationship().
Example usage:
isMemberOfCollection = "info:fedora/fedora-system:def/relations-external#isMemberOfCollection"
collection_uri = "info:fedora/foo:456"
object.add_relationship(isMemberOfCollection, collection_uri)
Parameters: |
|
---|---|
Return type: | boolean |
XML-specific version of Datastream. Datastreams are initialized as instances of XmlDatastreamObject. An additional, optional parameter objtype is passed to the Datastream object to configure the type of eulxml.xmlmap.XmlObject that should be used for datastream content.
Example usage:
from eulxml.xmlmap.dc import DublinCore
class MyDigitalObject(DigitalObject):
dc = XmlDatastream("DC", "Dublin Core", DublinCore)
Default namespace to use when generating new PIDs in get_default_pid() (by default, calls Fedora getNextPid, which will use Fedora-configured namespace if default_pidspace is not set).
Dictionary of all datastreams that belong to this object in Fedora. Key is datastream id, value is an ObjectDatastream for that datastream.
Only retrieved when requested; cached after first retrieval.
Does the object exist in Fedora?
Get any datastream on this object as a DatastreamObject
Get information about a particular datastream belonging to this object.
Parameters: | dsid – datastream id |
---|---|
Return type: | DatastreamProfile |
Get information about this object (label, owner, date created, etc.).
Return type: | ObjectProfile |
---|
Get the next default pid when creating and ingesting a new DigitalObject instance without specifying a pid. By default, calls ApiFacade.getNextPID() with the configured class default_pidspace (if specified) as the pid namespace.
If your project requires custom pid logic (e.g., object pids are based on an external pid generator), you should extend DigitalObject and override this method.
Check if this object subscribes to the specified content model.
Parameters: | model – URI for the content model, as a string (currently only accepted in info:fedora/foo:### format) |
---|---|
Return type: | boolean |
Does the object have the expected content models for this type of DigitalObject ?
object label
object owner
Fedora pidspace of this object
RDF-specific version of Datastream. Datastreams are initialized as instances of RdfDatastreamObject.
Example usage:
class MyDigitalObject(DigitalObject):
rels_ext = RdfDatastream("RELS-EXT", "External Relations")
Save to Fedora any parts of this object that have been modified (object profile or any datastream content or info). If a failure occurs at any point on saving any of the parts of the object, will back out any changes that have been made and raise a DigitalObjectSaveFailure with information about where the failure occurred and whether or not it was recoverable.
If the object is new, ingest it. If object profile information has been modified before saving, this data is used in the ingest. Datastreams are initialized to sensible defaults: XML objects are created using their default constructor, and RDF graphs start empty. If they’re updated before saving then those updates are included in the initial version. Datastream profile information is initialized from defaults specified in the Datastream declaration, though it too can be overridden prior to the initial save.
object state (Active/Inactive/Deleted)
Fedora URI for this object (info:fedora/foo:### form of object pid)
Fedora URI for this object, as an rdflib URI object
Custom exception class for when a save error occurs part-way through saving an instance of DigitalObject. This exception should contain enough information to determine where the save failed, and whether or not any changes saved before the failure were successfully rolled back.
Datastream descriptor to simplify configuration and access to datastreams that belong to a particular DigitalObject.
When accessed, will initialize a DatastreamObject and cache it on the DigitalObject that it belongs to.
Example usage:
class MyDigitalObject(DigitalObject):
text = Datastream("TEXT", "Text content", defaults={'mimetype': 'text/plain'})
All other configuration defaults are passed on to the DatastreamObject.
XML-specific version of Datastream. Datastreams are initialized as instances of XmlDatastreamObject. An additional, optional parameter objtype is passed to the Datastream object to configure the type of eulxml.xmlmap.XmlObject that should be used for datastream content.
Example usage:
from eulxml.xmlmap.dc import DublinCore
class MyDigitalObject(DigitalObject):
dc = XmlDatastream("DC", "Dublin Core", DublinCore)
RDF-specific version of Datastream. Datastreams are initialized as instances of RdfDatastreamObject.
Example usage:
class MyDigitalObject(DigitalObject):
rels_ext = RdfDatastream("RELS-EXT", "External Relations")
Object to ease accessing and updating a datastream belonging to a Fedora object. Handles datastream content as well as datastream profile information. Content and datastream info are only pulled from Fedora when content and info fields are accessed.
Intended to be used with DigitalObject and intialized via Datastream.
param obj: | the DigitalObject that this datastream belongs to. |
---|---|
param id: | datastream id |
param label: | default datastream label |
param mimetype: | default datastream mimetype |
param versionable: | |
default configuration for datastream versioning | |
param state: | default configuration for datastream state |
param format: | default configuration for datastream format URI |
param checksum: | default configuration for datastream checksum |
param format: | default configuration for datastream checksum type |
contents of the datastream; only pulled from Fedora when accessed, cached after first access
Check if either the datastream content or profile fields have changed and should be saved to Fedora.
Return type: | boolean |
---|
datastream label
datastream mimetype
Save datastream content and any changed datastream profile information to Fedora.
Return type: | boolean for success |
---|
Size of the datastream content
datastream state (Active/Inactive/Deleted)
Undo the last change made to the datastream content and profile, effectively reverting to the object state in Fedora as of the specified timestamp.
For a versioned datastream, this will purge the most recent datastream. For an unversioned datastream, this will overwrite the last changes with a cached version of any content and/or info pulled from Fedora.
boolean; indicates if Fedora is configured to version the datastream
Extends DatastreamObject in order to initialize datastream content as an instance of a specified XmlObject.
See DatastreamObject for more details. Has one additional parameter:
Parameters: | objtype – xml object type to use for datastream content; if not specified, defaults to XmlObject |
---|
Extends DatastreamObject in order to initialize datastream content as an RDF graph.
Replace a uri reference everywhere it appears in the graph with another one. It could appear as the subject, predicate, or object of a statement, so for each position loop through each statement that uses the reference in that position, remove the old statement, and add the replacement.