Version: 1.1.1

org.biomoby.shared.datatypes
Class MobyXref

java.lang.Object
  extended by org.biomoby.shared.datatypes.MobyObject
      extended by org.biomoby.shared.datatypes.MobyXref

public class MobyXref
extends MobyObject

An object representing a cross reference. A cross reference is an optional component of any Biomoby object. It can be of a simple or of an advanced version.

A simple cross reference is a base Biomoby object (named 'Object') that can have only attributes 'namespace' and 'id' (no value, no article name, no children). Such cross reference return true in its isSimpleXref.

An advanced cross reference additionally includes a reference to a Biomoby service that a creator of this cross reference (which is a Biomoby service provider) suggests to execute in order to get more about the cross-referenced data.

The cross references are a moving target - better to check details in the Biomoby API description.

Note that jMoby contains yet another object representing a cross reference: MobyDataXref. These two representations of a cross-reference do not depend on each other (except the list of evidence codes that is shared) - jMoby simply has more ways to do the same.

Version:
$Id: MobyXref.java,v 1.2 2006/02/20 05:51:11 senger Exp $
Author:
Martin Senger

Constructor Summary
MobyXref()
          Default constructor.
 
Method Summary
 String format(int indent)
          Return the same contents as MobyObject.toString() method but indented by level expressed in the parameter 'indent'.
 String getDescription()
          Get a human-readable description of this cross reference.
 String getEvidenceCode()
          Get an evidence code.
 MobyService getService()
          Get an object representing a Biomoby service that can consume data this cross reference is included in.
 String getXrefType()
          Get a semantic type of this cross reference.
 boolean isSimpleXref()
          Find what kind of cross reference this instance is.
 void setDescription(String desc)
          Set a human-readable description of this cross reference.
 void setEvidenceCode(String code)
          Set an evidence code.
 void setService(MobyService service)
          Set a Biomoby service that can consume data this cross reference is included in.
 void setSimple(boolean yes)
          Set the kind of this cross reference.
 void setXrefType(String type)
          Set a semantic type of this cross reference.
 String toString()
          Format all non-empty public members in a human-readable way.
 org.jdom.Element toXML()
          Create an XML element representing this object.
 
Methods inherited from class org.biomoby.shared.datatypes.MobyObject
addXref, getId, getMobyTypeName, getName, getNamespace, getProvision, getValue, getXrefs, isPrimitiveType, setId, setName, setNamespace, setProvision, setValue, setValueXML, setXrefs
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MobyXref

public MobyXref()
Default constructor.

Method Detail

isSimpleXref

public boolean isSimpleXref()
Find what kind of cross reference this instance is.

Returns:
true if this instance if a simple cross reference

setSimple

public void setSimple(boolean yes)
Set the kind of this cross reference.

Parameters:
yes - should be true in order to make this cross reference a simple one

getDescription

public String getDescription()
Get a human-readable description of this cross reference.


setDescription

public void setDescription(String desc)
Set a human-readable description of this cross reference.


setEvidenceCode

public void setEvidenceCode(String code)
                     throws MobyException
Set an evidence code. An evidence code is a term from the GO evidence codes list, indicating the type of evidence that supports this cross-reference as being valid for the data object it is included in.

Parameters:
code - to be set
Throws:
MobyException - if the 'code' is empty (it should also check if it is valid but it does not do it now - TBD)
See Also:
for a list of evidence codes

getEvidenceCode

public String getEvidenceCode()
Get an evidence code.

See Also:
for details what values are expected

setXrefType

public void setXrefType(String type)
Set a semantic type of this cross reference. A semantic type is a term from the "Cross-Reference-Type Ontology" (which is only vaguely defined in the Biomoby API description).

Parameters:
type - to be set; no validity check is done now

getXrefType

public String getXrefType()
Get a semantic type of this cross reference.


getService

public MobyService getService()
Get an object representing a Biomoby service that can consume data this cross reference is included in.


setService

public void setService(MobyService service)
Set a Biomoby service that can consume data this cross reference is included in.


toXML

public org.jdom.Element toXML()
Description copied from class: MobyObject
Create an XML element representing this object.

Overrides:
toXML in class MobyObject
Returns:
a jDom element that can be easily incorporated into a bigger XML document

toString

public String toString()
Description copied from class: MobyObject
Format all non-empty public members in a human-readable way.

Overrides:
toString in class MobyObject
Returns:
a formatted string
See Also:
for making the returned string better indented

format

public String format(int indent)
Description copied from class: MobyObject
Return the same contents as MobyObject.toString() method but indented by level expressed in the parameter 'indent'. It is useful when a hierarchy of objects call toString methods on their children. For example, assuming that a MobyObject has a list of cross references (represented by a Vector xrefs, the method toString of such MobyObject can include code like this:
  StringBuffer buf = new StringBuffer();
  for (Enumeration en = xrefs.elements(); en.hasMoreElements(); )
    buf.append (((MobyXref)en.nextElement()).format (1));

Overrides:
format in class MobyObject
Parameters:
indent - means a level of wanted indentation: number 1 means three spaces, number two six spaces, etc.
Returns:
a formatted, and indented, string

Version: 1.1.1

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