Version: 1.1.1

org.biomoby.shared
Class MobyDataType

java.lang.Object
  extended by org.biomoby.shared.MobyDataType
All Implemented Interfaces:
Comparable<MobyDataType>, LSIDAccessible
Direct Known Subclasses:
MobyDataTypeTemplate

public class MobyDataType
extends Object
implements Comparable<MobyDataType>, LSIDAccessible

A container representing a data type used in the Moby registry (in the BioMoby speak it is called "Object Class"). The Moby data types are used to specify what types of inputs and outputs are needed or produced by Moby services.

This container is used mainly to register a new data type into a Moby registry, and to find services with this particular input or output data type.

Version:
$Id: MobyDataType.java,v 1.28 2010/05/13 15:54:16 gordonp Exp $
Author:
Martin Senger

Field Summary
static String DUMMY_NAME
          A dummy name used for MobyDataType instances that do not have (yet) a real name.
 
Constructor Summary
MobyDataType()
          Default constructor.
MobyDataType(String name)
          Normal constructor.
 
Method Summary
 void addChild(MobyRelationship child)
           
 void addChild(String name, String typeName, int relationshipType)
          Create a MobyRelationship object from given parameters and add it as a new child.
 void addParentName(String value)
          Add one parent of this data type.
 int compareTo(MobyDataType obj)
           
 boolean equals(Object obj)
           
 String format(int indent)
           
 MobyRelationship[] getAllChildren()
          Returns all HAS/HASA children for this object and all of its parent classes.
 String getAuthority()
          Return an authority for this data type.
static Comparator getAuthorityComparator()
          Create a comparator for case-insensitive sorting of data types by their authorities.
 MobyRelationship getChild(String fieldName)
          Returns the HAS/HASA child with the given name (if it exists) for this object or any of its parent classes.
 MobyRelationship[] getChildren()
          Return children of this data type, and the way how they are ontologically related to this data type.
 String getComment()
          Return a comment that is attached to this instance.
static MobyDataType getDataType(String className)
           
