org.biojava.utils.lsid
Class LifeScienceIdentifier

java.lang.Object
  extended by org.biojava.utils.lsid.LifeScienceIdentifier
All Implemented Interfaces:
java.io.Serializable

public final class LifeScienceIdentifier
extends java.lang.Object
implements java.io.Serializable

Life Science Identifier (LSID). LSID syntax:

urn:lsid:<authorityId>:<namespaceId>:<objectId>:<revisionId>

The elements of a LSID are as follows:

Examples:

 urn:lsid:ebi.ac.uk:SWISS-PROT/accession:P34355:3
 urn:lsid:rcsb.org:PDB:1D4X:22
 urn:lsid:ncbi.nlm.nih.gov:Genbank/accession:NT_001063:2
 

As described in the memo URN Namespace for Life Science Identifiers
> http://www.i3c.org/workgroups/technical_architecture/resources/lsid/docs/LSIDSyntax9-20-02.htm

TODO:
Should this class support the spec definition of "lexical equivalence" in the equals(Object) method, or by the introduction of a new method boolean lexicallyEquivalent(LifeScienceIdentifier)?

From the spec:
For various purposes such as caching and replication, it's often desirable to determine if two LSIDs are the same without resolving them. The general purpose means of doing so is by testing for "lexical equivalence" as defined: LSIDs are lexically equivalent if the AuthorityID, NamespaceID, ObjectID, and RevisionID are all identical (case-insensitive comparison).

Author:
Michael Heuer
See Also:
Serialized Form

Method Summary
 boolean equals(java.lang.Object value)
           
 java.lang.String getAuthorityId()
          Return the authority id for this identifier.
 java.lang.String getNamespaceId()
          Return the namespace id for this identifier within the authority.
 java.lang.String getObjectId()
          Return the object id of this identifier.
 java.lang.String getRevisionId()
          Return the revision id of this identifier.
 int hashCode()
           
 java.lang.String toString()
           
static LifeScienceIdentifier valueOf(java.lang.String lsid)
          Create a new LifeScienceIdentifier parsed from the properly formatted string lsid.
static LifeScienceIdentifier valueOf(java.lang.String authorityId, java.lang.String namespaceId, java.lang.String objectId)
          Create a new LifeScienceIdentifier from the specified parameters.
static LifeScienceIdentifier valueOf(java.lang.String authorityId, java.lang.String namespaceId, java.lang.String objectId, java.lang.String revisionId)
          Create a new LifeScienceIdentifier from the specified parameters.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getAuthorityId

public java.lang.String getAuthorityId()
Return the authority id for this identifier.


getNamespaceId

public java.lang.String getNamespaceId()
Return the namespace id for this identifier within the authority.


getObjectId

public java.lang.String getObjectId()
Return the object id of this identifier.


getRevisionId

public java.lang.String getRevisionId()
Return the revision id of this identifier. May return null.


equals

public boolean equals(java.lang.Object value)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

valueOf

public static LifeScienceIdentifier valueOf(java.lang.String lsid)
                                     throws LifeScienceIdentifierParseException
Create a new LifeScienceIdentifier parsed from the properly formatted string lsid.

Parameters:
lsid - formatted LifeScienceIdentifier string
Throws:
LifeScienceIdentifierParseException - if lsid is not properly formatted

valueOf

public static LifeScienceIdentifier valueOf(java.lang.String authorityId,
                                            java.lang.String namespaceId,
                                            java.lang.String objectId,
                                            java.lang.String revisionId)
Create a new LifeScienceIdentifier from the specified parameters.

Parameters:
authorityId - identifies the organization
namespaceId - namespace to scope the identifier value
objectId - identifer of the object within namespace
revisionId - optional version information
Throws:
java.lang.NullPointerException - if any of authorityId, namespaceId, or objectId are null

valueOf

public static LifeScienceIdentifier valueOf(java.lang.String authorityId,
                                            java.lang.String namespaceId,
                                            java.lang.String objectId)
Create a new LifeScienceIdentifier from the specified parameters.

Parameters:
authorityId - identifies the organization
namespaceId - namespace to scope the identifier value
objectId - identifer of the object within namespace
Throws:
java.lang.NullPointerException - if any of authorityId, namespaceId, or objectId are null