dor-services 7.2.4 → 8.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/config_defaults.yml +24 -41
- data/config/dev_console_env.rb.example +0 -9
- data/lib/dor-services.rb +6 -9
- data/lib/dor/config.rb +2 -126
- data/lib/dor/datastreams/content_metadata_ds.rb +7 -0
- data/lib/dor/datastreams/embargo_metadata_ds.rb +1 -1
- data/lib/dor/datastreams/role_metadata_ds.rb +1 -1
- data/lib/dor/datastreams/workflow_definition_ds.rb +0 -22
- data/lib/dor/datastreams/workflow_ds.rb +2 -64
- data/lib/dor/indexers/workflows_indexer.rb +7 -1
- data/lib/dor/models/abstract.rb +2 -4
- data/lib/dor/models/workflow_object.rb +0 -46
- data/lib/dor/release_tags.rb +13 -0
- data/lib/dor/release_tags/identity_metadata.rb +202 -0
- data/lib/dor/release_tags/purl.rb +50 -0
- data/lib/dor/release_tags/purl_client.rb +44 -0
- data/lib/dor/services/release_tag_service.rb +9 -179
- data/lib/dor/services/state_service.rb +23 -0
- data/lib/dor/static_config.rb +108 -0
- data/lib/dor/static_config/fedora_config.rb +36 -0
- data/lib/dor/static_config/solr_config.rb +21 -0
- data/lib/dor/static_config/ssl_config.rb +33 -0
- data/lib/dor/static_config/stacks_config.rb +39 -0
- data/lib/dor/static_config/suri_config.rb +45 -0
- data/lib/dor/static_config/workflow_config.rb +51 -0
- data/lib/dor/version.rb +1 -1
- data/lib/dor/workflow/document.rb +0 -10
- metadata +26 -66
- data/lib/dor/services/cleanup_service.rb +0 -63
- data/lib/dor/services/create_workflow_service.rb +0 -53
- data/lib/dor/services/delete_service.rb +0 -60
- data/lib/dor/services/metadata_handlers/catalog_handler.rb +0 -27
- data/lib/dor/services/metadata_service.rb +0 -64
- data/lib/dor/services/mods2dc.xslt +0 -474
- data/lib/dor/services/public_desc_metadata_service.rb +0 -184
- data/lib/dor/services/purl_client.rb +0 -42
- data/lib/dor/services/thumbnail_service.rb +0 -59
@@ -1,63 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'pathname'
|
4
|
-
|
5
|
-
module Dor
|
6
|
-
# Remove all traces of the object's data files from the workspace and export areas
|
7
|
-
class CleanupService
|
8
|
-
# @param [LyberCore::Robots::WorkItem] dor_item The DOR work item whose workspace should be cleaned up
|
9
|
-
# @return [void] Delete all workspace and export entities for the druid
|
10
|
-
def self.cleanup(dor_item)
|
11
|
-
druid = dor_item.respond_to?(:druid) ? dor_item.druid : dor_item.id
|
12
|
-
cleanup_by_druid druid
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.cleanup_by_druid(druid)
|
16
|
-
cleanup_workspace_content(druid, Config.cleanup.local_workspace_root)
|
17
|
-
cleanup_workspace_content(druid, Config.cleanup.local_assembly_root)
|
18
|
-
cleanup_export(druid)
|
19
|
-
end
|
20
|
-
|
21
|
-
# @param [String] druid The identifier for the object whose data is to be removed
|
22
|
-
# @param [String] base The base directory to delete from
|
23
|
-
# @return [void] remove the object's data files from the workspace area
|
24
|
-
def self.cleanup_workspace_content(druid, base)
|
25
|
-
DruidTools::Druid.new(druid, base).prune!
|
26
|
-
end
|
27
|
-
private_class_method :cleanup_workspace_content
|
28
|
-
|
29
|
-
# @param [String] druid The identifier for the object whose data is to be removed
|
30
|
-
# @return [void] remove copy of the data that was exported to preservation core
|
31
|
-
def self.cleanup_export(druid)
|
32
|
-
id = druid.split(':').last
|
33
|
-
bag_dir = File.join(Config.cleanup.local_export_home, id)
|
34
|
-
remove_branch(bag_dir)
|
35
|
-
tarfile = "#{bag_dir}.tar"
|
36
|
-
remove_branch(tarfile)
|
37
|
-
end
|
38
|
-
private_class_method :cleanup_export
|
39
|
-
|
40
|
-
# @param [Pathname,String] pathname The full path of the branch to be removed
|
41
|
-
# @return [void] Remove the specified directory and all its children
|
42
|
-
def self.remove_branch(pathname)
|
43
|
-
pathname = Pathname(pathname) if pathname.instance_of? String
|
44
|
-
pathname.rmtree if pathname.exist?
|
45
|
-
end
|
46
|
-
private_class_method :remove_branch
|
47
|
-
|
48
|
-
# Tries to remove any exsitence of the object in our systems
|
49
|
-
# Does the following:
|
50
|
-
# - Removes item from Dor/Fedora/Solr
|
51
|
-
# - Removes content from dor workspace
|
52
|
-
# - Removes content from assembly workspace
|
53
|
-
# - Removes content from sdr export area
|
54
|
-
# - Removes content from stacks
|
55
|
-
# - Removes content from purl
|
56
|
-
# - Removes active workflows
|
57
|
-
# @param [String] druid id of the object you wish to remove
|
58
|
-
def self.nuke!(druid)
|
59
|
-
Deprecation.warn(self, 'CleanupService.nuke! is deprecated and will be removed in dor-services 8. Use Dor::DeleteService.destroy() instead.')
|
60
|
-
DeleteService.destroy(druid)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Dor
|
4
|
-
class CreateWorkflowService
|
5
|
-
extend Deprecation
|
6
|
-
# Initializes workflow for the object in the workflow service
|
7
|
-
# It will set the priorty of the new workflow to the current_priority if it is > 0
|
8
|
-
# It will set lane_id from the item's APO default workflow lane
|
9
|
-
# @param [String] name of the workflow to be initialized
|
10
|
-
# @param [Boolean] create_ds create a 'workflows' datastream in Fedora for the object
|
11
|
-
# @param [Integer] priority the workflow's priority level
|
12
|
-
def self.create_workflow(item, name:, create_ds: true, priority: 0)
|
13
|
-
Deprecation.warn(self, 'CreateWorkflowService is deprecated. Use dor-workflow-service instead')
|
14
|
-
new(item).create_workflow(name: name, create_ds: create_ds, priority: priority)
|
15
|
-
end
|
16
|
-
|
17
|
-
def initialize(item)
|
18
|
-
@item = item
|
19
|
-
end
|
20
|
-
|
21
|
-
def create_workflow(name:, create_ds: true, priority: 0)
|
22
|
-
priority = item.workflows.current_priority if priority == 0
|
23
|
-
opts = { create_ds: create_ds, lane_id: default_workflow_lane }
|
24
|
-
opts[:priority] = priority if priority > 0
|
25
|
-
Dor::Config.workflow.client.create_workflow(Dor::WorkflowObject.initial_repo(name),
|
26
|
-
item.pid,
|
27
|
-
name,
|
28
|
-
Dor::WorkflowObject.initial_workflow(name),
|
29
|
-
opts)
|
30
|
-
item.workflows.content(true) # refresh the copy of the workflows datastream
|
31
|
-
end
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
attr_reader :item
|
36
|
-
delegate :admin_policy_object, to: :item
|
37
|
-
|
38
|
-
# Returns the default lane_id from the item's APO. Will return 'default' if the item does not have
|
39
|
-
# and APO, or if the APO does not have a default_lane
|
40
|
-
# @return [String] the lane id
|
41
|
-
def default_workflow_lane
|
42
|
-
return 'default' if admin_policy_object.nil? # TODO: log warning?
|
43
|
-
|
44
|
-
admin_md = admin_policy_object.datastreams['administrativeMetadata']
|
45
|
-
return 'default' unless admin_md.respond_to?(:default_workflow_lane) # Some APOs don't have this datastream
|
46
|
-
|
47
|
-
lane = admin_md.default_workflow_lane
|
48
|
-
return lane unless lane.blank?
|
49
|
-
|
50
|
-
'default'
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Dor
|
4
|
-
# Remove all traces of the object's data files from the workspace and export areas
|
5
|
-
class DeleteService
|
6
|
-
# Tries to remove any exsitence of the object in our systems
|
7
|
-
# Does the following:
|
8
|
-
# - Removes item from Fedora/Solr
|
9
|
-
# - Removes content from dor workspace
|
10
|
-
# - Removes content from assembly workspace
|
11
|
-
# - Removes content from sdr export area
|
12
|
-
# - Removes content from stacks
|
13
|
-
# - Removes content from purl
|
14
|
-
# - Removes active workflows
|
15
|
-
# @param [String] druid id of the object you wish to remove
|
16
|
-
def self.destroy(druid)
|
17
|
-
new(druid).destroy
|
18
|
-
end
|
19
|
-
|
20
|
-
def initialize(druid)
|
21
|
-
@druid = druid
|
22
|
-
end
|
23
|
-
|
24
|
-
def destroy
|
25
|
-
CleanupService.cleanup_by_druid druid
|
26
|
-
cleanup_stacks
|
27
|
-
cleanup_purl_doc_cache
|
28
|
-
remove_active_workflows
|
29
|
-
delete_from_dor
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
attr_reader :druid
|
35
|
-
|
36
|
-
def cleanup_stacks
|
37
|
-
DruidTools::StacksDruid.new(druid, Config.stacks.local_stacks_root).prune!
|
38
|
-
end
|
39
|
-
|
40
|
-
def cleanup_purl_doc_cache
|
41
|
-
DruidTools::PurlDruid.new(druid, Config.stacks.local_document_cache_root).prune!
|
42
|
-
end
|
43
|
-
|
44
|
-
def remove_active_workflows
|
45
|
-
%w[dor sdr].each do |repo|
|
46
|
-
dor_wfs = Dor::Config.workflow.client.workflows(druid, repo)
|
47
|
-
dor_wfs.each { |wf| Dor::Config.workflow.client.delete_workflow(repo, druid, wf) }
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
# Delete an object from DOR.
|
52
|
-
#
|
53
|
-
# @param [string] pid the druid
|
54
|
-
def delete_from_dor
|
55
|
-
Dor::Config.fedora.client["objects/#{druid}"].delete
|
56
|
-
Dor::SearchService.solr.delete_by_id(druid)
|
57
|
-
Dor::SearchService.solr.commit
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rest-client'
|
4
|
-
|
5
|
-
module Dor
|
6
|
-
class CatalogHandler
|
7
|
-
def fetch(prefix, identifier)
|
8
|
-
client = RestClient::Resource.new(Dor::Config.metadata.catalog.url,
|
9
|
-
Dor::Config.metadata.catalog.user,
|
10
|
-
Dor::Config.metadata.catalog.pass)
|
11
|
-
params = "?#{prefix.chomp}=#{identifier.chomp}"
|
12
|
-
client[params].get
|
13
|
-
rescue RestClient::Exception => e
|
14
|
-
raise BadResponseFromCatalog, "#{e.class} - when contacting (with BasicAuth hidden): #{Dor::Config.metadata.catalog.url}#{params}"
|
15
|
-
end
|
16
|
-
|
17
|
-
def label(metadata)
|
18
|
-
mods = Nokogiri::XML(metadata)
|
19
|
-
mods.root.add_namespace_definition('mods', 'http://www.loc.gov/mods/v3')
|
20
|
-
mods.xpath('/mods:mods/mods:titleInfo[1]').xpath('mods:title|mods:nonSort').collect(&:text).join(' ').strip
|
21
|
-
end
|
22
|
-
|
23
|
-
def prefixes
|
24
|
-
%w(catkey barcode)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'cache'
|
4
|
-
require 'dor/services/metadata_handlers/catalog_handler'
|
5
|
-
|
6
|
-
module Dor
|
7
|
-
class MetadataError < RuntimeError; end
|
8
|
-
|
9
|
-
class MetadataService
|
10
|
-
class << self
|
11
|
-
@@cache = Cache.new(nil, nil, 250, 300)
|
12
|
-
|
13
|
-
def known_prefixes
|
14
|
-
handlers.keys
|
15
|
-
end
|
16
|
-
|
17
|
-
def can_resolve?(identifier)
|
18
|
-
(prefix, _identifier) = identifier.split(/:/, 2)
|
19
|
-
handlers.key?(prefix.to_sym)
|
20
|
-
end
|
21
|
-
|
22
|
-
# TODO: Return a prioritized list
|
23
|
-
def resolvable(identifiers)
|
24
|
-
identifiers.select { |identifier| can_resolve?(identifier) }
|
25
|
-
end
|
26
|
-
|
27
|
-
def fetch(identifier)
|
28
|
-
@@cache.fetch(identifier) do
|
29
|
-
(prefix, identifier) = identifier.split(/:/, 2)
|
30
|
-
handler = handler_for(prefix)
|
31
|
-
handler.fetch(prefix, identifier)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def label_for(identifier)
|
36
|
-
(prefix, identifier) = identifier.split(/:/, 2)
|
37
|
-
handler = handler_for(prefix)
|
38
|
-
handler.label(handler.fetch(prefix, identifier))
|
39
|
-
end
|
40
|
-
|
41
|
-
def handler_for(prefix)
|
42
|
-
handler = handlers[prefix.to_sym]
|
43
|
-
raise MetadataError, "Unknown metadata prefix: #{prefix}" if handler.nil?
|
44
|
-
|
45
|
-
handler
|
46
|
-
end
|
47
|
-
|
48
|
-
private
|
49
|
-
|
50
|
-
def handlers
|
51
|
-
@handlers ||= {}.tap do |md_handlers|
|
52
|
-
# There's only one. If additional handlers are added, will need to be registered here.
|
53
|
-
register(CatalogHandler.new, md_handlers)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def register(handler, md_handlers)
|
58
|
-
handler.prefixes.each do |prefix|
|
59
|
-
md_handlers[prefix.to_sym] = handler
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
@@ -1,474 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<xsl:stylesheet version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
3
|
-
xmlns:mods="http://www.loc.gov/mods/v3" exclude-result-prefixes="mods"
|
4
|
-
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
5
|
-
xmlns:srw_dc="info:srw/schema/1/dc-schema"
|
6
|
-
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
|
7
|
-
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
8
|
-
|
9
|
-
<!--
|
10
|
-
This stylesheet transforms MODS version 3.2 records and collections of records to simple Dublin Core (DC) records,
|
11
|
-
based on the Library of Congress' MODS to simple DC mapping <http://www.loc.gov/standards/mods/mods-dcsimple.html>
|
12
|
-
|
13
|
-
The stylesheet will transform a collection of MODS 3.2 records into simple Dublin Core (DC)
|
14
|
-
as expressed by the SRU DC schema <http://www.loc.gov/standards/sru/dc-schema.xsd>
|
15
|
-
|
16
|
-
The stylesheet will transform a single MODS 3.2 record into simple Dublin Core (DC)
|
17
|
-
as expressed by the OAI DC schema <http://www.openarchives.org/OAI/2.0/oai_dc.xsd>
|
18
|
-
|
19
|
-
Because MODS is more granular than DC, transforming a given MODS element or subelement to a DC element frequently results in less precise tagging,
|
20
|
-
and local customizations of the stylesheet may be necessary to achieve desired results.
|
21
|
-
|
22
|
-
This stylesheet makes the following decisions in its interpretation of the MODS to simple DC mapping:
|
23
|
-
|
24
|
-
When the roleTerm value associated with a name is creator, then name maps to dc:creator
|
25
|
-
When there is no roleTerm value associated with name, or the roleTerm value associated with name is a value other than creator, then name maps to dc:contributor
|
26
|
-
Start and end dates are presented as span dates in dc:date and in dc:coverage
|
27
|
-
When the first subelement in a subject wrapper is topic, subject subelements are strung together in dc:subject with hyphens separating them
|
28
|
-
Some subject subelements, i.e., geographic, temporal, hierarchicalGeographic, and cartographics, are also parsed into dc:coverage
|
29
|
-
The subject subelement geographicCode is dropped in the transform
|
30
|
-
|
31
|
-
|
32
|
-
Revision 1.1 2007-05-18 <tmee@loc.gov>
|
33
|
-
Added modsCollection conversion to DC SRU
|
34
|
-
Updated introductory documentation
|
35
|
-
|
36
|
-
Version 1.0 2007-05-04 Tracy Meehleib <tmee@loc.gov>
|
37
|
-
|
38
|
-
-->
|
39
|
-
|
40
|
-
<xsl:output method="xml" indent="yes"/>
|
41
|
-
|
42
|
-
<xsl:template match="/">
|
43
|
-
<xsl:choose>
|
44
|
-
<xsl:when test="//mods:modsCollection">
|
45
|
-
<srw_dc:dcCollection xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:srw_dc="info:srw/schema/1/dc-schema" xsi:schemaLocation="info:srw/schema/1/dc-schema http://www.loc.gov/standards/sru/dc-schema.xsd">
|
46
|
-
<xsl:apply-templates/>
|
47
|
-
<xsl:for-each select="mods:modsCollection/mods:mods">
|
48
|
-
<srw_dc:dc xsi:schemaLocation="info:srw/schema/1/dc-schema http://www.loc.gov/standards/sru/dc-schema.xsd">
|
49
|
-
|
50
|
-
<xsl:apply-templates/>
|
51
|
-
</srw_dc:dc>
|
52
|
-
</xsl:for-each>
|
53
|
-
</srw_dc:dcCollection>
|
54
|
-
</xsl:when>
|
55
|
-
<xsl:otherwise>
|
56
|
-
<xsl:for-each select="mods:mods">
|
57
|
-
<oai_dc:dc xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:srw_dc="info:srw/schema/1/dc-schema" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
|
58
|
-
<xsl:apply-templates/>
|
59
|
-
|
60
|
-
</oai_dc:dc>
|
61
|
-
</xsl:for-each>
|
62
|
-
</xsl:otherwise>
|
63
|
-
</xsl:choose>
|
64
|
-
</xsl:template>
|
65
|
-
|
66
|
-
<xsl:template match="mods:titleInfo">
|
67
|
-
<dc:title>
|
68
|
-
<xsl:value-of select="mods:nonSort"/>
|
69
|
-
<xsl:if test="mods:nonSort">
|
70
|
-
|
71
|
-
<xsl:text> </xsl:text>
|
72
|
-
</xsl:if>
|
73
|
-
<xsl:value-of select="mods:title"/>
|
74
|
-
<xsl:if test="mods:subTitle">
|
75
|
-
<xsl:text>: </xsl:text>
|
76
|
-
<xsl:value-of select="mods:subTitle"/>
|
77
|
-
</xsl:if>
|
78
|
-
<xsl:if test="mods:partNumber">
|
79
|
-
|
80
|
-
<xsl:text>. </xsl:text>
|
81
|
-
<xsl:value-of select="mods:partNumber"/>
|
82
|
-
</xsl:if>
|
83
|
-
<xsl:if test="mods:partName">
|
84
|
-
<xsl:text>. </xsl:text>
|
85
|
-
<xsl:value-of select="mods:partName"/>
|
86
|
-
</xsl:if>
|
87
|
-
</dc:title>
|
88
|
-
|
89
|
-
</xsl:template>
|
90
|
-
|
91
|
-
<xsl:template match="mods:name">
|
92
|
-
<xsl:choose>
|
93
|
-
<xsl:when
|
94
|
-
test="mods:role/mods:roleTerm[@type='text']='creator' or mods:role/mods:roleTerm[@type='code']='cre' ">
|
95
|
-
<dc:creator>
|
96
|
-
<xsl:call-template name="name"/>
|
97
|
-
</dc:creator>
|
98
|
-
</xsl:when>
|
99
|
-
|
100
|
-
<xsl:otherwise>
|
101
|
-
<dc:contributor>
|
102
|
-
<xsl:call-template name="name"/>
|
103
|
-
</dc:contributor>
|
104
|
-
</xsl:otherwise>
|
105
|
-
</xsl:choose>
|
106
|
-
</xsl:template>
|
107
|
-
|
108
|
-
<xsl:template match="mods:classification">
|
109
|
-
|
110
|
-
<dc:subject>
|
111
|
-
<xsl:value-of select="."/>
|
112
|
-
</dc:subject>
|
113
|
-
</xsl:template>
|
114
|
-
|
115
|
-
<xsl:template match="mods:subject[mods:topic | mods:name | mods:occupation | mods:geographic | mods:hierarchicalGeographic | mods:cartographics | mods:temporal] ">
|
116
|
-
<dc:subject>
|
117
|
-
<xsl:for-each select="mods:topic">
|
118
|
-
<xsl:value-of select="."/>
|
119
|
-
|
120
|
-
<xsl:if test="position()!=last()">--</xsl:if>
|
121
|
-
</xsl:for-each>
|
122
|
-
|
123
|
-
<xsl:for-each select="mods:occupation">
|
124
|
-
<xsl:value-of select="."/>
|
125
|
-
<xsl:if test="position()!=last()">--</xsl:if>
|
126
|
-
</xsl:for-each>
|
127
|
-
|
128
|
-
<xsl:for-each select="mods:name">
|
129
|
-
|
130
|
-
<xsl:call-template name="name"/>
|
131
|
-
</xsl:for-each>
|
132
|
-
</dc:subject>
|
133
|
-
|
134
|
-
<xsl:for-each select="mods:titleInfo/mods:title">
|
135
|
-
<dc:subject>
|
136
|
-
<xsl:value-of select="mods:titleInfo/mods:title"/>
|
137
|
-
</dc:subject>
|
138
|
-
</xsl:for-each>
|
139
|
-
|
140
|
-
<xsl:for-each select="mods:geographic">
|
141
|
-
<dc:coverage>
|
142
|
-
<xsl:value-of select="."/>
|
143
|
-
</dc:coverage>
|
144
|
-
</xsl:for-each>
|
145
|
-
|
146
|
-
<xsl:for-each select="mods:hierarchicalGeographic">
|
147
|
-
<dc:coverage>
|
148
|
-
<xsl:for-each
|
149
|
-
select="mods:continent|mods:country|mods:provence|mods:region|mods:state|mods:territory|mods:county|mods:city|mods:island|mods:area">
|
150
|
-
|
151
|
-
<xsl:value-of select="."/>
|
152
|
-
<xsl:if test="position()!=last()">--</xsl:if>
|
153
|
-
</xsl:for-each>
|
154
|
-
</dc:coverage>
|
155
|
-
</xsl:for-each>
|
156
|
-
|
157
|
-
<xsl:for-each select="mods:cartographics/*">
|
158
|
-
<dc:coverage>
|
159
|
-
<xsl:value-of select="."/>
|
160
|
-
|
161
|
-
</dc:coverage>
|
162
|
-
</xsl:for-each>
|
163
|
-
|
164
|
-
<xsl:if test="mods:temporal">
|
165
|
-
<dc:coverage>
|
166
|
-
<xsl:for-each select="mods:temporal">
|
167
|
-
<xsl:value-of select="."/>
|
168
|
-
<xsl:if test="position()!=last()">-</xsl:if>
|
169
|
-
</xsl:for-each>
|
170
|
-
|
171
|
-
</dc:coverage>
|
172
|
-
</xsl:if>
|
173
|
-
|
174
|
-
<xsl:if test="*[1][local-name()='topic'] and *[local-name()!='topic']">
|
175
|
-
<dc:subject>
|
176
|
-
<xsl:for-each select="*[local-name()!='cartographics' and local-name()!='geographicCode' and local-name()!='hierarchicalGeographic'] ">
|
177
|
-
<xsl:value-of select="."/>
|
178
|
-
<xsl:if test="position()!=last()">--</xsl:if>
|
179
|
-
</xsl:for-each>
|
180
|
-
|
181
|
-
</dc:subject>
|
182
|
-
</xsl:if>
|
183
|
-
</xsl:template>
|
184
|
-
|
185
|
-
<xsl:template match="mods:abstract | mods:tableOfContents | mods:note">
|
186
|
-
<dc:description>
|
187
|
-
<xsl:copy-of select="@type"/>
|
188
|
-
<xsl:copy-of select="@displayLabel"/>
|
189
|
-
<xsl:value-of select="."/>
|
190
|
-
</dc:description>
|
191
|
-
</xsl:template>
|
192
|
-
|
193
|
-
<xsl:template match="mods:originInfo">
|
194
|
-
<xsl:apply-templates select="*[@point='start']"/>
|
195
|
-
<xsl:for-each
|
196
|
-
select="mods:dateIssued[(count(@point) = 0) or (@point!='start' and @point!='end')] |mods:dateCreated[(count(@point) = 0) or (@point!='start' and @point!='end')] | mods:dateCaptured[(count(@point) = 0) or (@point!='start' and @point!='end')] | mods:dateOther[(count(@point) = 0) or (@point!='start' and @point!='end')]">
|
197
|
-
<dc:date>
|
198
|
-
<xsl:value-of select="."/>
|
199
|
-
</dc:date>
|
200
|
-
</xsl:for-each>
|
201
|
-
|
202
|
-
<xsl:for-each select="mods:publisher">
|
203
|
-
|
204
|
-
<dc:publisher>
|
205
|
-
<xsl:value-of select="."/>
|
206
|
-
</dc:publisher>
|
207
|
-
</xsl:for-each>
|
208
|
-
</xsl:template>
|
209
|
-
|
210
|
-
<xsl:template match="mods:dateIssued | mods:dateCreated | mods:dateCaptured">
|
211
|
-
<dc:date>
|
212
|
-
<xsl:choose>
|
213
|
-
|
214
|
-
<xsl:when test="@point='start'">
|
215
|
-
<xsl:value-of select="."/>
|
216
|
-
<xsl:text> - </xsl:text>
|
217
|
-
</xsl:when>
|
218
|
-
<xsl:when test="@point='end'">
|
219
|
-
<xsl:value-of select="."/>
|
220
|
-
</xsl:when>
|
221
|
-
<xsl:otherwise>
|
222
|
-
|
223
|
-
<xsl:value-of select="."/>
|
224
|
-
</xsl:otherwise>
|
225
|
-
</xsl:choose>
|
226
|
-
</dc:date>
|
227
|
-
</xsl:template>
|
228
|
-
|
229
|
-
<xsl:template match="mods:genre">
|
230
|
-
<xsl:choose>
|
231
|
-
<xsl:when test="@authority='dct'">
|
232
|
-
|
233
|
-
<dc:type>
|
234
|
-
<xsl:value-of select="."/>
|
235
|
-
</dc:type>
|
236
|
-
<xsl:for-each select="mods:typeOfResource">
|
237
|
-
<dc:type>
|
238
|
-
<xsl:value-of select="."/>
|
239
|
-
</dc:type>
|
240
|
-
</xsl:for-each>
|
241
|
-
</xsl:when>
|
242
|
-
|
243
|
-
<xsl:otherwise>
|
244
|
-
<dc:type>
|
245
|
-
<xsl:value-of select="."/>
|
246
|
-
</dc:type>
|
247
|
-
</xsl:otherwise>
|
248
|
-
</xsl:choose>
|
249
|
-
</xsl:template>
|
250
|
-
|
251
|
-
<xsl:template match="mods:typeOfResource">
|
252
|
-
|
253
|
-
<xsl:if test="@collection='yes'">
|
254
|
-
<dc:type>Collection</dc:type>
|
255
|
-
</xsl:if>
|
256
|
-
<xsl:if test=". ='software' and ../mods:genre='database'">
|
257
|
-
<dc:type>DataSet</dc:type>
|
258
|
-
</xsl:if>
|
259
|
-
<xsl:if test=".='software' and ../mods:genre='online system or service'">
|
260
|
-
<dc:type>Service</dc:type>
|
261
|
-
|
262
|
-
</xsl:if>
|
263
|
-
<xsl:if test=".='software'">
|
264
|
-
<dc:type>Software</dc:type>
|
265
|
-
</xsl:if>
|
266
|
-
<xsl:if test=".='cartographic material'">
|
267
|
-
<dc:type>Image</dc:type>
|
268
|
-
</xsl:if>
|
269
|
-
<xsl:if test=".='multimedia'">
|
270
|
-
|
271
|
-
<dc:type>InteractiveResource</dc:type>
|
272
|
-
</xsl:if>
|
273
|
-
<xsl:if test=".='moving image'">
|
274
|
-
<dc:type>MovingImage</dc:type>
|
275
|
-
</xsl:if>
|
276
|
-
<xsl:if test=".='three-dimensional object'">
|
277
|
-
<dc:type>PhysicalObject</dc:type>
|
278
|
-
|
279
|
-
</xsl:if>
|
280
|
-
<xsl:if test="starts-with(.,'sound recording')">
|
281
|
-
<dc:type>Sound</dc:type>
|
282
|
-
</xsl:if>
|
283
|
-
<xsl:if test=".='still image'">
|
284
|
-
<dc:type>StillImage</dc:type>
|
285
|
-
</xsl:if>
|
286
|
-
<xsl:if test=". ='text'">
|
287
|
-
|
288
|
-
<dc:type>Text</dc:type>
|
289
|
-
</xsl:if>
|
290
|
-
<xsl:if test=".='notated music'">
|
291
|
-
<dc:type>Text</dc:type>
|
292
|
-
</xsl:if>
|
293
|
-
</xsl:template>
|
294
|
-
|
295
|
-
<xsl:template match="mods:physicalDescription">
|
296
|
-
|
297
|
-
<xsl:if test="mods:extent">
|
298
|
-
<dc:format>
|
299
|
-
<xsl:value-of select="mods:extent"/>
|
300
|
-
</dc:format>
|
301
|
-
</xsl:if>
|
302
|
-
<xsl:if test="mods:form">
|
303
|
-
<dc:format>
|
304
|
-
<xsl:value-of select="mods:form"/>
|
305
|
-
</dc:format>
|
306
|
-
|
307
|
-
</xsl:if>
|
308
|
-
<xsl:if test="mods:internetMediaType">
|
309
|
-
<dc:format>
|
310
|
-
<xsl:value-of select="mods:internetMediaType"/>
|
311
|
-
</dc:format>
|
312
|
-
</xsl:if>
|
313
|
-
</xsl:template>
|
314
|
-
|
315
|
-
<xsl:template match="mods:mimeType">
|
316
|
-
|
317
|
-
<dc:format>
|
318
|
-
<xsl:value-of select="."/>
|
319
|
-
</dc:format>
|
320
|
-
</xsl:template>
|
321
|
-
|
322
|
-
<xsl:template match="mods:identifier">
|
323
|
-
<xsl:variable name="type" select="translate(@type,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/>
|
324
|
-
<xsl:choose>
|
325
|
-
<xsl:when test="contains ('isbn issn uri doi lccn uri', $type)">
|
326
|
-
|
327
|
-
<dc:identifier>
|
328
|
-
<xsl:value-of select="$type"/>: <xsl:value-of select="."/>
|
329
|
-
</dc:identifier>
|
330
|
-
</xsl:when>
|
331
|
-
<xsl:otherwise>
|
332
|
-
<dc:identifier>
|
333
|
-
<xsl:value-of select="."/>
|
334
|
-
</dc:identifier>
|
335
|
-
|
336
|
-
</xsl:otherwise>
|
337
|
-
</xsl:choose>
|
338
|
-
</xsl:template>
|
339
|
-
|
340
|
-
<xsl:template match="mods:location[mods:url]">
|
341
|
-
<dc:identifier>
|
342
|
-
<xsl:for-each select="mods:url">
|
343
|
-
<xsl:value-of select="."/>
|
344
|
-
</xsl:for-each>
|
345
|
-
|
346
|
-
</dc:identifier>
|
347
|
-
</xsl:template>
|
348
|
-
|
349
|
-
<xsl:template match="mods:language">
|
350
|
-
<dc:language>
|
351
|
-
<xsl:value-of select="normalize-space(.)"/>
|
352
|
-
</dc:language>
|
353
|
-
</xsl:template>
|
354
|
-
|
355
|
-
<xsl:template match="mods:relatedItem[mods:titleInfo | mods:name | mods:identifier | mods:location]">
|
356
|
-
|
357
|
-
<xsl:choose>
|
358
|
-
<xsl:when test="@type='original'">
|
359
|
-
<dc:source>
|
360
|
-
<xsl:for-each
|
361
|
-
select="mods:titleInfo/mods:title | mods:identifier | mods:location/mods:url">
|
362
|
-
<xsl:if test="normalize-space(.)!= ''">
|
363
|
-
<xsl:value-of select="."/>
|
364
|
-
<xsl:if test="position()!=last()">--</xsl:if>
|
365
|
-
</xsl:if>
|
366
|
-
|
367
|
-
</xsl:for-each>
|
368
|
-
</dc:source>
|
369
|
-
</xsl:when>
|
370
|
-
<xsl:when test="@type='series'"/>
|
371
|
-
<xsl:otherwise>
|
372
|
-
<dc:relation>
|
373
|
-
<xsl:if test="mods:location/mods:url">
|
374
|
-
<xsl:attribute name="type">url</xsl:attribute>
|
375
|
-
<xsl:attribute name="href"><xsl:value-of select="mods:location/mods:url"/></xsl:attribute>
|
376
|
-
</xsl:if>
|
377
|
-
<xsl:for-each
|
378
|
-
select="mods:titleInfo/mods:title | mods:identifier">
|
379
|
-
<xsl:if test="normalize-space(.)!= ''">
|
380
|
-
<xsl:value-of select="."/>
|
381
|
-
|
382
|
-
<xsl:if test="position()!=last()">--</xsl:if>
|
383
|
-
</xsl:if>
|
384
|
-
</xsl:for-each>
|
385
|
-
</dc:relation>
|
386
|
-
</xsl:otherwise>
|
387
|
-
</xsl:choose>
|
388
|
-
</xsl:template>
|
389
|
-
|
390
|
-
|
391
|
-
<xsl:template match="mods:location[mods:physicalLocation[@type='repository']]">
|
392
|
-
<dc:relation type="repository">
|
393
|
-
<xsl:value-of select="normalize-space(.)"/>
|
394
|
-
</dc:relation>
|
395
|
-
</xsl:template>
|
396
|
-
<xsl:template match="mods:relatedItem[@type='host']">
|
397
|
-
<xsl:choose>
|
398
|
-
<xsl:when test="mods:location/mods:physicalLocation[@type='location']">
|
399
|
-
<dc:relation type="location">
|
400
|
-
<xsl:value-of select="normalize-space(.)"/>
|
401
|
-
</dc:relation>
|
402
|
-
</xsl:when>
|
403
|
-
<xsl:when test="mods:typeOfResource[@collection='yes']">
|
404
|
-
<dc:relation type="collection">
|
405
|
-
<xsl:value-of select="normalize-space(mods:titleInfo/mods:title)"/>
|
406
|
-
</dc:relation>
|
407
|
-
</xsl:when>
|
408
|
-
</xsl:choose>
|
409
|
-
</xsl:template>
|
410
|
-
|
411
|
-
<xsl:template match="mods:accessCondition">
|
412
|
-
|
413
|
-
<dc:rights>
|
414
|
-
<xsl:value-of select="."/>
|
415
|
-
</dc:rights>
|
416
|
-
</xsl:template>
|
417
|
-
|
418
|
-
<xsl:template name="name">
|
419
|
-
<xsl:variable name="name">
|
420
|
-
<xsl:for-each select="mods:namePart[not(@type)]">
|
421
|
-
<xsl:if test="normalize-space(.)!= ''">
|
422
|
-
<xsl:text> </xsl:text>
|
423
|
-
<xsl:value-of select="normalize-space(.)"/>
|
424
|
-
<xsl:text></xsl:text>
|
425
|
-
</xsl:if>
|
426
|
-
</xsl:for-each>
|
427
|
-
<xsl:value-of select="mods:namePart[@type='family']"/>
|
428
|
-
<xsl:if test="mods:namePart[@type='given']">
|
429
|
-
<xsl:text>, </xsl:text>
|
430
|
-
<xsl:value-of select="normalize-space(mods:namePart[@type='given'])"/>
|
431
|
-
</xsl:if>
|
432
|
-
<xsl:if test="mods:namePart[@type='date']">
|
433
|
-
<xsl:text>, </xsl:text>
|
434
|
-
<xsl:value-of select="mods:namePart[@type='date']"/>
|
435
|
-
<xsl:text/>
|
436
|
-
</xsl:if>
|
437
|
-
<xsl:if test="mods:displayForm">
|
438
|
-
<xsl:text> (</xsl:text>
|
439
|
-
<xsl:value-of select="mods:displayForm"/>
|
440
|
-
<xsl:text>) </xsl:text>
|
441
|
-
</xsl:if>
|
442
|
-
<xsl:for-each select="mods:role[mods:roleTerm[@type='text']!='creator']">
|
443
|
-
<xsl:text> (</xsl:text>
|
444
|
-
<xsl:value-of select="normalize-space(.)"/>
|
445
|
-
<xsl:text>) </xsl:text>
|
446
|
-
</xsl:for-each>
|
447
|
-
|
448
|
-
</xsl:variable>
|
449
|
-
<xsl:value-of select="normalize-space($name)"/>
|
450
|
-
</xsl:template>
|
451
|
-
|
452
|
-
<xsl:template match="mods:dateIssued[@point='start'] | mods:dateCreated[@point='start'] | mods:dateCaptured[@point='start'] | mods:dateOther[@point='start'] ">
|
453
|
-
<xsl:variable name="dateName" select="local-name()"/>
|
454
|
-
<dc:date>
|
455
|
-
<xsl:value-of select="."/>-<xsl:value-of select="../*[local-name()=$dateName][@point='end']"/>
|
456
|
-
</dc:date>
|
457
|
-
|
458
|
-
</xsl:template>
|
459
|
-
|
460
|
-
<xsl:template match="mods:temporal[@point='start'] ">
|
461
|
-
<xsl:value-of select="."/>-<xsl:value-of select="../mods:temporal[@point='end']"/>
|
462
|
-
</xsl:template>
|
463
|
-
|
464
|
-
<xsl:template match="mods:temporal[(count(@point) = 0) or (@point!='start' and @point!='end')] ">
|
465
|
-
<xsl:value-of select="."/>
|
466
|
-
</xsl:template>
|
467
|
-
|
468
|
-
<!-- suppress all else:-->
|
469
|
-
|
470
|
-
<xsl:template match="*"/>
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
</xsl:stylesheet>
|