A 'service' in Anno-J (often referred to as a fetcher) is is a small program that sits out on the web somewhere and responds to simple HTTP requests with sensible data. For example, a time fetcher might respond to the query: http://www.somesite.com/service?tellTime with a response of 09:30:00 AM. From the client's perspective, the fetcher's implementation details are irrelevant.
Anno-J is a client and it's important to realize that it does not store data: it is a REST-based, 100% server-side agnostic application. It is the responsibility of the data provider, not the client, to maintain, curate, secure, syndicate, and host his/her own data.
This section provides an example of how to create a server-side fetcher that provides Gene Model annotation data in response to simple HTTP GET requests (conveniently the same requests that an Anno-J GeneModels plugin uses). The example uses MySQL, PHP and Apache but does not depend upon these technologies.
Syndication provides a way for you to attach ownership information to your data service and also provides potential users with information about the data itself. Anno-J requires that a data service provide syndication information in order to function.
Anno-J uses a simple GET request to syndicate data and expects a JSON string in response, eg: example.php?action=syndicate.
Here is an example of some code, written in PHP, that generates an appropriate response to a request for syndication.
/**
* Example of a PHP-based response to a syndication request (for the gene models data service)
* Note that PHP, like most popular languages, now has inbuilt JSON support
*/
if (isset($_GET['syndicate']))
{
$response = array
(
'success' => true,
'data' => array
(
'institution' => array
(
'name' => 'Some Institution',
'url' => 'http://www.si.org',
'logo' => 'http://www.si.org/logo.png'
),
'curator' => array
(
'name' => 'Joe Schmo',
'email' => 'joe.schmo@si.org'
),
'service' => array
(
'title' => 'Gene Models',
'copyright' => 'Copyright 2008 Some Institution',
'license' => 'http://creativecommons.org',
'version' => '2008-May-15',
'details' => 'Gene-model annotations for our favourite little weed.'
)
)
);
echo json_encode($response);
}