Version: 1.1.1

org.biomoby.shared.data
Class MobyDataXref

java.lang.Object
  extended by org.biomoby.shared.MobyData
      extended by org.biomoby.shared.MobyPrimaryData
          extended by org.biomoby.shared.MobyPrimaryDataSimple
              extended by org.biomoby.shared.data.MobyDataObject
                  extended by org.biomoby.shared.data.MobyDataObjectSAI
                      extended by org.biomoby.shared.data.MobyDataXref
All Implemented Interfaces:
Cloneable, Comparable, MobyDataInstance, MobyDataServiceAssocInstance

public class MobyDataXref
extends MobyDataObjectSAI

Note: This class has not been thoroughly tested. If you find bugs, please e-mail Paul Gordon, gordonp@ucalgary.ca Represents an Xref tag within the CrossReferenceInformation Block (CRIB) of a MOBY Object. While not strictly a MOBY Object, it contains all of the information for one (namespace and id), hence it can act as either in this class. An Xref is a special case of a service associated Object where there can only be one service associated, and the additional fields of a textual description, a cross reference type, and an "evidence code" (indicating source and strength of the cross reference). Another unusual aspect to this class is that due to its polymorphism, toXML() accepts extra XML modes, used only in this class. By default the Xref acts (and is therefore printed) like a base MOBY Object, but if you are a service provider creating XML you want it to print as "" in the parent Object's Cross Reference Information Block (CRIB). To acheive this, use the CRIB_XML_MODE_ON and CRIB_XML_MODE_OFF modes around your toXML(). If you are using MobyDataObject derivatives, this is done for you automatically.


Field Summary
static int CRIB_XML_MODE_OFF
           
static int CRIB_XML_MODE_ON
           
static String IC
           
static String IDA
           
static String IEA
           
static String IEP
           
static String IGI
           
static String IMP
           
static String IPI
           
static String ISS
           
static String NAS
           
static String ND
           
static String NR
           
static String RCA
           
static String TAS
           
 
Fields inherited from interface org.biomoby.shared.data.MobyDataInstance
CENTRAL_XML_MODE, SERVICE_XML_MODE
 
Constructor Summary
MobyDataXref(Element e)
           
MobyDataXref(Element e, Registry registry)
           
MobyDataXref(MobyDataObject mdsi, MobyService service)
          Build an Xref based on an existing object.
MobyDataXref(MobyNamespace namespace, String id, MobyService service)
           
MobyDataXref(String namespace, String id, MobyService service)
          Gets the registry implicitly from the service being passed in.
MobyDataXref(String namespace, String id, String serviceName, String authURI)
           
MobyDataXref(String namespace, String id, String serviceName, String authURI, Registry registry)
           
 
Method Summary
 void addNamespace(MobyNamespace ns)
          Values passed here are essentially ignored when a namespace already exists, because an Xref can only have one.
 MobyDataXref clone()
          Simply calls new constructor with object's existing data type, name and value.
static String evidenceAbbrevToCode(String abbrev)
          Given one of the static final evidence codes from this class, returns the 2 or 3 letter GO evidence abbreviations.
static String evidenceCodeToAbbrev(String code)
          Given one of the static final evidence codes from this class, returns the 2 or 3 letter GO evidence abbreviations.
 String getDescription()
          Provided by a called service A, describes in plain English(?)
 String getEvidenceCode()
          Provided by a called service A, indicates the source and strength of the relationship between the Xref (encapsulated in an Object returned by A) and the cross-referenced service B.
 MobyNamespace getNamespace()
          Since an Xref can only have one namespace, this method returns the one that will be used in Xref-style XML output.
 MobyNamespace[] getNamespaces()
          Return all namespaces defined in this data container.
 MobyService getService()
           
 String getXrefType()
           
 void setDescription(String desc)
           
 void setEvidenceCode(String code)
           
 void setEvidenceCodeByAbbrev(String abbrev)
           
 void setServices(MobyService[] services)
          If more than one service is provided, only the first will be taken.
 void setXmlMode(int mode)
          If the XML mode is one of the constants defined by MobyDataInstance, this method calls its superclass equivalent (i.e. acts and prints like a Moby Object).
 void setXrefType(String type)
          At the moment, no check is made for the validity of the type string in the cross reference ontology, mostly because I don't know how to access it properly.
 String toString()
          Convenience method to get the basic XML representation
 String toXML()
          Produces a full-blown XML fragment that depending on the value of getXmlMode() is either a template for use in MOBY Central services, or a Simple element for use in calling a service instance.
 
