Fable.grainspotter has embedded database support. Everytime grainspotter is run or an output log file is loaded into grainspotter then the data is loaded into the database. The database is based on Derby, a relational database implemented in Java. The current implementation of fable.grainspotter uses the embedded version of the Derby database in grainspotter. This means only one instance of grainspotter can run on one pc at a time. In the future grainspotter will support the use of the networked version of the database which means database will be able to be shared between multiple instances of grainspotter and persisted between runs.
The following tables have been defined in the database for grainspotter :
Table 1 - GRAINS
Holds the grain information. It has the following structure :
grain |
int |
gve_expected |
int |
gve_measured |
int |
ia |
double |
u11 |
double |
u12 |
double |
u13 |
double |
u21 |
double |
u22 |
double |
u23 |
double |
u31 |
double |
u32 |
double |
u33 |
double |
Table 2 - GRAINFITS
Holds information about the grain fits to the gvectors. It has the following structure :
grain |
int |
gvector |
int |
h |
int |
k |
int |
l |
int |
tth_meas |
double |
tth_pred |
double |
dtth |
double |
omega_meas |
double |
omega_pred |
double |
domega |
double |
eta_meas |
double |
eta_pred |
double |
deta |
double |
ia |
double |
SQL Console
Fable.grainspotter supports a simple (i.e. dumb) console for querying the database. Select Edit -> Sql Console to open it. You will see a prompt in the window :
sql >
You can type sql queries in the console to query the database. SQL is a powerful yet simple to use query language. If you need help on SQL refer to the web e.g. W3 Schools SQL
Here are some examples of queries you can do and their example outputs :
Example 1 - select * from grains
sql > select * from grains
Results of query select * from grains
GRAIN GVE_EXPECTED GVE_MEASURED IA U11 U12 U13 U21 U22 U23 U31 U32 U33
-------------------------------------------------
1 227 55 0.0936 0.270058267 -0.962618139 -0.020853092 0.762187999 0.226961938 -0.606265399 0.588334928 0.147833007 0.79498894
2 227 77 0.428 0.333347238 -0.830150018 0.446912258 -0.548771086 -0.556294928 -0.624008212 0.766635451 -0.037241111 -0.641001705
Example 1 - select grain,gvector,h,k,l from grainfits where h=1
sql > select grain,gvector,h,k,l from grainfits where h=1
Results of query select grain,gvector,h,k,l from grainfits where h=1
GRAIN GVECTOR H K L
-------------------------------------------------
1 101 1 -3 -1
1 99 1 -3 1
1 244 1 -5 -1
1 245 1 -5 1
2 8 1 -1 1
2 96 1 -1 3
2 242 1 -1 5