Alert.png The wiki is deprecated and due to be decommissioned by the end of September 2022.
The content is being migrated to other supports, new updates will be ignored and lost.
If needed you can get in touch with EGI SDIS team using operations @ egi.eu.

GOCDB/Release4/XML Input

From EGIWiki
Jump to navigation Jump to 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 SINGLE parent-child relationship that has been defined in ‘gocdb_schema.xml’ using the <abstract_class> and <linktype> elements.
  • If an Object has many parents, each parent-child relationship needs to be defined directly beneath the root element as a new parent-child branch (in a single nesting structure, a child object can only be enclosed by a single parent).
  • 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