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,
},
);
}

 

Advertisements
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: