<!--      libgnomedb-dict.dtd
          DTD for libgnomedb
          Version 1.32
          Copyright (C) 2000 - 2005 Vivien Malerba
          Copyright (C) 2001 - 2002 Fernando Martins

	  Note: encoding of XML ID strings is done using a derivative of BASE64.
-->
<!ELEMENT GNOME_DB_DICT (GNOME_DB_SERVER, GNOME_DB_DATABASE?, GNOME_DB_QUERIES*, GNOME_DB_GRAPHS?, GNOME_DB_LAYOUTS?)>

<!--      Information specific to a connection: GNOME_DB_SERVER
          ID construction for:
             * data types: "DT" + encoded type name (ex: name="DTYm9vbA")
             * function:   "PR" + encoded oid       (ex: oid="PRMTcwNQ")
             * aggregate:  "AG" + encoded oid       (ex: oid="AGMjEwMQ")
-->

<!ELEMENT GNOME_DB_SERVER (GNOME_DB_GDA_DATASOURCE, GNOME_DB_USERNAME, GNOME_DB_DATATYPES?, GNOME_DB_PROCEDURES?, GNOME_DB_AGGREGATES?)>
<!ATTLIST GNOME_DB_SERVER 
	  with_functions (t|f) #IMPLIED>

<!ELEMENT GNOME_DB_GDA_DATASOURCE (#PCDATA)>
<!ELEMENT GNOME_DB_USERNAME (#PCDATA)>


<!ELEMENT GNOME_DB_DATATYPES (GNOME_DB_DATATYPE*)>
<!ELEMENT GNOME_DB_DATATYPE EMPTY>
<!ATTLIST GNOME_DB_DATATYPE
	  id ID #REQUIRED
          name CDATA #REQUIRED
          owner CDATA #IMPLIED
          descr CDATA #IMPLIED
          nparam NMTOKEN #REQUIRED
          gdatype NMTOKEN #REQUIRED
	  synonyms CDATA #IMPLIED
	  custom (t|f) #IMPLIED>

<!ELEMENT GNOME_DB_PROCEDURES (GNOME_DB_FUNCTION*)>
<!ELEMENT GNOME_DB_FUNCTION (GNOME_DB_FUNC_PARAM*)>
<!ATTLIST GNOME_DB_FUNCTION
	  id ID #REQUIRED
          name CDATA #REQUIRED 
          owner CDATA #IMPLIED
          descr CDATA #IMPLIED>

<!ELEMENT GNOME_DB_FUNC_PARAM EMPTY>
<!ATTLIST GNOME_DB_FUNC_PARAM
          type IDREF #IMPLIED
          way (out|in) #REQUIRED>

<!ELEMENT GNOME_DB_AGGREGATES (GNOME_DB_AGGREGATE*)>
<!ELEMENT GNOME_DB_AGGREGATE (GNOME_DB_FUNC_PARAM*)>
<!ATTLIST GNOME_DB_AGGREGATE
          id ID #REQUIRED
          name CDATA #REQUIRED
          owner CDATA #IMPLIED
          descr CDATA #IMPLIED>




<!--      Information specific to a database: GNOME_DB_DATABASE
          ID construction for:
             * tables:   "TV" + encoded table/view name (ex: name="TVY3VzdG9tZXJz")
             * fields:   table id + ":FI" + encoded field name (ex: name="TVY3VzdG9tZXJz:FIaWQ")
             * sequences:"SE" + encoded sequence name (ex: name="SEdG9tZX")
-->

<!ELEMENT GNOME_DB_DATABASE (GNOME_DB_TABLES?, GNOME_DB_SEQUENCES?, GNOME_DB_CONSTRAINTS?)>

<!ELEMENT GNOME_DB_TABLES (GNOME_DB_TABLE*)>

<!ELEMENT GNOME_DB_TABLE (GNOME_DB_PARENT_TABLE*, GNOME_DB_FIELD*)>
<!ATTLIST GNOME_DB_TABLE
          id ID #REQUIRED
	  name CDATA #REQUIRED
          owner NMTOKEN #IMPLIED
          descr CDATA #IMPLIED
          is_view (t|f) #IMPLIED>

<!ELEMENT GNOME_DB_PARENT_TABLE EMPTY>
<!ATTLIST GNOME_DB_PARENT_TABLE
          table IDREF #REQUIRED
          order NMTOKEN #REQUIRED>

<!ELEMENT GNOME_DB_FIELD EMPTY>
<!ATTLIST GNOME_DB_FIELD
          id ID #REQUIRED
	  name CDATA #REQUIRED
	  owner NMTOKEN #IMPLIED
	  descr CDATA #IMPLIED
          type IDREF #REQUIRED
          length NMTOKEN #REQUIRED
	  scale NMTOKEN #REQUIRED
          default CDATA #IMPLIED
	  default_gda_type NMTOKEN #IMPLIED
	  extra_attr NMTOKENS #IMPLIED
          plugin NMTOKENS #IMPLIED>

<!ELEMENT GNOME_DB_CONSTRAINTS (GNOME_DB_CONSTRAINT*)>

<!ELEMENT GNOME_DB_CONSTRAINT (GNOME_DB_CONSTRAINT_FIELD* | GNOME_DB_CONSTRAINT_PAIR*)>
<!ATTLIST GNOME_DB_CONSTRAINT
	  name CDATA #IMPLIED
	  table IDREF #REQUIRED
	  user_defined (t|f) #IMPLIED
	  type NMTOKEN #REQUIRED
	  on_update NMTOKEN #IMPLIED
	  on_delete NMTOKEN #IMPLIED>

<!ELEMENT GNOME_DB_CONSTRAINT_FIELD EMPTY>
<!ATTLIST GNOME_DB_CONSTRAINT_FIELD
	  field IDREF #REQUIRED>

<!ELEMENT GNOME_DB_CONSTRAINT_PAIR EMPTY>
<!ATTLIST GNOME_DB_CONSTRAINT_PAIR
          field IDREF #REQUIRED
	  ref IDREF #REQUIRED>

<!ELEMENT GNOME_DB_SEQUENCES (GNOME_DB_SEQUENCE*)>
<!ELEMENT GNOME_DB_SEQUENCE (seq_link*)>
<!ATTLIST GNOME_DB_SEQUENCE
          name ID #REQUIRED
          comments CDATA #IMPLIED
          owner NMTOKEN #REQUIRED>

<!ELEMENT seq_link EMPTY>
<!ATTLIST seq_link
          field IDREF #REQUIRED>




<!--      Information specific to a queries
          ID construction for:
             * queries:  "QU" + query ident (ex: name="QU15")
	     * target: query id + ":T" + id of the target
             * field: Query id + ":QF" + element order in the list
                                            (ex: id = "QU15:QF2")
	     * condition: Query id + "C" + id of the condition
-->

<!ELEMENT GNOME_DB_QUERIES (GNOME_DB_QUERY*)>

<!ELEMENT GNOME_DB_QUERY (GNOME_DB_PARAM_SOURCES?, ((GNOME_DB_TARGET*, GNOME_DB_QF*, GNOME_DB_JOIN*, GNOME_DB_COND?, GNOME_DB_FIELDS_ORDER?, GNOME_DB_QUERY*) | GNOME_DB_QUERY_TEXT?))>
<!ATTLIST GNOME_DB_QUERY
          id ID #REQUIRED
          name CDATA #IMPLIED
          descr CDATA #IMPLIED
	  query_type (SEL|INS|UPD|DEL|NION|ECT|XPT|TXT) #REQUIRED
	  distinct (t|f) #IMPLIED>

<!ELEMENT GNOME_DB_TARGET EMPTY>
<!ATTLIST GNOME_DB_TARGET
          id ID #REQUIRED
	  entity_ref IDREF #REQUIRED
	  occ CDATA #IMPLIED
	  alias NMTOKENS #IMPLIED>

<!-- value_prov can be a query in case of GnomeDbQfValue fields -->
<!ELEMENT GNOME_DB_QF (GNOME_DB_QF_REF*)>
<!ATTLIST GNOME_DB_QF
          id ID #REQUIRED
          type (FIELD|ALL|AGG|FUNC|VAL) #REQUIRED
          name CDATA #IMPLIED
	  descr CDATA #IMPLIED
          target IDREF #IMPLIED
          object NMTOKEN #IMPLIED
          is_visible (t|f) #IMPLIED
          is_internal (t|f) #IMPLIED
          value_prov IDREF #IMPLIED
          alias CDATA #IMPLIED
	  value CDATA #IMPLIED
          srv_type IDREF #IMPLIED
          default CDATA #IMPLIED
	  default_gda_type NMTOKEN #IMPLIED
	  is_param (t|f) #IMPLIED
	  null_ok (t|f) #IMPLIED
	  plugin NMTOKENS #IMPLIED>

<!ELEMENT GNOME_DB_QF_REF EMPTY>
<!ATTLIST GNOME_DB_QF_REF
 	  object IDREF #REQUIRED
          order (ASC|DES) #IMPLIED>

<!ELEMENT GNOME_DB_FIELDS_ORDER (GNOME_DB_QF_REF*)>

<!ELEMENT GNOME_DB_COND (GNOME_DB_COND*)>
<!ATTLIST GNOME_DB_COND
          id ID #REQUIRED
          type (AND|OR|NOT|EQ|NE|SUP|ESUP|INF|EINF|LIKE|SIMI|REG|CREG|NREG|CNREG|IN|BTW) #REQUIRED
	  l_op IDREF #IMPLIED
	  r_op IDREF #IMPLIED
	  r_op2 IDREF #IMPLIED>

<!ELEMENT GNOME_DB_JOIN (GNOME_DB_COND?)>
<!ATTLIST GNOME_DB_JOIN
          target1 IDREF #REQUIRED
          target2 IDREF #REQUIRED
	  join_type (INNER|LEFT|RIGHT|FULL|CROSS) #IMPLIED>

<!ELEMENT GNOME_DB_QUERY_TEXT (#PCDATA)>

<!ELEMENT GNOME_DB_PARAM_SOURCES (GNOME_DB_QUERY*)>


<!--      Information specific to the GUI part of the program 
	  ID construction for:
		* GnomeDbGraph: "GR" + graph ident (example: "GR10")
-->
<!ELEMENT GNOME_DB_GRAPHS (GNOME_DB_GRAPH*)>

<!ELEMENT GNOME_DB_GRAPH (GNOME_DB_GRAPH_ITEM*)>
<!ATTLIST GNOME_DB_GRAPH
	  id ID #REQUIRED
	  name CDATA #IMPLIED
          descr CDATA #IMPLIED
	  type (R|Q|M) #IMPLIED
          object IDREF #IMPLIED>

<!ELEMENT GNOME_DB_GRAPH_ITEM EMPTY>
<!ATTLIST GNOME_DB_GRAPH_ITEM
          object IDREF #IMPLIED
	  xpos CDATA #IMPLIED
	  ypos CDATA #IMPLIED>

<!--      Defining complex layouts (GNOME_DB_CUSTOM_LAYOUT) composed of GnomeDbiDataWidget objects (as defined by GNOME_DB_CUSTOM_FORM, GNOME_DB_CUSTOM_GRID and GNOME_DB_CUSTOM_MATRIX)
          and other GNOME_DB_CUSTOM_LAYOUT.

	  Every time, the GNOME_DB_GLADE tag defines which glade file to load, and in which box (GtkBox) display the corresponding widgets (GnomeDbiDataWidget or
	  individual GnomeDbDataEntry for GNOME_DB_CUSTOM_FORM if the GNOME_DB_GLADE tag exists).

	  ID is "CL" + the layout serial id

	  Layout names must be unique throughout a GnomeDbDict dictionary.
-->
<!ELEMENT GNOME_DB_LAYOUTS ((GNOME_DB_CUSTOM_LAYOUT | GNOME_DB_CUSTOM_FORM | GNOME_DB_CUSTOM_GRID | GNOME_DB_CUSTOM_MATRIX)*)>

<!ELEMENT GNOME_DB_CUSTOM_LAYOUT ((GNOME_DB_CUSTOM_FORM | GNOME_DB_CUSTOM_GRID | GNOME_DB_CUSTOM_MATRIX | GNOME_DB_CUSTOM_LAYOUT)*, GNOME_DB_GLADE, GNOME_DB_LAYOUT_CONNECT*)>
<!ATTLIST GNOME_DB_CUSTOM_LAYOUT
	  id ID #REQUIRED
	  name CDATA #IMPLIED
          descr CDATA #IMPLIED>

<!ELEMENT GNOME_DB_LAYOUT_CONNECT EMPTY>
<!ATTLIST GNOME_DB_LAYOUT_CONNECT
	  src_layout IDREF #REQUIRED
	  src_field CDATA #REQUIRED
	  dest_layout IDREF #REQUIRED
          dest_field CDATA #REQUIRED>

<!ELEMENT GNOME_DB_CUSTOM_GRID (GNOME_DB_QUERY | GNOME_DB_QUERY_REF)>
<!ATTLIST GNOME_DB_CUSTOM_GRID
	  id ID #REQUIRED
	  modif_target IDREF #IMPLIED
	  mode CDATA #IMPLIED
	  name CDATA #IMPLIED
          descr CDATA #IMPLIED>

<!ELEMENT GNOME_DB_CUSTOM_MATRIX ((GNOME_DB_QUERY | GNOME_DB_QUERY_REF), (GNOME_DB_QUERY | GNOME_DB_QUERY_REF))>
<!ATTLIST GNOME_DB_CUSTOM_MATRIX
	  id ID #REQUIRED
	  rows_target IDREF #REQUIRED
	  cols_target IDREF #REQUIRED
	  modif_table IDREF #IMPLIED
	  mode CDATA #IMPLIED
          view_type (TS|LD|LS) #IMPLIED
	  name CDATA #IMPLIED
          descr CDATA #IMPLIED>

<!ELEMENT GNOME_DB_CUSTOM_FORM ((GNOME_DB_QUERY | GNOME_DB_QUERY_REF), GNOME_DB_GLADE?)>
<!ATTLIST GNOME_DB_CUSTOM_FORM
	  id ID #REQUIRED
	  modif_target IDREF #IMPLIED
	  mode CDATA #IMPLIED
          name CDATA #IMPLIED
          descr CDATA #IMPLIED>

<!ELEMENT GNOME_DB_QUERY_REF EMPTY>
<!ATTLIST GNOME_DB_QUERY_REF
	  id_query IDREF #REQUIRED> <!-- references another query in the dictionary -->

<!ELEMENT GNOME_DB_GLADE (GNOME_DB_GLADE_BOX*)>
<!ATTLIST GNOME_DB_GLADE
	  filename CDATA #REQUIRED
	  root_widget CDATA #REQUIRED> <!-- root widget to take into account -->

<!--  box_name Id of the widget in the glade file -->
<!ELEMENT GNOME_DB_GLADE_BOX (GNOME_DB_GLADE_DEST*)>
<!ATTLIST GNOME_DB_GLADE_BOX
	  box_name CDATA #REQUIRED
	  show_actions (t|f) #IMPLIED> 

<!ELEMENT GNOME_DB_GLADE_DEST EMPTY>
<!ATTLIST GNOME_DB_GLADE_DEST
	  object IDREF #REQUIRED> <!-- references either another GNOME_DB_CUSTOM_FORM, GNOME_DB_CUSTOM_GRID, GNOME_DB_CUSTOM_MATRIX, GNOME_DB_CUSTOM_LAYOUT or a GNOME_DB_QF -->
