[OPEN-ILS-DEV] Feed.pm

Grant Johnson FGJohnson at upei.ca
Wed Nov 12 14:19:51 EST 2008


Hi all,

I would like to make a feed to return oai_dc. Has anyone done this yet?
Do I use the loc version or openarchives 

http://www.loc.gov/standards/marcxml/
or
      from http://open-ils.org/dokuwiki/doku.php?id=backend-devel:supercat:examples
  <format>
    <name>oai_dc</name>
    <type>application/xml</type>
    <namespace_uri>http://www.openarchives.org/OAI/2.0/oai_dc/</namespace_uri>
    <schema_location>http://www.openarchives.org/OAI/2.0/oai_dc.xsd</schema_location>
  </format>


And how would I integrate it into Feed.pm?
Thanks

Grant

____________ MODS3 Example below  ________________________

package OpenILS::WWW::SuperCat::Feed::mods3;
use base 'OpenILS::WWW::SuperCat::Feed::mods';

sub new {
	my $class = shift;
	my $self = $class->SUPER::build('<mods:modsCollection version="3.0" xmlns:mods="http://www.loc.gov/mods/v3"/>');
	$self->{type} = 'application/xml';
	$self->{item_xpath} = '/mods:modsCollection';
	return $self;
}

package OpenILS::WWW::SuperCat::Feed::mods3::item;
use base 'OpenILS::WWW::SuperCat::Feed::mods::item';

sub new {
	my $class = shift;
	my $xml = shift;
	my $self = $class->SUPER::build($xml);
	$self->{doc}->documentElement->setNamespace('http://www.loc.gov/mods/v3', undef);
	$self->{doc}->documentElement->setNamespace('http://www.loc.gov/mods/v3', 'mods');
	$self->{type} = 'application/xml';
	$self->{holdings_xpath} = '/mods:mods';
	return $self;
}

sub link {
	my $self = shift;
	my $type = shift;
	my $id = shift;

	if ($type eq 'unapi' || $type eq 'opac') {
		$self->_create_node(
			'mods:mods',
			'http://www.loc.gov/mods/v3',
			'mods:relatedItem',
			undef,
			{ type => 'otherFormat', id => 'link-'.$linkid }
		);
		$self->_create_node(
			"mods:mods/mods:relatedItem[\@id='link-$linkid']",
			'http://www.loc.gov/mods/v3',
			'mods:recordIdentifier',
			$id
		);
		$linkid++;
	}
}





More information about the Open-ils-dev mailing list