Methods inherited from class org.biomoby.shared.data.MobyDataObjectSAI
addCrossReference, getCrossReferences, getDataInstance, getDataType, getId, getObject, getServices, getUserData, getValue, getXmlMode, hasCrossReferences, setId, setUserData
 
Methods inherited from class org.biomoby.shared.data.MobyDataObject
addCrossReferences, addCrossReferences, addProvisionInfo, compareTo, createInstanceFromDOM, createInstanceFromDOM, createInstanceFromString, createInstanceFromString, createInstanceFromXML, equals, getId, getName, getPrimaryNamespace, getProvisionInfo, getTextContents, setName, setPrimaryNamespace, setProvisionInfo
 
Methods inherited from class org.biomoby.shared.MobyPrimaryDataSimple
format, removeNamespace, removeNamespace, setDataType, setNamespaces
 
Methods inherited from class org.biomoby.shared.MobyPrimaryData
isPrimary
 
Methods inherited from class org.biomoby.shared.MobyData
getName
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.biomoby.shared.data.MobyDataInstance
getName, setName
 

Field Detail

CRIB_XML_MODE_ON

public static final int CRIB_XML_MODE_ON
See Also:
Constant Field Values

CRIB_XML_MODE_OFF

public static final int CRIB_XML_MODE_OFF
See Also:
Constant Field Values

IC

public static final String IC
See Also:
Constant Field Values

IDA

public static final String IDA
See Also:
Constant Field Values

IEA

public static final String IEA
See Also:
Constant Field Values

IEP

public static final String IEP
See Also:
Constant Field Values

IGI

public static final String IGI
See Also:
Constant Field Values

IMP

public static final String IMP
See Also:
Constant Field Values

IPI

public static final String IPI
See Also:
Constant Field Values

ISS

public static final String ISS
See Also:
Constant Field Values

NAS

public static final String NAS
See Also:
Constant Field Values

ND

public static final String ND
See Also:
Constant Field Values

RCA

public static final String RCA
See Also:
Constant Field Values

TAS

public static final String TAS
See Also:
Constant Field Values

NR

public static final String NR
See Also:
Constant Field Values
Constructor Detail

MobyDataXref

public MobyDataXref(MobyNamespace namespace,
                    String id,
                    MobyService service)

MobyDataXref

public MobyDataXref(String namespace,
                    String id,
                    MobyService service)
Gets the registry implicitly from the service being passed in.


MobyDataXref

public MobyDataXref(String namespace,
                    String id,
                    String serviceName,
                    String authURI)

MobyDataXref

public MobyDataXref(String namespace,
                    String id,
                    String serviceName,
                    String authURI,
                    Registry registry)

MobyDataXref

public MobyDataXref(Element e)
             throws MobyException
Throws:
MobyException

MobyDataXref

public MobyDataXref(Element e,
                    Registry registry)
             throws MobyException
Throws:
MobyException

MobyDataXref

public MobyDataXref(MobyDataObject mdsi,
                    MobyService service)
Build an Xref based on an existing object. The namespace and id will be kept, everything else ignored as they don't fit in a base MOBY Object.

Method Detail

getDescription

public String getDescription()
Provided by a called service A, describes in plain English(?) the relationship between the Xref (encapsulated in an Object returned by A) and the cross-referenced service B.


setDescription

public void setDescription(String desc)

setEvidenceCodeByAbbrev

public void setEvidenceCodeByAbbrev(String abbrev)
                             throws IllegalArgumentException
Throws:
IllegalArgumentException

setEvidenceCode

public void setEvidenceCode(String code)
                     throws IllegalArgumentException
