SeeAlso::Response - SeeAlso Simple Response
This class models a SeeAlso Simple Response which is practically the same as am OpenSearch Suggestions Response.
Creates a new SeeAlso::Response object (this is the same as an OpenSearch Suggestions Response object). The optional parameters are passed to the set method, so this is equivalent:
$r = SeeAlso::Response->new($query, $labels, $descriptions, $urls); $r = SeeAlso::Response->new->set($query, $labels, $descriptions, $urls);
To create a SeeAlso::Response from JSON use the fromJSON method.
Set the query parameter or the full content of this response. If the query parameter is an instance of SeeAlso::Identifier, the return of its normalized method is used. This methods croaks if the passed parameters do not fit to a SeeAlso response.
normalized
Add an item to the result set. All parameters must be strings. The URI is only partly checked for well-formedness, so it is recommended to use a specific URI class like URI and pass a normalized version of the URI:
URI
$uri = URI->new( $uri_str )->canonical
Otherwise your SeeAlso response may be invalid. If you pass a non-empty URI without schema, this method will croak. If label, description, and uri are all empty, nothing is added.
Returns the SeeAlso::Response object so you can chain method calls.
Get the number of entries in this response.
Get a specific triple of label, description, and url (starting with index 0):
($label, $description, $url) = $response->get( $index )
Get and/or set query parameter. If the query is a SeeAlso::Identifier it will be normalized, otherwise it will be converted to a string.
Return the response in JSON format and a non-mandatory callback wrapped around. The method will croak if you supply a callback name that does not match ^[a-z][a-z0-9._\[\]]*$.
^[a-z][a-z0-9._\[\]]*$
The encoding is not changed, so please only feed response objects with UTF-8 strings to get JSON in UTF-8. Optionally you can pass a JSON object to do JSON encoding of your choice.
Set this response by parsing JSON format. Croaks if the JSON string does not fit SeeAlso response format. You can use this method as as constructor or as method;
my $response = SeeAlso::Response->fromJSON( $jsonstring ); $response->fromJSON( $jsonstring )
Returns the response in CSV format with one label, description, uri triple per line. The response query is omitted. Please note that newlines in values are allowed so better use a clever CSV parser!
Returns the response as RDF triples in JSON/RDF structure. Parts of the result that cannot be interpreted as valid RDF are omitted.
Returns the response as RDF triples in JSON/RDF format.
Return the repsonse in RDF/N3 (including pretty print).
Escape a specific characters in a UTF-8 string for Turtle syntax / Notation 3
Encode an object as JSON string, possibly wrapped by callback method.
Jakob Voss <jakob.voss@gbv.de>
<jakob.voss@gbv.de>
Copyright (C) 2007-2009 by Verbundzentrale Goettingen (VZG) and Jakob Voss
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
To install SeeAlso::Server, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SeeAlso::Server
CPAN shell
perl -MCPAN -e shell install SeeAlso::Server
For more information on module installation, please visit the detailed CPAN module installation guide.