Mike Taylor > Keystone-Resolver > Keystone::Resolver::Result

Download:
Keystone-Resolver-1.23.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

Keystone::Resolver::Result - a result, with its type, resolved from an OpenURL

SYNOPSIS ^

 $result = new OpenURL::Result("fulltext", "", "CQL Tutorial", 15,
                               "http://zing.z3950.org/cql/intro.html");
 $type = $result->type();
 $text = $result->text()

DESCRIPTION ^

A Keystone::Resolver::Result object represents one of the (potentially) many results found by resolving an OpenURL. It can't do anything useful apart from tell you the data with which it was created, and render itself. What we're looking for here is, I think, what we doctors, in fact, call a struct.

METHODS ^

new()

 $r1 = new OpenURL::Result("fulltext", "", "CQL web site", 10,
                           "http://zing/z3950.org/cql/");
 $r2 = new OpenURL::Result("bookstore", "", "Amazon", 25,
                           "isbn:0253333490");
 $r3 = new OpenURL::Result("citation", "JVP", "JVP format citation", 99,
                           "Wedel 2003.  <i>Paleobiology</i>.",
                           "text/html", 1);

Creates a new Keystone::Resolver::Result object with the specified parameters. A result is represented by the following components:

type

A short string indicating the type of service that provided the result, e.g. fulltext, abstract, websearch, citation. These are intended to be recognised by XSLT stylesheets rather than read by humans.

tag

A short string indicating the particular service that provided the result. This, too, is intended for stylesheets to compare with rather than for humans: service is the human-readable equivalent. This tag is useful for some types of service (e.g. citation) but not necessarily for others (e.g. fulltext).

service

A short human-readable description of the service that provided the result.

priority

An integer representing the priority of this result relative to others of the same type. Lower values represent higher priorities.

text

The text of the result itself. Its form may vary depending on the type of service that provided it. For example, for fulltext and abstract services, it's a URI; but for citation services, it's an HTML fragment.

text

The text of the result itself. Its form may vary depending on the type of service that provided it. For example, for fulltext and abstract services, it's a URI; but for citation services, it's an HTML fragment.

mimeType

(Optional) An indication of the MIME-type of the text.

single

(Optional) If provided and true, then this result is the only one explicitly requested by the ContextObject.

type(), tag(), service(), priority(), text(), mimeType(), single()

 $type = $result->type();
 $text = $result->text();
 die if $type ne "fulltext" || $text ne "http://zing.z3950.org/cql/";

type() returns the type of a Keystone::Resolver::Result, tag() returns a tag for the name of the service that provides it, service() returns a description of the service, priority() returns its priority, text() returns its text, mimeType() returns its mime-type and single() returns an indication of whether the result was the only one requested. These are, respectively, the first to seventh parameters with which it was created.

render()

 print $result->render(), "\n";

Returns a human-readable string representing a Keystone::Resolver::Result.

syntax highlighting: