/*
 *Central.java 
 */
package org.biomoby.registry.Central;

/**
 * An interface that outlines the methods needed to query a Moby central
 * registry. To fully implement a Mobycentral registry, {@link org.biomoby.registry.Central Registry}
 * must also be implemented.
 * 
 * @author Eddie created Nov 30, 2005
 */
public interface Central {

	/**
	 * Locate a service instance, matching various characteristics, such as the
	 * provider name, the kind of input expected by the service, the kind of
	 * output it provides, etc.
	 * 
	 * @param serviceQueryObject
	 *            a service query object like the following:
	 * 
	 * <pre>
	 *                                  &lt;findService&gt;
	 *                                         &lt;!--  Service Query Object --&gt;
	 *                                  &lt;/findService&gt;
	 *                                 
	 *                          where a Service Query Object contains a Query Object that allows a user
	 *                          to query Moby Central.
	 *                                  
	 *                          To query MOBY Central, you fill out the relevant elements of a Query
	 *                          Object. These include the input and/or output data Classes (by name
	 *                          from the Class ontology), the Service-type (by name from the Service-type
	 *                          ontology), the authority (service provider URI), or any number of
	 *                          keywords that must appear in the service description.
	 *                              
	 *                                   * MOBY Central finds all services which match the contents of
	 *                                     the Query Object.
	 *                                   * All elements are optional, however at least one must be
	 *                                     present.
	 *                                   * All elements present are considered to be increasingly
	 *                                     limiting on the search (i.e. &quot;AND&quot;).
	 *                                   * keywords are:
	 *                                         o one keyword or fragment per keyword element
	 *                                         o wildcard &quot;*&quot; is allowed in combination with
	 *                                           keyword fragments and or sentence fragments 
	 *                                           (lone &quot;*&quot; is meaningless and ignored)
	 *                                         o multiple keywords are considered joined by
	 *                                           &quot;AND&quot;.
	 *                               
	 *                               In addition to the search parameters, there are three
	 *                               &quot;flags&quot; that can be set in the Query object:
	 *                               
	 *                                  1. expandServices: when TRUE, this flag will cause MOBY Central
	 *                                     to traverse the Service ontology and discover services that
	 *                                     are child types (more specific) than the Service-type you
	 *                                     requested. For example, you might request
	 *                                     &quot;alignment&quot;, and it would discover services such as
	 *                                     &quot;Blast&quot;, &quot;Smith Waterman&quot;,
	 *                                     &quot;Needleman Wunsch&quot;.
	 *                                  2. expandObjects: when TRUE, this flag will cause MOBY Central to
	 *                                     traverse the Class ontology to find services that operate not
	 *                                     only on the Object Class you are querying, but also any
	 *                                     ontolological parent types of that Object Class. For example,
	 *                                     if you request services that work on AnnotatedSequence Objects
	 *                                     this flag will also return services that work on Sequence
	 *                                     objects, since AnnotatedSequence objects inherit from Sequence
	 *                                     objects.
	 *                                  3. authoritative: When this boolean flag is TRUE, only services
	 *                                     that report themselves to be &quot;authoritative&quot; for a
	 *                                     particular transformation will be discovered. When set to any
	 *                                     other value both authoritative and non-authoritative services
	 *                                     will be discovered.
	 *                               
	 *                               The Query object structure is as follows:
	 *                               
	 *                              	 &lt;inputObjects&gt;
	 *                              	     &lt;Input&gt;
	 *                              	         &lt;!-- one or more Simple or Collection articles --&gt;
	 *                              	     &lt;/Input&gt;
	 *                              	 &lt;/inputObjects&gt;
	 *                              	 &lt;outputObjects&gt;
	 *                              	     &lt;Output&gt;
	 *                              	         &lt;!-- one or more Simple or Collection articles --&gt;
	 *                              	     &lt;/Output&gt;
	 *                              	 &lt;/outputObjects&gt;
	 *                              	 &lt;serviceType&gt;ServiceTypeTerm&lt;/serviceType&gt;
	 *                              	 &lt;Protocol&gt;moby&lt;/Protocol&gt;
	 *                              	 &lt;authURI&gt;desired.service.provider&lt;/authURI&gt;;
	 *                              	 &lt;serviceName&gt;MyServiceName&lt;/serviceName&gt;;
	 *                              	 &lt;expandObjects&gt;1|0&lt;/expandObjects&gt; 
	 *                              	 &lt;expandServices&gt;1|0&lt;/expandServices&gt;
	 *                              	 &lt;authoritative&gt;1|0&lt;/authoritative&gt;
	 *                              	 &lt;keywords&gt;
	 *                              	     &lt;keyword&gt;something&lt;/keyword&gt;
	 *                              	     ....
	 *                              	     ....
	 *                              	 &lt;/keywords&gt;     
	 * </pre>
	 * 
	 * @return a string containing the XML for the Service List response whichis
	 *         as follows:
	 * 
	 * <pre>
	 *                               &lt;Services&gt;
	 *                                 &lt;Service authURI=&quot;authority.URI.here&quot; serviceName=&quot;MyService&quot; lsid='urn:lsid:authority.uri:serviceinstance:id'&gt;
	 *                                   &lt;serviceType lsid='urn:lsid:authority.uri:servicetype:OntologyTerm'&gt;Ontology_Term&lt;/serviceType&gt;
	 *                                   &lt;authoritative&gt;1&lt;/authoritative&gt;
	 *                                   &lt;Category&gt;moby&lt;/Category&gt; &lt;!-- 'moby' or 'cgi' or 'soap' --&gt;
	 *                                   &lt;Description&gt;&lt;![CDATA[free text description here]]&gt;&lt;/Description&gt;
	 *                                   &lt;contactEmail&gt;your@email.addy.here&lt;/contactEmail&gt;
	 *                                   &lt;URL&gt;http://service.endpoint.here/scriptname&lt;/URL&gt;
	 *                                   &lt;Input&gt;
	 *                                        &lt;!-- zero or more Simple and/or Collection articles --&gt;
	 *                                   &lt;/Input&gt;
	 *                                   &lt;Output&gt;
	 *                                        &lt;!-- zero or more Simple and/or Collection articles --&gt; 
	 *                                   &lt;/Output&gt;
	 *                                   &lt;secondaryArticles&gt;
	 *                                        &lt;!-- zero or more Secondary (Parameter) articles --&gt;
	 *                                  &lt;/secondaryArticles&gt;
	 *                                  &lt;/Service&gt;
	 *                                  ...  
	 *                                  &lt;!--  one or more Service blocks may be returned --&gt;
	 *                                  ...
	 *                                  ...
	 *                               &lt;/Services&gt;
	 * </pre>
	 */
	public String findService(String serviceQueryObject);

