diff --git a/ands_rifcs.php b/ands_rifcs.php
deleted file mode 100644
index 1182480..0000000
--- a/ands_rifcs.php
+++ /dev/null
@@ -1,257 +0,0 @@
-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);
- }
-
- /** 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 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 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/doc/ands__rifcs_8php.html b/doc/ands__rifcs_8php.html
deleted file mode 100644
index 8ba6b63..0000000
--- a/doc/ands__rifcs_8php.html
+++ /dev/null
@@ -1,79 +0,0 @@
-
-
-
-
-
-OAI PHP: ands_rifcs.php File Reference
-
-
-
-
-
-
-
-
-
Classes related to generating RIF-CS XML response file for ANDS from repository. It also serves as an exmaple how class ANDS_RIFCS can be used in a particular case.
-More...
Class ANDS_RIFCS provides all essential functionalities for creating ANDS RIF-CS records. The protected member functions are the backbone functions which can be used for creating any ANDS RIF-CS records.
DOMElement. The meta node which all subsequent nodes will be added to.
-
-
-
-
-
-
-
Member Function Documentation
-
-
-
-
-
-
ANDS_RIFCS::addChild
-
(
-
$
-
mom_node,
-
-
-
-
-
$
-
name,
-
-
-
-
-
$
-
value = ''
-
-
-
-
)
-
[protected]
-
-
-
-
-
A worker function for easily adding a newly created node to current XML Doc.
-
Parameters:
-
-
$mom_node
Type: DOMElement. Node the new child will be attached to.
-
$name
Type: sting. The name of the child node is being added.
-
$value
Type: sting. The text content of the child node is being added. The default is ''.
-
-
-
-
Returns:
DOMElement. The added child node
-
-
-
-
-
-
-
-
-
ANDS_RIFCS::create_regObjects
-
(
-
-
)
-
[protected]
-
-
-
-
-
Create a registryObjects node to hold individual registryObject's. This is only a holder node.
-
-
-
-
-
-
-
-
-
ANDS_RIFCS::create_regObject
-
(
-
$
-
group,
-
-
-
-
-
$
-
key,
-
-
-
-
-
$
-
originatingSource
-
-
-
-
)
-
[protected]
-
-
-
-
-
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.
-
Parameters:
-
-
$group
string, group attribute of the new registryObject node .
-
$key
string, key node, used as an identifier.
-
$originatingSource
string, an url of the data provider.
-
-
-
-
-
-
-
-
-
-
-
-
ANDS_RIFCS::create_rifcs_node
-
(
-
$
-
set_name,
-
-
-
-
-
$
-
set_type
-
-
-
-
)
-
[protected]
-
-
-
-
-
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.
-
Parameters:
-
-
$set_name
string, the name of set. For ANDS, they are Activity, Party and Collection
-
$set_type
string, the type of set. For example, Activity can have project as a type.
-
-
-
-
-
-
-
-
-
-
-
-
ANDS_RIFCS::create_name_node
-
(
-
$
-
name_type = 'primary'
-
)
-
[protected]
-
-
-
-
-
Create a top level name node.
-
Parameters:
-
-
$name_type
string. Text for the types, can be either primary or abbreviated. Default: primary
-
-
-
-
Returns:
DOMElement $added_name_node. The newly created node, it will be used for further expansion by adding namePart.
-
-
-
-
-
-
-
-
-
ANDS_RIFCS::create_namePart
-
(
-
$
-
name_node,
-
-
-
-
-
$
-
value,
-
-
-
-
-
$
-
part_type = ''
-
-
-
-
)
-
[protected]
-
-
-
-
-
Create a namePart of a name node.
-
Parameters:
-
-
$name_node
Type: DOMElement. Node of name_node created previously
-
$value
Type: string. Text fror this namePart
-
$part_type
Type: string, used for group:person record. Types can be: titile, given, family
-
-
-
-
-
-
-
-
-
-
-
-
ANDS_RIFCS::create_relatedObject
-
(
-
$
-
key,
-
-
-
-
-
$
-
relation_type
-
-
-
-
)
-
[protected]
-
-
-
-
-
Create related object. One RIF-CS can have more than one related object nodes, each object is described by one node.
-
Parameters:
-
-
$key
Type: string. The identifier of the related object.
-
$relation_type
Type: string. Type of relationship.
-
-
-
-
-
-
-
-
-
-
-
-
ANDS_RIFCS::create_description_node
-
(
-
$
-
value,
-
-
-
-
-
$
-
des_type = 'brief'
-
-
-
-
)
-
[protected]
-
-
-
-
-
Create description node. One RIF-CS can have more than one description nodes. Each description node has only one description.
-
Parameters:
-
-
$value
Type: string. The content of the description.
-
$des_type
Type: string. Type of the description. Types can be brief, full, acessRights and note. Default is 'brief'.
-
-
-
-
-
-
-
-
-
-
-
-
ANDS_RIFCS::create_identifier_node
-
(
-
$
-
key,
-
-
-
-
-
$
-
i_type = 'local'
-
-
-
-
)
-
[protected]
-
-
-
-
-
Create local or other type of identifier inside of RIF-CS metadata node
-
Parameters:
-
-
$key
Type string. The indentifier itself.
-
$i_type
Type string. Type of identifier. Can be abn, uri, local, etc.. Default is local.
-
-
-
-
-
-
-
-
-
-
-
-
ANDS_RIFCS::create_location_node
-
(
-
-
)
-
[protected]
-
-
-
-
-
Location node is a holder node for either address or spatial nodes
-
Returns:
DOMElement node, for adding address or spatial nodes.
-
-
-
-
-
-
-
-
-
ANDS_RIFCS::create_address_node
-
(
-
$
-
location_node
-
)
-
[protected]
-
-
-
-
-
Address node is a holder node for phiscal or electrical nodes.
-
Parameters:
-
-
$location_node
Type: DOMElement. Location node created previously.
-
-
-
-
Returns:
DOMElement
-
-
-
-
-
-
-
-
-
ANDS_RIFCS::create_e_node
-
(
-
$
-
addr_node,
-
-
-
-
-
$
-
e_node,
-
-
-
-
-
$
-
e_type = 'email'
-
-
-
-
)
-
[protected]
-
-
-
-
-
Electrical address node. Used for email, url, etc
-
Parameters:
-
-
$addr_node
Type: DOMElement. Previously created address node.
-
$e_node
Type: string. The content of the adding node.
-
$e_type
Type: string. Default is email.
-
-
-
-
-
-
-
-
-
-
-
-
ANDS_RIFCS::create_physcial_fone_fax
-
(
-
$
-
addr_node,
-
-
-
-
-
$
-
number,
-
-
-
-
-
$
-
fone_fax = 'telephoneNumber'
-
-
-
-
)
-
[protected]
-
-
-
-
-
Physical node is a holder node for phone or fax nodes.
-
Parameters:
-
-
$addr_node
Type: DOMelement. Address node created before to which the new phiscial->addressPart will be attached.
-
$number
Type: string. Telephone or fax number as a string.
-
$fone_fax
Type: string. Either telehoneNumber or faxNumber.
-
-
-
-
-
-
-
-
-
-
-
-
ANDS_RIFCS::create_physcial_addr_txt
-
(
-
$
-
addr_node,
-
-
-
-
-
$
-
txt_addr,
-
-
-
-
-
$
-
phys_type = 'streetAddress'
-
-
-
-
)
-
[protected]
-
-
-
-
-
create address node under location node, either streetAddress or postalAddress. But they are in text (one block) format.
-
Parameters:
-
-
$addr_node
Type: DOMelement. Address node created before to which the new phiscial->addressPart will be attached.
-
$txt_addr
string, full street address in text block format
-
$phys_type
string, default is 'streetAddress', can be 'postalAddress'
-
-
-
-
-
-
-
-
-
-
-
-
ANDS_RIFCS::create_spatial_node
-
(
-
$
-
location_node,
-
-
-
-
-
$
-
value = '138.6396,
-
-
-
-
-
-34.97063'
-
,
-
-
-
-
-
$
-
sp_type = 'kmlPolyCoords'
-
-
-
-
)
-
[protected]
-
-
-
-
-
Create spatial node under a location node.
-
Parameters:
-
-
$location_node
Type: DOMElement. Location node where spatial node is being added to.
-
$value
Type: string. The value of spatial information. Default is local latitude and longitude.
-
$sp_type
Type: string. Type of spaitial informaion. Default is kmlPolyCoords.
-
-
-
-
-
-
-
-
-
-
-
-
ANDS_RIFCS::create_coverage_tempo
-
(
-
$
-
values
-
)
-
[protected]
-
-
-
-
-
Create temporal coverage node for collection or activity records.
-
Parameters:
-
-
$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.
-
-
-
-
-
-
-
-
-
-
-
-
ANDS_RIFCS::create_coverage_tempo_date
-
(
-
$
-
t,
-
-
-
-
-
$
-
value
-
-
-
-
)
-
[private]
-
-
-
-
-
Create temporal coverage node for collection or activity records.
-
Parameters:
-
-
$t
Type: DOMElement. The <coverage><temporal/></coverage> node to which <date> nodes will be attached to.
-
$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.
Create an empty <record> node. Other nodes will be appended to it later.
-
-
-
-
-
-
-
-
-
ANDS_Response_XML::create_header
-
(
-
$
-
identifier,
-
-
-
-
-
$
-
timestamp,
-
-
-
-
-
$
-
ands_class,
-
-
-
-
-
$
-
add_to_node = null
-
-
-
-
)
-
-
-
-
-
-
Headers are enclosed inside of <record> to the query of ListRecords, ListIdentifiers and etc.
-
Parameters:
-
-
$identifier
Type: string. The identifier string for node <identifier>.
-
$timestamp
Type: timestamp. Timestapme in UTC format for node <datastamp>.
-
$ands_class
Type: mix. Can be an array or just a string. Content of <setSpec>.
-
$add_to_node
Type: DOMElement. Default value is null. In normal cases, $add_to_node is the <record> node created previously. When it is null, the newly created header node is attatched to $this->verbNode. Otherwise it will be attatched to the desired node defined in $add_to_node.
-
-
-
-
-
-
-
-
-
-
-
-
ANDS_Response_XML::create_metadata
-
(
-
$
-
mom_record_node
-
)
-
-
-
-
-
-
Create metadata node for holding metadata. This is always added to <record> node.
-
Parameters:
-
-
$mom_record_node
DOMElement. A node acts as the parent node.
-
-
-
-
Returns:
$meta_node Type: DOMElement. The newly created registryObject node which will be used for further expansion. metadata node itself is maintained by internally by the Class.
-
-
-
-
-
-
-
-
-
ANDS_Response_XML::create_resumpToken
-
(
-
$
-
token,
-
-
-
-
-
$
-
expirationdatetime,
-
-
-
-
-
$
-
num_rows,
-
-
-
-
-
$
-
cursor = null
-
-
-
-
)
-
-
-
-
-
-
If there are too many records request could not finished a resumpToken is generated to let harvester know
-
Parameters:
-
-
$token
Type: string. A random number created somewhere?
-
$expirationdatetime
Type: string. A string representing time.
-
$num_rows
Type: integer. Number of records retrieved.
-
$cursor
Type: string. Cursor can be used for database to retrieve next time.
-
-
-
-
-
-
-
Member Data Documentation
-
-
-
-
-
-
ANDS_Response_XML::$verbNode
-
-
-
-
-
Type: DOMElement. Verb node itself.
-
-
-
-
-
-
-
-
-
ANDS_Response_XML::$verb [protected]
-
-
-
-
-
Type: string. The verb in the request
-
-
-
-The documentation for this class was generated from the following file:
Class ANDS_RIFCS provides all essential functionalities for creating ANDS RIF-CS records. The protected member functions are the backbone functions which can be used for creating any ANDS RIF-CS records. At the time of design only data source is database and there is only one set of outputs. Therefore there is only one class has been designed. Ideally, there should be a separated class for creating actual records which reflect data source and data models.
-
Example usage: publish records meet ANDS RIF-CS requirements
DOMElement. The meta node which all subsequent nodes will be added to.
-
$db
Type: PDO. The database connection of the data source.
-
-
-
-
-
-
-
Member Function Documentation
-
-
-
-
-
-
ANDS_TPA::create_obj_node
-
(
-
$
-
set_name,
-
-
-
-
-
$
-
key
-
-
-
-
)
-
-
-
-
-
-
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.
-
Parameters:
-
-
$set_name
Type: string. The name of set is going to be created. Can be one of activity, collection or party.
-
$key
Type: string. The main identifier used in ANDS system. There can be other identifier.
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.
-
Parameters:
-
-
$table_name
Type: string. The table name will be used to retrieve data from.
-
$id_party
Type: integer. Internal party id associated to this 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.
-
Parameters:
-
-
$table_name
Type: string. The table name will be used to retrieve data from.
-
$id_party
Type: integer. Internal party id associated to this party-person.
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.
-
Parameters:
-
-
$table_name
Type: string. The table name will be used to retrieve data from.
-
$id_party
Type: integer. Internal party id associated to this party-group.
Add a child node to a parent node on a XML Doc: a worker function.
-
Parameters:
-
-
$mom_node
Type: DOMNode. The target node.
-
$name
Type: string. The name of child nade is being added
-
$value
Type: string. Text for the adding node if it is a text node.
-
-
-
-
Returns:
DOMElement $added_node The newly created node, can be used for further expansion. If no further expansion is expected, return value can be igored.
-
-
-
-
-
-
-
-
-
ANDS_XML::create_request
-
(
-
$
-
par_array
-
)
-
-
-
-
-
-
Create an OAI request node.
-
Parameters:
-
-
$par_array
Type: array The attributes of a request node. They describe the verb of the request and other associated parameters used in the request. Keys of the array define attributes, and values are their content.
-
-
-
-
-
-
-
-
-
-
-
-
ANDS_XML::display
-
(
-
-
)
-
-
-
-
-
-
Display a doc in a readable, well-formatted way for display or saving
-
-
-
-
Member Data Documentation
-
-
-
-
-
-
ANDS_XML::$doc
-
-
-
-
-
Type: DOMDocument. Handle of current XML Document object
-
-
-
-The documentation for this class was generated from the following file:
This class is used to construct database connection to a PostgreSQL database. It also includes some basic operation to database. This can be a template for future development of connecting to other databases
-
Constructor & Destructor Documentation
-
-
-
-
-
-
DB_OP::__construct
-
(
-
$
-
params
-
)
-
-
-
-
-
-
Constructor. Accepts one parameter containing the database connection settings.
-
Parameters:
-
-
array
-
-
-
-
-
-
-
Member Function Documentation
-
-
-
-
-
-
DB_OP::initialize
-
(
-
-
)
-
[private]
-
-
-
-
-
Initialize Database Settings. Called by the constructor.
-
Parameters:
-
-
void
-
-
-
-
Returns:
boolean. TRUE for successful initialisation. FALSE otherwise.
-
-
-
-
-
-
-
-
-
DB_OP::_connect_string
-
(
-
-
)
-
[private]
-
-
-
-
-
Construct connection string
-
Returns:
string
-
-
-
-
-
-
-
-
-
DB_OP::db_connect
-
(
-
-
)
-
[private]
-
-
-
-
-
Non-persistent database connection
-
Returns:
resource
-
-
-
-
-
-
-
-
-
DB_OP::db_pconnect
-
(
-
-
)
-
[private]
-
-
-
-
-
Persistent database connection
-
Returns:
resource
-
-
-
-
-
-
-
-
-
DB_OP::reconnect
-
(
-
-
)
-
-
-
-
-
-
Reconnect
-
Keep / reestablish the db connection if no queries have been sent for a length of time exceeding the server's idle timeout
-
Returns:
void
-
-
-
-
-
-
-
-
-
DB_OP::affected_rows
-
(
-
-
)
-
-
-
-
-
-
Affected Rows
-
Returns:
integer
-
-
-
-
-
-
-
-
-
DB_OP::select
-
(
-
$
-
table,
-
-
-
-
-
$
-
select = array('*')
-
-
-
-
)
-
-
-
-
-
-
Generates the SELECT portion of the query when multiple fileds are needed
-
Parameters:
-
-
$table
Type: string.
-
$select
Type: array.
-
-
-
-
Returns:
string
-
-
-
-
-
-
-
-
-
DB_OP::simple_query
-
(
-
$
-
sql
-
)
-
-
-
-
-
-
Simple Query This function is used for client script will process result. Or running transaction commands since they do not require all the features of the main query() function.
-
Parameters:
-
-
string
the sql query
-
-
-
-
Returns:
resource
-
-
-
-
-
-
-
-
-
DB_OP::query
-
(
-
$
-
sql,
-
-
-
-
-
$
-
return_object = FALSE
-
-
-
-
)
-
-
-
-
-
-
Execute the query
-
Accepts an SQL string as input and returns a result object upon successful execution of a "read" type query. Returns boolean TRUE upon successful execution of a "write" type query. Returns boolean FALSE upon failure.
-
Parameters:
-
-
string
An SQL query string
-
array
An array of binding data
-
-
-
-
Returns:
mixed
-
-
-
-
-
-
-
-
-
DB_OP::load_rdriver
-
(
-
-
)
-
-
-
-
-
-
Load the result drivers
-
Returns:
string the name of the result class
-
-
-
-
-
-
-
-
-
DB_OP::close
-
(
-
-
)
-
-
-
-
-
-
Close database connection
-
Returns:
void
-
-
-
-
-
-
-
-
-
DB_OP::_error_message
-
(
-
-
)
-
[private]
-
-
-
-
-
The error message string
-
Returns:
string
-
-
-
-
-
-
-
-
-
DB_OP::display_error
-
(
-
$
-
error = '',
-
-
-
-
-
$
-
swap = '',
-
-
-
-
-
$
-
native = FALSE
-
-
-
-
)
-
-
-
-
-
-
Display an error message in some format
-
Parameters:
-
-
string
the error message
-
string
any "swap" values
-
boolean
whether to localize the message
-
-
-
-
Returns:
string sends the application/error_db.php template
-
-
-
-The documentation for this class was generated from the following file:
Support to different metadataformats in your own systems. Two examples provided with the package are: record_dc.php and record_rif.php. They are helpers and need information from the real records. They need to be devloped for a particular system.
Support to different metadataformats in your own systems. Two examples provided with the package are: record_dc.php and record_rif.php. They are helpers and need information from the real records. They need to be devloped for a particular system.
Classes related to generating RIF-CS XML response file for ANDS from repository. It also serves as an exmaple how class ANDS_RIFCS can be used in a particular case
Local variables $metadataPrefix and $identifier need to be provided through global array variable $args by their indexes 'metadataPrefix' and 'identifier'. The reset of information will be extracted from database based those two parameters.
This is an implementation for an OAI-PMH 2.0 Data Provider (sometimes, repository is used exchangeablly) written in PHP.
-
This implementation completely complies to OAI-PMH 2.0, including the support of on-the-fly output compression which may significantly reduce the amount of data being transfered.
-
This package has been inspired by PHP OAI Data Provider developed by Heinrich Stamerjohanns at University of Oldenburg. Some of the functions and algorithms used in this code were transplanted from his implementation at http://physnet.uni-oldenburg.de/oai/.
-
Database support is supported through PDO (PHP Data Objects included in the PHP distribution), so almost any popular SQL-database can be used without any change in the code. Only thing need to do is to configure database connection and define a suitable data structure.
-
The repository can be quite easily configured by just editing oaidp-config.php, most possible values and options are explained.
Copy the the files in source package to a location under your document root of your web server. The directory structure should be preserved.
-
Change to that directory (e.g. cd /var/www/html/oai).
-
Allow your webserver to write to the token directory. The default token directory is /tmp which does not need any attention.
-
Edit oaidp-config.php. Almost all possible options are explained. It is assumed that basic elements of a record are stored in one simple table. You can find sql examples of table definition in doc folder. If your data is organized differently, you have to adjust the Query functions to reflect it and even develop your own code.
-
Check your oai site through a web browser. e.g. :
http://localhost/oai/
-
-
SELinux needs special treatments for database connection and other permission.
Support to different metadataformats in your own systems. Two examples provided with the package are: record_dc.php and record_rif.php. They are helpers and need information from the real records. They need to be devloped for your particular system.
Default starting point of OAI Data Provider for a human to check.
-More...
-
-
-
Detailed Description
-
OAI Data Provider is not designed for human to retrieve data but it is possible to use this page to test and check the functionality of current implementation. This page provides a summary of the OAI-PMH and the implementation.
Lists records according to conditions. If there are too many, a resumptionToken is generated.
-
-
If a request comes with a resumptionToken and is still valid, read it and send back records.
-
Otherwise, set up a query with conditions such as: 'metadataPrefix', 'from', 'until', 'set'. Only 'metadataPrefix' is compulsory. All conditions are accessible through global array variable $args by keywords.
Remember: to define your own classess for generating metadata records. In common cases, you have to implement your own code to act fully and correctly. For generic usage, you can try the ANDS_Response_XML defined in xml_creater.php.
-
Variable Documentation
-
-
-
-
-
-
$errors = array()
-
-
-
-
-
An array for collecting erros which can be reported later. It will be checked before a new action is taken.
Support to different metadataformats in your own systems. Two examples provided with the package are: record_dc.php and record_rif.php. They are helpers and need information from the real records. They need to be devloped for a particular system.
This is the configuration file for the PHP OAI Data Provider. Please read through the WHOLE file, there are several things, that need to be adjusted.
-
The response may may be compressed for better performace:
-
-
Compression : a compression encoding supported by the repository. The recommended values are those defined for the Content-Encoding header in Section 14.11 of RFC 2616 describing HTTP 1.1. A compression element should not be included for the identity encoding, which is implied.
-
-
Some other used variables:
-
-
$adminEmail: the e-mail addresses of administrators of the repository.
-
-
-
$repositoryIdentifier : For a data provider there is only one. For repositories to comply with the oai format it has to be unique identifiers for items records. Basically using domainname will be fine. See: http://www.openarchives.org/OAI/2.0/guidelines-oai-identifier.htm.
-
-
-
$SETS: An array with key words . List of supported SETs.
-
-
-
$METADATAFORMATS: List of supported metadata formats. It is a two-dimensional array with keys. Each supported format is one element of this array at the first dimension. The key is the name of a metadata format. The exact number of items within each format associated array depends on the nature of a metadata format. Most definitions are done here but handlers themselves are defined in separated files because only the names of PHP script are listed here.
-
metadataPrefix
-
schema
-
metadataNamespace
-
myhandler
-
other optional items: record_prefix, record_namespace and etc.
-
-
-
-
-
$SQL: Settings for database and queries from database
-
-
-
$DSN: DSN for connecting your database. Reference PDO for details.
-
-
The rest of settings will not normally need to be adjusted. Read source code for details.
Whether to show error message for dubug. For installation, testing and debuging set SHOW_QUERY_ERROR to TRUE If set to TRUE, application will die and display query and database error message as soon as there is a problem. Do not set this to TRUE on a production site, since it will show error messages to everybody. If set FALSE, will create XML-output, no matter what happens.
Identifier settings. It needs to have proper values to reflect the settings of the data provider.
-
-
$identifyResponse['repositoryName'] : compulsory. A human readable name for the repository;
-
$identifyResponse['baseURL'] : compulsory. The base URL of the repository;
-
$identifyResponse['protocolVersion'] : compulsory. The version of the OAI-PMH supported by the repository;
-
$identifyResponse['earliestDatestamp'] : compulsory. A UTCdatetime that is the guaranteed lower limit of all datestamps recording changes, modifications, or deletions in the repository. A repository must not use datestamps lower than the one specified by the content of the earliestDatestamp element. earliestDatestamp must be expressed at the finest granularity supported by the repository.
-
$identifyResponse['deletedRecord'] : the manner in which the repository supports the notion of deleted records. Legitimate values are no ; transient ; persistent with meanings defined in the section on deletion.
-
$identifyResponse['granularity'] : the finest harvesting granularity supported by the repository. The legitimate values are YYYY-MM-DD and YYYY-MM-DDThh:mm:ssZ with meanings as defined in ISO8601.
Currently only gzip is supported (you need output buffering turned on, and php compiled with libgz). The client MUST send "Accept-Encoding: gzip" to actually receive
Prints a message for debugging, only works when SHOW_QUERY_ERROR is true. PHP function print_r can be used to construct message with return parameter sets to true.
Check if provided correct arguments for a request.
-
Only number of parameters is checked. metadataPrefix has to be checked before it is used. set has to be checked before it is used. resumptionToken has to be checked before it is used. from and until can easily checked here because no extra information is needed.
-
-
-
-
-
-
-
-
-
is_valid_uri
-
(
-
$
-
url
-
)
-
-
-
-
-
-
Validates an identifier. The pattern is: '/^[-a-z\.0-9]+$/i' which means it accepts -, letters and numbers. Used only by function oai_error code idDoesNotExist.
-
Parameters:
-
-
$url
Type: string
-
-
-
-
-
-
-
-
-
-
-
-
is_valid_attrb
-
(
-
$
-
attrb
-
)
-
-
-
-
-
-
Validates attributes come with the query. It accepts letters, numbers, ':', '_', '.' and -. Here there are few more match patterns than is_valid_uri(): ':_'.
-
Parameters:
-
-
$attrb
Type: string
-
-
-
-
-
-
-
-
-
-
-
-
formatDatestamp
-
(
-
$
-
datestamp
-
)
-
-
-
-
-
-
All datestamps used in this system are GMT even return value from database has no TZ information
-
-
-
-
-
-
-
-
-
checkDateFormat
-
(
-
$
-
date
-
)
-
-
-
-
-
-
The database uses datastamp without time-zone information. It needs to clean all time-zone informaion from time string and reformat it
Finish a request when there is an error: send back errors.
-
-
-
-
-
-
-
-
-
get_token
-
(
-
-
)
-
-
-
-
-
-
Generate a string based on the current Unix timestamp in microseconds for creating resumToken file name.
-
-
-
-
-
-
-
-
-
createResumToken
-
(
-
$
-
cursor,
-
-
-
-
-
$
-
extquery,
-
-
-
-
-
$
-
metadataPrefix
-
-
-
-
)
-
-
-
-
-
-
Create a token file. It has three parts which is separated by '#': cursor, extension of query, metadataPrefix. Called by listrecords.php.
-
-
-
-
-
-
-
-
-
readResumToken
-
(
-
$
-
resumptionToken
-
)
-
-
-
-
-
-
Read a saved ResumToken
-
-
-
-
-
-
-
-
-
selectallQuery
-
(
-
$
-
metadPrefix = "rif",
-
-
-
-
-
$
-
id = ''
-
-
-
-
)
-
-
-
-
-
-
this function should generate a query which will return all records the useless condition id_column = id_column is just there to ease further extensions to the query, please leave it as it is.
-
-
-
-
-
-
-
-
-
idFormatQuery
-
(
-
$
-
id
-
)
-
-
-
-
-
-
this function will return metadataFormat of a record
-
-
-
-
-
-
-
-
-
idQuery
-
(
-
$
-
metadPrefix = "rif",
-
-
-
-
-
$
-
id = ''
-
-
-
-
)
-
-
-
-
-
-
this function will return identifier and datestamp for all records not very useful
-
-
-
-
-
-
-
-
-
untilQuery
-
(
-
$
-
until
-
)
-
-
-
-
-
-
filter for until, appends to the end of SQL query
-
-
-
-
-
-
-
-
-
fromQuery
-
(
-
$
-
from
-
)
-
-
-
-
-
-
filter for from , appends to the end of SQL query
-
-
-
-
-
-
-
-
-
setQuery
-
(
-
$
-
set
-
)
-
-
-
-
-
-
filter for sets, appends to the end of SQL query
-
-
-
-
-
-
-
-
-
rowCount
-
(
-
$
-
metadataPrefix,
-
-
-
-
-
$
-
extQuery,
-
-
-
-
-
$
-
db
-
-
-
-
)
-
-
-
-
-
-
for accurately to assess how many records satisfy conditions for all DBs
-
-
-
-
-
-
-
-
-
process_pdo_error
-
(
-
$
-
query,
-
-
-
-
-
$
-
e
-
-
-
-
)
-
-
-
-
-
-
A worker function for processing an error when a query was executed
-
Parameters:
-
-
$query
string, original query
-
$e
PDOException, the PDOException object
-
-
-
-
-
-
-
-
-
-
-
-
exec_pdo_query
-
(
-
$
-
db,
-
-
-
-
-
$
-
query
-
-
-
-
)
-
-
-
-
-
-
When query return no result, throw an Exception of Not found.
Project information includes 1. General project informaion 2. List of plants: studied objects 3. Imaging regime 4. Outcomes 5. Image data download options 6. Copyright statement 6.1. Contact person 6.2 Organisations involved
-
Function Documentation
-
-
-
-
-
-
format_bytes
-
(
-
$
-
bytes
-
)
-
-
-
-
-
-
Format files size to a in bytes, KB, MB, GB and TB
-
Parameters:
-
-
$bytes
Type: integer. Value of size will be formatted.
-
-
-
-
Returns:
string. Round to a format of xxx.xx unit.
-
-
-
-
-
-
-
-
-
disp_ul_sec
-
(
-
$
-
result,
-
-
-
-
-
$
-
lbls
-
-
-
-
)
-
-
-
-
-
-
Organise a query result in an unordered list
-
Parameters:
-
-
$result
Type: resource. The query result to be displayed.
-
$lbls
Type: array. The string array of labels.
-
-
-
-
-
-
-
-
-
-
-
-
disp_dl_group
-
(
-
$
-
lbls,
-
-
-
-
-
$
-
row
-
-
-
-
)
-
-
-
-
-
-
Organise a lable and content pair in <dt> <dd> pair.
Project information includes 1. General project informaion 2. List of plants: studied objects 3. Imaging regime 4. Outcomes 5. Image data download options 6. Copyright statement 6.1. Contact person 6.2 Organisations involved
Project information includes 1. General project informaion 2. List of plants: studied objects 3. Imaging regime 4. Outcomes 5. Image data download options 6. Copyright statement 6.1. Contact person 6.2 Organisations involved
-
Function Documentation
-
-
-
-
-
-
format_bytes
-
(
-
$
-
bytes
-
)
-
-
-
-
-
-
Format files size to a in bytes, KB, MB, GB and TB
-
Parameters:
-
-
$bytes
Type: integer. Value of size will be formatted.
-
-
-
-
Returns:
string. Round to a format of xxx.xx unit.
-
-
-
-
-
-
-
-
-
disp_ul_sec
-
(
-
$
-
result,
-
-
-
-
-
$
-
lbls
-
-
-
-
)
-
-
-
-
-
-
Display results in an unordered list setction Within each list, there is a description list
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
disp_dl_group
-
(
-
$
-
lbls,
-
-
-
-
-
$
-
row
-
-
-
-
)
-
-
-
-
-
-
Organise a lable and content pair in <dt> <dd> pair.
It is not working as it does not provide any content to the metadata node. It only included to demonstrate how a new metadata can be supported. For a working example, please see record_rif.php.
It is a plug-in helper function which will be called from where a metadata in rif format is being generated. The name of function defined here cannot be changed. This can also be used as an example for your own metadata strucutre:
-
-
create a metetadata node
-
append contents of the record to the metedata node
-
-
In this example, every time when a new record is being generated, a new instance of ANDS_TPA is created. As XML output document and the database connection are the same, it is possible to design otherwise.