Class LifeScienceIdentifier
- java.lang.Object
-
- org.biojava.utils.lsid.LifeScienceIdentifier
-
- All Implemented Interfaces:
Serializable
public final class LifeScienceIdentifier extends Object implements Serializable
Life Science Identifier (LSID). LSID syntax:urn:lsid:<authorityId>:<namespaceId>:<objectId>:<revisionId>
The elements of a LSID are as follows:
- authorityId = <authorityId> identifies the organization
- namespaceId = <namespaceId> namespace to scope the identifier value
- objectId = <objectId> identifier of the object within namespace
- revisionId = <revisionId> optional version information
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.htmTODO:
Should this class support the spec definition of "lexical equivalence" in the equals(Object) method, or by the introduction of a new methodboolean 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object value)
String
getAuthorityId()
Return the authority id for this identifier.String
getNamespaceId()
Return the namespace id for this identifier within the authority.String
getObjectId()
Return the object id of this identifier.String
getRevisionId()
Return the revision id of this identifier.int
hashCode()
String
toString()
static LifeScienceIdentifier
valueOf(String lsid)
Create a new LifeScienceIdentifier parsed from the properly formatted stringlsid
.static LifeScienceIdentifier
valueOf(String authorityId, String namespaceId, String objectId)
Create a new LifeScienceIdentifier from the specified parameters.static LifeScienceIdentifier
valueOf(String authorityId, String namespaceId, String objectId, String revisionId)
Create a new LifeScienceIdentifier from the specified parameters.
-
-
-
Method Detail
-
getAuthorityId
public String getAuthorityId()
Return the authority id for this identifier.
-
getNamespaceId
public String getNamespaceId()
Return the namespace id for this identifier within the authority.
-
getObjectId
public String getObjectId()
Return the object id of this identifier.
-
getRevisionId
public String getRevisionId()
Return the revision id of this identifier. May return null.
-
valueOf
public static LifeScienceIdentifier valueOf(String lsid) throws LifeScienceIdentifierParseException
Create a new LifeScienceIdentifier parsed from the properly formatted stringlsid
.- Parameters:
lsid
- formatted LifeScienceIdentifier string- Throws:
LifeScienceIdentifierParseException
- iflsid
is not properly formatted
-
valueOf
public static LifeScienceIdentifier valueOf(String authorityId, String namespaceId, String objectId, String revisionId)
Create a new LifeScienceIdentifier from the specified parameters.- Parameters:
authorityId
- identifies the organizationnamespaceId
- namespace to scope the identifier valueobjectId
- identifer of the object within namespacerevisionId
- optional version information- Throws:
NullPointerException
- if any ofauthorityId
,namespaceId
, orobjectId
are null
-
valueOf
public static LifeScienceIdentifier valueOf(String authorityId, String namespaceId, String objectId)
Create a new LifeScienceIdentifier from the specified parameters.- Parameters:
authorityId
- identifies the organizationnamespaceId
- namespace to scope the identifier valueobjectId
- identifer of the object within namespace- Throws:
NullPointerException
- if any ofauthorityId
,namespaceId
, orobjectId
are null
-
-