	/**
	 * Retrieve the definition for a service instance, as specified in WSDL
	 * format. This information is used by the client to compose queries.
	 * 
	 * @param query
	 *            a string of XML similar to the following
	 * 
	 * <pre>
	 *                          &lt;retrieveService&gt;
	 *                               &lt;Service authURI=&quot;authority.URI.here&quot; serviceName=&quot;MyService&quot;/&gt;          
	 *                           &lt;retrieveService&gt;
	 * </pre>
	 * 
	 * <b><i>Note:</i></b> AuthURI and serviceName attributes are sufficient
	 * to identify a unique service, and both are required in the element.
	 * 
	 * @return a string of XML, for example
	 * 
	 * <pre>
	 *                            *  moby
	 *                                       &lt;Service authURI=&quot;authority.URI.here&quot; serviceName=&quot;MyService&quot; lsid='urn:lsid:authority.uri:serviceinstance:id'&gt;
	 *                                            &lt;![CDATA[WSDL document here]]
	 *                                       &lt;/Service&gt;
	 *                        
	 *                            * cgi
	 *                                       &lt;Service&gt;
	 *                                          &lt;serviceName&gt;NameOfService&lt;/serviceName&gt;
	 *                                          &lt;URL&gt;http://service.url.here&lt;/URL&gt;;
	 *                                          &lt;GETstring&gt;sprintf_formatted_GET_string&lt;/GETstring&gt;
	 *                                          &lt;Description&gt;
	 *                                                &lt;![CDATA[human readable description here]]&gt;
	 *                                          &lt;/Description&gt;
	 *                                       &lt;/Service&gt;
	 *                                   
	 *                        
	 *                            * soap
	 *                                        UNKNOWN AT THIS TIME
	 * </pre>
	 * 
	 * <b><i>Note:</i></b> The WSDL that is returned is not currently valid.
	 * It will only become valid once we have the ability to convert our class
	 * ontology into an XML schema. In addition, the WSDL that is returned does
	 * not necessarily describe the actual interface of the service. In the
	 * BioMOBY system, you are allowed to pass more complex objects to a
	 * service, and the service is allowed to pass more complex objects back to
	 * you, so long as they obey the parentage rules of the class ontology. As
	 * such, the WSDL that you receive is the minimal interface for the service,
	 * not necessarily the actual interface.
	 * 
	 * The use of WSDL in the BioMOBY system is subject to change in future
	 * revisions, and is provided at this time only to facilitate the creation
	 * of service stubs on the client side using the commonly available WSDL
	 * parsers
	 */
	public String retrieveService(String query);

