diff --git a/ands_rifcs.php b/ands_rifcs.php
index 41625bd..1f8ba64 100644
--- a/ands_rifcs.php
+++ b/ands_rifcs.php
@@ -17,244 +17,242 @@ require_once('xml_creater.php');
* The protected member functions are the backbone functions which can be used for creating any ANDS RIF-CS records.
*
*/
-
class ANDS_RIFCS {
- /**
- * \var $oai_pmh
- * Type: ANDS_Response_XML. Assigned by constructor. \see __construct
- */
- protected $oai_pmh;
- /** \var $working_node
- * Type: DOMElement. Assigned by constructor. \see __construct
- */
- protected $working_node;
+ /**
+ * \var $oai_pmh
+ * Type: ANDS_Response_XML. Assigned by constructor. \see __construct
+ */
+ protected $oai_pmh;
+ /** \var $working_node
+ * Type: DOMElement. Assigned by constructor. \see __construct
+ */
+ protected $working_node;
- /**
- * Constructor
- *
- * \param $ands_response_doc ANDS_Response_XML. A XML Doc acts as the parent node.
- * \param $metadata_node DOMElement. The meta node which all subsequent nodes will be added to.
- */
- function __construct($ands_response_doc, $metadata_node) {
- $this->oai_pmh = $ands_response_doc;
- $this->working_node = $metadata_node;
- $this->create_regObjects();
- }
+ /**
+ * Constructor
+ *
+ * \param $ands_response_doc ANDS_Response_XML. A XML Doc acts as the parent node.
+ * \param $metadata_node DOMElement. The meta node which all subsequent nodes will be added to.
+ */
+ function __construct($ands_response_doc, $metadata_node) {
+ $this->oai_pmh = $ands_response_doc;
+ $this->working_node = $metadata_node;
+ $this->create_regObjects();
+ }
- /**
- * A worker function for easily adding a newly created node to current XML Doc.
- * @param $mom_node Type: DOMElement. Node the new child will be attached to.
- * @param $name Type: sting. The name of the child node is being added.
- * @param $value Type: sting. The text content of the child node is being added. The default is ''.
- * @return DOMElement. The added child node
- */
- protected function addChild($mom_node,$name, $value='') {
- return $this->oai_pmh->addChild($mom_node,$name, $value);
- }
+ /**
+ * A worker function for easily adding a newly created node to current XML Doc.
+ * @param $mom_node Type: DOMElement. Node the new child will be attached to.
+ * @param $name Type: sting. The name of the child node is being added.
+ * @param $value Type: sting. The text content of the child node is being added. The default is ''.
+ * @return DOMElement. The added child node
+ */
+ protected function addChild($mom_node,$name, $value='') {
+ return $this->oai_pmh->addChild($mom_node,$name, $value);
+ }
- /** Create a registryObjects node to hold individual registryObject's.
- * This is only a holder node.
- */
- protected function create_regObjects() {
- $this->working_node = $this->oai_pmh->addChild($this->working_node,'registryObjects');
- $this->working_node->setAttribute('xmlns',"http://ands.org.au/standards/rif-cs/registryObjects");
- $this->working_node->setAttribute('xmlns:xsi',"http://www.w3.org/2001/XMLSchema-instance");
- $this->working_node->setAttribute('xsi:schemaLocation','http://ands.org.au/standards/rif-cs/registryObjects http://services.ands.org.au/documentation/rifcs/1.2.0/schema/registryObjects.xsd');
- }
-
- /** Create a single registryObject node. Each set has its own structure but they all have an attribute of group, a key node and an originatingSource node. The newly created node will be used as the working node.
- *
- * \param $group string, group attribute of the new registryObject node .
- * \param $key string, key node, used as an identifier.
- * \param $originatingSource string, an url of the data provider.
- */
- protected function create_regObject($group, $key, $originatingSource) {
- $regObj_node = $this->addChild($this->working_node,'registryObject');
- $regObj_node->setAttribute('group',$group);
- $this->addChild($regObj_node,'key',$key);
- $this->addChild($regObj_node,'originatingSource',$originatingSource);
- $this->working_node = $regObj_node;
- }
-
- /** RIF-CS node is the content node of RIF-CS metadata node which starts from regObjects.
- * Each set supportted in RIF-CS has its own content model. The created node will be used as the
- * root node of this record for following nodes will be created.
- *
- * \param $set_name string, the name of set. For ANDS, they are Activity, Party and Collection
- * \param $set_type string, the type of set. For example, Activity can have project as a type.
- */
- protected function create_rifcs_node($set_name, $set_type) {
- $this->working_node = $this->addChild($this->working_node, $set_name);
- $this->working_node->setAttribute('type', $set_type);
- }
+ /** Create a registryObjects node to hold individual registryObject's.
+ * This is only a holder node.
+ */
+ protected function create_regObjects() {
+ $this->working_node = $this->oai_pmh->addChild($this->working_node,'registryObjects');
+ $this->working_node->setAttribute('xmlns',"http://ands.org.au/standards/rif-cs/registryObjects");
+ $this->working_node->setAttribute('xmlns:xsi',"http://www.w3.org/2001/XMLSchema-instance");
+ $this->working_node->setAttribute('xsi:schemaLocation','http://ands.org.au/standards/rif-cs/registryObjects http://services.ands.org.au/documentation/rifcs/1.2.0/schema/registryObjects.xsd');
+ }
- /**
- * Create a top level name node.
- * @param $name_type string. Text for the types, can be either primary or abbreviated. Default: primary
- *
- * @return DOMElement $added_name_node.
- * The newly created node, it will be used for further expansion by adding namePart.
- */
- protected function create_name_node($name_type = 'primary') {
- $c = $this->addChild($this->working_node, 'name');
- $c->setAttribute('type', $name_type);
- return $c;
- }
-
- /**
- * Create a namePart of a name node.
- * @param $name_node
- * Type: DOMElement. Node of name_node created previously
- *
- * @param $value
- * Type: string. Text fror this namePart
- *
- * @param $part_type Type: string, used for group:person record. Types can be: titile, given, family
- *
- */
- protected function create_namePart($name_node, $value, $part_type = '') {
- $c = $this->addChild($name_node, 'namePart', $value);
- if (!empty($part_type)) {
- $c->setAttribute('type', $part_type);
- }
- }
-
- /** Create related object. One RIF-CS can have more than one related object nodes,
- * each object is described by one node.
- * \param $key
- * Type: string. The identifier of the related object.
- * \param $relation_type
- * Type: string. Type of relationship.
- *
- */
- protected function create_relatedObject($key,$relation_type) {
- $c = $this->addChild($this->working_node, 'relatedObject');
- $this->addChild($c,'key',$key);
- $c = $this->addChild($c, 'relation');
- // Mimick ANDS with enpty value to get both tags for relation. Only for better display
- // $c = $this->addChild($c, 'relation',' ');
- $c->setAttribute('type', $relation_type);
- }
-
- /** Create description node. One RIF-CS can have more than one description nodes.
- * Each description node has only one description.
- * \param $value Type: string. The content of the description.
- * \param $des_type Type: string. Type of the description. Types can be brief, full, acessRights and note. Default is 'brief'.
- */
- protected function create_description_node($value, $des_type='brief') {
- $c = $this->addChild($this->working_node, 'description', $value);
- $c->setAttribute('type', $des_type);
- }
+ /** Create a single registryObject node. Each set has its own structure but they all have an attribute of group, a key node and an originatingSource node. The newly created node will be used as the working node.
+ *
+ * \param $group string, group attribute of the new registryObject node .
+ * \param $key string, key node, used as an identifier.
+ * \param $originatingSource string, an url of the data provider.
+ */
+ protected function create_regObject($group, $key, $originatingSource) {
+ $regObj_node = $this->addChild($this->working_node,'registryObject');
+ $regObj_node->setAttribute('group',$group);
+ $this->addChild($regObj_node,'key',$key);
+ $this->addChild($regObj_node,'originatingSource',$originatingSource);
+ $this->working_node = $regObj_node;
+ }
- /** Create local or other type of identifier inside of RIF-CS metadata node
- * \param $key
- * Type string. The indentifier itself.
- * \param $i_type
- * Type string. Type of identifier. Can be abn, uri, local, etc.. Default is local.
- */
- protected function create_identifier_node($key, $i_type='local') {
- $c = $this->addChild($this->working_node, 'identifier',$key);
- $c->setAttribute('type', $i_type);
- }
-
- /** Location node is a holder node for either address or spatial nodes
- * \return DOMElement node, for adding address or spatial nodes.
- */
- protected function create_location_node() {
- return $this->addChild($this->working_node, 'location');
- }
-
- /** Address node is a holder node for phiscal or electrical nodes.
- * \param $location_node Type: DOMElement. Location node created previously.
- * \return DOMElement
- */
- protected function create_address_node($location_node) {
- return $this->addChild($location_node, 'address');
- }
-
- /** Electrical address node. Used for email, url, etc
- * \param $addr_node Type: DOMElement. Previously created address node.
- * \param $e_node Type: string. The content of the adding node.
- * \param $e_type Type: string. Default is email.
- */
- protected function create_e_node($addr_node, $e_node, $e_type = 'email') {
- $c = $this->addChild($addr_node, 'electronic');
- $c->setAttribute('type', $e_type);
- $this->addChild($c,'value',$e_node);
- }
+ /** RIF-CS node is the content node of RIF-CS metadata node which starts from regObjects.
+ * Each set supportted in RIF-CS has its own content model. The created node will be used as the
+ * root node of this record for following nodes will be created.
+ *
+ * \param $set_name string, the name of set. For ANDS, they are Activity, Party and Collection
+ * \param $set_type string, the type of set. For example, Activity can have project as a type.
+ */
+ protected function create_rifcs_node($set_name, $set_type) {
+ $this->working_node = $this->addChild($this->working_node, $set_name);
+ $this->working_node->setAttribute('type', $set_type);
+ }
- /** Physical node is a holder node for phone or fax nodes.
- * \param $addr_node Type: DOMelement. Address node created before to which the new phiscial->addressPart will be attached.
- * \param $number Type: string. Telephone or fax number as a string.
- * \param $fone_fax Type: string. Either telehoneNumber or faxNumber.
- */
- protected function create_physcial_fone_fax($addr_node, $number,$fone_fax='telephoneNumber') {
- $c = $this->addChild($addr_node, 'physical');
- $c = $this->addChild($c, 'addressPart', $number);
- $c->setAttribute('type', $fone_fax);
- }
+ /**
+ * Create a top level name node.
+ * @param $name_type string. Text for the types, can be either primary or abbreviated. Default: primary
+ *
+ * @return DOMElement $added_name_node.
+ * The newly created node, it will be used for further expansion by adding namePart.
+ */
+ protected function create_name_node($name_type = 'primary') {
+ $c = $this->addChild($this->working_node, 'name');
+ $c->setAttribute('type', $name_type);
+ return $c;
+ }
- /** create address node under location node, either streetAddress or postalAddress.
- * But they are in text (one block) format.
- * \param $addr_node Type: DOMelement. Address node created before to which the new phiscial->addressPart will be attached.
- * \param $txt_addr string, full street address in text block format
- * \param $phys_type string, default is 'streetAddress', can be 'postalAddress'
- */
- protected function create_physcial_addr_txt($addr_node, $txt_addr,$phys_type='streetAddress') {
- $c = $this->addChild($addr_node, 'physical');
- $c->setAttribute('type', $phys_type);
- $c = $this->addChild($c, 'addressPart', $txt_addr);
- $c->setAttribute('type', 'text');
- }
+ /**
+ * Create a namePart of a name node.
+ * @param $name_node
+ * Type: DOMElement. Node of name_node created previously
+ *
+ * @param $value
+ * Type: string. Text fror this namePart
+ *
+ * @param $part_type Type: string, used for group:person record. Types can be: titile, given, family
+ *
+ */
+ protected function create_namePart($name_node, $value, $part_type = '') {
+ $c = $this->addChild($name_node, 'namePart', $value);
+ if (!empty($part_type)) {
+ $c->setAttribute('type', $part_type);
+ }
+ }
- /** Create spatial node under a location node.
- * \param $location_node Type: DOMElement. Location node where spatial node is being added to.
- * \param $value Type: string. The value of spatial information. Default is local latitude and longitude.
- * \param $sp_type Type: string. Type of spaitial informaion. Default is kmlPolyCoords.
- */
- protected function create_spatial_node($location_node, $value = '138.6396,-34.97063', $sp_type = 'kmlPolyCoords') {
- $c = $this->addChild($location_node, 'spatial',$value);
- $c->setAttribute('type',$sp_type);
- }
+ /** Create related object. One RIF-CS can have more than one related object nodes,
+ * each object is described by one node.
+ * \param $key
+ * Type: string. The identifier of the related object.
+ * \param $relation_type
+ * Type: string. Type of relationship.
+ *
+ */
+ protected function create_relatedObject($key,$relation_type) {
+ $c = $this->addChild($this->working_node, 'relatedObject');
+ $this->addChild($c,'key',$key);
+ $c = $this->addChild($c, 'relation');
+ // Mimick ANDS with enpty value to get both tags for relation. Only for better display
+ // $c = $this->addChild($c, 'relation',' ');
+ $c->setAttribute('type', $relation_type);
+ }
- /** Create temporal coverage node for collection or activity records.
- * \param $values Type: 2-D array. The values of temporal coverage. It can has maximal two elements: one from 'dateFrom' and another for 'dateTo'.
- * Either can be ommited according to RIF-CS schema. Each element of $values is an array and has keys: date, type and format.
- * ['date'] is a string represents date. It has to be in W3CDTF or UTC format.
- * ['type'] has to be either 'dateFrom' or 'dateTo'.
- * ['format'] is optional and its default is 'W3CDTF'. UTC format requires date has to be in UTC: dateTtimeZ.
- * It throws an exception if the input parameter is not an array.
- */
- protected function create_coverage_tempo($values) {
- // Non array is not acceptable.
- if (!is_array($values)) { throw new Exception('The input of temporal coverage has to be an array of arraies with keys.');}
- $c = $this->addChild($this->working_node,'coverage');
- $t = $this->addChild($c,'temporal');
- foreach($values as $value) $this->create_coverage_tempo_date($t, $value);
- }
+ /** Create description node. One RIF-CS can have more than one description nodes.
+ * Each description node has only one description.
+ * \param $value Type: string. The content of the description.
+ * \param $des_type Type: string. Type of the description. Types can be brief, full, acessRights and note. Default is 'brief'.
+ */
+ protected function create_description_node($value, $des_type='brief') {
+ $c = $this->addChild($this->working_node, 'description', $value);
+ $c->setAttribute('type', $des_type);
+ }
- /** Create temporal coverage node for collection or activity records.
- * \param $t Type: DOMElement. The \\\ node to which \ nodes will be attached to.
- * \param $value Type: array. The value of temporal coverage. It has maxmimal three elements with keys: type, date and format.
- * It throws an exception if the input parameter is not an array.
- * \see create_coverage_tempo
- */
- private function create_coverage_tempo_date($t, $value) {
- if (!is_array($value)) { throw new Exception('The input of temporal coverage has to be an array with keys.');}
- $d = $this->addChild($t,'date',$value['date']);
- $d->setAttribute('type',$value['type']);
- if (isset($value['format'])) $d->setAttribute('dateFormat',$value['format']);
- else $d->setAttribute('dateFormat','W3CDTF');
- }
-
- /** Create a subject node for a researcher, project, project, etc
- * \param $value Type: string. A string representing the new namePart.
- * \param $subject_type Type: string. A string representing the type of subject. The default value is anzsrc-for.
- */
- protected function create_subject_node($value, $subject_type = 'anzsrc-for') {
- if (empty($value)) return;
- $c = $this->addChild($this->working_node,'subject',$value);
- $c->setAttribute('type',$subject_type);
- }
+ /** Create local or other type of identifier inside of RIF-CS metadata node
+ * \param $key
+ * Type string. The indentifier itself.
+ * \param $i_type
+ * Type string. Type of identifier. Can be abn, uri, local, etc.. Default is local.
+ */
+ protected function create_identifier_node($key, $i_type='local') {
+ $c = $this->addChild($this->working_node, 'identifier',$key);
+ $c->setAttribute('type', $i_type);
+ }
+
+ /** Location node is a holder node for either address or spatial nodes
+ * \return DOMElement node, for adding address or spatial nodes.
+ */
+ protected function create_location_node() {
+ return $this->addChild($this->working_node, 'location');
+ }
+
+ /** Address node is a holder node for phiscal or electrical nodes.
+ * \param $location_node Type: DOMElement. Location node created previously.
+ * \return DOMElement
+ */
+ protected function create_address_node($location_node) {
+ return $this->addChild($location_node, 'address');
+ }
+
+ /** Electrical address node. Used for email, url, etc
+ * \param $addr_node Type: DOMElement. Previously created address node.
+ * \param $e_node Type: string. The content of the adding node.
+ * \param $e_type Type: string. Default is email.
+ */
+ protected function create_e_node($addr_node, $e_node, $e_type = 'email') {
+ $c = $this->addChild($addr_node, 'electronic');
+ $c->setAttribute('type', $e_type);
+ $this->addChild($c,'value',$e_node);
+ }
+
+ /** Physical node is a holder node for phone or fax nodes.
+ * \param $addr_node Type: DOMelement. Address node created before to which the new phiscial->addressPart will be attached.
+ * \param $number Type: string. Telephone or fax number as a string.
+ * \param $fone_fax Type: string. Either telehoneNumber or faxNumber.
+ */
+ protected function create_physcial_fone_fax($addr_node, $number,$fone_fax='telephoneNumber') {
+ $c = $this->addChild($addr_node, 'physical');
+ $c = $this->addChild($c, 'addressPart', $number);
+ $c->setAttribute('type', $fone_fax);
+ }
+
+ /** create address node under location node, either streetAddress or postalAddress.
+ * But they are in text (one block) format.
+ * \param $addr_node Type: DOMelement. Address node created before to which the new phiscial->addressPart will be attached.
+ * \param $txt_addr string, full street address in text block format
+ * \param $phys_type string, default is 'streetAddress', can be 'postalAddress'
+ */
+ protected function create_physcial_addr_txt($addr_node, $txt_addr,$phys_type='streetAddress') {
+ $c = $this->addChild($addr_node, 'physical');
+ $c->setAttribute('type', $phys_type);
+ $c = $this->addChild($c, 'addressPart', $txt_addr);
+ $c->setAttribute('type', 'text');
+ }
+
+ /** Create spatial node under a location node.
+ * \param $location_node Type: DOMElement. Location node where spatial node is being added to.
+ * \param $value Type: string. The value of spatial information. Default is local latitude and longitude.
+ * \param $sp_type Type: string. Type of spaitial informaion. Default is kmlPolyCoords.
+ */
+ protected function create_spatial_node($location_node, $value = '138.6396,-34.97063', $sp_type = 'kmlPolyCoords') {
+ $c = $this->addChild($location_node, 'spatial',$value);
+ $c->setAttribute('type',$sp_type);
+ }
+
+ /** Create temporal coverage node for collection or activity records.
+ * \param $values Type: 2-D array. The values of temporal coverage. It can has maximal two elements: one from 'dateFrom' and another for 'dateTo'.
+ * Either can be ommited according to RIF-CS schema. Each element of $values is an array and has keys: date, type and format.
+ * ['date'] is a string represents date. It has to be in W3CDTF or UTC format.
+ * ['type'] has to be either 'dateFrom' or 'dateTo'.
+ * ['format'] is optional and its default is 'W3CDTF'. UTC format requires date has to be in UTC: dateTtimeZ.
+ * It throws an exception if the input parameter is not an array.
+ */
+ protected function create_coverage_tempo($values) {
+ // Non array is not acceptable.
+ if (!is_array($values)) { throw new Exception('The input of temporal coverage has to be an array of arraies with keys.');}
+ $c = $this->addChild($this->working_node,'coverage');
+ $t = $this->addChild($c,'temporal');
+ foreach($values as $value) $this->create_coverage_tempo_date($t, $value);
+ }
+
+ /** Create temporal coverage node for collection or activity records.
+ * \param $t Type: DOMElement. The \\\ node to which \ nodes will be attached to.
+ * \param $value Type: array. The value of temporal coverage. It has maxmimal three elements with keys: type, date and format.
+ * It throws an exception if the input parameter is not an array.
+ * \see create_coverage_tempo
+ */
+ private function create_coverage_tempo_date($t, $value) {
+ if (!is_array($value)) { throw new Exception('The input of temporal coverage has to be an array with keys.');}
+ $d = $this->addChild($t,'date',$value['date']);
+ $d->setAttribute('type',$value['type']);
+ if (isset($value['format'])) $d->setAttribute('dateFormat',$value['format']);
+ else $d->setAttribute('dateFormat','W3CDTF');
+ }
+
+ /** Create a subject node for a researcher, project, project, etc
+ * \param $value Type: string. A string representing the new namePart.
+ * \param $subject_type Type: string. A string representing the type of subject. The default value is anzsrc-for.
+ */
+ protected function create_subject_node($value, $subject_type = 'anzsrc-for') {
+ if (empty($value)) return;
+ $c = $this->addChild($this->working_node,'subject',$value);
+ $c->setAttribute('type',$subject_type);
+ }
} // end of class ANDS_RIFCS
-
diff --git a/ands_tpa.php b/ands_tpa.php
index e86c031..16a4dff 100644
--- a/ands_tpa.php
+++ b/ands_tpa.php
@@ -31,319 +31,318 @@ require_once('ands_rifcs.php');
*/
class ANDS_TPA extends ANDS_RIFCS {
- //! Type: PDO. The database connection of the data source.
- //! \see __construct.
- private $db;
+ //! Type: PDO. The database connection of the data source.
+ //! \see __construct.
+ private $db;
- /**
- * Constructor
- * The first two parameters are used by its parent class ANDS_RIFCS. The third is its own private property.
- *
- * \param $ands_response_doc ANDS_Response_XML. A XML Doc acts as the parent node.
- * \param $metadata_node DOMElement. The meta node which all subsequent nodes will be added to.
- * \param $db Type: PDO. The database connection of the data source.
- */
- function __construct($ands_response_doc, $metadata_node, $db) {
- parent::__construct($ands_response_doc, $metadata_node);
- $this->db = $db;
- }
+ /**
+ * Constructor
+ * The first two parameters are used by its parent class ANDS_RIFCS. The third is its own private property.
+ *
+ * \param $ands_response_doc ANDS_Response_XML. A XML Doc acts as the parent node.
+ * \param $metadata_node DOMElement. The meta node which all subsequent nodes will be added to.
+ * \param $db Type: PDO. The database connection of the data source.
+ */
+ function __construct($ands_response_doc, $metadata_node, $db) {
+ parent::__construct($ands_response_doc, $metadata_node);
+ $this->db = $db;
+ }
-
- /**
- * This is the general entrence of creating actual content. It calls different functions for different type of RIF-CS model.
- * When anything goes wrong, e.g. found no record, or $set_name is not recognised, an exception will be thrown.
- * And for this implementation, data are stored in a database therefore a PDO is needed. But the source can be any.
- *
- * \param $set_name Type: string. The name of set is going to be created. Can be one of activity, collection or party.
- * \param $key Type: string. The main identifier used in ANDS system. There can be other identifier.
- *
- * \see create_activity, create_collection, create_party
- */
- function create_obj_node($set_name, $key) {
- $db = $this->db;
- $set_name = strtolower($set_name);
- if (in_array($set_name,prepare_set_names())) {
- try {
- // Get ori_id and which the original table is:
- $query = "select ori_table_name, ori_id from oai_headers where oai_identifier = '".$key."'";
- $res = exec_pdo_query($db, $query);
- $record = $res->fetch(PDO::FETCH_ASSOC);
- } catch (PDOException $e) {
- echo "$key returned no record.\n";
- echo $e->getMessage();
- }
- $processor = 'create_'.substr($set_name,6);
- $this->create_regObject(REG_OBJ_GROUP, $key, MY_URI);
- $this->$processor($record['ori_table_name'],$record['ori_id']);
- $this->create_identifier_node($key);
- $this->create_identifier_node('table='.$record['ori_table_name'].'+id='.$record['ori_id']);
- } else {
- throw new Exception('Wrong set name was used: '.$set_name);
- }
- }
-
- /** The processor for creating metadata node of Activity. Called from create_obj_node.
- * \param $table_name Type: string. The table name will be used to retrieve data from.
- * \param $id_project Type: integer. Internal project id associated to this activity-project.
- * \see Function create_obj_node.
- */
- private function create_activity($table_name, $id_project) {
- $db = $this->db;
+ /**
+ * This is the general entrence of creating actual content. It calls different functions for different type of RIF-CS model.
+ * When anything goes wrong, e.g. found no record, or $set_name is not recognised, an exception will be thrown.
+ * And for this implementation, data are stored in a database therefore a PDO is needed. But the source can be any.
+ *
+ * \param $set_name Type: string. The name of set is going to be created. Can be one of activity, collection or party.
+ * \param $key Type: string. The main identifier used in ANDS system. There can be other identifier.
+ *
+ * \see create_activity, create_collection, create_party
+ */
+ function create_obj_node($set_name, $key) {
+ $db = $this->db;
+ $set_name = strtolower($set_name);
+ if (in_array($set_name,prepare_set_names())) {
+ try {
+ // Get ori_id and which the original table is:
+ $query = "select ori_table_name, ori_id from oai_headers where oai_identifier = '".$key."'";
+ $res = exec_pdo_query($db, $query);
+ $record = $res->fetch(PDO::FETCH_ASSOC);
+ } catch (PDOException $e) {
+ echo "$key returned no record.\n";
+ echo $e->getMessage();
+ }
+
+ $processor = 'create_'.substr($set_name,6);
+ $this->create_regObject(REG_OBJ_GROUP, $key, MY_URI);
+ $this->$processor($record['ori_table_name'],$record['ori_id']);
+ $this->create_identifier_node($key);
+ $this->create_identifier_node('table='.$record['ori_table_name'].'+id='.$record['ori_id']);
+ } else {
+ throw new Exception('Wrong set name was used: '.$set_name);
+ }
+ }
+
+ /** The processor for creating metadata node of Activity. Called from create_obj_node.
+ * \param $table_name Type: string. The table name will be used to retrieve data from.
+ * \param $id_project Type: integer. Internal project id associated to this activity-project.
+ * \see Function create_obj_node.
+ */
+ private function create_activity($table_name, $id_project) {
+ $db = $this->db;
# // Get ori_id and which the original table is:
# $query = "select ori_table_name, ori_id from oai_headers where oai_identifier = '".$key."'";
# $res = exec_pdo_query($db, $query);
# $record = $res->fetch(PDO::FETCH_ASSOC);
# // $id_project will e used later, so save it:
# $id_project = $record['ori_id'];
- // Get the content using the previously obtained infor:
- $query = sprintf("select inter_no,start_date, end_date,pub_descrip from %s where id_project = %s",$table_name,$id_project);
-
- try {
- $res = exec_pdo_query($db,$query);
- $record = $res->fetch(PDO::FETCH_ASSOC);
- } catch (Exception $e) {
- echo $e->getMessage();
- }
-
- $this->create_rifcs_node('activity','project');
- $c = $this->create_name_node();
- $this->create_namePart($c,'The Plant Accelerator Project '.$record['inter_no']);
-// Test codes for rich format.
+ // Get the content using the previously obtained infor:
+ $query = sprintf("select inter_no,start_date, end_date,pub_descrip from %s where id_project = %s",$table_name,$id_project);
+
+ try {
+ $res = exec_pdo_query($db,$query);
+ $record = $res->fetch(PDO::FETCH_ASSOC);
+ } catch (Exception $e) {
+ echo $e->getMessage();
+ }
+
+ $this->create_rifcs_node('activity','project');
+ $c = $this->create_name_node();
+ $this->create_namePart($c,'The Plant Accelerator Project '.$record['inter_no']);
+ // Test codes for rich format.
# // \n works
# $this->create_description_node(sprintf("Line one:%s,\nLine two:%s.\nThird",'a','b'));
- $this->create_description_node(str_replace("\r\n","\n",$record['pub_descrip']));
+ $this->create_description_node(str_replace("\r\n","\n",$record['pub_descrip']));
- $this->create_description_node('The experiment was carried out between '.$record['start_date'].' and '.$record['end_date'],'note');
- $query = sprintf("select idr,stype from list_prj_ids_v2(%d) where stype in ('dataset','person')",$id_project);
- // echo $query;
- try {
- $res = $db->query($query,PDO::FETCH_ASSOC);
- if ($res==false) {
- throw new Exception($query."\nIt found nothing.\n");
- }
- foreach ($res as $record) {
- switch ($record['stype']) {
- case 'dataset':
- $this->create_relatedObject($record['idr'],'hasOutput');
- break;
- case 'person':
- $this->create_relatedObject($record['idr'],'isManagedBy');
- break;
- }
- }
- // The Plant Accelerator always participates in Activity
- $this->create_relatedObject('0874ad60-ab4d-11df-aebd-0002a5d5c51b','hasParticipant');
- } catch (PDOException $e) {
- process_pdo_error($query, $e);
- }// end of try-catch block
- } // end of function create_activity($key, $id_project)
-
- /** The processor for creating metadata node of Collection. Called from create_obj_node.
- * \param $table_name Type: string. The table name will be used to retrieve data from.
- * \param $id_collect Type: integer. Internal collection id associated to this collection-dataset.
- * \see Function create_obj_node.
- */
- private function create_collection($table_name, $id_collect) {
- $db = $this->db;
- try {
- $query = sprintf("select plant,variety,start_date,end_date,img_freq,anzsrc from %s where id_collect = %s",$table_name,$id_collect);
- $res = exec_pdo_query($db, $query);
- $dataset = $res->fetch(PDO::FETCH_ASSOC);
+ $this->create_description_node('The experiment was carried out between '.$record['start_date'].' and '.$record['end_date'],'note');
+ $query = sprintf("select idr,stype from list_prj_ids_v2 where stype in ('dataset','person')",$id_project);
+ // echo $query;
+ try {
+ $res = $db->query($query,PDO::FETCH_ASSOC);
+ if ($res==false) {
+ throw new Exception($query."\nIt found nothing.\n");
+ }
+ foreach ($res as $record) {
+ switch ($record['stype']) {
+ case 'dataset':
+ $this->create_relatedObject($record['idr'],'hasOutput');
+ break;
+ case 'person':
+ $this->create_relatedObject($record['idr'],'isManagedBy');
+ break;
+ }
+ }
+ // The Plant Accelerator always participates in Activity
+ $this->create_relatedObject('0874ad60-ab4d-11df-aebd-0002a5d5c51b','hasParticipant');
+ } catch (PDOException $e) {
+ process_pdo_error($query, $e);
+ }// end of try-catch block
+ } // end of function create_activity($key, $id_project)
- $res = exec_pdo_query($db, $query);
- $record = $res->fetch(PDO::FETCH_ASSOC);
-
- $query = 'select id_rep, inter_no, id_project from tpa_project_ids where id_collect = '.$id_collect;
- $res = exec_pdo_query($db, $query);
- $prj_info = $res->fetch(PDO::FETCH_ASSOC);
-
- $query = 'select email from tpa_person where id_rep = '.$prj_info['id_rep'];
- $res = exec_pdo_query($db, $query);
- $email = $res->fetch(PDO::FETCH_ASSOC);
- } catch (PDOException $e) {
- echo $query.' was failed\n';
- echo $e->getMessage();
- }
-
- $this->create_rifcs_node('collection','dataset');
- // Get the project inter_no as the name of this dataset
- $c = $this->create_name_node();
- $this->create_namePart($c,'Data set of Plant Accelerator Project '.$prj_info['inter_no']);
-
- // locatin node: contact person
- $l_node = $this->create_location_node();
- $a_node = $this->create_address_node($l_node);
- $this->create_e_node($a_node, $email['email']);
- // location node: TPA's physical address
- $l_node = $this->create_location_node();
- $a_node = $this->create_address_node($l_node);
- $this->create_physcial_addr_txt($a_node, 'The Plant Accelerator, Hartley Grove, Urrbrae, SA 5064') ;
- // Temporal coverage of colletion
- $dates = array(array('date'=>$dataset['start_date'],'type'=>'dateFrom'),array('date'=>$dataset['end_date'],'type'=>'dateTo'));
- $this->create_coverage_tempo($dates);
- // subject
- $this->create_subject_node($dataset['aznsrc']);
- // relatedOjbects
- $query = sprintf("select idr,stype from list_prj_ids_v2(%d) where stype in ('project','person')",$prj_info['id_project']);
- try {
- $res = $db->query($query,PDO::FETCH_ASSOC);
- if ($res==false) {
- throw new Exception($query."\nIt found nothing.\n");
- }
- foreach ($res as $record) {
- switch ($record['stype']) {
- case 'project':
- $this->create_relatedObject($record['idr'],'isOutputOf');
- break;
- case 'person':
- $this->create_relatedObject($record['idr'],'isOwnedBy');
- break;
- }
- }
- } catch (PDOException $e) {
- process_pdo_error($query, $e);
- }// end of try-catch block
-
- // right of accessing
- $this->create_description_node('For information on rights and access to this dataset, please contact the owner.','accessRights');
+ /** The processor for creating metadata node of Collection. Called from create_obj_node.
+ * \param $table_name Type: string. The table name will be used to retrieve data from.
+ * \param $id_collect Type: integer. Internal collection id associated to this collection-dataset.
+ * \see Function create_obj_node.
+ */
+ private function create_collection($table_name, $id_collect) {
+ $db = $this->db;
+ try {
+ $query = sprintf("select plant,variety,start_date,end_date,img_freq,anzsrc from %s where id_collect = %s",$table_name,$id_collect);
+ $res = exec_pdo_query($db, $query);
+ $dataset = $res->fetch(PDO::FETCH_ASSOC);
- // image data:
- $imgs = ''; $ex_conf = '';
- $dic = array('im_type_rgb'=>'RGB','im_type_nir'=>'NIR','im_type_fir'=>'FIR','im_type_nir_roots'=>'NIR Roots','im_type_fluo'=>'Fluorescence');
- $query = 'select im_type_rgb,im_type_nir,im_type_fir,im_type_nir_roots,im_type_fluo, lines, treatments, replicates, total from ands_collection where id_collect = '. $id_collect;
- $res = $db->query($query,PDO::FETCH_ASSOC);
- if ($res==false) {
- throw new Exception($query."\nIt found nothing.\n");
- }
- $info = $res->fetch();
- foreach ($info as $item => $v) {
- switch ($item) {
- case 'im_type_rgb':
- case 'im_type_nir':
- case 'im_type_fir':
- case 'im_type_nir_roots':
- case 'im_type_fluo':
- if (!empty($v)) { $imgs .= $dic[$item].', '; }
- break;
- default:
- if (!empty($v)) { $ex_conf .= ' '.$item.' = '.$v.', '; }
- break;
- }
- }
- if (empty($imgs)) $imgs = "Images data of RGB, FIR, NIR, NIR Roots and Fluorescence cameras., ";
- $imgs = substr($imgs,0,-2);
- if (!empty($ex_conf)) $imgs = $imgs."\n".substr($ex_conf,0,-2);
- $this->create_description_node($imgs);
- // imaging frequency
- $this->create_description_node('Imaging frequency: '.$dataset['img_freq'],'note');
- } // end of function create_collection($key,$id_collect)
-
- /** The processor for creating metadata node of Party. Called from create_obj_node. As party-person is different to party-group, there are two sub-functions are called accordingly.
- * \param $table_name Type: string. The table name will be used to retrieve data from.
- * \param $id_party Type: integer. Internal party id associated to this party.
- * \see Function create_obj_node.
- */
- private function create_party($table_name, $id_party) {
- $db = $this->db;
- $query = sprintf("SELECT set_type FROM oai_headers WHERE ori_table_name = '%s' AND ori_id = %s",$table_name,$id_party);
- $res = exec_pdo_query($db, $query);
- $party_type = $res->fetch(PDO::FETCH_ASSOC);
-
- if (in_array($party_type['set_type'],array('person','group'))) {
- $this->create_rifcs_node('party',$party_type['set_type']);
+ $res = exec_pdo_query($db, $query);
+ $record = $res->fetch(PDO::FETCH_ASSOC);
- if ($party_type['set_type']=='person') {
- $this->create_person($table_name, $id_party);
- } elseif ($party_type['set_type']=='group') {
- $this->create_group($table_name, $id_party); }
- } else {
- throw new Exception('Unsupported set_type: '.$party_type['set_type']);
- }
- } // end of function create_part($key,$id_party)
+ $query = 'select id_rep, inter_no, id_project from tpa_project_ids where id_collect = '.$id_collect;
+ $res = exec_pdo_query($db, $query);
+ $prj_info = $res->fetch(PDO::FETCH_ASSOC);
- /** The processor for creating metadata node of Party. Called from create_obj_node. As party-person is different to party-group, there are two sub-functions are called accordingly.
- * \param $table_name Type: string. The table name will be used to retrieve data from.
- * \param $id_party Type: integer. Internal party id associated to this party-person.
- * \see Function create_party.
- */
- private function create_person($table_name, $id_party) {
- $db = $this->db;
- $query = sprintf("SELECT id_org, title, first_name, family_name, tel, fax, email, www, address, post_code, city,state,country,duty FROM %s WHERE id_rep = %s",$table_name, $id_party);
- $res = exec_pdo_query($db, $query);
- $info = $res->fetch(PDO::FETCH_ASSOC);
- $c = $this->create_name_node();
- if (!empty($info['title'])) $this->create_namePart($c,$info['title'],'title');
- $this->create_namePart($c,$info['family_name'],'family');
- $this->create_namePart($c,$info['first_name'],'given');
-
- // locatin node: contact person
- $l_node = $this->create_location_node();
- $a_node = $this->create_address_node($l_node);
- $this->create_e_node($a_node, $info['email']);
- if (!empty($info['www'])) $this->create_e_node($a_node, $info['www'],'url');
- $this->create_physcial_fone_fax($a_node, $info['tel'],'telephoneNumber');
- if (!empty($info['fax'])) $this->create_physcial_fone_fax($a_node, $info['fax'],'faxNumber');
- $add_txt = trim($info['address']).', '.$info['city'].' '.$info['state'].' '.$info['post_code'].', '.$info['country'];
- // the strlength of ', , ' is 6
- if (strlen($add_txt)>6) $this->create_physcial_addr_txt($a_node,$add_txt);
-
- // related objects:
- // their group: id_customer is a foreign key of tpa_organisation
- $query = sprintf("SELECT get_identifier('tpa_organisation',%s)",$info['id_org']);
- $res = exec_pdo_query($db, $query);
- $info = $res->fetch(PDO::FETCH_NUM);
- $this->create_relatedObject($info[0],'isMemberOf');
-
- // their activities
- $query = "SELECT list_persons_objs($id_party,'project')";
- $res = exec_pdo_query($db, $query);
- $info = $res->fetch(PDO::FETCH_NUM);
- foreach ($info as $item) {
- $this->create_relatedObject($item,'isManagerOf');
- }
- // their collections
- $query = "SELECT list_persons_objs($id_party,'dataset')";
- $res = exec_pdo_query($db, $query);
- $info = $res->fetch(PDO::FETCH_NUM);
- foreach ($info as $item) {
- $this->create_relatedObject($item,'isOwnerOf');
- }
- }
-
- /** The processor for creating metadata node of Party. Called from create_obj_node. As party-person is different to party-group, there are two sub-functions are called accordingly.
- * \param $table_name Type: string. The table name will be used to retrieve data from.
- * \param $id_party Type: integer. Internal party id associated to this party-group.
- * \see Function create_party.
- */
- private function create_group($table_name, $id_party) {
- $db = $this->db;
- // echo 'table: ',$table_name,' party: ',$id_party,"\n";
- $query = sprintf("SELECT customer_name, abn, post_code, address, city, state, country, tel, fax, email, www, description FROM %s WHERE id_org = %s",$table_name, $id_party);
- //echo $query;
- $res = exec_pdo_query($db, $query);
- $info = $res->fetch(PDO::FETCH_ASSOC);
- $c = $this->create_name_node();
- $this->create_namePart($c,$info['customer_name']);
- if (!empty($info['abn'])) $this->create_identifier_node($info['abn'],'abn');
+ $query = 'select email from tpa_person where id_rep = '.$prj_info['id_rep'];
+ $res = exec_pdo_query($db, $query);
+ $email = $res->fetch(PDO::FETCH_ASSOC);
+ } catch (PDOException $e) {
+ echo $query.' was failed\n';
+ echo $e->getMessage();
+ }
- if (!empty($info['description'])) $this->create_description_node($info['description']);
-
- $l_node = $this->create_location_node();
- $a_node = $this->create_address_node($l_node);
- $this->create_physcial_fone_fax($a_node, $info['tel'],'telephoneNumber');
- $this->create_physcial_fone_fax($a_node, $info['fax'],'faxNumber');
- $add_txt = trim($info['address']).', '.$info['city'].' '.$info['state'].' '.$info['post_code'].', '.$info['country'];
- $this->create_physcial_addr_txt($a_node,$add_txt);
-
- // related objects:
- // their members:
- $query = "SELECT list_pub_members($id_party)";
- $res = exec_pdo_query($db, $query);
- $info = $res->fetch(PDO::FETCH_NUM);
- foreach ($info as $item) {
- $this->create_relatedObject($item,'hasMember');
- }
- }
+ $this->create_rifcs_node('collection','dataset');
+ // Get the project inter_no as the name of this dataset
+ $c = $this->create_name_node();
+ $this->create_namePart($c,'Data set of Plant Accelerator Project '.$prj_info['inter_no']);
+
+ // locatin node: contact person
+ $l_node = $this->create_location_node();
+ $a_node = $this->create_address_node($l_node);
+ $this->create_e_node($a_node, $email['email']);
+ // location node: TPA's physical address
+ $l_node = $this->create_location_node();
+ $a_node = $this->create_address_node($l_node);
+ $this->create_physcial_addr_txt($a_node, 'The Plant Accelerator, Hartley Grove, Urrbrae, SA 5064') ;
+ // Temporal coverage of colletion
+ $dates = array(array('date'=>$dataset['start_date'],'type'=>'dateFrom'),array('date'=>$dataset['end_date'],'type'=>'dateTo'));
+ $this->create_coverage_tempo($dates);
+ // subject
+ $this->create_subject_node($dataset['aznsrc']);
+ // relatedOjbects
+ $query = sprintf("select idr,stype from list_prj_ids_v2(%d) where stype in ('project','person')",$prj_info['id_project']);
+ try {
+ $res = $db->query($query,PDO::FETCH_ASSOC);
+ if ($res==false) {
+ throw new Exception($query."\nIt found nothing.\n");
+ }
+ foreach ($res as $record) {
+ switch ($record['stype']) {
+ case 'project':
+ $this->create_relatedObject($record['idr'],'isOutputOf');
+ break;
+ case 'person':
+ $this->create_relatedObject($record['idr'],'isOwnedBy');
+ break;
+ }
+ }
+ } catch (PDOException $e) {
+ process_pdo_error($query, $e);
+ }// end of try-catch block
+
+ // right of accessing
+ $this->create_description_node('For information on rights and access to this dataset, please contact the owner.','accessRights');
+
+ // image data:
+ $imgs = ''; $ex_conf = '';
+ $dic = array('im_type_rgb'=>'RGB','im_type_nir'=>'NIR','im_type_fir'=>'FIR','im_type_nir_roots'=>'NIR Roots','im_type_fluo'=>'Fluorescence');
+ $query = 'select im_type_rgb,im_type_nir,im_type_fir,im_type_nir_roots,im_type_fluo, lines, treatments, replicates, total from ands_collection where id_collect = '. $id_collect;
+ $res = $db->query($query,PDO::FETCH_ASSOC);
+ if ($res==false) {
+ throw new Exception($query."\nIt found nothing.\n");
+ }
+ $info = $res->fetch();
+ foreach ($info as $item => $v) {
+ switch ($item) {
+ case 'im_type_rgb':
+ case 'im_type_nir':
+ case 'im_type_fir':
+ case 'im_type_nir_roots':
+ case 'im_type_fluo':
+ if (!empty($v)) { $imgs .= $dic[$item].', '; }
+ break;
+ default:
+ if (!empty($v)) { $ex_conf .= ' '.$item.' = '.$v.', '; }
+ break;
+ }
+ }
+ if (empty($imgs)) $imgs = "Images data of RGB, FIR, NIR, NIR Roots and Fluorescence cameras., ";
+ $imgs = substr($imgs,0,-2);
+ if (!empty($ex_conf)) $imgs = $imgs."\n".substr($ex_conf,0,-2);
+ $this->create_description_node($imgs);
+ // imaging frequency
+ $this->create_description_node('Imaging frequency: '.$dataset['img_freq'],'note');
+ } // end of function create_collection($key,$id_collect)
+
+ /** The processor for creating metadata node of Party. Called from create_obj_node. As party-person is different to party-group, there are two sub-functions are called accordingly.
+ * \param $table_name Type: string. The table name will be used to retrieve data from.
+ * \param $id_party Type: integer. Internal party id associated to this party.
+ * \see Function create_obj_node.
+ */
+ private function create_party($table_name, $id_party) {
+ $db = $this->db;
+ $query = sprintf("SELECT set_type FROM oai_headers WHERE ori_table_name = '%s' AND ori_id = %s",$table_name,$id_party);
+ $res = exec_pdo_query($db, $query);
+ $party_type = $res->fetch(PDO::FETCH_ASSOC);
+
+ if (in_array($party_type['set_type'],array('person','group'))) {
+ $this->create_rifcs_node('party',$party_type['set_type']);
+
+ if ($party_type['set_type']=='person') {
+ $this->create_person($table_name, $id_party);
+ } elseif ($party_type['set_type']=='group') {
+ $this->create_group($table_name, $id_party); }
+ } else {
+ throw new Exception('Unsupported set_type: '.$party_type['set_type']);
+ }
+ } // end of function create_part($key,$id_party)
+
+ /** The processor for creating metadata node of Party. Called from create_obj_node. As party-person is different to party-group, there are two sub-functions are called accordingly.
+ * \param $table_name Type: string. The table name will be used to retrieve data from.
+ * \param $id_party Type: integer. Internal party id associated to this party-person.
+ * \see Function create_party.
+ */
+ private function create_person($table_name, $id_party) {
+ $db = $this->db;
+ $query = sprintf("SELECT id_org, title, first_name, family_name, tel, fax, email, www, address, post_code, city,state,country,duty FROM %s WHERE id_rep = %s",$table_name, $id_party);
+ $res = exec_pdo_query($db, $query);
+ $info = $res->fetch(PDO::FETCH_ASSOC);
+ $c = $this->create_name_node();
+ if (!empty($info['title'])) $this->create_namePart($c,$info['title'],'title');
+ $this->create_namePart($c,$info['family_name'],'family');
+ $this->create_namePart($c,$info['first_name'],'given');
+
+ // locatin node: contact person
+ $l_node = $this->create_location_node();
+ $a_node = $this->create_address_node($l_node);
+ $this->create_e_node($a_node, $info['email']);
+ if (!empty($info['www'])) $this->create_e_node($a_node, $info['www'],'url');
+ $this->create_physcial_fone_fax($a_node, $info['tel'],'telephoneNumber');
+ if (!empty($info['fax'])) $this->create_physcial_fone_fax($a_node, $info['fax'],'faxNumber');
+ $add_txt = trim($info['address']).', '.$info['city'].' '.$info['state'].' '.$info['post_code'].', '.$info['country'];
+ // the strlength of ', , ' is 6
+ if (strlen($add_txt)>6) $this->create_physcial_addr_txt($a_node,$add_txt);
+
+ // related objects:
+ // their group: id_customer is a foreign key of tpa_organisation
+ $query = sprintf("SELECT get_identifier('tpa_organisation',%s)",$info['id_org']);
+ $res = exec_pdo_query($db, $query);
+ $info = $res->fetch(PDO::FETCH_NUM);
+ $this->create_relatedObject($info[0],'isMemberOf');
+
+ // their activities
+ $query = "SELECT list_persons_objs($id_party,'project')";
+ $res = exec_pdo_query($db, $query);
+ $info = $res->fetch(PDO::FETCH_NUM);
+ foreach ($info as $item) {
+ $this->create_relatedObject($item,'isManagerOf');
+ }
+ // their collections
+ $query = "SELECT list_persons_objs($id_party,'dataset')";
+ $res = exec_pdo_query($db, $query);
+ $info = $res->fetch(PDO::FETCH_NUM);
+ foreach ($info as $item) {
+ $this->create_relatedObject($item,'isOwnerOf');
+ }
+ }
+
+ /** The processor for creating metadata node of Party. Called from create_obj_node. As party-person is different to party-group, there are two sub-functions are called accordingly.
+ * \param $table_name Type: string. The table name will be used to retrieve data from.
+ * \param $id_party Type: integer. Internal party id associated to this party-group.
+ * \see Function create_party.
+ */
+ private function create_group($table_name, $id_party) {
+ $db = $this->db;
+ // echo 'table: ',$table_name,' party: ',$id_party,"\n";
+ $query = sprintf("SELECT customer_name, abn, post_code, address, city, state, country, tel, fax, email, www, description FROM %s WHERE id_org = %s",$table_name, $id_party);
+ //echo $query;
+ $res = exec_pdo_query($db, $query);
+ $info = $res->fetch(PDO::FETCH_ASSOC);
+ $c = $this->create_name_node();
+ $this->create_namePart($c,$info['customer_name']);
+ if (!empty($info['abn'])) $this->create_identifier_node($info['abn'],'abn');
+
+ if (!empty($info['description'])) $this->create_description_node($info['description']);
+
+ $l_node = $this->create_location_node();
+ $a_node = $this->create_address_node($l_node);
+ $this->create_physcial_fone_fax($a_node, $info['tel'],'telephoneNumber');
+ $this->create_physcial_fone_fax($a_node, $info['fax'],'faxNumber');
+ $add_txt = trim($info['address']).', '.$info['city'].' '.$info['state'].' '.$info['post_code'].', '.$info['country'];
+ $this->create_physcial_addr_txt($a_node,$add_txt);
+
+ // related objects:
+ // their members:
+ $query = "SELECT list_pub_members($id_party)";
+ $res = exec_pdo_query($db, $query);
+ $info = $res->fetch(PDO::FETCH_NUM);
+ foreach ($info as $item) {
+ $this->create_relatedObject($item,'hasMember');
+ }
+ }
} // end of class ANDS_TPA
-
diff --git a/getrecord.php b/getrecord.php
index 2c8cc2b..f858c91 100644
--- a/getrecord.php
+++ b/getrecord.php
@@ -16,11 +16,10 @@ $metadataPrefix = $args['metadataPrefix'];
// myhandler is a php file which will be included to generate metadata node.
// $inc_record = $METADATAFORMATS[$metadataPrefix]['myhandler'];
-if (is_array($METADATAFORMATS[$metadataPrefix])
- && isset($METADATAFORMATS[$metadataPrefix]['myhandler'])) {
- $inc_record = $METADATAFORMATS[$metadataPrefix]['myhandler'];
+if (is_array($METADATAFORMATS[$metadataPrefix]) && isset($METADATAFORMATS[$metadataPrefix]['myhandler'])) {
+ $inc_record = $METADATAFORMATS[$metadataPrefix]['myhandler'];
} else {
- $errors[] = oai_error('cannotDisseminateFormat', 'metadataPrefix', $metadataPrefix);
+ $errors[] = oai_error('cannotDisseminateFormat', 'metadataPrefix', $metadataPrefix);
}
$identifier = $args['identifier'];
@@ -31,50 +30,44 @@ debug_message("Query: $query") ;
$res = $db->query($query);
if ($res===false) {
- if (SHOW_QUERY_ERROR) {
- echo __FILE__.','.__LINE__."
";
- echo "Query: $query
\n";
- die($db->errorInfo());
- } else {
- $errors[] = oai_error('idDoesNotExist', '', $identifier);
- }
+ if (SHOW_QUERY_ERROR) {
+ echo __FILE__.','.__LINE__."
";
+ echo "Query: $query
\n";
+ die($db->errorInfo());
+ } else {
+ $errors[] = oai_error('idDoesNotExist', '', $identifier);
+ }
} elseif (!$res->rowCount()) { // based on PHP manual, it might only work for some DBs
- $errors[] = oai_error('idDoesNotExist', '', $identifier);
+ $errors[] = oai_error('idDoesNotExist', '', $identifier);
}
-
if (!empty($errors)) {
- oai_exit();
+ oai_exit();
}
$record = $res->fetch(PDO::FETCH_ASSOC);
if ($record===false) {
- if (SHOW_QUERY_ERROR) {
- echo __FILE__.','.__LINE__."
";
- echo "Query: $query
\n";
- }
- $errors[] = oai_error('idDoesNotExist', '', $identifier);
+ if (SHOW_QUERY_ERROR) {
+ echo __FILE__.','.__LINE__."
";
+ echo "Query: $query
\n";
+ }
+ $errors[] = oai_error('idDoesNotExist', '', $identifier);
}
$identifier = $record[$SQL['identifier']];;
$datestamp = formatDatestamp($record[$SQL['datestamp']]);
-if (isset($record[$SQL['deleted']]) && ($record[$SQL['deleted']] == 'true') &&
- ($deletedRecord == 'transient' || $deletedRecord == 'persistent')) {
- $status_deleted = TRUE;
-} else {
- $status_deleted = FALSE;
-}
+$status_deleted = (isset($record[$SQL['deleted']]) && ($record[$SQL['deleted']] == 'true') &&
+ ($deletedRecord == 'transient' || $deletedRecord == 'persistent'));
$outputObj = new ANDS_Response_XML($args);
$cur_record = $outputObj->create_record();
$cur_header = $outputObj->create_header($identifier, $datestamp,$record[$SQL['set']],$cur_record);
// return the metadata record itself
if (!$status_deleted) {
- include($inc_record); // where the metadata node is generated.
- create_metadata($outputObj, $cur_record, $identifier, $record[$SQL['set']], $db);
+ include($inc_record); // where the metadata node is generated.
+ create_metadata($outputObj, $cur_record, $identifier, $record[$SQL['set']], $db);
} else {
- $cur_header->setAttribute("status","deleted");
+ $cur_header->setAttribute("status","deleted");
}
-?>
diff --git a/identify.php b/identify.php
index cf8bf7b..ea064f8 100644
--- a/identify.php
+++ b/identify.php
@@ -10,23 +10,24 @@
// The response to Identify is fixed
if (SHOW_QUERY_ERROR) {
- echo "Here are some settings in raw format:\n";
- print_r($identifyResponse);
- echo 'MAXRECORDS ',MAXRECORDS, ', MAXIDS ', MAXIDS,"\n";
- echo 'Token is valid for ',TOKEN_VALID," seconds\n";
- echo 'Tokens have prefix: ',TOKEN_PREFIX,"\n";
- echo 'XMLSCHEMA: ',XMLSCHEMA,"\n";
- echo "\n";
+ echo "Here are some settings in raw format:\n";
+ print_r($identifyResponse);
+ echo 'MAXRECORDS ',MAXRECORDS, ', MAXIDS ', MAXIDS,"\n";
+ echo 'Token is valid for ',TOKEN_VALID," seconds\n";
+ echo 'Tokens have prefix: ',TOKEN_PREFIX,"\n";
+ echo 'XMLSCHEMA: ',XMLSCHEMA,"\n";
+ echo "\n";
}
+
$outputObj = new ANDS_Response_XML($args);
foreach($identifyResponse as $key => $val) {
- $outputObj->add2_verbNode($key, $val);
+ $outputObj->add2_verbNode($key, $val);
}
if(isset($compression)) {
- foreach($compression as $val) {
- $outputObj->add2_verbNode("compression", $val);
- }
+ foreach($compression as $val) {
+ $outputObj->add2_verbNode("compression", $val);
+ }
}
// A description MAY be included.
@@ -132,4 +133,3 @@ if(strlen($output)>10) {
$des->appendXML($output);
$outputObj->verbNode->appendChild($des);
}
-?>
diff --git a/index.php b/index.php
index 862f00a..c2c2ca5 100644
--- a/index.php
+++ b/index.php
@@ -136,6 +136,3 @@ University of Adelaide