[MOBY-l] registering Scored_string object...
Michael Jensen
mdjgf8 at mizzou.edu
Mon Mar 29 20:39:20 UTC 2004
Thanks again for Ken and his examples to get me this far...
I want to register this object, but as it is my first one I may need
some assistance. Some output of my service may be:
<Collection>
<Simple>
<Scored_string namespace="" id="">
<String namespace="Global_keyword" id=""
articleName="acronym">MAPK</String>
<Object namespace="Global_keyword" id="mitogen-activated
protein kinase" articleName="string_component"/>
<Long namespace="" id=""
articleName="score">0.90884572798250385</Long>
</Scored_string>
</Simple>
<Simple>
<Scored_string namespace="" id="">
<String namespace="Global_keyword" id="" articleName="acronym"/>
<Object namespace="Global_keyword" id="MAPK"
articleName="string_component"/>
<Long namespace="" id="" articleName="score">1</Long>
</Scored_string>
</Simple>
<Simple>
<Scored_string namespace="" id="">
<String namespace="Global_keyword" id="" articleName="acronym"/>
<Object namespace="Global_keyword" id="increase"
articleName="string_component"/>
<Long namespace="" id=""
articleName="score">0.06212914418525689</Long>
</Scored_string>
</Simple>
</Collection>
Starting with Ken's object registration example script, I put the
following together. On the ISA and HASA I am assuming below the first
value is what the tag is, like String, Object, or Long, unless it is a
ISA, then it is just what type it is. Then I assume the second value is
what the articleName is, and can be blank if there is none.
Is this correct? Will what I have below register the object for the XML
output above?
------------------------
#!/usr/local/bin/perl5.6.1
use warnings 'all';
use strict;
# Register a new data object called Scored_string
use lib '/usr/home/jonhar/Apps/moby-live/Perl';
use MOBY::Client::Central;
use MOBY::Client::Service;
my $Central = MOBY::Client::Central->new();
my $reg = $Central->registerObjectClass(
objectType => "Scored_string",
description => "Any text with a score or ranking associated, with a
possible acronym for the keyword",
contactEmail => 'michael at inblosam.com',
authURI => "www.inblosam.com",
Relationships => {
ISA => [
['Object', ''],
],
HASA => [
['String', 'acronym'],
['Object', 'string_component'],
['Long', 'score'],
]
}
);
print STDERR "registerObjectClass failed: ", $reg->message, "\n"
unless $reg->success;
-----------------------
And one more question: In the MOBYClientCentral test file
(testMOBYClientCentral_v05.pl) on the site, it has the following
snippet of code. As I will have a collection as my output, do I just
use it like I have it below (below the test one)?
TEST($C->registerService(
serviceName => "myfirstservice2",
serviceType => "Retrieval",
authURI => "www.illuminae.com",
contactEmail => 'your at mail.address',
description => "this is my first service",
category => "moby",
URL => "http://illuminae/cgi-bin/service.pl",
input =>[
# ['articleName1', [[Object => ['UglyNamespace']]]], # Collection
['articleName1', [Object => ['UglyNamespace']]], # Simple
],
output =>[
['articleName2', [String => ['UglyNamespace']]], # Simple
],
), 20, 1);
sub register_service {
my $C = shift;
my $reg = $C->registerService(
serviceName => 'extractGeneProteinNames',
authURI => $authURI,
contactEmail => $email,
description => "Takes any text (abstract, full text article, etc.)
and extr
acts names and abbreviations of genes and proteins, with a score (0-1,
with 1 be
ing highest).",
URL => $url,
input => [ ['', ["text-plain" => []]], ],
output => [ ['', [["Scored_string" => []]]], ],
category => "moby",
serviceType => "Retrieval",
);
die "Bad return value from registerService" unless $reg;
if ($reg->success == 1){
print "Registration successful\n\n";
}
else {
print "Registration failed: ", $reg->message, "\n";
}
}
I am not sure the "text-plain" is right for the input either, but all I
expect is something like this.
<?xml version='1.0' encoding='UTF-8'?>
<moby:MOBY xmlns:moby='http://www.biomoby.org/moby-s'>
<moby:Query>
<moby:queryInput moby:articleName=''>
<moby:Simple>
<moby:Text namespace=''>
<moby:String namespace='' id='' articleName='text'>We observed an
increase in mitogen-activated protein kinase (MAPK)
activity.</moby:String>
</moby:Text>
</moby:Simple>
</moby:queryInput>
</moby:Query>
</moby:MOBY>
Thanks for all your help with all of my questions!!
-Michael Jensen
michael at inblosam.com
More information about the moby-l
mailing list