	/**
	 * Retrieve the URLs of all registered services.
	 * 
	 * @return a string of XML, for example
	 * 
	 * <pre>
	 *                      	 &lt;resourceURLs&gt;
	 *                     	 	 &lt;Resource name=&quot;ServiceInstance&quot; url=&quot;http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances&gt;
	 *                      		 &lt;Resource name=&quot;Object&quot; url=&quot;http://biomoby.org/RESOURCES/MOBY-S/Objects&quot;/&gt;
	 *                      	 	 &lt;Resource name=&quot;Namespace&quot; url=&quot;http://biomoby.org/RESOURCES/MOBY-S/Namespaces&quot;/&gt;
	 *                      	 	 &lt;Resource name=&quot;Service&quot; url=&quot;http://biomoby.org/RESOURCES/MOBY-S/Services/Services&quot;/&gt;
	 *                      		 &lt;Resource name=&quot;Full&quot; url=&quot;http://biomoby.org/RESOURCES/MOBY-S/Services/FULL&quot;/&gt;
	 *                      	 &lt;/resourceURLs&gt; 	
	 * </pre>
	 * 
	 * <i><b>Note:</b></i> Finds the URL from which the RDF of a MOBY
	 * Ontology can be retrieved by HTTP GET. There are five possible ontology
	 * names: "Service", "Object", "Namespace", "ServiceInstance", or "Full"
	 * (Full retrieves all of the ontologies)
	 * 
	 * 
	 */
	public String retrieveResourceURLs();

	/**
	 * Retrieve the names of all registered service providers. This allows you
	 * to see what sites are providing MOBY services.
	 * 
	 * @return a string of output XML, for example:
	 * 
	 * <pre>
	 *                             &lt;serviceTypes&gt;
	 *                                &lt;serviceType name=&quot;serviceName&quot; lsid='urn:lsid:authority.uri:servicetype:id'&gt;
	 *                                      &lt;Description&gt;&lt;![CDATA[free text description here]]&gt;&lt;/Description&gt;
	 *                                       &lt;contactEmail&gt;email@address here&lt;/contactEmail&gt;
	 *                                       &lt;authURI&gt;authority.uri.here&lt;/authURI&gt;
	 *                                &lt;/serviceType&gt;
	 *                                     ...
	 *                             &lt;/serviceTypes&gt;
	 * </pre>
	 * 
	 */
	public String retrieveServiceProviders();

