[MOBY-guts] biomoby commit
Mark Wilkinson
mwilkinson at pub.open-bio.org
Mon Nov 24 17:25:49 UTC 2003
mwilkinson
Mon Nov 24 12:25:49 EST 2003
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv14453/Perl/MOBY
Modified Files:
Central.pm OntologyServer.pm
Log Message:
fixed bug reported by Martin this AM. Relationships method should now return only the relationships that you asked for, and should not return duplicates... I hope...
moby-live/Perl/MOBY Central.pm,1.111,1.112 OntologyServer.pm,1.28,1.29
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -r1.111 -r1.112
--- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2003/11/01 16:42:13 1.111
+++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2003/11/24 17:25:48 1.112
@@ -234,13 +234,10 @@
if ($term =~ /FAILED/){return &_error("Malformed XML;","");}
return &_error("Malformed XML; may be missing required parameters objectType, Description, authURI or contactEmail","");
}
- # push @{$relationships{$relationshipType}}, [$objectType, $articleName];
- # validate that the final ontology will be valid
+ # validate that the final ontology will be valid by testing against existing relationships and such
while (my ($reltype, $obj) = each %{$relationships}){
my ($success, $message, $URI) = $RelOntologyServer->relationshipExists(term => $reltype, ontology => 'object'); # success = 1 if it does
$success==0 && return &_error($message, $URI );
- }
- while (my ($reltype, $obj) = each %{$relationships}){
foreach (@{$obj}){
my ($objectType, $articleName) = @{$_};
my ($success, $message, $URI) = $OntologyServer->objectExists(term => $objectType); # success = 1 if it does
@@ -291,19 +288,12 @@
my ($success, $message, $deleteURI) = $OntologyServer->deleteObject(term => $term); # hopefully this situation will never happen!
$success==0 && return &_error("object failed ISA and/or HASA connections,
and subsequently failed deletion. This is a critical error,
- and may indicate corruption of the MOBY Central registry", $deleteURI);
+ and may indicate corruption of the MOBY Central registry.", $deleteURI);
return &_error("object failed to register due to failure during registration of ISA/HASA relationships".(join ",", (@failures))."\n", "");
}
return &_success("Object $term registered successfully.", $URI);
}
- #<Relationship relationshipType="RelationshipOntologyTerm">
- # <objectType articleName="SomeName">ExistingObjectType</objectType>
- # ...
- # ...
- #</Relationship>
- #...
- #...
sub _registerObjectPayload {
my ($payload) = @_;
@@ -863,13 +853,61 @@
=item * only Input Secondary articles are defined during registration; Output Secondary objects are entirely optional and may or may not be interpreted Client-side using their articleName tags.
+=item * Service Categories:
+
+=over 3
+
+=item * moby - for services that use the MOBY SOAP messaging format and object structure (i.e. the objects used in service transaction inherit from the root 'Object' Class in the MOBY Class ontology).
+
+=item * soap - for other SOAP services that do not use the MOBY messaging format. The other elements in the registration should be interpreted as follows:
+
+=over 2
+
+=item * authURI - a URI representing your organization (e.g. yourdomain.com); no http-prefix, and no trailing path information is allowed.
+
+=item * serviceName - an arbitrary, but unique, name for your service within your authURI namespace
+
+=item * URL - the URL from which a WSDL document describing your service can be retrieved by an HTTP GET call.
+
+=item * Comments about Input and Output:
+
+=over 2
+
+=item * in "moby" services, the input and output messaging structure is defined by the BioMOBY API, and the services use data Objects that are defined in the Class ontology as inheriting from the root "Object" Class. For "soap" services, there is additional flexibility:
+
+=over 2
+
+=item * Similar to a "moby" service, your "soap" service must consume/produce ontologically valid named data-types in order to be discovered by registry searches. As such, you _must_ register a single unique name for any non-MOBY input or output data Classes, regardless of the actual complexity of the input/output message.
+
+=item * Do this using the registerObjectClass call of MOBY Central; To ensure uniqueness and LSID compatibilty of data class names, you must name your data using the following format: your.authURI:dataClassName
+
+=item * remember, you may use any MOBY Object as your input/output (i.e. any Class Ontology term that inherits from Object) so long as you follow the MOBY message structure for that input or output.
+
+=item * You may register, for example, a service that consumes a non-MOBY data Class and outputs a MOBY data class, so long as you follow the MOBY Messaging format for the output data
+
+=item * You may register, for example, a service that consumes a MOBY data Class and outputs a non-MOBY data class, so long as you follow the MOBY Messaging format for the ihput data
+
+=item * NOTE: Nether of the cases above are considred MOBY services, and are therefore described in the category of "soap" service
+
+=item * When registering a non-MOBY data Class name, it DOES NOT have any "Relationship" component (see registerObjectClass API)
+
+=item * non-MOBY inputs or outputs are described as a single Primary, Simple article of your new named type.
+
+=back
+
+=item * secondaryArticles - not applicable; should be left out of message.
+
+=back
+
+=back
+
=back
Input XML :
<registerService>
- <Category>moby</Category> <!-- one of 'moby', 'cgi', 'soap' ; currently only 'moby' services are fully supported -->
+ <Category>moby</Category> <!-- one of 'moby', 'cgi', 'wsdl' ; currently only 'moby' and 'wsdl' services are fully supported -->
<serviceName>YourServiceNameHere</serviceName>
<serviceType>TypeOntologyTerm</serviceType>
<authURI>your.URI.here</authURI>
@@ -1025,7 +1063,7 @@
return &_error("Category may take the (case sensitive) values 'moby', 'cgi', 'soap'\n","") unless (($Category eq "est") || ($Category eq "cgi") || ($Category eq "moby"));
$debug && &_LOG("Entering switch with $Category method\n");
- return &_error("Service categories other than 'moby' are not yet implemented","") unless ($Category eq "moby");
+ return &_error("Service categories other than 'moby' and 'soap' are not yet implemented","") unless ($Category eq "moby" || $Category eq "soap");
my @IN = @{$INPUTS};
my @OUT = @{$OUTPUTS};
my @SECS = @{$SECONDARY};
@@ -1050,6 +1088,8 @@
return &_error("$message","$URI") unless ($valid);
# right, registration should be successful now!
+ # "soap" services may only have one input and one output
+
my $SVC = MOBY::service_instance->new(
category => $Category,
servicename => $serviceName,
@@ -2259,22 +2299,22 @@
my $doc = $Parser->parse($payload);
my $x = $doc->getElementsByTagName("relationshipType");
- my $l = $x->getLength; # might be a Collection object with multiple simples...
+ my $l = $x->getLength;
my $exp = $doc->getElementsByTagName("expandRelationship");
- my $expl = $exp->getLength; # might be a Collection object with multiple simples...
+ my $expl = $exp->getLength;
my $expand_relationship = &_nodeTextContent($doc, 'expandRelationship');
$expand_relationship =~ s/\s//g;
$expand_relationship ||=0;
- my @reltypes;
+ my %reltypes;
for (my $n=0; $n < $l; ++$n){
my @child = $x->item($n)->getChildNodes;
foreach (@child){
next unless ($_->getNodeType == TEXT_NODE);
my $name .= $_->toString; $name =~ s/\s//g;
- push @reltypes, $name;
+ $reltypes{$name} = 1;
}
}
@@ -2286,13 +2326,20 @@
$ontology ||="service"; # if we have now succeeded and haven't already taken the ontology then it must be the service ontology
&_LOG("Ontology was $ontology; Term was $term\n");
my $OS = MOBY::OntologyServer->new(ontology => $ontology);
- my %rels = %{$OS->Relationships(term => $term, expand => $expand_relationship)};
+ my %rels = %{$OS->Relationships(term => $term, expand => $expand_relationship)}; # %rels = $rels{relationship} = [lsid, lsid,lsid]
my $response="<Relationships>\n";
my $OSrel = MOBY::OntologyServer->new(ontology => 'relationship');
+ foreach (keys %reltypes){ # for each of our desired types
+ my $rellsid = $OSrel->getRelationshipURI($ontology, $_); # get the LSID
+ delete $reltypes{$_}; # remove the non-LSID version from the hash
+ $reltypes{$rellsid} = 1; # set the LSID as valid
+ }
+ # now for each of the relationship types that we were returned
foreach (keys %rels){
my $rellsid = $OSrel->getRelationshipURI($ontology, $_);
next unless $rellsid;
+ next unless $reltypes{$rellsid}; # next unless it is one ofthe relationship types we requested
my $lsids = $rels{$rellsid};
next unless $lsids->[0];
$response .="<Relationship relationshipType='$rellsid'>\n";
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2003/09/15 02:44:40 1.28
+++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2003/11/24 17:25:49 1.29
@@ -785,7 +785,7 @@
if ($direction eq 'root'){
unless (defined $relationship){
$defs = $self->dbh->selectall_arrayref("
- select s2.${ontology}_lsid, relationship_type from
+ select distinct s2.${ontology}_lsid, relationship_type from
${ontology}_term2term as t2t,
$ontology as s1,
$ontology as s2
@@ -795,7 +795,7 @@
s1.${ontology}_lsid = ?", undef, $term); # ")
} else {
$defs = $self->dbh->selectall_arrayref("
- select s2.${ontology}_lsid, relationship_type from
+ select distinct s2.${ontology}_lsid, relationship_type from
${ontology}_term2term as t2t,
$ontology as s1,
$ontology as s2
@@ -808,7 +808,7 @@
} else {
unless (defined $relationship){
$defs = $self->dbh->selectall_arrayref("
- select s2.${ontology}_lsid, relationship_type from
+ select distinct s2.${ontology}_lsid, relationship_type from
${ontology}_term2term as t2t,
$ontology as s1,
$ontology as s2
@@ -818,7 +818,7 @@
s2.${ontology}_lsid = ?", undef, $term); # ")
} else {
$defs = $self->dbh->selectall_arrayref("
- select s2.${ontology}_lsid, relationship_type from
+ select distinct s2.${ontology}_lsid, relationship_type from
${ontology}_term2term as t2t,
$ontology as s1,
$ontology as s2
More information about the MOBY-guts
mailing list