use strict;
use LS::ID;
use LS::Locator;
use RDF::Core::Model::Parser;
use RDF::Core::Storage::Memory;
use RDF::Core::Model;
use RDF::Core::Resource;
use RDF::Core::Literal;
use RDF::Core::Statement;
my $storage = new RDF::Core::Storage::Memory;
my $model = new RDF::Core::Model (Storage => $storage);
my $id = 'urn:lsid:biomoby.org:serviceinstance:bioinfo.icapture.ubc.ca,FASTA2HighestGenericSequenceObject:2006-04-12T18-27-15Z';
# the lines below convert the LSID into a URL since that's what BioMoby
# currently returns in its metadata... sorry!
my $r = 'http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#';
$id =~ /urn:lsid:biomoby.org:serviceinstance:([^:]+)/;
$r .= $1;
my $lsid = LS::ID->new($id);
my $locator = LS::Locator->new();
my $authority = $locator->resolveAuthority($lsid);
my $resource = $authority->getResource($lsid);
my $locations = $resource->getMetadataLocations;
foreach my $locs(keys %$locations){
foreach my $loc(@{$locations->{$locs}}){
my $data;
eval{$data = $resource->getMetadata(location => $loc);};
next if $@;
my $response_filehandle = $data->response;
my $RDF = join "", <$response_filehandle>;
my %options = (Model => $model,
Source => $RDF,
SourceType => 'string',
BaseURI => "http://www.foo.com/",
BNodePrefix => "genid"
);
my $parser = new RDF::Core::Model::Parser(%options);
$parser->parse;
}
}
print "model contains ", $model->countStmts, " statements\n\n";
my $resource = RDF::Core::Resource->new($r);
my $enumerator = $model->getStmts($resource);
my $statement = $enumerator->getFirst;
while (defined $statement) {
my $s= $statement->getSubject->getLocalValue;
my $o= $statement->getObject;
$o=($o->isLiteral?$o->getValue:$o->getLocalValue);
my $p= $statement->getPredicate->getLocalValue;
print "$s $p $o\n" unless $o =~ /genid/;
$statement = $enumerator->getNext
}
$enumerator->close;
A place where I publicly ponder, explore, and rant (mostly rant :-) ) about issues that come up during the course of my laboratory's research into the Semantic Web in Health Care and Life Sciences. The thoughts here are sometimes very raw (a.k.a. half-baked), but reflect the current state of my thinking. The content of this site may irritate some readers... and sometimes it is meant to!
Thursday, November 22, 2007
A more complex LSID client
This one merges metadata from multiple endpoints, and then parses it using RDF::Core.
Wednesday, November 14, 2007
LSID Perl libraries submitted to CPAN
Just a quick note to announce that my lead developer, Eddie Kawas, has recently uploaded the Perl LSID stack to CPAN. As such, it is no longer necessary to get the code from the sourceforge Subversion repository. Just start-up CPAN and say "install LS".
Google Gadgets for BioMoby
I love it when a bunch of open APIs come together into something greater than the sum of the parts :-)
Thanks to the good folks at Google and their Google Gadgets for making things so darn simple! It only took an hour or so to write a script that wrapped every BioMoby Web service (more than 1400 of them!) with a Google Gadget. Now it is an absolute a no-brainer to create an amazing mashup of bioinformatics data by simply selecting the various services you are interested in and dropping their Gadgets on your iGoogle page. You might even make a variety of different Gadget tabs with different combinations of services to provide different views.
I'm still working on getting the rendering to be more size-appropriate (currently I am using the same rendering engine as I used in Gbrowse_moby) but I think it's pretty good for a first-pass!
Try them for yourself: http://mobycentral.icapture.ubc.ca/Gadgets
Labels:
"semantic web",
BioMoby,
iGoogle,
mashup,
Semantic Web Services,
Web 2.0,
Web Services
Subscribe to:
Posts (Atom)