Child pages
  • Doms Views and Update Tracking

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


  • collectionPid
  • state
  • viewAngle
  • offset
  • limit

This can esily easily be found by a simple query in the ENTRIES table.


Changing an object and marking the view as updated

Basically, we need three kinds of operations to handle updates:

  • We need to update the time for when a bundle was last updated. We'll call this "updateTimestamps"
  • We need to update which bundles in which states exist. We'll call this "modifyState"
  • We need to update which objects are part of the view. We'll call this "recalculateView"

There are a fixed number of operations that can be done on objects in doms. 

For each of these, this is what should be done on the index as a result

  1. Object Created: The Object was created in DOMS
    Fedora operations:
    - ingest

    Code Block


  2. Object Deleted: The Object was purged from DOMS
    Fedora operations:
    - purgeObject

    Code Block


  3. Object State Changed: The Object changed state in DOMS


    Fedora operations:
    - modifyObject

    Code Block


  4. Datastream Changed: The Object

    changed in some fashion that does not require the view to be recomputed, such as the content of datastreams.

    datastreams changed. Handled differently depending on whether this is the relations datastream
    Fedora operations:
    - modifyDatastreamByReference
    - modifyDatastreamByValue
    - setDatastreamState
    - setDatastreamVersionable

    Code Block
      if RELS-EXT


  5. Object Relations Changed: The Object changed in a fashion that DOES require the view to be recomputed.
    Fedora operations:
    - addRelationship
    - purgeRelationship

    Code Block

Each of these operations will be elaborated below



When the object state changes, we will have to update the state in the object, and possibly in any view containing the state.


  • Active, if the new state is Active and all other objects in the view are current Active
  • Deleted, if this is the entry object, and
  • Inactive, otherwise
