Archive for December, 2010

Implementing types in proserver

To implement the types command in proserver as written by Andy Jenkinson who has updated proserver to a 1.6 spec version:

 

It is done by implementing the build_types method. The ‘grouped_db’ adaptor that comes with ProServer implements it. There is also a default implementation of this method in the default SourceAdaptor superclass (so just turn it on by declaring the capability), but it works by getting the list of types from the features command, so usually only works if the build_features method is built to handle method calls with no ‘segment’ parameter. When I implement it, I generally do this:

sub build_types {
my ($self, $args) = @_;

if ($args->{‘segment’}) {
return $self->SUPER::build_types($args);
}

return (
{
‘type’         => ‘description’,
‘typetxt’      => ‘Citation count’,
‘type_cvid’    => ‘BS:00127’, # “nonpositional”
‘typecategory’ => ‘summary’,
‘count’        => 0,
},
{
‘type’         => ‘publication-summary’,
‘typetxt’      => ‘Publication’,
‘type_cvid’    => ‘BS:00138’, # “publication”
‘typecategory’ => ‘summary’,
‘count’        => 0,
},
);
}