public final class DataSource extends Object
enum pattern.
You cannot instantiate DataSources directly, instead you have to use one of
the constants from the org.bridgedb.bio module such as BioDataSource.ENSEMBL,
or the getBySystemcode or "getByFullname" methods.
These methods return a predefined DataSource object if it exists.
If a predefined DataSource for a requested SystemCode doesn't exists,
a new one springs to life automatically. This can be used
when the user requests new, unknown data sources. If you call
getBySystemCode twice with the same argument, it is guaranteed
that you get the same return object. However, there is no way
to combine a new DataSource with a new FullName unless you use
the "register" method.
This way any number of pre-defined DataSources can be used, but plugins can define new ones and you can handle unknown data sources in the same way as predefined ones.
Definitions for common DataSources can be found in org.bridgedb.bio.BioDataSource.
| Modifier and Type | Class and Description |
|---|---|
static class |
DataSource.Builder
Uses builder pattern to set optional attributes for a DataSource.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
fullNameExists(String fullName)
Check if a DataSoucre with this sfullName has been registered
|
String |
getAlternative()
Retrieves any saved alternative name.
|
static DataSource |
getByAlias(String alias) |
static DataSource |
getByIdentiferOrgBase(String base)
Since version 2.0 this method will return null if no DataSource is known
|
static DataSource |
getByMiriamBase(String base)
Since version 2.0 this method will return null if no DataSource is known
|
String |
getCompactIdentifier(String id)
Creates a compact identifier.
|
static Set<DataSource> |
getDataSources()
get all registered datasoures as a set.
|
String |
getDescription()
Retrieves any saved description.
|
Xref |
getExample() |
static DataSource |
getExistingByFullName(String fullName)
returns pre-existing DataSource object
|
static DataSource |
getExistingBySystemCode(String systemCode) |
static Set<DataSource> |
getFilteredSet(Boolean primary,
Boolean metabolite,
Object o)
returns a filtered subset of available datasources.
|
String |
getFullName()
returns full name of DataSource e.g.
|
static List<String> |
getFullNames()
Get a list of all non-null full names.
|
String |
getIdentifiersOrgUri(String id) |
String |
getKnownUrl(String id)
Turn id into url pointing to info page on the web, e.g.
|
String |
getMainUrl()
Return the main Url for this datasource,
that can be used to refer to the datasource in general.
|
String |
getMiriamURN(String id)
Creates a global identifier.
|
Object |
getOrganism() |
String |
getSystemCode()
returns GenMAPP SystemCode, e.g.
|
String |
getType() |
boolean |
isDeprecated()
A DataSource is deprecated if it is replaced by another data source
which should be used instead.
|
DataSource |
isDeprecatedBy()
Returns the DataSource that should be used instead if this DataSource
is deprecated.
|
boolean |
isMetabolite() |
boolean |
isPrimary() |
static DataSource.Builder |
register(String sysCode,
String fullName)
Register a new DataSource with (optional) detailed information.
|
void |
registerAlias(String alias) |
static boolean |
systemCodeExists(String systemCode)
Check if a DataSoucre with this systemCode has been registered
|
String |
toString()
The string representation of a DataSource is equal to
it's full name.
|
boolean |
urlPatternKnown()
Check if a Url pattern is know for this DataSource.
|
public static final String UNKOWN
public String getKnownUrl(String id)
id - identifier to use in urlpublic boolean urlPatternKnown()
public String getFullName()
public String getSystemCode()
public String getMainUrl()
public String getType()
public String getMiriamURN(String id)
id - Id to generate URN from.public String getCompactIdentifier(String id)
id - identifier to generate compact identifier from.public String getAlternative()
public String getDescription()
public static DataSource.Builder register(String sysCode, String fullName)
sysCode - short unique code between 1-4 letters, originally used by GenMAPPfullName - full name used in GPML.public void registerAlias(String alias)
public static DataSource getExistingBySystemCode(String systemCode)
systemCode - short unique code to query forIllegalArgumentException - if no DataSource is known with this systemCodepublic static boolean systemCodeExists(String systemCode)
systemCode - to checkpublic static DataSource getExistingByFullName(String fullName)
fullName - full name to query forIllegalArgumentException - if no DataSource is known with this systemCodepublic static boolean fullNameExists(String fullName)
fullName - to checkpublic static DataSource getByAlias(String alias)
public static Set<DataSource> getDataSources()
public static Set<DataSource> getFilteredSet(Boolean primary, Boolean metabolite, Object o)
primary - Filter for specified primary-ness. If null, don't filter on primary-ness.metabolite - Filter for specified metabolite-ness. If null, don't filter on metabolite-ness.o - Filter for specified organism. If null, don't filter on organism.public static List<String> getFullNames()
Warning: the ordering of this list is undefined. Two subsequent calls may give different results.
public String toString()
public Xref getExample()
public boolean isPrimary()
public boolean isDeprecated()
public DataSource isDeprecatedBy()
public boolean isMetabolite()
public Object getOrganism()
public static DataSource getByMiriamBase(String base)
base - the base urn, which must start with "urn:miriam:". It it isn't, null is returned.public static DataSource getByIdentiferOrgBase(String base)
base - the base urn, which must start with "http://identifiers.org/". It it isn't, null is returned.Copyright © 2006–2021 BridgeDb project. All rights reserved.