Skip to content

Commit

Permalink
Merge pull request #61 from Natkeeran/oai_pmh_mods_2
Browse files Browse the repository at this point in the history
oai-pmh mods representation (attempt 2)
  • Loading branch information
rosiel authored Mar 2, 2023
2 parents afea257 + b1b1e62 commit cfc0cdd
Show file tree
Hide file tree
Showing 10 changed files with 2,125 additions and 11 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,9 @@ In summary: These two messages seem to be ignorable.
#### Patches
There are currently no patches included with the Starter Site. If a patch (external or internal) is necessary, it can be applied automatically by composer by using the [composer-patches plugin](https://github.com/cweagans/composer-patches). Any patches included in the Starter Site should be described fully in this section (including when they should be removed).
If a patch (external or internal) is necessary, it can be applied automatically by composer by using the [composer-patches plugin](https://github.com/cweagans/composer-patches). Any patches included in the Starter Site should be described fully in this section (including when they should be removed).
* rest_oai_pmh - issue#3283661 - https://www.drupal.org/files/issues/2022-06-01/mods_view_render.patch is being applied to fix an issue related to getting view data into the MODS twig representation.
### Ongoing Project Maintenance
Expand Down
136 changes: 136 additions & 0 deletions assets/templates/mods.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
<titleInfo>
<title lang="eng">{{ elements.title }}</title>
{% if elements.subtitle is not empty%}
<subTitle>{{ elements.subtitle }}</subTitle>
{% endif %}
</titleInfo>

{% for role_name_info in elements.linked_agent |split ('|') %}
{% set role_name = role_name_info|split(':') %}
{% set name_type_info = elements.linked_agent_vocabulary|split(',') %}

{% set name_type_info_x = name_type_info[loop.index0]|replace({"Person":"person", "Corporate Body":"corporate", "Family":"family"})|raw %}

<name type="{{ name_type_info_x }}">
<role>
<roleTerm type="text">{{ role_name[0] }}</roleTerm>
</role>
<namePart>{{ role_name[1] }}</namePart>
</name>
{% endfor %}

<typeOfResource>{{ elements.typeofresource }}</typeOfResource>
<genre>{{ elements.genre }} </genre>
<abstract>{{ elements.description }}</abstract>
<language>
{% for language in elements.language_iso6392b |split ('|') %}
<languageTerm authority="iso639-2b" type="code">{{ language|trim }}</languageTerm>
{% endfor %}
</language>
<originInfo>
<publisher>{{ elements.publisher }}</publisher>
<place>
<placeTerm type="text">{{ elements.published_place }}</placeTerm>
<placeTerm authority="marccountry">{{ elements.published_place_marccountry }}</placeTerm>
</place>
<dateCreated keyDate="yes">{{ elements.datecreated_rad14b5 }}</dateCreated>
{% if elements.datecreated_start_iso8601 is not empty%}
<dateCreated point="start">{{ elements.datecreated_start_iso8601 }}</dateCreated>
{% endif %}
{% if elements.datecreated_end_iso8601 is not empty%}
<dateCreated point="end">{{ elements.datecreated_end_iso8601 }}</dateCreated>
{% endif %}
<copyrightDate>{{ elements.datecopyright_iso8601 }}</copyrightDate>
</originInfo>
<physicalDescription>
<form authority="smd">{{ elements.physicaldescription_form }}</form>
<extent>{{ elements.physicaldescription_extent }}</extent>
<reformattingQuality>{{ elements.physicaldescription_reformatting_quality }}</reformattingQuality>
<digitalOrigin>{{ elements.physicaldescription_digitalorigin }}</digitalOrigin>
<internetMediaType>{{ elements.physicaldescription_internetmediatype }}</internetMediaType>
<note>{{ elements.physicaldescription_note }}</note>
</physicalDescription>
<subject authority="local">
{% for topic in elements.subject_topic |split ('|') %}
<topic>{{ topic|trim }}</topic>
{% endfor %}
{% for geographic in elements.subject_geographic |split ('|') %}
<geographic>{{ geographic|trim }}</geographic>
{% endfor %}
{% for temporal in elements.subject_temporal |split ('|') %}
<temporal>{{ temporal|trim }}</temporal>
{% endfor %}

{% set name_type_info = elements.subjects_name_vocabulary|split('|') %}
{% for subject_name_info in elements.subjects_name |split ('|') %}

{% set name_type_info_x = name_type_info[loop.index - 1]|replace({"Person":"person"})|raw %}
{% set name_type_info_x = name_type_info_x|replace({"Corporate Body":"corporate"})|raw %}

<name type="{{ name_type_info_x }}">
<namePart>{{ subject_name_info }}</namePart>
</name>
{% endfor %}

<hierarchicalGeographic>
<continent>{{ elements.subject_hierarchicalgeographic_continent }}</continent>
<country>{{ elements.subject_hierarchicalgeographic_country }}</country>
<state>{{ elements.subject_hierarchicalgeographic_state }}</state>
<province>{{ elements.subject_hierarchicalgeographic_province }}</province>
<region>{{ elements.subject_hierarchicalgeographic_region }}</region>
<county>{{ elements.subject_hierarchicalgeographic_county }}</county>
<island>{{ elements.subject_hierarchicalgeographic_island }}</island>
<city>{{ elements.subject_hierarchicalgeographic_city }}</city>
<citySection>{{ elements.subject_hierarchicalgeographic_citysection }}</citySection>
</hierarchicalGeographic>
<cartographics>
<coordinates>{{ elements.subject_geographic_coordinates }}</coordinates>
</cartographics>
</subject>
{% if elements.relateditem_title is not empty %}
<relatedItem type="host">
<titleInfo>
<title>{{ elements.relateditem_title }}</title>
</titleInfo>
</relatedItem>
{% endif %}
{% if elements.relateditem_collection_title is not empty %}
<relatedItem type="collection">
<titleInfo>
<title>{{ elements.relateditem_collection_title }}</title>
</titleInfo>
</relatedItem>
{% endif %}
{% if elements.accesscondition_restrictionandaccess is not empty%}
<accessCondition type="restriction and access">{{ elements.accesscondition_restrictionandaccess }}</accessCondition>
{% endif %}
<accessCondition type="use and reproduction">{{ elements.accesscondition_useandreproduction }}</accessCondition>
<location>
<url usage="primary display">{{ elements.location_url }}</url>
{% if elements.location_physical is not empty %}
<physicalLocation>{{ elements.location_physical }}</physicalLocation>
{% endif %}
</location>
<identifier type="uri">{{ elements.identifier_uri}}</identifier>
<identifier type="local">{{ elements.identifier_local}}</identifier>
<identifier type="ark">{{ elements.identifier_ark}}</identifier>
<note>{{ elements.note }}</note>
<recordInfo>
{% if elements.recordinfo_note_coursecode is not empty %}
<recordInfoNote type="courseCode">{{ elements.recordinfo_note_coursecode }}</recordInfoNote>
{% endif %}
{% if elements.recordinfo_note_courseyear is not empty %}
<recordInfoNote type="courseYear">{{ elements.recordinfo_note_courseyear }}</recordInfoNote>
{% endif %}
{% if elements.recordinfo_note_courseterm is not empty %}
<recordInfoNote type="courseTerm">{{ elements.recordinfo_note_courseterm }}</recordInfoNote>
{% endif %}
<languageOfCataloging>
{% if elements.recordinfo_cataloguing_language_iso6392b is not empty %}
<languageTerm authority="iso639-2b" type="code">{{ elements.recordinfo_cataloguing_language_iso6392b }}</languageTerm>
{% else %}
{# Assume language of cataloguing is eng #}
<languageTerm authority="iso639-2b" type="code">eng</languageTerm>
{% endif %}
</languageOfCataloging>
</recordInfo>
7 changes: 7 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,15 @@
]
},
"patches": {
"drupal/rest_oai_pmh": {
"View render issue #3283661": "https://www.drupal.org/files/issues/2022-06-01/mods_view_render.patch"
}
}
},
"scripts": {
"post-install-cmd": ["cp -f assets/templates/mods.html.twig web/modules/contrib/rest_oai_pmh/templates/mods.html.twig"],
"post-update-cmd": ["cp -f assets/templates/mods.html.twig web/modules/contrib/rest_oai_pmh/templates/mods.html.twig"]
},
"require-dev": {
"drupal/config_inspector": "^2.1",
"drupal/devel": "^5.0",
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config/sync/context.context.citation_select_block.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dependencies:
label: 'Citation Select Block'
name: citation_select_block
group: Display
description: 'On an Islandora nodes (except Collections), show Citation Select Block'
description: 'If an Islandora node, and not a Collection, show Citation Select Block'
requireAllConditions: true
disabled: false
conditions:
Expand Down
55 changes: 55 additions & 0 deletions config/sync/context.context.display_oai_pmh_item_links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
uuid: 6aec9511-76fc-43c1-bea6-eb9bab0d990f
langcode: en
status: true
dependencies:
config:
- views.view.oai_pmh_item_links
module:
- islandora
- views
label: 'Display OAI-PMH Item Links'
name: display_oai_pmh_item_links
group: Display
description: 'If an Islandora node, and not a Collection, show OAI-PMH Item Record Links (MODS, DC)'
requireAllConditions: true
disabled: false
conditions:
node_has_term:
id: node_has_term
negate: true
uuid: 52390830-adb8-47da-8dca-7017f36377a3
context_mapping:
node: '@node.node_route_context:node'
uri: 'http://purl.org/dc/dcmitype/Collection'
logic: and
node_is_islandora_object:
id: node_is_islandora_object
negate: 0
uuid: 8f5d786a-c538-4505-b3ad-4c613143d4fd
context_mapping:
node: '@node.node_route_context:node'
reactions:
blocks:
id: blocks
uuid: 4fbfa7a6-f1d5-4220-994f-db705a50993b
blocks:
554b31f0-bd04-420f-aac3-6e3b71889f59:
uuid: 554b31f0-bd04-420f-aac3-6e3b71889f59
id: 'views_block:oai_pmh_item_links-block_1'
label: ''
provider: views
label_display: visible
region: content
weight: '0'
custom_id: views_block_oai_pmh_item_links_block_1
theme: olivero
css_class: ''
unique: 0
context_id: display_oai_pmh_item_links
context_mapping: { }
views_label: ''
items_per_page: none
third_party_settings: { }
include_default_blocks: 0
saved: false
weight: 0
13 changes: 7 additions & 6 deletions config/sync/rest_oai_pmh.settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ _core:
rest_oai_pmh:
entity_type: node
view_displays:
'oai_pmh:all_repository_items': 'oai_pmh:all_repository_items'
'oai_pmh:collection_sets': 'oai_pmh:collection_sets'
'oai_pmh:collectionless_set': 'oai_pmh:collectionless_set'
support_sets: 1
Expand All @@ -11,16 +12,16 @@ repository_name: 'Islandora 8'
repository_email: admin@example.com
expiration: '3600'
metadata_map_plugins:
-
label: oai_dc
value: dublin_core_rdf
-
label: mods
value: ''
value: mods
-
label: oai_raw
value: ''
-
label: oai_dc
value: dublin_core_rdf
cache_technique: liberal_cache
mods_view:
view_machine_name: ''
view_display_name: ''
view_machine_name: oai_pmh_item_data
view_display_name: page_1
22 changes: 20 additions & 2 deletions config/sync/search_api.index.default_solr_index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ status: true
dependencies:
config:
- field.storage.node.field_alt_title
- field.storage.node.field_edtf_date_created
- field.storage.node.field_member_of
- field.storage.node.field_description
- field.storage.node.field_dewey_classification
- field.storage.node.field_edition
- field.storage.node.field_edtf_date_created
- field.storage.node.field_extent
- field.storage.node.field_full_title
- field.storage.node.field_isbn
Expand All @@ -18,12 +18,12 @@ dependencies:
- field.storage.node.field_physical_form
- field.storage.node.field_resource_type
- field.storage.node.field_rights
- field.storage.node.field_tags
- field.storage.node.field_subject_general
- field.storage.node.field_geographic_subject
- field.storage.node.field_subjects_name
- field.storage.node.field_temporal_subject
- field.storage.node.field_subject
- field.storage.node.field_tags
- search_api.server.default_solr_server
- core.entity_view_mode.node.search_index
module:
Expand Down Expand Up @@ -234,6 +234,16 @@ field_settings:
dependencies:
config:
- field.storage.node.field_tags
linked_agent_vid:
label: 'Linked Agent Vocab'
datasource_id: 'entity:node'
property_path: 'field_linked_agent:entity:vid'
type: string
dependencies:
config:
- field.storage.node.field_linked_agent
module:
- taxonomy
member_of_title:
label: 'Member of » Content » Title'
datasource_id: 'entity:node'
Expand All @@ -244,6 +254,14 @@ field_settings:
- field.storage.node.field_member_of
module:
- node
nid:
label: ID
datasource_id: 'entity:node'
property_path: nid
type: integer
dependencies:
module:
- node
node_grants:
label: 'Node access information'
property_path: search_api_node_grants
Expand Down
Loading

0 comments on commit cfc0cdd

Please sign in to comment.