When our records are being harvested via OAI we should notice that some harvesters need a namespace and some others do not. So, what is a namespace? Example:
- Namespace setName:
- No-Namespace setName:
Our cds invenio 0.99.1 did NOT have namespace’d setNames. Adding em is a easy task.
Adding namespaces to SetName’s
Edit oaiarchive.py and replace these lines:
for set in unique(get_field(sysno, CFG_OAI_SET_FIELD)): if set: # Print only if field not empty out = "%s <setSpec>%s</setSpec>\n" % (out, set) |
With
for set in unique(get_field(sysno, CFG_OAI_SET_FIELD)): if set: # Print only if field not empty out = "%s <setSpec>uzcds:%s</setSpec>\n" % (out, set) |
(notice that my ‘namespace’ will be ‘uzcds’)
Harvesting (ListRecords) from a set, no matter if it is called with the namespace or not
Version: 0.99.1
File: oai_repository.py
Function: oaigetsysnolist
Whe you list your sets: http://zaguan.unizar.es/oai2d?verb=ListSets invenio spits:
By default, this work: http://zaguan.unizar.es/oai2d?verb=ListRecords&metadataPrefix=oai_dc&set=tesis
But this does not: http://zaguan.unizar.es/oai2d?verb=ListRecords&metadataPrefix=oai_dc&set=uzcds:tesis
The fix to make the second statement work is super-easy! Replace the oaigetsysnolist default function with the following code:
def oaigetsysnolist(set="", fromdate="", untildate=""): "Returns list of system numbers for the OAI set 'set', modified from 'fromdate' until 'untildate'." if fromdate != "": fromdate = normalize_date(fromdate, "T00:00:00Z") else: fromdate = get_earliest_datestamp() if untildate != "": untildate = normalize_date(untildate, "T23:59:59Z") else: untildate = get_latest_datestamp() #--- These are the new lines! setlimpio=set.split(':') if len(setlimpio) == 2: set = setlimpio[1] #---/end of new lines recids = perform_request_search(f1=CFG_OAI_ID_FIELD, p1="oai:*", m1="e", op1='a', f2=((set and CFG_OAI_SET_FIELD) or ""), p2=set, m2="e", d1=utc_to_localtime(fromdate), d2=utc_to_localtime(untildate), dt='m', ap=0) return recids |
