Fedora Object Templates

It is easily possible to create data objects from the definition in a content model, which was the basic strategy for the DOMS GUI. This strategy has one drawback, however. With just the information contained in the content models, almost no data can be automatically filled in. But for most data objects there is much data that could be filled automatically, based on the context. As a general solution to this problem, we introduced the concept of Object Templates (prototypes, stem-objects and so on).

A template is for all intents and purposes a normal data object. It has a special relation "doms-relations:isTemplateFor" (see DomsNameSpacesAndSchemas) to a content model. This marks it as a template for this content model. There can be any number of templates for each content model. Most content models will have at least one template. This one will be the blank object, i.e. the object that could be automatically created from the content model.

A template object is not guaranteed to be valid in regards to the content models that it subscribes to. It is guaranteed not to contain anything not allowed, but it might not contain everything required, as this should be filled in when the template is used. As such, the template data objects are always in the fedora state "Inactive". This prevents the validation services from marking the object as broken, and the dissemination services from publishing the object to the customers.

A template object must always be part of a collection, like ordinary data objects.

Using a template

The way to create a new object via the template goes like this, given the PID of a collection object and a list of PIDs of content models.

  1. Find the template object:
    1. Query the Resource index for all templates that has a "doms-relations:isPartOfCollection" relation to this collection, and has a "doms-relations:isTemplateFor" relation to one of the content models, or a content model that has is connected to one of those via a list of "doms-relations:extendsModel" relations. This can be done easily with the allTemplatesInCollectionForContentModel API method

  2. Have the user select one of the found templates
  3. Load the object from Fedora and change it to a normal data object. This can be done like this, or through the Object creation API

    1. Generate a new PID for the object
    2. Delete all "doms-relations:isTemplateFor" relations in the object
    3. Save the new object to Fedora
  4. Open the new object in the GUI

So, the relations from the template will be copied into the new object, along with the content of any datastreams.

There are two situations, where new objects will be made from templates.

  1. You have an existing object. You wish to relate this object to a new object, which you will create. From the ontology, you know which content model the object should subscribe to. That gives you the list (of length one) of PIDs of content models. The new object should be in the same collection as the current object, so there you have the PID of the collection. Then make the object according to the guide above.
  2. You do not have an existing object. Rather, you want to create a new main object (see FedoraViewBlobs). Select a named view. Select a collection for the object. The query for all content models in this collection, that are declared as main for the named view. This gives you the list of content models and the collection pid. Then make the object according to the guide above.

Abstract Content Models

Templates are meant to be the one and only way to create new objects, aside from batch ingests, import and other yet-to-be defined ways. So, for content models without templates, there is no way to make objects of this content model. Such content models are referred to as abstract content models, and many of the content models in the Base collection will be abstract.

Note, you can still create objects of other content models, that extend the abstract models. Just not of the abstract models themselves.

FedoraObjectTemplates (last edited 2010-03-17 13:12:47 by localhost)