GOCDB/Release4/XML Input

From EGIWiki
< GOCDB‎ | Release4
Revision as of 15:24, 31 January 2012 by Davidm (talk | contribs) (Created page with '===Overivew=== The XML input module is used to insert gocdb object data into the database. The structure of an XML input file reflects the properties of those objects and of thei…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Overivew

The XML input module is used to insert gocdb object data into the database. The structure of an XML input file reflects the properties of those objects and of their relationships to other objects within the database (a hierarchical input file structure inserts data according to established parent-child object relationships). Data for many objects can be defined within a single input file.

XML Input File Formatting Rules

The formatting rules of an input XML document are as follows:

  • Element names and attribute values ARE case-sensitive.
  • The root element name is NOT significant (e.g. <results> is used for the Sample and Seed data).
  • The root element can contain one or more child Object elements.
  • An Object element MUST be named after an object that is already declared using the <object_type_name> value in the ‘$GOCDB_HOME/config/gocdb_schema.xml’ file. (In turn, the <abstract_class> that encloses the <object_type_name> is used to map the object directly to a database table – see ‘gocdb_schema.xml’ for more information).
  • Object elements MUST have a ‘gridID’ attribute of type integer. This value SHOULD always be ‘0’ to signify that the inserted object(s) belong to that grid. When inserting nested parent-child objects, the gridID value MUST be identical.
  • An Object element MUST contain one or more child elements that MUST be of the following type (ordering is NOT significant and multiples of both types ARE allowed):
    • A database Row element(s). This is a leaf element that MUST NOT nest child elements. The Row element’s name maps directly to an object’s attribute name (as established in ‘gocdb_schema.xml’ using <abstract_class><field><fname>). Row element value provides the value of the attribute. Row elements do NOT specify the ‘gridID’ attribute.
    • A nested child Object element(s).
  • A nested child Object element MUST reflect a parent-child relationship that is already defined in ‘gocdb_schema.xml’ using the <abstract_class> and <linktype> elements.
  • A Row element MAY define the key="primary" attribute to signify that this attribute value must NOT BE NULL and IS UNIQUE within the database (it effectively provides a primary key value). Important: If an object already exists in the database that defines the same attribute value, then ALL the attributes of that object will be updated with the new values of the input_xml Object’s attributes (rather than a new object being inserted).
  • An Object element MUST NOT define the key=”primary” attribute.

Worked Example

TODO