Throws:
IllegalArgumentException

evidenceAbbrevToCode

public static String evidenceAbbrevToCode(String abbrev)
                                   throws IllegalArgumentException
Given one of the static final evidence codes from this class, returns the 2 or 3 letter GO evidence abbreviations. See http://www.geneontology.org/doc/GO.evidence.html

Throws:
IllegalArgumentException

evidenceCodeToAbbrev

public static String evidenceCodeToAbbrev(String code)
                                   throws IllegalArgumentException
Given one of the static final evidence codes from this class, returns the 2 or 3 letter GO evidence abbreviations. See http://www.geneontology.org/doc/GO.evidence.html

Throws:
IllegalArgumentException

getEvidenceCode

public String getEvidenceCode()
Provided by a called service A, indicates the source and strength of the relationship between the Xref (encapsulated in an Object returned by A) and the cross-referenced service B. The indication is made using one of the GeneOntology evidence types enumerated in this class.


setXrefType

public void setXrefType(String type)
At the moment, no check is made for the validity of the type string in the cross reference ontology, mostly because I don't know how to access it properly.


getXrefType

public String getXrefType()

clone

public MobyDataXref clone()
Description copied from class: MobyDataObject
Simply calls new constructor with object's existing data type, name and value. Subclasses should override this method if more datafields need to be copied for an accurate clone of the Moby Data Instance (i.e. anything but a base object). The subclasses should ensure that they also return a MobyDataObject.

Overrides:
clone in class MobyDataObjectSAI
Returns:
an object of class MobyDataObject

getService

public MobyService getService()

setServices

public void setServices(MobyService[] services)
If more than one service is provided, only the first will be taken.

Specified by:
setServices in interface MobyDataServiceAssocInstance
Overrides:
setServices in class MobyDataObjectSAI

setXmlMode

public void setXmlMode(int mode)
                throws IllegalArgumentException
If the XML mode is one of the constants defined by MobyDataInstance, this method calls its superclass equivalent (i.e. acts and prints like a Moby Object). If you are a service provider formulating an XML response object's Cross Reference Information Block, you will want to call this method with CRIB_XML_MODE_ON before calling toXML(), and with CRIB_XML_MODE_OFF afterwards (which restores the previous SERVICE or CENTRAL mode setting). If you are using MobyDataObject derivatives, this mode setting is done for you automatically.

Specified by:
setXmlMode in interface MobyDataInstance
Overrides:
setXmlMode in class MobyDataObjectSAI
Parameters:
mode - one of MobyDataInstance.CENTRAL_XML_MODE or MobyDataInstance.SERVICE_XML_MODE
Throws:
IllegalArgumentException - if the mode is not one of the specified values

addNamespace

public void addNamespace(MobyNamespace ns)
Values passed here are essentially ignored when a namespace already exists, because an Xref can only have one. When thwe Xref is acting an an Object though, the extra namespaces could matter.

Overrides:
addNamespace in class MobyDataObjectSAI

getNamespaces

public MobyNamespace[] getNamespaces()
Description copied from class: MobyPrimaryDataSimple
Return all namespaces defined in this data container.

Overrides:
getNamespaces in class MobyDataObjectSAI

getNamespace

public MobyNamespace getNamespace()
Since an Xref can only have one namespace, this method returns the one that will be used in Xref-style XML output. The first namespace in the namespace array is used, if available.


toString

public String toString()
Description copied from class: MobyDataObject
Convenience method to get the basic XML representation

Overrides:
toString in class MobyDataObjectSAI
Returns:
the raw XML representation of the object

toXML

public String toXML()
Description copied from class: MobyDataObject
Produces a full-blown XML fragment that depending on the value of getXmlMode() is either a template for use in MOBY Central services, or a Simple element for use in calling a service instance.

Specified by:
toXML in interface MobyDataInstance
Overrides:
toXML in class MobyDataObjectSAI
Returns:
the MOBY XML representation of the data instance

Version: 1.1.1

Submit a bug or feature
Generated: Sat May 29 04:26:35 EDT 2010