Differences between revisions 4 and 15 (spanning 11 versions)
Revision 4 as of 2008-09-30 09:38:12
Size: 2275
Editor: abr
Comment:
Revision 15 as of 2010-03-17 13:12:47
Size: 4184
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Fedora Object Prototypes = ## page was renamed from FedoraObjectPrototypes
= Fedora Object Templates =
Line 3: Line 4:
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 are much data that could be filled automatically, based on the context. As a general solution to this problem, we introduced the concept of Object Prototypes (templates, stem-objects and so on). 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).
Line 5: Line 6:
A prototype is for all intents and purposes a normal data object. It has a special relation "doms-relations:isPrototypeFor" (see DomsNameSpaces) to a content model. This marks it as a prototype for this content model. There can be any number of prototypes for each content model, but each to them must have at least one. This one will be the blank object, ie. the object that could be automatically created from the content model. 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.
Line 7: Line 8:
A prototype object is not guaranteed to be valid in regards to the content models that describe it. It is guaranteed not to contain anything not allowed, but it might not contain everything required, as this should be filled in when the prototype is used. A prototype is therefore never in the STATE "published", but always in "intermediate", (see FedoraTransactionsReplacement). 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 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.
Line 9: Line 10:
A template object must always be part of a collection, like ordinary data objects.
Line 10: Line 12:
== Using a prototype == == Using a template ==
Line 12: Line 14:
The way to create a new object via the prototype goes like this:
 1. Select the content model you wish to create a new object from
 1. Query the triple store for all objects having a "doms-relations:isPrototypeFor" relation to this content model
 1. Have the user select one of the found prototypes
 1. Load the object from Fedora.
 1. Change the PID so that when resaved it does not overwrite the prototype
 1. Remove the "doms-relations:isPrototype" relation from the object.
 1. Open the loaded+changed object in the GUI
 1. Have the user perform any other changes
 1. Ingest the object with the new PID.
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 [[Fedora 3.0 triple store API| 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 [[Risearch API|allTemplatesInCollectionForContentModel]] API method
 1. Have the user select one of the found templates
 1. 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
  1. Delete all "doms-relations:isTemplateFor" relations in the object
  1. Save the new object to Fedora
 1. Open the new object in the GUI
Line 23: Line 24:
So, the relations from the prototype will be copied into the new object, along with the content of any datastreams. 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.
 1. 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.

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)