	/**
	 * Retrieve the names of all registered services. The service name, service
	 * provider and service lsid are all returned.
	 * 
	 * @return a string of output XML, for example:
	 * 
	 * <pre>
	 *                             &lt;serviceNames&gt;
	 *                               &lt;serviceName name=&quot;serviceName&quot; authURI='authority.info.here' lsid='urn:lsid:authority.uri:namespace:id'/&gt;
	 *                                    ...
	 *                            &lt;/serviceNames&gt;
	 * </pre>
	 */
	public String retrieveServiceNames();

	/**
	 * Retrieve the definitions and registration details of all registered
	 * service types.
	 * 
	 * @return a string of output XML, for example:
	 * 
	 * <pre>
	 *                           &lt;serviceTypes&gt;
	 *                              &lt;serviceType name=&quot;serviceName&quot; lsid='urn:lsid:authority.uri:servicetype:id'&gt;
	 *                                     &lt;Description&gt;&lt;![CDATA[free text description here]]&gt;&lt;/Description&gt;
	 *                                     &lt;contactEmail&gt;email@address here&lt;/contactEmail&gt;
	 *                                     &lt;authURI&gt;authority.uri.here&lt;/authURI&gt;
	 *                              &lt;/serviceType&gt;
	 *                                   ...
	 *                           &lt;/serviceTypes&gt;
	 *                   	
	 * </pre>
	 */
	public String retrieveServiceTypes();

	/**
	 * Retrieve the definitions and registration details of all registered
	 * object types.
	 * 
	 * @return a string of output XML, for example:
	 * 
	 * <pre>
	 *                          &lt;objectNames&gt;
	 *                             &lt;Object name=&quot;objectName&quot; lsid='urn:lsid:authority.uri:namespace:id'&gt;
	 *                                    &lt;Description&gt;&lt;![CDATA[free text description here]]&gt;&lt;/Description&gt;
	 *                             &lt;/Object&gt;
	 *                                  ...
	 *                          &lt;/objectNames&gt;
	 * </pre>
	 */
	public String retrieveObjectNames();

	/**
	 * Retrieve the class definition, in the form of the full registration
	 * details for the class type specified by the input XML.
	 * 
	 * @param query
	 *            input XML, for example:
	 * 
	 * <pre>
	 *                       &lt;retrieveObjectDefinition&gt;
	 *                            &lt;objectType&gt;ExistingObjectClassname&lt;/objectType&gt;
	 *                       &lt;/retrieveObjectDefinition&gt;
	 *                 	
	 * </pre>
	 * 
	 * @return a string of XML that represents the full declaration of the
	 *         object, as defined by the XML used to register it. For example:
	 * 
	 * <pre>
	 *                         &lt;retrieveObjectDefinition&gt;
	 *                             &lt;objectType lsid='urn:lsid:authority.uri:namespace:id'&gt;ObjectClassName&lt;/objectType&gt;
	 *                             &lt;Description&gt;&lt;![CDATA[
	 *                                     human readable description
	 *                                     of data type]]&gt;
	 *                             &lt;/Description&gt;
	 *                             &lt;Relationship relationshipType=&quot;RelationshipOntologyTerm&quot; 
	 *                             	    lsid='urn:lsid:authority.uri:namespace:id'&gt;
	 *                                &lt;objectType articleName=&quot;SomeName&quot; lsid='urn:lsid:authority.uri:namespace:id'&gt;ExistingObjectType&lt;/objectType&gt;
	 *                             &lt;/Relationship&gt;
	 *                             ...
	 *                             &lt;authURI&gt;owner.URI.here&lt;/authURI&gt;
	 *                             &lt;contactEmail&gt;owner@their.address.com&lt;/contactEmail&gt;
	 *                         &lt;/retrieveObjectDefinition&gt;
	 * </pre>
	 */
	public String retrieveObjectDefinitions(String query);

