Appendices
<?php
require_once IMu::$lib . '/Trace.php';
require_once WS::$shared . '/BaseMetadataFormat.php';
$class = 'oai_dc';
class oai_dc extends BaseMetadataFormat
{
public function __construct()
{
parent::__construct('oai_dc',
'http://www.openarchives.org/OAI/2.0/oai_dc.xsd',
'http://www.openarchives.org/OAI/2.0/oai_dc/',
'2.0');
}
public function getColumnsByModule()
{
$columnsByModule = array
(
'emultimedia' => array
(
'ChaMediaForm',
'DetContributor_tab',
'DetCoverage',
'DetLanguage_tab',
'DetPublisher',
'DetRelation_tab',
'DetResourceType',
'DetRights',
'DetSource',
'DetSubject_tab',
'MulCreator_tab',
'MulDescription',
'MulIdentifier',
'MulMimeFormat',
'MulMimeType',
'MulTitle',
),
);
return($columnsByModule);
}
public function writeMetadata($module, array $row)
{
$this->writer->startElement('oai_dc:dc');
$this->writer->writeAttribute('xmlns:oai_dc',
'http://www.openarchives.org/OAI/2.0/oai_dc/');
$this->writer->writeAttribute('xmlns:dc',
'http://purl.org/dc/elements/1.1/');
$this->writer->writeAttribute('xmlns:xsi',
'http://www.w3.org/2001/XMLSchema-instance');
$this->writer->writeAttribute('xsi:schemaLocation',
'http://www.openarchives.org/OAI/2.0/oai_dc/' .
'http://www.openarchives.org/OAI/2.0/oai_dc.xsd');
$this->writeElement('dc:contributor', $row, 'DetContributor_tab');
$this->writeElement('dc:coverage', $row, 'DetCoverage');
$this->writeElement('dc:creator', $row, 'MulCreator_tab');
$this->writer->writeElement('dc:date', $this->getDateInserted($row));
$this->writeElement('dc:description', $row, 'MulDescription');
$this->writeElement('dc:format', $row, array('MulMimeFormat','ChaMediaForm'));
$this->writeElement('dc:language', $row, 'DetLanguage_tab');
$this->writeElement('dc:publisher', $row, 'DetPublisher');
$this->writeElement('dc:relation', $row, 'DetRelation_tab');
$this->writeElement('dc:rights', $row, 'DetRights');
$this->writeElement('dc:source', $row, 'DetSource');
$this->writeElement('dc:subject', $row, 'DetSubject_tab');
$this->writeElement('dc:title', $row, 'MulTitle');
$this->writeElement('dc:type', $row, array('MulMimeType','DetResourceType'));
$this->writer->endElement();
}
protected function writeElement($field, $row, $columns)
{
if (! is_array($columns))
{
$columns = array($columns);
}
foreach ($columns as $column)
{
if (! $this->hasValue($row, $column))
{
continue;
}
$values = $row[$column];
if (! is_array($values))
{
$values = array($values);
}
foreach ($values as $value)
{
$this->writer->writeElement($field, $value);
}
}
}
}
?>
<?php require_once IMu::$lib . '/Trace.php'; require_once WS::$base . '/common/formats/oai_dc.php'; $class = 'oai_dc_client'; class oai_dc_client extends oai_dc { public function getColumnsByModule() { $columnsByModule = array ( 'emultimedia' => array ( 'ChaMediaForm', 'DetContributor_tab', 'DetCoverage', 'DetLanguage_tab', 'DetPublisher', 'DetRelation_tab', 'DetResourceType', 'DetRights', 'DetSource', 'DetSubject_tab', 'MulCreator_tab', 'MulDescription', 'MulIdentifier', 'MulMimeFormat', 'MulMimeType', 'MulTitle', ), ); return($columnsByModule); } public function writeMetadata($module, array $row) { $this->writer->startElement('oai_dc:dc'); $this->writer->writeAttribute('xmlns:oai_dc', 'http://www.openarchives.org/OAI/2.0/oai_dc/'); $this->writer->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/'); $this->writer->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); $this->writer->writeAttribute('xsi:schemaLocation', 'http://www.openarchives.org/OAI/2.0/oai_dc/' . ' http://www.openarchives.org/OAI/2.0/oai_dc.xsd'); # Using the writeElement method inherited from the oai_dc class. # $this->writeElement('dc:contributor', $row, 'DetContributor_tab'); $this->writeElement('dc:coverage', $row, 'DetCoverage'); $this->writeElement('dc:creator', $row, 'MulCreator_tab'); # Using the getDateInserted method inherited (ultimately) from the # BaseMetadataFormat class. # $this->writer->writeElement('dc:date', $this->getDateInserted($row)); $this->writeElement('dc:description', $row, 'MulDescription'); $this->writeElement('dc:format', $row, array('MulMimeFormat', 'ChaMediaForm')); $this->writeElement('dc:language', $row, 'DetLanguage_tab'); $this->writeElement('dc:publisher', $row, 'DetPublisher'); $this->writeElement('dc:relation', $row, 'DetRelation_tab'); $this->writeElement('dc:rights', $row, 'DetRights'); $this->writeElement('dc:source', $row, 'DetSource'); $this->writeElement('dc:subject', $row, 'DetSubject_tab'); $this->writeElement('dc:title', $row, 'MulTitle'); $this->writeElement('dc:type', $row, array('MulMimeType', 'DetResourceType')); $this->writer->endElement(); } } ?>