Code Block
void objectStateModifiedmodifystate(String pid, Date date, String state) {
  	//Find the DomsObject rows that regard //If this object. 	//There will be one per entry/viewAngle combination
	results = OBJECTS.list(objectPid=pid);

	//Find all Entries that include this object
	//If the object does not previously exist, this list will be empty
	for (result : results) {
    	if (result.entryPid != pid) {
			if (viewAngle = 'Active' && allActive(entryPid, viewangle)) {
   was previously unknown and is an entry object, add it as a new entry object
    if (!OBJECTS.contains(pid)) {
        List<viewangle,cmpid,collection> viewEntries = doms.getViewEntries();
        foreach (viewEntry : viewEntries) //If{
this makes the view active, mark it as updated    ENTRIES.add(pid,date,state,viewangle,cmpid,collection)
	//Find the DomsObject rows that regard this object.
	//There will be one per entry/viewAngle  'Active',
	results = OBJECTS.list(objectPid=pid);

	//Find all Entries that include this object
	foreach (result : results) {
        oldstate = result.viewAngle,entryPid.state;
        newstate = calculatestate(result.entryPid, pid, 	                  date);
 timestamp, state) //TODO! Missing        
  }         	//Always markIf themthis asdeletes updatedthe forentry, thehandle inactivethat
state 	       if updateEntry(result.entryPid,newstate = 'D') {
 	           if (oldstate != 'D') {
      'Inactive',         	ENTRIES.removeAll(result.entryPid)
           date); 	}
   } 	}   	// Find view Info for thisreturn
object 	List<ViewInfo> viewInfoList = fedora.getViewInfo(pid, date); 	for (ViewInfo viewInfo}
: viewInfoList) {     	 // If it is anset entry objectactive, setremove itany indeleted theentries
ENTRIES table 	    if (viewInfo.isEntry()) {
			if (viewAnglenewstate = 'Active' && allActive(pid, viewInfo.viewangle))A') {
                updateEntry(pidENTRIES.remove(result.entryPid, 'Active', viewInfo.viewAngle, dateD');
  	    updateEntry(pid, 'Inactive', viewInfo.viewAngle, date);
            } else if (viewAngle = 'Deleted') {
                // TODO: Should we remove all objects referring to this viewangle?


Code Block
// Update the Entries table regarding a change
void updatetimestamps(String pid, Date date) {
	objects = OBJECTS.list(objectPid=pid);

	//Find all Entries that include this object
	foreach (object : objects) {

        state = updateEntry(pid, 'Deleted', viewInfo.viewAngle, date);
  calculatestate(object.entryPid) //TODO! Missing
        //If }entry elseis {currently deleted, skip
      	  if  updateEntry(pid,state = 'Inactive', viewInfo.viewAngle, date);
D') {
           } return;
   	} 	} }  // Update}
the Entries table regarding a change void updateEntry(String entryPid, String state, String viewAngle, Date date) {
    //Find the Entry objects that fulfill these restrictions
        List<Entry> results = ENTRIES.list(entrypid,state,viewangle) 
    //There might be no Entry, but if we are here, we know that an entry should exist, so create it.
    if (results.size() == 0) {
		ENTRIES.insert(new Entry(entryPid, viewAngle, state, date)); object.entrypid)

   } else {         for (Entry result : results) {
	            //IsOnly thisupdate active entry olderif thanbundle theis currentactive
change?             if (result.getDateForChange().getTime() < date.getTime()) {
   state = 'A' and state != 'A') {
            result.setDateForChange(date);    continue
	        //Is this entry older than the current  result.setState(state);change?
            if     (result.setViewAngle(viewAngle);getDateForChange < date) {
         }             //Save the entry
            ENTRIES.update(result, date);
        }     }
}   void updateDomsObjects(String objectPid, String entryPid, String viewAngle)}
{ 	list<DomsObject> results = OBJECTS.list(objectPid,entryPid,viewAngle)
    if (results.size() == 0) {
        OBJECTS.insert(new DomsObject(objectPid, entryPid, viewAngle));



An object's relations changed. This could change which objects are in which entry's views. 


Then we update the ENTRIES table to mark that the view is changed. 

TODO: This may ALSO also update content models or collections. I think we can fix this by calling objectModified when these specific relations are called



model or collection relations, which is handled separately

Code Block
objectRelationsChanged(pid, date) {
  //This code is pseudo'er than the rest
  if relation changes collection
    if it is an entry object
      update collection field for inactive
      if entry object is active
        update collection field for active

  //This code is pseudo'er than the rest
  if relation changes content model
    if it is previously an entry object
    if it is now an entry object

    //This can change the structure of the views and we must therefore recaculate the views

    //if a current entry object use this object, we will need to recalculate the view of that object

    //This method will only be called on objects that already exist.
    //ObjectModified() creates an Entry row, if the object is an entry object. As such, there will always be
    // the correct Entry entries when this method is called, and these should just be recalculated

    List<DomsObject> results = OBJECTS.list(objectPid=pid);

    //we now have a list of all the entries that include this object.

    for (DomsObject result : results) {

        //get the ViewBundle from fedora
        ViewBundle bundle = fedora.calcViewBundle(result.getEntryPid(), result.getViewAngle(), date);

        //First, remove all the objects in this bundle from the table
        removeNotListedFromDomsObjects(bundleOBJECTS.getContaineddelete(), result.getEntryPid(), result.getViewAngle());
        //Add all the objects from the bundle to the objects Table.
        for (String objectPid : bundle.getContained()) {
            updateDomsObjects(objectPid, bundle.getEntryOBJECTS.addAll(result.getEntryPid(), result.getViewAngle(), bundle.getViewAnglegetObjects());

      }          updateEntryupdateTimestamp(bundle.getEntry(), STATE_INPROGRESS, bundle.getViewAngle(), date);


void removeNotListedFromDomsObjects(List<String> objectPid, String entryPid, String viewAngle) {

    List<DomsObject> results = OBJECTS.list(entryPid,viewAngle);

    for (DomsObject result : results) {
        if (!objectPid.contains(result.getObjectPid())) {


With these two functions, the rest of the events can be modelled as from them

Object Changed

This is the same as Object State Changed, if the state did not really change. If the state is not changed, this method will just update timestamps in ENTRIES.

Object Created

An object that is created will not, per default, be part of any views, except any where it is the entry object, as these are defined through relations, and a newly created object will not reference any other objects.

As such, it is the same as Object State Changed.

Object Deleted

The Object was purged from DOMS.

Find the object as an entrypid in ENTRIES (if it is not an entry, it will not be there).

if is an entry 

    Mark is as deleted with the new date.

    Find all the rows in OBJECTS which refer to this entrypid and viewangles, and remove them. 

Remove the object from OBJECTS

TODO pseudocode