hepdata is hosted by Hepforge, IPPP Durham

cedar.hepdata.db
Class DBManager

java.lang.Object
  extended by cedar.hepdata.db.DBManager

public abstract class DBManager
extends java.lang.Object

Database INSERT and UPDATE functionality. This contains most of the migration code but is intended to be utilised in the longer term by new methods of data input.

Version:
$Date: 2006-01-20 11:37:12 +0000 (Fri, 20 Jan 2006) $ $Revision: 469 $
Author:
S Butterworth

Constructor Summary
DBManager()
           
 
Method Summary
static void add(Axis axis)
          Add an Axis record to the DB.
static void add(Dataset ds)
          Add a Dataset record to the DB.
static void add(Detector d)
          Add a Detector to the DB, if it doesn't already exist.
static void add(Experiment ex)
          Add an Experiment record if it doesn't already exist.
static void add(Observable obs)
          Add an Observable record to the DB.
static void add(Paper paper)
          Add a Paper record to the DB, or update comment if the record already exists.
static void add(Qualifier q)
          Adds Qualifier record to the Database.
static void add(Reaction r)
          Add a Reaction record to the DB - first checks that the reaction is not already there.
static void add(Reaction r, Particle fp)
          Add a Final Particle Record: Particle in the final state of a reaction
static void add(Reference reference)
          Add a Reference record to the DB.
static void addProperties()
          Decodes header and descriptions on Axis and Dataset records into Reactions,Observables and Propertys.
static void addSysYVals()
          Final step in the migration of systematic errors from legacy db which apply to a subset of the points of a specific dataset.
protected static int doQuery(java.lang.String query)
          performs a query of the nature SELECT count(*) count FROM some_table
static void runTests()
          Performs a count of database tables and prints out the result
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBManager

public DBManager()
Method Detail

add

public static void add(Paper paper)
                throws HDException
Add a Paper record to the DB, or update comment if the record already exists. New comments can be appended to an existing record while the comment length is less than paper.MAXCOMMENTLENGTH

Parameters:
paper - to be added
Throws:
HDException


add

public static void add(Dataset ds)
                throws HDException
Add a Dataset record to the DB. If the input dataset has only ids, a header and a description this indicates that an existing record should be updated.

Throws:
HDException


add

public static void add(Reaction r)
                throws HDException
Add a Reaction record to the DB - first checks that the reaction is not already there. Adds final particles for the reaction Also adds a reaction keyword, if one is defined.

Throws:
HDException


add

public static void add(Observable obs)
                throws HDException
Add an Observable record to the DB. First tests whether it already exists. Also adds observable keyword if one is specified.

Throws:
HDException


add

public static void add(Reaction r,
                       Particle fp)
                throws HDException
Add a Final Particle Record: Particle in the final state of a reaction

Throws:
HDException


add

public static void add(Reference reference)
                throws HDException
Add a Reference record to the DB. Checks that this record does not already exist.

Parameters:
reference - to be added
Throws:
HDException


add

public static void add(Detector d)
                throws HDException
Add a Detector to the DB, if it doesn't already exist. Then add a Paper-Detector record to the DB.

Throws:
HDException


add

public static void add(Experiment ex)
                throws HDException
Add an Experiment record if it doesn't already exist. Then add Paper-Experiment record.

Throws:
HDException


add

public static void add(Axis axis)
                throws HDException
Add an Axis record to the DB. First check that the axis has not already been loaded. If it is a YAxis with header and description only, an existing record should be updated.

Parameters:
axis -
Throws:
HDException


add

public static void add(Qualifier q)
                throws HDException
Adds Qualifier record to the Database. Qualifier in this context is an axis or dataset level record such as Systematic Error or Scalefactor. Add one record for each match to a dataset or axis. - except where upper and lower limits are specified, in which case, 2 records added If there is no Match, a record with dataset_id = 0 should be added.

Parameters:
q - Qualifier to be added
Throws:
HDException


addSysYVals

public static void addSysYVals()
Final step in the migration of systematic errors from legacy db which apply to a subset of the points of a specific dataset. This subset is defined by giving an xval or a range of xvals. Dataset points must be found corresponding to these xvals. The yvals for these points can then have the systematic error added. This routine - obtains a collection of xvals (with ranges specified rather than exact values and points) - for each xval, finds corresponding point ids and yaxis ids - for each y axis point found, inserts a new sys error


addProperties

public static void addProperties()
Decodes header and descriptions on Axis and Dataset records into Reactions,Observables and Propertys. (maybe we need a Property superclass?) Note: ignores xaxis headers Note: at present errors on property values will be populated in the object model - property.value.ErrorValue but not inserted into the DB Note: attempt to pull out all records into a cache of property objects failed because it was too big.


runTests

public static void runTests()
Performs a count of database tables and prints out the result


doQuery

protected static int doQuery(java.lang.String query)
performs a query of the nature SELECT count(*) count FROM some_table


Generated 20060512 1623

HEPData