Revision 423M

org.bridgedb.file
Class IDMapperFile

java.lang.Object
  extended by org.bridgedb.file.IDMapperFile
All Implemented Interfaces:
IDMapper
Direct Known Subclasses:
IDMapperText

public abstract class IDMapperFile
extends java.lang.Object
implements IDMapper

Interface for ID mapping from files.


Field Summary
protected  org.bridgedb.file.IDMapperFile.IDMapperFileCapabilities cap
           
protected  IDMappingReader reader
           
 
Constructor Summary
IDMapperFile(IDMappingReader reader)
          Constuctor from a IDMappingReader.
IDMapperFile(IDMappingReader reader, boolean freeSearch)
          Constuctor from a IDMappingReader and user-defined free search capacity.
 
Method Summary
 void close()
          dispose any resources (such as open database connections) associated with this IDMapper.
 IDMapperCapabilities getCapabilities()
           
protected  IDMappingReader getIDMappingReader()
           
 boolean isConnected()
          Use this method to check if the IDMapper is still valid.
 java.util.Map<Xref,java.util.Set<Xref>> mapID(java.util.Collection<Xref> srcXrefs, DataSource... tgtDataSources)
          Get all cross-references for a set of entities, restricting the result to contain only references from the given set of data sources.
 java.util.Set<Xref> mapID(Xref srcXref, DataSource... tgtDataSources)
          Get all cross-references for the given entity, restricting the result to contain only references from the given set of data sources.
 boolean xrefExists(Xref xref)
          Check whether an Xref is known by the given mapping source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.bridgedb.IDMapper
freeSearch
 

Field Detail

cap

protected final org.bridgedb.file.IDMapperFile.IDMapperFileCapabilities cap

reader

protected final IDMappingReader reader
Constructor Detail

IDMapperFile

public IDMapperFile(IDMappingReader reader)
             throws IDMapperException
Constuctor from a IDMappingReader. transitivity is unsupported by default.

Parameters:
reader - ID mapping reader
Throws:
IDMapperException - when failed to read

IDMapperFile

public IDMapperFile(IDMappingReader reader,
                    boolean freeSearch)
             throws IDMapperException
Constuctor from a IDMappingReader and user-defined free search capacity.

Parameters:
reader - ID mapping reader
freeSearch - if this IDMapper supports free search
Throws:
IDMapperException - when failed to read
java.lang.IllegalArgumentException - if reader is null
Method Detail

mapID

public java.util.Map<Xref,java.util.Set<Xref>> mapID(java.util.Collection<Xref> srcXrefs,
                                                     DataSource... tgtDataSources)
                                              throws IDMapperException
Get all cross-references for a set of entities, restricting the result to contain only references from the given set of data sources. Supports one-to-one mapping and one-to-many mapping.

Specified by:
mapID in interface IDMapper
Parameters:
srcXrefs - source Xref, containing ID and ID type/data source
tgtDataSources - target ID types/data sources. Set this to null if you want to retrieve all results.
Returns:
a map from source Xref to target Xref's. The map is not guaranteed to contain a result for each srcXrefs you pass in. This method will never return null however.
Throws:
IDMapperException - if the mapping service is (temporarily) unavailable

mapID

public java.util.Set<Xref> mapID(Xref srcXref,
                                 DataSource... tgtDataSources)
                          throws IDMapperException
Get all cross-references for the given entity, restricting the result to contain only references from the given set of data sources.

Specified by:
mapID in interface IDMapper
Parameters:
srcXref - the entity to get cross-references for.
tgtDataSources - target ID types/data sources. Set this to null if you want to retrieve all results.
Returns:
A Set containing the cross references, or an empty Set when no cross references could be found. This method does not return null.
Throws:
IDMapperException - if the mapping service is (temporarily) unavailable

xrefExists

public boolean xrefExists(Xref xref)
                   throws IDMapperException
Check whether an Xref is known by the given mapping source. This is an optionally supported operation.

Specified by:
xrefExists in interface IDMapper
Parameters:
xref - reference to check
Returns:
if the reference exists, false if not
Throws:
IDMapperException - if failed, UnsupportedOperationException if it's not supported by the Driver.

close

public void close()
           throws IDMapperException
dispose any resources (such as open database connections) associated with this IDMapper.

Specified by:
close in interface IDMapper
Throws:
IDMapperException - if the associated resources could not be freed.

isConnected

public boolean isConnected()
Use this method to check if the IDMapper is still valid.

Specified by:
isConnected in interface IDMapper
Returns:
false after the close() method is called on this object, true otherwise

getCapabilities

public IDMapperCapabilities getCapabilities()
Specified by:
getCapabilities in interface IDMapper
Returns:
capacities of the ID mapper

getIDMappingReader

protected IDMappingReader getIDMappingReader()

Generated July 29 2010