Skip to content
Snippets Groups Projects
Commit 31da92ae authored by Daniel Berthereau's avatar Daniel Berthereau
Browse files

Added a quick mapping between bibo and dcterms.

parent 6af91ed2
No related branches found
No related tags found
No related merge requests found
...@@ -159,6 +159,29 @@ class Module extends AbstractModule ...@@ -159,6 +159,29 @@ class Module extends AbstractModule
$services = $this->getServiceLocator(); $services = $this->getServiceLocator();
$settings = $services->get('Omeka\Settings'); $settings = $services->get('Omeka\Settings');
$mapping = $settings->get('oaipmhrepository_map_properties', []); $mapping = $settings->get('oaipmhrepository_map_properties', []);
foreach ($mapping as $sourceTerm => $destinationTerm) {
if ($sourceTerm === $destinationTerm
|| empty($sourceTerm)
|| empty($destinationTerm)
|| mb_substr($sourceTerm, 0, 1) === '#'
|| mb_substr($destinationTerm, 0, 1) === '#'
|| !strpos($sourceTerm, ':')
|| !strpos($destinationTerm, ':')
) {
unset($mapping[$sourceTerm]);
continue;
}
$property = $this->getProperty($sourceTerm);
if (!$property) {
unset($mapping[$sourceTerm]);
continue;
}
$property = $this->getProperty($destinationTerm);
if (!$property) {
unset($mapping[$sourceTerm]);
continue;
}
}
} }
if (!count($mapping)) { if (!count($mapping)) {
return; return;
...@@ -170,12 +193,9 @@ class Module extends AbstractModule ...@@ -170,12 +193,9 @@ class Module extends AbstractModule
$values = $event->getParam('values', []); $values = $event->getParam('values', []);
// Do a double loop for quicker process. // Do a double loop for quicker process. Mapping is already checked.
foreach ($mapping as $sourceTerm => $destinationTerm) { foreach ($mapping as $sourceTerm => $destinationTerm) {
if ($sourceTerm === $destinationTerm || empty($sourceTerm) || empty($destinationTerm)) {
continue;
}
if (isset($values[$destinationTerm]['values'])) { if (isset($values[$destinationTerm]['values'])) {
continue; continue;
} }
......
...@@ -119,6 +119,74 @@ return [ ...@@ -119,6 +119,74 @@ return [
'mods', 'mods',
], ],
'oaipmhrepository_map_properties' => [ 'oaipmhrepository_map_properties' => [
'# Quick mapping between Bibliographic Ontology and Dublin Core terms',
'bibo:abstract' => 'dcterms:abstract',
'bibo:affirmedBy' => 'dcterms:relation',
'bibo:annotates' => 'dcterms:description',
'bibo:asin' => 'dcterms:identifier',
'bibo:chapter' => 'dcterms:format',
'bibo:citedBy' => 'dcterms:isReferencedBy',
'bibo:cites' => 'dcterms:references',
'bibo:coden' => 'dcterms:identifier',
'bibo:content' => 'dcterms:description',
'bibo:court' => 'dcterms:spatial',
'bibo:argued' => 'dcterms:date',
'bibo:director' => 'dcterms:contributor',
'bibo:distributor' => 'dcterms:publisher',
'bibo:doi' => 'dcterms:identifier',
'bibo:eanucc13' => 'dcterms:identifier',
'bibo:edition' => 'dcterms:format',
'bibo:editor' => 'dcterms:publisher',
'bibo:eissn' => 'dcterms:identifier',
'bibo:gtin14' => 'dcterms:identifier',
'bibo:handle' => 'dcterms:identifier',
'bibo:identifier' => 'dcterms:identifier',
'bibo:interviewee' => 'dcterms:contributor',
'bibo:interviewer' => 'dcterms:contributor',
'bibo:isbn' => 'dcterms:identifier',
'bibo:isbn10' => 'dcterms:identifier',
'bibo:isbn13' => 'dcterms:identifier',
'bibo:issn' => 'dcterms:identifier',
'bibo:issue' => 'dcterms:format',
'bibo:issuer' => 'dcterms:publisher',
'bibo:lccn' => 'dcterms:identifier',
'bibo:authorList' => 'dcterms:creator',
'bibo:contributorList' => 'dcterms:contributor',
'bibo:editorList' => 'dcterms:publisher',
'bibo:locator' => 'dcterms:identifier',
'bibo:number' => 'dcterms:format',
'bibo:numPages' => 'dcterms:format',
'bibo:numVolumes' => 'dcterms:format',
'bibo:oclcnum' => 'dcterms:identifier',
'bibo:organizer' => 'dcterms:contributor',
'bibo:owner' => 'dcterms:provenance',
'bibo:pageEnd' => 'dcterms:format',
'bibo:pageStart' => 'dcterms:format',
'bibo:pages' => 'dcterms:format',
'bibo:performer' => 'dcterms:creator',
'bibo:pmid' => 'dcterms:identifier',
'bibo:prefixName' => 'dcterms:description',
'bibo:presentedAt' => 'dcterms:relation',
'bibo:presents' => 'dcterms:relation',
'bibo:producer' => 'dcterms:contributor',
'bibo:recipient' => 'dcterms:contributor',
'bibo:reproducedIn' => 'dcterms:relation',
'bibo:reversedBy' => 'dcterms:relation',
'bibo:reviewOf' => 'dcterms:relation',
'bibo:section' => 'dcterms:format',
'bibo:shortTitle' => 'dcterms:alternative',
'bibo:shortDescription' => 'dcterms:abstract',
'bibo:sici' => 'dcterms:identifier',
'bibo:degree' => 'dcterms:description',
'bibo:status' => 'dcterms:description',
'bibo:subsequentLegalDecision' => 'dcterms:relation',
'bibo:suffixName' => 'dcterms:description',
'bibo:transcriptOf' => 'dcterms:isVersionOf',
'bibo:translationOf' => 'dcterms:isVersionOf',
'bibo:translator' => 'dcterms:contributor',
'bibo:upc' => 'dcterms:identifier',
'bibo:uri' => 'dcterms:identifier',
'bibo:volume' => 'dcterms:format',
], ],
'oaipmhrepository_mets_data_item' => 'dcterms', 'oaipmhrepository_mets_data_item' => 'dcterms',
'oaipmhrepository_mets_data_media' => 'dcterms', 'oaipmhrepository_mets_data_media' => 'dcterms',
......
...@@ -105,4 +105,5 @@ if (version_compare($oldVersion, '3.3.5.2', '<')) { ...@@ -105,4 +105,5 @@ if (version_compare($oldVersion, '3.3.5.2', '<')) {
'oaipmhrepository_generic_dcterms', 'oaipmhrepository_generic_dcterms',
$settings->get('oaipmhrepository_generic_dcterms', true) ? ['oai_dc', 'cdwalite', 'mets', 'mods'] : [] $settings->get('oaipmhrepository_generic_dcterms', true) ? ['oai_dc', 'cdwalite', 'mets', 'mods'] : []
); );
$settings->set('oaipmhrepository_map_properties', $defaultSettings['oaipmhrepository_map_properties']);
} }
...@@ -212,8 +212,8 @@ class ConfigForm extends Form implements TranslatorAwareInterface ...@@ -212,8 +212,8 @@ class ConfigForm extends Form implements TranslatorAwareInterface
'name' => 'oaipmhrepository_map_properties', 'name' => 'oaipmhrepository_map_properties',
'type' => ArrayTextarea::class, 'type' => ArrayTextarea::class,
'options' => [ 'options' => [
'label' => 'Map properties to Dublin Core ', // @translate 'label' => 'Map properties', // @translate
'info' => 'Map any property to Dublin Core terms, so they will be available in format "oai_dcterms" and "oai_dc" (if option "Genericize dcterms" is set).', // @translate 'info' => 'Map any property to any other property, so they will be available in other formats, in particular "oai_dcterms" and "oai_dc".', // @translate
'as_key_value' => true, 'as_key_value' => true,
], ],
'attributes' => [ 'attributes' => [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment