Fedora Repository Views
...
But the angle one views the repository might also affect the number of entries seen. The above, recursive approach will always lead to one entry per data object. The remedy for this is to mark some classes as Entries for a certain view angle. This means that to compute the records for a given view angle, the view of all objects of a class that is an Entry should be computed. This is the view of the repository.
Fedora Implementation
This section describes how the above could be implemented in Fedora.
...
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
- object Object Created: The Object was created in DOMS
- object Object Deleted: The Object was purged from DOMS
- object Object State Changed: The Object changed state in DOMS
- object Object Changed: The Object changed in some fashion that does not require the view to be recomputed, such as the content of datastreams.
- object Object Relations Changed: The Object changed in a fashion that DOES require the view to be recomputed.
Each of these operations will be elaborated below
Object Created
Object Created can be implemented as Object State Changed, followed by Object Relations Changed.
Object State Changed
Code Block | ||
---|---|---|
| ||
objectModified(String pid, Date date, String state) {
//Find the DomsObject rows that regard this object.
//There will be one per entry/viewAngle combination
List<DomsObject> results = OBJECTS.list(objectPid=pid);
//Find all Entries that include this object
for (DomsObject result : results) {
if (!result.getEntryPid().equals(pid)) {
//Mark them as updated
updateEntry(result.getEntryPid(),
state,
result.getViewAngle(),
date);
}
}
// Find view Info for this object
List<ViewInfo> viewInfoList = fedora.getViewInfo(pid, date);
for (ViewInfo viewInfo : viewInfoList) {
//If it is an entry object, set it in the ENTRIES table
if (viewInfo.isEntry()) {
updateEntry(pid, state, viewInfo.getViewAngle(), date);
updateDomsObjects(pid, pid, viewInfo.getViewAngle());
}
}
}
private 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));
} else {
for (Entry result : results) {
//Or there might have been some results
//Is this entry older than the current change?
if (result.getDateForChange().getTime() < date.getTime()) {
result.setDateForChange(date);
result.setEntryPid(entryPid);
result.setState(state);
result.setViewAngle(viewAngle);
}
//Save the entry
ENTRIES.update(result);
}
}
}
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));
}
}
|
Find all the EntryPids that refer to this object, by querying the OBJECTS table for rows objectPid.
There are several situations where the list will be used
...