|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface XerialStorageContext
An example table data:
Gene Table --------------------- |id | start | end | |-------------------| |1 | 10 | 100 | |2 | 120 | 300 | |-------------------|
possible annotations for this table:
species="human", chromosome="chr18", genome.revision="hg18", creater="leo", created_at="2007/07/06"
Some user may generate the following table, containing annotations:
Gene Table with annotation -------------------------------------------- |id | start | end | species | chromosome | |------------------------------------------- |1 | 10 | 100 | human | chr18 | |2 | 120 | 300 | human | chr18 | |-------------------------------------------
In both cases, we want to use the same syntax to query these tables. For example, to retrieve gene data of human chromosome 18:
select id, start, end from gene_table where species="human" and chromosome="chr18"
Corresponding AmoebaQuery representation:
select gene.id, gene.start, gene.end from (species = "human", chromosome="chr18")Annotating table data can be deferred until you insert the gene object data:
XreialFS fs = (initialization of XerialfS)
XerialStorageContext db = fs.open("/home/leo/genedata");
db.append("gene(id=1, start=10, end=100)"); // insert a gene object
db.append("gene(id=2, start=120, end=300)");
// add annotations to all gene objects
db.append("gene", "species=human, chromosome=chr18, created_at='2007/07/06'");
// add additional annotations for a gene with id = 1
db.append("gene(id=1)", "description='my gene', author='leo'");
Adding exon data to individual genes:
If you forget to add id for each gene, you can add such IDs later:
db.append("gene:(id=1)", "exon:(start=10, end=15)");
db.append("gene:(id=1)", "exon:(start=20, end=30, description='my exon')");
db.append("gene:(id=2)", "exon:(start=125, end=130)");
int count = 1;
for(AmeobaQueryResultSetHandler handler = db.retrieve("gene"); handler.hasNext(); )
{
handler.next().append("id=" + count++);
}
| Method Summary | |
|---|---|
void |
append(AmoebaQuery contest,
AmoebaTuple tuple)
Appends the data into the given context |
void |
append(AmoebaTuple tuple)
Appends the data without specifying a particular context, i.e., the data will be inserted into the global context |
AmoebaQueryResultSetHandler |
retrieve(AmoebaQuery query)
Retrieves database data |
AmoebaQueryResultSetHandler |
retrieve(AmoebaQuery context,
AmoebaQuery query)
Retreives database data within the specified context |
void |
write(AmoebaQuery context,
AmoebaTuple tuple)
Overwrites the data within the specified context |
void |
write(AmoebaTuple tuple)
Overwrites the data in the global context of the database file |
| Method Detail |
|---|
AmoebaQueryResultSetHandler retrieve(AmoebaQuery query)
throws DBException
query - the query
XerialFSException
DBException
AmoebaQueryResultSetHandler retrieve(AmoebaQuery context,
AmoebaQuery query)
throws DBException
context - the contextquery - the query
XerialFSException
DBException
void append(AmoebaTuple tuple)
throws DBException
tuple - a data to insert
XerialFSException
DBException
void append(AmoebaQuery contest,
AmoebaTuple tuple)
throws DBException
context - the update contexttuple - a data to write
XerialFSException
DBException
void write(AmoebaTuple tuple)
throws DBException
tuple - a data to write
XerialFSException
DBException
void write(AmoebaQuery context,
AmoebaTuple tuple)
throws DBException
conetxt - the update contexttuple - a data to write
XerialFSException
DBException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
