#!/usr/bin/perl -w #----------------------------------------------------------------- # GenerateRDF.cgi # Author: Edward Kawas , # For copyright and disclaimer see below. # # $Id: GenerateRDF.cgi,v 1.1 2008/02/21 00:21:27 kawas Exp $ # # NOTES: # 1. This script assumes that a BioMOBY registry is properly # installed and that SetEnv commands have been added to # the servers environment (e.g. httpd.conf) #----------------------------------------------------------------- use strict; use CGI qw/:standard/; use MOBY::RDF::Ontologies::Objects; use MOBY::RDF::Ontologies::ServiceTypes; use MOBY::RDF::Ontologies::Namespaces; use MOBY::RDF::Ontologies::Services; use MOBY::Client::Central; my $url = url( -relative => 1, -path_info => 1 ); my $form = new CGI; my %p = $form->Vars unless param('keywords'); %p = ($form->param('keywords') => '') if param('keywords'); my $service = $p{'service'} || ''; my $authority = $p{'authority'} || ''; if ($service and $authority) { my $name = $p{'service'}; $name =~ s/ //g; $name = $p{'authority'} unless $name; print "Content-type: application/rdf+xml\n"; print "Content-Disposition: attachment; filename=". $name . ".rdf\n"; print "Content-Description: Service Instance RDF\n\n"; my $x = MOBY::RDF::Ontologies::Services->new; # get pretty printed RDF/XML for one service print $x->findService({ serviceName => $p{'service'}, isAlive => 'no', authURI => $p{'authority'} }); } elsif ($authority and not $service) { print "Content-type: application/rdf+xml\n"; print "Content-Disposition: attachment; filename=". $p{'authority'} . ".rdf\n"; print "Content-Description: Service Instance RDF\n\n"; my $x = MOBY::RDF::Ontologies::Services->new; # get unformatted RDF/XML for a bunch of services from a single provider print $x->findService({ authURI => $p{'authority'}, isAlive => 'no' }); } else { print "Content-type: text/html\n\n"; print &GENERATE_FORM(); } sub GENERATE_FORM { my $values = ""; my $m = MOBY::Client::Central->new(); my @URIs = $m->retrieveServiceProviders(); foreach my $uri (@URIs) { next if $uri eq '127.0.0.1'; $values .= "\n" } my $msg =< Generate RDF

Generate RDF

This for can be used to generate RDF for a specific service or a group of services registered by a service provider.


EOF return $msg; }