	/**
	 * Retrieve a list of all registered namespaces
	 * 
	 * @return a string of XML, for example:
	 * 
	 * <pre>
	 *                        &lt;Namespaces&gt;
	 *                           &lt;Namespace name=&quot;namespace&quot; lsid='urn:lsid:authority.uri:namespace:id'&gt;
	 *                                  &lt;Description&gt;&lt;![CDATA[free text description here]]&gt;&lt;/Description&gt;
	 *                                  &lt;contactEmail&gt;email@address here&lt;/contactEmail&gt;
	 *                                  &lt;authURI&gt;authority.uri.here&lt;/authURI&gt;
	 *                           &lt;/Namespace&gt;
	 *                                ...
	 *                        &lt;/Namespaces&gt;
	 * </pre>
	 */
	public String retrieveNamespaces();

	/**
	 * Retrieve an XML schema representation of a particular object class. This
	 * is currently not implemented since it appears to be impossible to
	 * represent MOBY Objects in XML Schema due to limitations of XML Schema
	 * 
	 * @param query
	 *            a string of XML, for example:
	 * 
	 * <pre>
	 *                       &lt;retrieveObjectSchema&gt;
	 *                          &lt;objectType&gt;ObjectType | all&lt;/objectType&gt;
	 *                       &lt;/retrieveObjectSchema&gt;
	 * </pre>
	 * 
	 * @return a string of XML that encapsulates the schema. For example:
	 * 
	 * <pre>
	 *                       &lt;Objects&gt;
	 *                          &lt;Object name=&quot;ObjectOntologyTerm&quot; lsid='urn:lsid:authority.uri:namespace:id'&gt;
	 *                                 &lt;Schema&gt;&lt;![CDATA[
	 *                                     &lt;XSD schema here&gt;]]&gt;
	 *                                 &lt;/Schema&gt;
	 *                          &lt;/Object&gt;
	 *                               ...
	 *                       &lt;/Objects&gt;
	 * </pre>
	 */
	public String retrieveObjectSchema(String query);

	/**
	 * Retrieve a list of MOBY object classes having a specified relationship
	 * with the given class
	 * 
	 * @param query
	 *            a string of XML, for example:
	 * 
	 * <pre>
	 *                      &lt;Relationship&gt;
	 *                        [ &lt;objectType&gt;OntologyTerm&lt;/objectType&gt; | 
	 *              	  &lt;serviceType&gt;OntologyTerm&lt;/serviceType&gt; ] 
	 *                       &lt;relationshipType&gt;RelationshipOntologyTerm1&lt;/relationshipType&gt;
	 *                       &lt;relationshipType&gt;RelationshipOntologyTerm2&lt;/relationshipType&gt;
	 *                               ...
	 *                       &lt;expandRelationship&gt;1|0&lt;/expandRelationship&gt;
	 *                      &lt;Relationship&gt;
	 * </pre>
	 * 
	 * @return a string of XML, for example:
	 * 
	 * <pre>
	 *                      &lt;Relationships&gt;
	 *                         &lt;Relationship relationshipType=&quot;RelationshipOntologyTerm1&quot; 
	 *              	   lsid='urn:lsid:authority.uri:namespace:id'&gt;
	 *                              [ &lt;objecctType lsid='...' articleName='foo'&gt;OntologyTerm&lt;/objectType&gt; | 
	 *              		&lt;serviceType lsid='...'&gt;OntologyTerm&lt;/serviceType&gt; ]
	 *                                     ...
	 *                         &lt;/Relationship&gt;
	 *                         ...
	 *                      &lt;/Relationships&gt;
	 * </pre>
	 * 
	 * <b><i>Note:</i></b> Unless the expandRelationships flag is set, it
	 * will return only the first-level objects in that relationship (i.e. take
	 * one step up the Ontology hierarchy). If the flag is set, MOBY Central
	 * will traverse the ontology right back to its root as a flattened list
	 * 
	 */
	public String Relationships(String query);

}
