NAME

PICA::Source - Data source that can be queried for PICA+ records

VERSION

version 0.585

SYNOPSIS

  my $server = PICA::Source->new(
      SRU => "http://my.server.org/sru-interface.cgi"
  );
  my $record = $server->getPPN('1234567890');
  $server->cqlQuery("pica.tit=Hamster")->count();

  # Get connection details from a config file
  $store = PICA::Source->new( config => "myconf.conf" );

  $result = $server->cqlQuery("pica.tit=Hamster", Limit => 15 );
  $result = $server->z3950Query('@attr 1=4 microformats');

  $record = $server->getPPN("1234567890");

Instead or in addition to SRU you can use Z39.50, PSI, and unAPI (experimental).

METHODS

new ( [ %params ] )

Create a new Server. You can specify an SRU interface with SRU, a Z39.50 server with Z3950, an unAPI base url with unAPI or a raw PICA PSI interface with PSI. Optional parameters include user and password for authentification. If you provide a config parameter, configuration parameters will read from a file or from the file specified with the PICASOURCE environment variable or from the file pica.conf in the current directory.

getPPN ( $ppn )

Get a record specified by its PPN. Returns a PICA::Record object or undef. Only available for source APIs SRU, unAPI, and PSI. You should check whether the returned object is empty or not. On error the special variable $@ is set.

cqlQuery ( $cql [ $parser | %params | ] )

Perform a CQL query and return the PICA::XMLParser object that was used to parse the resulting records. You can pass an existing Parser or parser parameters as listed at PICA::Parser. Only available for API type SRU.

z3950Query ( $query [, $plainparser | %params ] )

Perform a Z39.50 query via ZOOM. The resulting records are read with a PICA::PlainParser that is returned.

iktQuery ( $ikt, $term )

Search a source by IKT (search index) and search term. The current implementation only returns the first record. This method does only work for PSI source.

Returns a link to the result list of a search by IKT or undef. Croaks if no PSI source has been defined.

Returns a link to the record view of a record given by PPN. Croaks if no PSI source has been defined.

baseURL

Return the base URL (if specified) or the empty string.

UTILITY FUNCTIONS

The following methods are based on CGI::Utils by Don Owens.

url_encode

Returns the fully URL-encoded version of the given string. It does not convert space characters to '+' characters.

url_decode

Returns the fully URL-decoded version of the given string.

AUTHOR

Jakob Voß <voss@gbv.de>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Verbundzentrale Goettingen (VZG) and Jakob Voss.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.