# ... and a MODS clone to populate, with guts removed.
my $mods = $_parser->parse_string($master)->documentElement;
+ $mods->setNamespace('http://www.loc.gov/mods/', undef);
$mods->setNamespace( "http://www.loc.gov/mods/", "mods", 1 );
($mods) = $mods->findnodes('//mods:mods');
$mods->removeChildNodes;
# Add the metarecord ID as a (locally defined) info URI
my $recordInfo = $mods
->ownerDocument
- ->createElement("mods:recordInfo");
+ ->createElement("recordInfo");
my $recordIdentifier = $mods
->ownerDocument
- ->createElement("mods:recordIdentifier");
+ ->createElement("recordIdentifier");
my ($year,$month,$day) = reverse( (localtime)[3,4,5] );
$year += 1900;
my $relatedItem = $mods
->ownerDocument
- ->createElement("mods:relatedItem");
+ ->createElement("relatedItem");
$relatedItem->setAttribute( type => 'constituent' );
my $identifier = $mods
->ownerDocument
- ->createElement("mods:identifier");
+ ->createElement("identifier");
$identifier->setAttribute( type => 'uri' );
my $subRecordInfo = $mods
->ownerDocument
- ->createElement("mods:recordInfo");
+ ->createElement("recordInfo");
my $subRecordIdentifier = $mods
->ownerDocument
- ->createElement("mods:recordIdentifier");
+ ->createElement("recordIdentifier");
my $subid = $map->source;
$subRecordIdentifier->appendTextNode(
if (!$format) {
my $body = "Content-type: application/xml; charset=utf-8\n\n";
- if ($uri =~ m{^tag:[^:]+:([^\/]+)/(\d+)(?:\[([0-9,]+)\])?(?:/(.+))?}o) {
+ if ($uri =~ m{^tag:[^:]+:([^\/]+)/([^\/[]+)(?:\[([0-9,]+)\])?(?:/(.+))?}o) {
$id = $2;
$paging = $3;
$lib = uc($4);
return Apache2::Const::OK;
}
- if ($uri =~ m{^tag:[^:]+:([^\/]+)/(\d+)(?:\[([0-9,]+)\])?(?:/(.+))?}o) {
+ my $scheme;
+ if ($uri =~ m{^tag:[^:]+:([^\/]+)/([^\/[]+)(?:\[([0-9,]+)\])?(?:/(.+))?}o) {
+ $scheme = $1;
$id = $2;
$paging = $3;
($lib,$depth) = split('/', $4);
$type = 'record';
- $type = 'metarecord' if ($1 =~ /^metabib/o);
- $type = 'isbn' if ($1 =~ /^isbn/o);
- $type = 'call_number' if ($1 =~ /^call_number/o);
- $type = 'acp' if ($1 =~ /^asset-copy/o);
- $type = 'acn' if ($1 =~ /^asset-call_number/o);
- $type = 'auri' if ($1 =~ /^asset-uri/o);
- $type = 'authority' if ($1 =~ /^authority/o);
+ $type = 'metarecord' if ($scheme =~ /^metabib/o);
+ $type = 'isbn' if ($scheme =~ /^isbn/o);
+ $type = 'acp' if ($scheme =~ /^asset-copy/o);
+ $type = 'acn' if ($scheme =~ /^asset-call_number/o);
+ $type = 'auri' if ($scheme =~ /^asset-uri/o);
+ $type = 'authority' if ($scheme =~ /^authority/o);
$command = 'retrieve';
- $command = 'browse' if ($type eq 'call_number');
+ $command = 'browse' if (grep { $scheme eq $_ } qw/call_number title author subjet topic authority.title authority.author authority.subject authority.topic series item-age/);
}
if ($paging) {
my $ou_types = $actor->request( 'open-ils.actor.org_types.retrieve' )->gather(1);
my $lib_depth = $depth || (grep { $_->id == $lib_object->ou_type } @$ou_types)[0]->depth;
- if ($type eq 'call_number' and $command eq 'browse') {
- print "Location: $root/browse/$base_format/call_number/$lib/$id\n\n";
+ if ($command eq 'browse') {
+ print "Location: $root/browse/$base_format/$scheme/$lib/$id\n\n";
return 302;
}
my $method = "open-ils.supercat.$type.$base_format.$command";
my @params = ($id);
- push @params, $lib, $flesh_feed, $paging if ($base_format eq 'holdings_xml');
+ push @params, $lib, $lib_depth, $flesh_feed, $paging if ($base_format eq 'holdings_xml');
my $req = $supercat->request($method,@params);
my $data = $req->gather();
my $base = $cgi->url;
my $host = $cgi->virtual_host || $cgi->server_name;
- my $year = (gmtime())[5] + 1900;
+ my ($year,$month,$day) = reverse( (localtime)[3,4,5] );
+ $year += 1900;
+ $month += 1;
+
+ my $tag_prefix = sprintf("tag:open-ils.org,$year-\%0.2d-\%0.2d", $month, $day);
my $flesh_feed = parse_feed_type($type);
#my $rec = $record->id;
my $rec = $record;
- my $item_tag = "tag:$host,$year:biblio-record_entry/$rec/$lib";
- $item_tag = "tag:$host,$year:isbn/$rec/$lib" if ($search eq 'isbn');
+ my $item_tag = "$tag_prefix:biblio-record_entry/$rec/$lib";
+ $item_tag = "$tag_prefix:metabib-metarecord/$rec/$lib" if ($search eq 'metarecord');
+ $item_tag = "$tag_prefix:isbn/$rec/$lib" if ($search eq 'isbn');
$item_tag .= "/$depth" if (defined($depth));
- $item_tag = "tag:$host,$year:authority-record_entry/$rec" if ($search eq 'authority');
+ $item_tag = "$tag_prefix:authority-record_entry/$rec" if ($search eq 'authority');
my $xml = $supercat->request(
"open-ils.supercat.$search.$type.retrieve",