isolateQuery
Description: Returns a list of isolate ids that match all fields. Searching is not case-sensitive. Any number of fields can be passed as arguments. By passing an exactMatch boolean parameter, you can set whether exact or partial matches are used.
Arguments
- database (string)
- n x [field]
where field is defined as {name,value} - exactMatch (boolean) [optional]
Sample Perl code
#!/usr/bin/perl #Written by Keith Jolley use SOAP::Lite; use strict; use warnings; #####Sample arguments######### my $database = 'neisseria'; my %fields = ('country' => 'france', 'serogroup' => 'b', 'year' => '2004'); my $exactMatch = 'true'; ############################## my $soap = SOAP::Lite -> uri('http://pubmlst.org/MLST') -> proxy('http://pubmlst.org/cgi-bin/mlstdbnet/mlstFetch.pl'); my @elements; foreach my $field (keys %fields){ push @elements,SOAP::Data->name('field' => \SOAP::Data->value( SOAP::Data->name('name' => $field), SOAP::Data->name('value' => $fields{$field}))); } my $soapResponse = $soap->isolateQuery($database,@elements,$exactMatch); unless ($soapResponse->fault){ for my $t ($soapResponse->valueof('//id')) { print "$t\n"; } } else { print join ', ',$soapResponse->faultcode,$soapResponse->faultstring; }
Sample Java code
package org.pubmlst.mlstSOAP; import org.apache.axis.client.Call; import org.apache.axis.client.Service; import javax.xml.namespace.QName; import java.util.*; public class IsolateQuery { public static void main(String[] args) { //Sample arguments//////////////// String database = "neisseria"; HashMap<String,Object> fields = new HashMap<String,Object>(); fields.put("country", "france"); fields.put("serogroup", "b"); fields.put("year", 2004); boolean exactMatch = true; ////////////////////////////////// try { String endpoint = "http://pubmlst.org/cgi-bin/mlstdbnet/mlstFetch.pl"; Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress(new java.net.URL(endpoint)); call.setOperationName(new QName("http://pubmlst.org/MLST/", "isolateQuery")); Vector<Object> callArgs = new Vector<Object>(); callArgs.add(database); Set keySet = fields.keySet(); Iterator it = keySet.iterator(); while (it.hasNext()){ HashMap<String,Object> field = new HashMap<String,Object>(); String fieldName = (String)it.next(); field.put("name", fieldName); field.put("value",fields.get(fieldName)); callArgs.addElement(field); } callArgs.add(exactMatch); Object idList = call.invoke(callArgs.toArray()); if (idList instanceof ArrayList){ for (int i=0; i<((ArrayList)idList).size(); i++){ System.out.println(((ArrayList)idList).get(i)); } } else if (idList instanceof Integer) { System.out.println(idList); } } catch (Exception e) { System.err.println(e.toString()); } } }
Output
5519 5524 5525 5527 5528 5530 5531 6621 6624 6627 6628 6629 6630 6632 6636 6638 6640 6641