Package org.biojava.bio.annodb
Class IndexedAnnotationDB
- java.lang.Object
-
- org.biojava.bio.annodb.IndexedAnnotationDB
-
- All Implemented Interfaces:
AnnotationDB
public class IndexedAnnotationDB extends Object implements AnnotationDB
A database of Annotation instances backed by an indexed file set.
- Since:
- 1.3
- Author:
- Matthew Pocock
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceIndexedAnnotationDB.ParserListenerFactoryA factory for retrieving parsers and listeners.static classIndexedAnnotationDB.StaticMethodRPFactoryAn implementation of ParserListenerFactory that uses a static method.
-
Field Summary
-
Fields inherited from interface org.biojava.bio.annodb.AnnotationDB
EMPTY
-
-
Constructor Summary
Constructors Constructor Description IndexedAnnotationDB(String dbName, File storeLoc, Index2Model model, List toIndex, int maxKeyLen, AnnotationType schema, IndexedAnnotationDB.ParserListenerFactory plFactory)Create a new IndexedAnnotationDB.IndexedAnnotationDB(BioStore store)Initialise the db from a store.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AnnotationDBfilter(AnnotationType at)Find all Annotation instances in this DB that are of a particular type.StringgetName()The name of this AnnotationDB.IndexedAnnotationDB.ParserListenerFactorygetParserListenerFactory()Get the ParserListenerFactory used by this IndexedAnnotationDB.AnnotationTypegetSchema()Get an AnnotationType that accepts all Annotation instances in this DB.Iteratoriterator()Loop over each Annotation in this db.AnnotationDBsearch(AnnotationType at)Find all Annotation instances in this DB and any Annotations that are child properties of these that match an AnnotationType.intsize()The number of Annotation instances in the DB.
-
-
-
Constructor Detail
-
IndexedAnnotationDB
public IndexedAnnotationDB(String dbName, File storeLoc, Index2Model model, List toIndex, int maxKeyLen, AnnotationType schema, IndexedAnnotationDB.ParserListenerFactory plFactory) throws BioException, CommitFailure, IOException, ParserException
Create a new IndexedAnnotationDB.- Parameters:
dbName-storeLoc-model-toIndex-maxKeyLen-schema-plFactory-- Throws:
BioExceptionCommitFailureIOExceptionParserException
-
IndexedAnnotationDB
public IndexedAnnotationDB(BioStore store) throws IOException, SAXException
Initialise the db from a store.- Parameters:
store- the BioStore to initalise from- Throws:
IOException- if there was an IO fault accessing the storeSAXException- if the XML configuration file is corrupted
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:AnnotationDBThe name of this AnnotationDB.
- Specified by:
getNamein interfaceAnnotationDB- Returns:
- the name of this AnnotationDB
-
getSchema
public AnnotationType getSchema()
Description copied from interface:AnnotationDBGet an AnnotationType that accepts all Annotation instances in this DB.
The schema should accept all Annotations in the DB. However, it may hit other Annotations. So, AnnotationType.ALL is always a valid schema. Obviously, the more retrictive it is, the more usefull it becomes for introspection.
- Specified by:
getSchemain interfaceAnnotationDB- Returns:
- the schema AnnotationType
-
iterator
public Iterator iterator()
Description copied from interface:AnnotationDBLoop over each Annotation in this db.- Specified by:
iteratorin interfaceAnnotationDB- Returns:
- an Iterator over each item in the DB
-
size
public int size()
Description copied from interface:AnnotationDBThe number of Annotation instances in the DB.- Specified by:
sizein interfaceAnnotationDB- Returns:
- the size of this DB
-
filter
public AnnotationDB filter(AnnotationType at)
Description copied from interface:AnnotationDBFind all Annotation instances in this DB that are of a particular type.- Specified by:
filterin interfaceAnnotationDB- Parameters:
at- the AnnotationType to match- Returns:
- an AnnotationDB with all matching Annotation instances
-
search
public AnnotationDB search(AnnotationType at)
Description copied from interface:AnnotationDBFind all Annotation instances in this DB and any Annotations that are child properties of these that match an AnnotationType.- Specified by:
searchin interfaceAnnotationDB- Parameters:
at- the AnnotationType to search with- Returns:
- an AnnotationDB with all matching Annotation instances, irregardless of how deep in the hieracy they are
-
getParserListenerFactory
public IndexedAnnotationDB.ParserListenerFactory getParserListenerFactory()
Get the ParserListenerFactory used by this IndexedAnnotationDB.- Returns:
- the ParserListenerFactory
-
-