static MobyDataType getDataType(String className, Registry reg)
          Retrieves a datatype object from the registry's ontology.
 String getDescription()
          Return a (usually) human readable description of this data type.
 String getEmailContact()
          Return a contact email.
 String getId()
          Return an ID that is given to this data type during its registration.
 MobyDataType[] getLineage()
          A convenience method for retrieving the entire inheritance tree for this MOBY object class.
 String getLSID()
          Return LSID representing this data type definition.
 String getName()
           
 MobyDataType getParent()
           
 String getParentName()
          Return the first parent name (at the moment the only one set and used, anyway.
 String[] getParentNames()
          Return names of all parental data types (as stored in the BioMoby class ontology).
 Registry getRegistry()
           
 boolean inheritsFrom(MobyDataType otherType)
          Searches the ontology lineage of the current data type against the provided type.
 boolean inheritsFrom(String otherTypeName)
          Searches the ontology lineage of the current data type against the data type corresponding to the provided name.
 void setAuthority(String value)
           
 void setChildren(MobyRelationship[] value)
           
 void setComment(String value)
           
 void setDescription(String value)
           
 void setEmailContact(String value)
           
 void setId(String value)
           
 void setLSID(String value)
           
 void setName(String value)
           
 void setParentNames(String[] value)
           
 void setRegistry(Registry r)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DUMMY_NAME

public static final String DUMMY_NAME
A dummy name used for MobyDataType instances that do not have (yet) a real name.

See Also:
Constant Field Values
Constructor Detail

MobyDataType

public MobyDataType()
Default constructor.


MobyDataType

public MobyDataType(String name)
Normal constructor. Other characteristics are empty - which is usually wrong - you should use 'set' methods to fill them before using this instance.

Parameters:
name - of this data type (e.g. GenericSequence, or String). The name can be either a simple string (e.g. Object), or a full-blown LSID (e.g. urn:lsid:biomoby.org:objectclass:Object).
Method Detail

compareTo

public int compareTo(MobyDataType obj)
Specified by:
compareTo in interface Comparable<MobyDataType>

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

setRegistry

public void setRegistry(Registry r)

getRegistry

public Registry getRegistry()

getDataType

public static MobyDataType getDataType(String className)

getDataType

public static MobyDataType getDataType(String className,
                                       Registry reg)
Retrieves a datatype object from the registry's ontology.


getName

public String getName()

setName

public void setName(String value)

getId

public String getId()
Return an ID that is given to this data type during its registration. The ID seems to be used only for de-registration of this data type; you are not supposed to fill it when you create an instance of this object.


setId

public void setId(String value)
See Also:
getId()

getAuthority

public String getAuthority()
Return an authority for this data type. The authority is an URI of this data type provider. Very often empty.


setAuthority

public void setAuthority(String value)
See Also:
getAuthority()

getEmailContact

public String getEmailContact()
Return a contact email. The purpose of this field is still a bit obscure - but I think that the intention is to use it in the process of de-registration of this data type.


setEmailContact

public void setEmailContact(String value)
See Also:
getEmailContact()

getDescription

public String getDescription()
Return a (usually) human readable description of this data type.


setDescription

public void setDescription(String value)
See Also:
getDescription()

getLSID

public String getLSID()
Return LSID representing this data type definition.

Specified by:
getLSID in interface LSIDAccessible

setLSID

public void setLSID(String value)
See Also:
getLSID()

getParentNames

public String[] getParentNames()
Return names of all parental data types (as stored in the BioMoby class ontology). Note, however, that the current BioMoby API (0.8) does not expect (probably even does not allow) multiple-inheritance.

Returns:
(at the moment) none (for the root data type) or one name. The name is an LSID (e.g. urn:lsid:biomoby.org:objectclass:Object).

getParentName

public String getParentName()
Return the first parent name (at the moment the only one set and used, anyway. This is a convenient method to getParentNames().

Returns:
parent name, or an empty string if there is no parent set

getParent

public MobyDataType getParent()

getLineage

public MobyDataType[] getLineage()
A convenience method for retrieving the entire inheritance tree for this MOBY object class. Index 0 should always contain the base Object class, and the last element should always be the current class.


setParentNames

public void setParentNames(String[] value)
Parameters:
value - is a set of parent names (usually just one name, however). If it is null all parents set previously are forgotten.
See Also:
getParentNames()

addParentName

public void addParentName(String value)
Add one parent of this data type.

Parameters:
value - is a name of a parental data type. A null value is ignored.
See Also:
getParentNames()

getChildren

public MobyRelationship[] getChildren()
Return children of this data type, and the way how they are ontologically related to this data type. The returned elements are containers, each of them defining the child data type, under what name it is used here (the BioMoby API calls this name an "article name"), and what relationship it has to this data type (HAS, HASA).

Note that it does not return children that belong to the parent types - in other words it does not go up through the whole ontology tree to find all children.

See Also:
Central.iHAS, Central.iHASA

getAllChildren

public MobyRelationship[] getAllChildren()
Returns all HAS/HASA children for this object and all of its parent classes.


getChild

public MobyRelationship getChild(String fieldName)
Returns the HAS/HASA child with the given name (if it exists) for this object or any of its parent classes. Ortherwise it returns null.


inheritsFrom

public boolean inheritsFrom(String otherTypeName)
Searches the ontology lineage of the current data type against the data type corresponding to the provided name.


inheritsFrom

public boolean inheritsFrom(MobyDataType otherType)
Searches the ontology lineage of the current data type against the provided type.


setChildren

public void setChildren(MobyRelationship[] value)
Parameters:
value - is an array of children. If it is null all children set previously are forgotten.
See Also:
getChildren()

addChild

public void addChild(MobyRelationship child)
Parameters:
child - a new child to be added. If null it is ignored.
See Also:
getChildren()

addChild

public void addChild(String name,
                     String typeName,
                     int relationshipType)
Create a MobyRelationship object from given parameters and add it as a new child.

Parameters:
name - is a name how the new child is known to this data type (an "article name" in the BioMoby speak), e.g. 'length'. Because of the backward compatibility it accepts also a null or empty string here - but according to the BioMoby API (0.8) this name should be always given.
typeName - is a name of the child data type, e.g. 'Integer'. If it is null it is ignored.
relationshipType - is either HASA or HAS. If it is something else it is silenty changed to HASA.
See Also:
getChildren()

toString

public String toString()
Overrides:
toString in class Object

format

public String format(int indent)

getComment

public String getComment()
Return a comment that is attached to this instance. A comment can be anything and it is not meant to be used by end-users (that's why it is not included in the toString() method). It is for developers doing various tricks with these instances.


setComment

public void setComment(String value)
See Also:
getComment()

getAuthorityComparator

public static Comparator getAuthorityComparator()
Create a comparator for case-insensitive sorting of data types by their authorities.


Version: 1.1.1

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