qa 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/controllers/qa/linked_data_terms_controller.rb +30 -9
- data/app/controllers/qa/terms_controller.rb +3 -2
- data/app/models/qa/linked_data/config/context_property_map.rb +6 -25
- data/app/services/qa/iri_template_service.rb +32 -24
- data/app/services/qa/linked_data/authority_service.rb +8 -0
- data/app/services/qa/linked_data/authority_url_service.rb +27 -8
- data/app/services/qa/linked_data/deep_sort_service.rb +3 -2
- data/app/services/qa/linked_data/graph_service.rb +13 -0
- data/app/services/qa/linked_data/language_service.rb +12 -0
- data/app/services/qa/linked_data/language_sort_service.rb +7 -2
- data/app/services/qa/linked_data/ldpath_service.rb +40 -0
- data/app/services/qa/linked_data/mapper/graph_ldpath_mapper_service.rb +49 -0
- data/app/services/qa/linked_data/mapper/graph_mapper_service.rb +3 -11
- data/app/services/qa/linked_data/mapper/graph_predicate_mapper_service.rb +40 -0
- data/app/services/qa/linked_data/mapper/search_results_mapper_service.rb +58 -11
- data/app/services/qa/linked_data/mapper/term_results_mapper_service.rb +80 -0
- data/config/authorities/linked_data/loc.json +13 -7
- data/config/authorities/linked_data/oclc_fast.json +13 -8
- data/lib/generators/qa/discogs/USAGE +10 -0
- data/lib/generators/qa/discogs/discogs_generator.rb +12 -0
- data/lib/generators/qa/discogs/templates/config/discogs-formats.yml +346 -0
- data/lib/generators/qa/discogs/templates/config/discogs-genres.yml +627 -0
- data/lib/generators/qa/install/templates/config/initializers/qa.rb +4 -0
- data/lib/qa.rb +6 -0
- data/lib/qa/authorities.rb +2 -0
- data/lib/qa/authorities/discogs.rb +28 -0
- data/lib/qa/authorities/discogs/discogs_instance_builder.rb +145 -0
- data/lib/qa/authorities/discogs/discogs_translation.rb +126 -0
- data/lib/qa/authorities/discogs/discogs_utils.rb +89 -0
- data/lib/qa/authorities/discogs/discogs_works_builder.rb +153 -0
- data/lib/qa/authorities/discogs/generic_authority.rb +151 -0
- data/lib/qa/authorities/discogs_subauthority.rb +9 -0
- data/lib/qa/authorities/linked_data/config.rb +7 -3
- data/lib/qa/authorities/linked_data/config/search_config.rb +99 -11
- data/lib/qa/authorities/linked_data/config/term_config.rb +112 -8
- data/lib/qa/authorities/linked_data/find_term.rb +154 -84
- data/lib/qa/authorities/linked_data/search_query.rb +76 -13
- data/lib/qa/configuration.rb +8 -0
- data/lib/qa/version.rb +1 -1
- data/spec/controllers/linked_data_terms_controller_spec.rb +151 -30
- data/spec/controllers/terms_controller_spec.rb +4 -0
- data/spec/features/linked_data/language_spec.rb +298 -0
- data/spec/fixtures/authorities/linked_data/lod_full_config.json +21 -5
- data/spec/fixtures/authorities/linked_data/lod_lang_defaults.json +4 -4
- data/spec/fixtures/authorities/linked_data/lod_lang_multi_defaults.json +4 -4
- data/spec/fixtures/authorities/linked_data/lod_lang_no_defaults.json +4 -5
- data/spec/fixtures/authorities/linked_data/lod_lang_param.json +4 -4
- data/spec/fixtures/authorities/linked_data/lod_term_uri_param_config.json +1 -1
- data/spec/fixtures/discogs-find-response-json.json +1 -0
- data/spec/fixtures/discogs-find-response-jsonld-master.json +1 -0
- data/spec/fixtures/discogs-find-response-jsonld-release.json +1 -0
- data/spec/fixtures/discogs-id-matches-master.json +1 -0
- data/spec/fixtures/discogs-id-matches-release.json +1 -0
- data/spec/fixtures/discogs-id-not-found-master.json +1 -0
- data/spec/fixtures/discogs-id-not-found-release.json +1 -0
- data/spec/fixtures/discogs-search-response-no-auth.json +1 -0
- data/spec/fixtures/discogs-search-response-no-subauth.json +1 -0
- data/spec/fixtures/discogs-search-response-subauth.json +1 -0
- data/spec/fixtures/lod_lang_search_enesfrde.rdf.xml +60 -0
- data/spec/fixtures/lod_lang_search_sv.rdf.xml +42 -0
- data/spec/fixtures/lod_loc_term_found.rdf.xml +5 -0
- data/spec/lib/authorities/discogs/generic_authority_spec.rb +235 -0
- data/spec/lib/authorities/discogs_spec.rb +17 -0
- data/spec/lib/authorities/linked_data/config_spec.rb +68 -5
- data/spec/lib/authorities/linked_data/find_term_spec.rb +298 -3
- data/spec/lib/authorities/linked_data/generic_authority_spec.rb +46 -485
- data/spec/lib/authorities/linked_data/search_config_spec.rb +154 -3
- data/spec/lib/authorities/linked_data/search_query_spec.rb +240 -3
- data/spec/lib/authorities/linked_data/term_config_spec.rb +193 -5
- data/spec/lib/configuration_spec.rb +18 -0
- data/spec/models/linked_data/config/context_property_map_spec.rb +3 -31
- data/spec/services/iri_template_service_spec.rb +54 -12
- data/spec/{lib/authorities → services}/linked_data/authority_service_spec.rb +47 -0
- data/spec/services/linked_data/language_service_spec.rb +52 -11
- data/spec/services/linked_data/ldpath_service_spec.rb +61 -0
- data/spec/services/linked_data/mapper/graph_ldpath_mapper_service_spec.rb +118 -0
- data/spec/services/linked_data/mapper/graph_predicate_mapper_service_spec.rb +110 -0
- data/spec/services/linked_data/mapper/term_results_mapper_service_spec.rb +94 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/support/matchers/include_hash.rb +5 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +4 -0
- metadata +73 -5
- data/lib/qa/authorities/linked_data/rdf_helper.rb +0 -49
@@ -0,0 +1,49 @@
|
|
1
|
+
# Provide service for mapping predicates to object values.
|
2
|
+
module Qa
|
3
|
+
module LinkedData
|
4
|
+
module Mapper
|
5
|
+
class GraphLdpathMapperService
|
6
|
+
class_attribute :ldpath_service
|
7
|
+
self.ldpath_service = Qa::LinkedData::LdpathService
|
8
|
+
|
9
|
+
# Extract values for ldpath specified in the ldpath_map from the graph and return as a value map for a single subject URI.
|
10
|
+
# @param graph [RDF::Graph] the graph from which to extract result values
|
11
|
+
# @param prefixes [Hash<Symbol><String>] URL map of prefixes to use with ldpaths
|
12
|
+
# @example prefixes
|
13
|
+
# {
|
14
|
+
# locid: 'http://id.loc.gov/vocabulary/identifiers/',
|
15
|
+
# skos: 'http://www.w3.org/2004/02/skos/core#',
|
16
|
+
# vivo: 'http://vivoweb.org/ontology/core#'
|
17
|
+
# }
|
18
|
+
# @param ldpath [Hash<Symbol><String||Symbol>] value either maps to a ldpath in the graph or is :subject_uri indicating to use the subject uri as the value
|
19
|
+
# @example ldpath map
|
20
|
+
# {
|
21
|
+
# uri: :subject_uri,
|
22
|
+
# id: 'locid:lccn :: xsd::string',
|
23
|
+
# label: 'skos:prefLabel :: xsd::string',
|
24
|
+
# altlabel: 'skos:altLabel :: xsd::string',
|
25
|
+
# sort: 'vivo:rank :: xsd::integer'
|
26
|
+
# }
|
27
|
+
# @param subject_uri [RDF::URI] the subject within the graph for which the values are being extracted
|
28
|
+
# @return [<Hash<Symbol><Array<Object>>] mapped result values with hash of map key = array of object values identified by the ldpath map.
|
29
|
+
# @example value map for a single result
|
30
|
+
# {:uri=>[#<RDF::URI:0x3fcff54a829c URI:http://id.loc.gov/authorities/names/n2010043281>],
|
31
|
+
# :id=>[#<RDF::Literal:0x3fcff4a367b4("n2010043281")>],
|
32
|
+
# :label=>[#<RDF::Literal:0x3fcff54a9a98("Valli, Sabrina"@en)>],
|
33
|
+
# :altlabel=>[],
|
34
|
+
# :sort=>[#<RDF::Literal:0x3fcff54b4c18("2")>]}
|
35
|
+
def self.map_values(graph:, ldpath_map:, subject_uri:, prefixes: {})
|
36
|
+
value_map = {}
|
37
|
+
ldpath_map.each do |key, ldpath|
|
38
|
+
next value_map[key] = [subject_uri] if ldpath == :subject_uri
|
39
|
+
ldpath_program = ldpath_service.ldpath_program(ldpath: ldpath, prefixes: prefixes)
|
40
|
+
values = ldpath_service.ldpath_evaluate(program: ldpath_program, graph: graph, subject_uri: subject_uri)
|
41
|
+
value_map[key] = values
|
42
|
+
end
|
43
|
+
value_map = yield value_map if block_given?
|
44
|
+
value_map
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -3,9 +3,6 @@ module Qa
|
|
3
3
|
module LinkedData
|
4
4
|
module Mapper
|
5
5
|
class GraphMapperService
|
6
|
-
class_attribute :graph_service
|
7
|
-
self.graph_service = Qa::LinkedData::GraphService
|
8
|
-
|
9
6
|
# Extract predicates specified in the predicate_map from the graph and return as a value map for a single subject URI.
|
10
7
|
# @param graph [RDF::Graph] the graph from which to extract result values
|
11
8
|
# @param predicate_map [Hash<Symbol><String||Symbol>] value either maps to a predicate in the graph or is :subject_uri indicating to use the subject uri as the value
|
@@ -25,14 +22,9 @@ module Qa
|
|
25
22
|
# :label=>[#<RDF::Literal:0x3fcff54a9a98("Valli, Sabrina"@en)>],
|
26
23
|
# :altlabel=>[],
|
27
24
|
# :sort=>[#<RDF::Literal:0x3fcff54b4c18("2")>]}
|
28
|
-
def self.map_values(graph:, predicate_map:, subject_uri
|
29
|
-
|
30
|
-
|
31
|
-
values = predicate == :subject_uri ? [subject_uri] : graph_service.object_values(graph: graph, subject: subject_uri, predicate: predicate)
|
32
|
-
value_map[key] = values
|
33
|
-
end
|
34
|
-
value_map = yield value_map if block_given?
|
35
|
-
value_map
|
25
|
+
def self.map_values(graph:, predicate_map:, subject_uri:, &block)
|
26
|
+
Qa.deprecation_warning(msg: "`Qa::LinkedData::Mapper::GraphMapperService` is deprecated; update to `Qa::LinkedData::Mapper::GraphPredicateMapperService`.")
|
27
|
+
Qa::LinkedData::Mapper::GraphPredicateMapperService.map_values(graph: graph, predicate_map: predicate_map, subject_uri: subject_uri, &block)
|
36
28
|
end
|
37
29
|
end
|
38
30
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Provide service for mapping predicates to object values.
|
2
|
+
module Qa
|
3
|
+
module LinkedData
|
4
|
+
module Mapper
|
5
|
+
class GraphPredicateMapperService
|
6
|
+
class_attribute :graph_service
|
7
|
+
self.graph_service = Qa::LinkedData::GraphService
|
8
|
+
|
9
|
+
# Extract predicates specified in the predicate_map from the graph and return as a value map for a single subject URI.
|
10
|
+
# @param graph [RDF::Graph] the graph from which to extract result values
|
11
|
+
# @param predicate_map [Hash<Symbol><String||Symbol>] value either maps to a predicate in the graph or is :subject_uri indicating to use the subject uri as the value
|
12
|
+
# @example predicate_map
|
13
|
+
# {
|
14
|
+
# uri: :subject_uri,
|
15
|
+
# id: [#<RDF::URI URI:http://id.loc.gov/vocabulary/identifiers/lccn>],
|
16
|
+
# label: [#<RDF::URI URI:http://www.w3.org/2004/02/skos/core#prefLabel>],
|
17
|
+
# altlabel: [#<RDF::URI URI:http://www.w3.org/2004/02/skos/core#altLabel>],
|
18
|
+
# sort: [#<RDF::URI URI:http://vivoweb.org/ontology/core#rank>]'
|
19
|
+
# }
|
20
|
+
# @param subject_uri [RDF::URI] the subject within the graph for which the values are being extracted
|
21
|
+
# @return [<Hash<Symbol><Array<Object>>] mapped result values with hash of map key = array of object values for predicates identified in predicate_map.
|
22
|
+
# @example value map for a single result
|
23
|
+
# {:uri=>[#<RDF::URI:0x3fcff54a829c URI:http://id.loc.gov/authorities/names/n2010043281>],
|
24
|
+
# :id=>[#<RDF::Literal:0x3fcff4a367b4("n2010043281")>],
|
25
|
+
# :label=>[#<RDF::Literal:0x3fcff54a9a98("Valli, Sabrina"@en)>],
|
26
|
+
# :altlabel=>[],
|
27
|
+
# :sort=>[#<RDF::Literal:0x3fcff54b4c18("2")>]}
|
28
|
+
def self.map_values(graph:, predicate_map:, subject_uri:)
|
29
|
+
value_map = {}
|
30
|
+
predicate_map.each do |key, predicate|
|
31
|
+
values = predicate == :subject_uri ? [subject_uri] : graph_service.object_values(graph: graph, subject: subject_uri, predicate: predicate)
|
32
|
+
value_map[key] = values
|
33
|
+
end
|
34
|
+
value_map = yield value_map if block_given?
|
35
|
+
value_map
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -3,8 +3,9 @@ module Qa
|
|
3
3
|
module LinkedData
|
4
4
|
module Mapper
|
5
5
|
class SearchResultsMapperService
|
6
|
-
class_attribute :
|
7
|
-
self.
|
6
|
+
class_attribute :graph_ldpath_mapper_service, :graph_predicate_mapper_service, :deep_sort_service, :context_mapper_service
|
7
|
+
self.graph_ldpath_mapper_service = Qa::LinkedData::Mapper::GraphLdpathMapperService
|
8
|
+
self.graph_predicate_mapper_service = Qa::LinkedData::Mapper::GraphPredicateMapperService
|
8
9
|
self.deep_sort_service = Qa::LinkedData::DeepSortService
|
9
10
|
self.context_mapper_service = Qa::LinkedData::Mapper::ContextMapperService
|
10
11
|
|
@@ -12,6 +13,22 @@ module Qa
|
|
12
13
|
# Extract predicates specified in the predicate_map from the graph and return as an array of value maps for each search result subject URI.
|
13
14
|
# If a sort key is present, a subject will only be included in the results if it has a statement with the sort predicate.
|
14
15
|
# @param graph [RDF::Graph] the graph from which to extract result values
|
16
|
+
# @param prefixes [Hash<Symbol><String>] URL map of prefixes to use with ldpaths
|
17
|
+
# @example prefixes
|
18
|
+
# {
|
19
|
+
# locid: 'http://id.loc.gov/vocabulary/identifiers/',
|
20
|
+
# skos: 'http://www.w3.org/2004/02/skos/core#',
|
21
|
+
# vivo: 'http://vivoweb.org/ontology/core#'
|
22
|
+
# }
|
23
|
+
# @param ldpath [Hash<Symbol><String||Symbol>] value either maps to a ldpath in the graph or is :subject_uri indicating to use the subject uri as the value
|
24
|
+
# @example ldpath map
|
25
|
+
# {
|
26
|
+
# uri: :subject_uri,
|
27
|
+
# id: 'locid:lccn :: xsd::string',
|
28
|
+
# label: 'skos:prefLabel :: xsd::string',
|
29
|
+
# altlabel: 'skos:altLabel :: xsd::string',
|
30
|
+
# sort: 'vivo:rank :: xsd::integer'
|
31
|
+
# }
|
15
32
|
# @param predicate_map [Hash<Symbol><String||Symbol>] value either maps to a predicate in the graph or is :subject_uri indicating to use the subject uri as the value
|
16
33
|
# @example predicate map
|
17
34
|
# {
|
@@ -22,24 +39,38 @@ module Qa
|
|
22
39
|
# sort: 'http://vivoweb.org/ontology/core#rank'
|
23
40
|
# }
|
24
41
|
# @param sort_key [Symbol] the key in the predicate map for the value on which to sort
|
42
|
+
# @param preferred_language [Array<Symbol>] sort multiple literals for a value with preferred language first
|
25
43
|
# @param context_map [Qa::LinkedData::Config::ContextMap] map of additional context to include in the results
|
26
44
|
# @return [Array<Hash<Symbol><Array<Object>>>] mapped result values with each result as an element in the array
|
27
45
|
# with hash of map key = array of object values for predicates identified in map parameter.
|
28
46
|
# @example value map for a single result
|
29
47
|
# [
|
30
|
-
# {
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
48
|
+
# { "uri":"http://id.loc.gov/authorities/genreForms/gf2011026181","id":"gf2011026181","label":"Stop-motion animation films",
|
49
|
+
# "context":[
|
50
|
+
# { "property":"Authoritative Label","values":["Stop-motion animation films"],"selectable":true,"drillable":false },
|
51
|
+
# { "property":"Variant Label","values":["Object animation films, Frame-by-frame animation films"],"selectable":false,"drillable":false },
|
52
|
+
# { "group":"Hierarchy","property":"Narrower: ",
|
53
|
+
# "values":[
|
54
|
+
# { "uri":"http://id.loc.gov/authorities/genreForms/gf2011026140","id":"gf2011026140","label":"Clay animation films"}
|
55
|
+
# ],
|
56
|
+
# "selectable":true,"drillable":true },
|
57
|
+
# { "group":"Hierarchy","property":"Broader: ",
|
58
|
+
# "values":[
|
59
|
+
# { "uri":"http://id.loc.gov/authorities/genreForms/gf2011026049","id":"gf2011026049","label":"Animated films"}
|
60
|
+
# ],
|
61
|
+
# "selectable":true,"drillable":true }
|
62
|
+
# ]
|
63
|
+
# }
|
35
64
|
# ]
|
36
|
-
def map_values(graph:, predicate_map
|
65
|
+
def map_values(graph:, prefixes: {}, ldpath_map: nil, predicate_map: nil, sort_key:, preferred_language: nil, context_map: nil) # rubocop:disable Metrics/ParameterLists
|
37
66
|
search_matches = []
|
38
67
|
graph.subjects.each do |subject|
|
39
68
|
next if subject.anonymous? # skip blank nodes
|
40
|
-
values =
|
41
|
-
|
42
|
-
|
69
|
+
values = if ldpath_map.present?
|
70
|
+
map_values_with_ldpath_map(graph: graph, ldpath_map: ldpath_map, prefixes: prefixes, subject_uri: subject, sort_key: sort_key, context_map: context_map)
|
71
|
+
else
|
72
|
+
map_values_with_predicate_map(graph: graph, predicate_map: predicate_map, subject_uri: subject, sort_key: sort_key, context_map: context_map)
|
73
|
+
end
|
43
74
|
search_matches << values if result_subject? values, sort_key
|
44
75
|
end
|
45
76
|
search_matches = deep_sort_service.new(search_matches, sort_key, preferred_language).sort
|
@@ -63,6 +94,22 @@ module Qa
|
|
63
94
|
value_map[:context] = context
|
64
95
|
value_map
|
65
96
|
end
|
97
|
+
|
98
|
+
def map_values_with_ldpath_map(graph:, ldpath_map:, prefixes:, subject_uri:, sort_key:, context_map:) # rubocop:disable Metrics/ParameterLists
|
99
|
+
graph_ldpath_mapper_service.map_values(graph: graph, ldpath_map: ldpath_map, prefixes: prefixes, subject_uri: subject_uri) do |value_map|
|
100
|
+
map_context(graph, sort_key, context_map, value_map, subject_uri)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def map_values_with_predicate_map(graph:, predicate_map:, subject_uri:, sort_key:, context_map:)
|
105
|
+
Qa.deprecation_warning(
|
106
|
+
in_msg: 'Qa::LinkedData::Mapper::SearchResultsMapperService',
|
107
|
+
msg: 'predicate_map is deprecated; update to use ldpath_map'
|
108
|
+
)
|
109
|
+
graph_predicate_mapper_service.map_values(graph: graph, predicate_map: predicate_map, subject_uri: subject_uri) do |value_map|
|
110
|
+
map_context(graph, sort_key, context_map, value_map, subject_uri)
|
111
|
+
end
|
112
|
+
end
|
66
113
|
end
|
67
114
|
end
|
68
115
|
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# Provide service for mapping graph to json limited to configured fields and context.
|
2
|
+
module Qa
|
3
|
+
module LinkedData
|
4
|
+
module Mapper
|
5
|
+
class TermResultsMapperService
|
6
|
+
class_attribute :graph_ldpath_mapper_service, :graph_predicate_mapper_service
|
7
|
+
self.graph_ldpath_mapper_service = Qa::LinkedData::Mapper::GraphLdpathMapperService
|
8
|
+
self.graph_predicate_mapper_service = Qa::LinkedData::Mapper::GraphPredicateMapperService
|
9
|
+
|
10
|
+
class << self
|
11
|
+
# Extract predicates specified in the predicate_map from the graph and return as an array of value maps for each search result subject URI.
|
12
|
+
# If a sort key is present, a subject will only be included in the results if it has a statement with the sort predicate.
|
13
|
+
# @param graph [RDF::Graph] the graph from which to extract result values
|
14
|
+
# @param subject_uri [RDF::URI] the uri of the term represented by the graph
|
15
|
+
# @param prefixes [Hash<Symbol><String>] URL map of prefixes to use with ldpaths
|
16
|
+
# @example prefixes
|
17
|
+
# {
|
18
|
+
# locid: 'http://id.loc.gov/vocabulary/identifiers/',
|
19
|
+
# skos: 'http://www.w3.org/2004/02/skos/core#',
|
20
|
+
# }
|
21
|
+
# @param ldpath [Hash<Symbol><String||Symbol>] value either maps to a ldpath in the graph or is :subject_uri indicating to use the subject uri as the value
|
22
|
+
# @example ldpath map
|
23
|
+
# {
|
24
|
+
# uri: :subject_uri,
|
25
|
+
# id: 'locid:lccn :: xsd::string',
|
26
|
+
# label: 'skos:prefLabel :: xsd::string',
|
27
|
+
# altlabel: 'skos:altLabel :: xsd::string',
|
28
|
+
# broader: 'skos:broader :: xsd::anyURI',
|
29
|
+
# narrower: 'skos:narrower :: xsd::anyURI',
|
30
|
+
# sameas: 'skos:exactMatch :: xsd::anyURI'
|
31
|
+
# }
|
32
|
+
# @param predicate_map [Hash<Symbol><String||Symbol>] value either maps to a predicate in the graph or is :subject_uri indicating to use the subject uri as the value
|
33
|
+
# @example predicate map
|
34
|
+
# {
|
35
|
+
# uri: :subject_uri,
|
36
|
+
# id_predicate: 'http://id.loc.gov/vocabulary/identifiers/lccn',
|
37
|
+
# label_predicate: 'http://www.w3.org/2004/02/skos/core#prefLabel',
|
38
|
+
# altlabel_predicate: 'http://www.w3.org/2004/02/skos/core#altLabel',
|
39
|
+
# broader_predicate: 'http://www.w3.org/2004/02/skos/core#broader',
|
40
|
+
# narrower_predicate: 'http://www.w3.org/2004/02/skos/core#narrower',
|
41
|
+
# sameas_predicate: 'http://www.w3.org/2004/02/skos/core#exactMatch'
|
42
|
+
# }
|
43
|
+
# @return [Hash<Symbol><Array<Object>>] mapped result values for the term
|
44
|
+
# with hash of map key = array of object values for predicates identified in map parameter.
|
45
|
+
# @example value map
|
46
|
+
# [
|
47
|
+
# {:uri=>[#<RDF::URI:0x3fcff54a829c URI:http://id.loc.gov/authorities/genreForms/gf2011026559>],
|
48
|
+
# :id=>[#<RDF::Literal:0x3fcff4a367b4("gf2011026559")>],
|
49
|
+
# :label=>[#<RDF::Literal:0x3fcff54a9a98("Science Fiction"@en)>],
|
50
|
+
# :altlabel=>[#<RDF::Literal:0x3fcff54a9a98("Sci-fi"@en)>],
|
51
|
+
# :broader=>[#<RDF::URI:0x3fcff54a8234 URI:http://id.loc.gov/authorities/genreForms/gf2014026339>],
|
52
|
+
# :narrower=>[#<RDF::URI:0x3fcff54a8283 URI:http://id.loc.gov/authorities/genreForms/gf2014026551>],
|
53
|
+
# :sameas=>[#<RDF::URI:0x3fcff54a8248 URI:http://id.loc.gov/authorities/names/n2010043281>]}
|
54
|
+
# ]
|
55
|
+
def map_values(graph:, subject_uri:, prefixes: nil, ldpath_map: nil, predicate_map: nil)
|
56
|
+
if ldpath_map.present?
|
57
|
+
map_values_with_ldpath_map(graph: graph, ldpath_map: ldpath_map, prefixes: prefixes, subject_uri: subject_uri)
|
58
|
+
else
|
59
|
+
map_values_with_predicate_map(graph: graph, predicate_map: predicate_map, subject_uri: subject_uri)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def map_values_with_ldpath_map(graph:, ldpath_map:, prefixes:, subject_uri:)
|
66
|
+
graph_ldpath_mapper_service.map_values(graph: graph, ldpath_map: ldpath_map, prefixes: prefixes, subject_uri: subject_uri)
|
67
|
+
end
|
68
|
+
|
69
|
+
def map_values_with_predicate_map(graph:, predicate_map:, subject_uri:)
|
70
|
+
Qa.deprecation_warning(
|
71
|
+
in_msg: 'Qa::LinkedData::Mapper::TermResultsMapperService',
|
72
|
+
msg: 'predicate_map is deprecated; update to use ldpath_map'
|
73
|
+
)
|
74
|
+
graph_predicate_mapper_service.map_values(graph: graph, predicate_map: predicate_map, subject_uri: subject_uri)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -1,5 +1,11 @@
|
|
1
1
|
{
|
2
|
-
"QA_CONFIG_VERSION": "2.
|
2
|
+
"QA_CONFIG_VERSION": "2.1",
|
3
|
+
"prefixes": {
|
4
|
+
"loc": "http://id.loc.gov/vocabulary/identifiers/",
|
5
|
+
"skos": "http://www.w3.org/2004/02/skos/core#",
|
6
|
+
"madsrdf": "http://www.loc.gov/mads/rdf/v1#",
|
7
|
+
"owl": "http://www.w3.org/2002/07/owl#"
|
8
|
+
},
|
3
9
|
"term": {
|
4
10
|
"url": {
|
5
11
|
"@context": "http://www.w3.org/ns/hydra/context.jsonld",
|
@@ -29,12 +35,12 @@
|
|
29
35
|
"term_id": "ID",
|
30
36
|
"language": ["en"],
|
31
37
|
"results": {
|
32
|
-
"
|
33
|
-
"
|
34
|
-
"
|
35
|
-
"
|
36
|
-
"
|
37
|
-
"
|
38
|
+
"id_ldpath": "loc:lccn",
|
39
|
+
"label_ldpath": "skos:prefLabel :: xsd:string",
|
40
|
+
"altlabel_ldpath": "skos:altLabel :: xsd:string",
|
41
|
+
"sameas_ldpath": "skos:exactMatch | owl:sameAs :: xsd:anyURI",
|
42
|
+
"narrower_ldpath": "madsrdf:hasNarrowerAuthority :: xsd:anyURI",
|
43
|
+
"broader_ldpath": "madsrdf:hasBroaderAuthority :: xsd:anyURI"
|
38
44
|
},
|
39
45
|
"subauthorities": {
|
40
46
|
"subjects": "subjects",
|
@@ -1,5 +1,10 @@
|
|
1
1
|
{
|
2
|
-
"QA_CONFIG_VERSION": "2.
|
2
|
+
"QA_CONFIG_VERSION": "2.1",
|
3
|
+
"prefixes": {
|
4
|
+
"dcterms": "http://purl.org/dc/terms/",
|
5
|
+
"skos": "http://www.w3.org/2004/02/skos/core#",
|
6
|
+
"schema": "http://schema.org/"
|
7
|
+
},
|
3
8
|
"term": {
|
4
9
|
"url": {
|
5
10
|
"@context": "http://www.w3.org/ns/hydra/context.jsonld",
|
@@ -20,10 +25,10 @@
|
|
20
25
|
},
|
21
26
|
"term_id": "ID",
|
22
27
|
"results": {
|
23
|
-
"
|
24
|
-
"
|
25
|
-
"
|
26
|
-
"
|
28
|
+
"id_ldpath": "dcterms:identifier",
|
29
|
+
"label_ldpath": "skos:prefLabel",
|
30
|
+
"altlabel_ldpath": "skos:altLabel",
|
31
|
+
"sameas_ldpath": "schema:sameAs"
|
27
32
|
}
|
28
33
|
},
|
29
34
|
"search": {
|
@@ -60,9 +65,9 @@
|
|
60
65
|
"subauth": "subauth"
|
61
66
|
},
|
62
67
|
"results": {
|
63
|
-
"
|
64
|
-
"
|
65
|
-
"
|
68
|
+
"id_ldpath": "dcterms:identifier",
|
69
|
+
"label_ldpath": "skos:prefLabel",
|
70
|
+
"sort_ldpath": "skos:prefLabel"
|
66
71
|
},
|
67
72
|
"subauthorities": {
|
68
73
|
"topic": "oclc.topic",
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class Qa::DiscogsGenerator < Rails::Generators::Base
|
2
|
+
source_root File.expand_path('../templates', __FILE__)
|
3
|
+
|
4
|
+
desc """
|
5
|
+
This generator makes the following change to your application:
|
6
|
+
1. Adds the Discogs authority configuration
|
7
|
+
"""
|
8
|
+
def copy_discogs_configs
|
9
|
+
copy_file "config/discogs-formats.yml", "config/discogs-formats.yml"
|
10
|
+
copy_file "config/discogs-genres.yml", "config/discogs-genres.yml"
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,346 @@
|
|
1
|
+
# carriers
|
2
|
+
4-TrackCartridge:
|
3
|
+
type: carrier
|
4
|
+
label: audio cartridge
|
5
|
+
uri: http://id.loc.gov/vocabulary/carriers/sg
|
6
|
+
8-TrackCartridge:
|
7
|
+
type: carrier
|
8
|
+
label: audio cartridge
|
9
|
+
uri: http://id.loc.gov/vocabulary/carriers/sg
|
10
|
+
Acetate:
|
11
|
+
type: carrier
|
12
|
+
label: other audio carrier
|
13
|
+
uri: http://id.loc.gov/vocabulary/carriers/sz
|
14
|
+
AllMedia:
|
15
|
+
type: carrier
|
16
|
+
label: other audio carrier
|
17
|
+
uri: http://id.loc.gov/vocabulary/carriers/sz
|
18
|
+
Betacam:
|
19
|
+
type: carrier
|
20
|
+
label: videocassette
|
21
|
+
uri: http://id.loc.gov/vocabulary/carriers/vf
|
22
|
+
BetacamSP:
|
23
|
+
type: carrier
|
24
|
+
label: videocassette
|
25
|
+
uri: http://id.loc.gov/vocabulary/carriers/vf
|
26
|
+
Betamax:
|
27
|
+
type: carrier
|
28
|
+
label: videocassette
|
29
|
+
uri: http://id.loc.gov/vocabulary/carriers/vf
|
30
|
+
Blu-ray:
|
31
|
+
type: carrier
|
32
|
+
label: videodisc
|
33
|
+
uri: http://id.loc.gov/vocabulary/carriers/vd
|
34
|
+
Blu-ray-R:
|
35
|
+
type: carrier
|
36
|
+
label: videodisc
|
37
|
+
uri: http://id.loc.gov/vocabulary/carriers/vd
|
38
|
+
Cassette:
|
39
|
+
type: carrier
|
40
|
+
label: audiocassette
|
41
|
+
uri: http://id.loc.gov/vocabulary/carriers/ss
|
42
|
+
CD:
|
43
|
+
type: carrier
|
44
|
+
label: audio disc
|
45
|
+
uri: http://id.loc.gov/vocabulary/carriers/sd
|
46
|
+
CDr:
|
47
|
+
type: carrier
|
48
|
+
label: audio disc
|
49
|
+
uri: http://id.loc.gov/vocabulary/carriers/sd
|
50
|
+
CDV:
|
51
|
+
type: carrier
|
52
|
+
label: videodisc
|
53
|
+
uri: http://id.loc.gov/vocabulary/carriers/vd
|
54
|
+
Cylinder:
|
55
|
+
type: carrier
|
56
|
+
label: audio cylinder
|
57
|
+
uri: http://id.loc.gov/vocabulary/carriers/se
|
58
|
+
DAT:
|
59
|
+
type: carrier
|
60
|
+
label: audiocassette
|
61
|
+
uri: http://id.loc.gov/vocabulary/carriers/ss
|
62
|
+
DCC:
|
63
|
+
type: carrier
|
64
|
+
label: computer tape cassette
|
65
|
+
uri: http://id.loc.gov/vocabulary/carriers/cf
|
66
|
+
DVD:
|
67
|
+
type: carrier
|
68
|
+
label: videodisc
|
69
|
+
uri: http://id.loc.gov/vocabulary/carriers/vd
|
70
|
+
DVDr:
|
71
|
+
type: carrier
|
72
|
+
label: videodisc
|
73
|
+
uri: http://id.loc.gov/vocabulary/carriers/vd
|
74
|
+
EdisonDisc:
|
75
|
+
type: carrier
|
76
|
+
label: audio disc
|
77
|
+
uri: http://id.loc.gov/vocabulary/carriers/sd
|
78
|
+
Elcaset:
|
79
|
+
type: carrier
|
80
|
+
label: audiocassette
|
81
|
+
uri: http://id.loc.gov/vocabulary/carriers/ss
|
82
|
+
File:
|
83
|
+
type: carrier
|
84
|
+
label: other computer carrier
|
85
|
+
uri: http://id.loc.gov/vocabulary/carriers/cz
|
86
|
+
Flexi-disc:
|
87
|
+
type: carrier
|
88
|
+
label: audio disc
|
89
|
+
uri: http://id.loc.gov/vocabulary/carriers/sd
|
90
|
+
FloppyDisk:
|
91
|
+
type: carrier
|
92
|
+
label: computer disc
|
93
|
+
uri: http://id.loc.gov/vocabulary/carriers/cd
|
94
|
+
HDDVD:
|
95
|
+
type: carrier
|
96
|
+
label: videodisc
|
97
|
+
uri: http://id.loc.gov/vocabulary/carriers/vd
|
98
|
+
HDDVD-R:
|
99
|
+
type: carrier
|
100
|
+
label: videodisc
|
101
|
+
uri: http://id.loc.gov/vocabulary/carriers/vd
|
102
|
+
Hybrid:
|
103
|
+
type: carrier
|
104
|
+
label: other audio carrier
|
105
|
+
uri: http://id.loc.gov/vocabulary/carriers/sz
|
106
|
+
Laserdisc:
|
107
|
+
type: carrier
|
108
|
+
label: videodisc
|
109
|
+
uri: http://id.loc.gov/vocabulary/carriers/vd
|
110
|
+
LatheCut:
|
111
|
+
type: carrier
|
112
|
+
label: audio disc
|
113
|
+
uri: http://id.loc.gov/vocabulary/carriers/sd
|
114
|
+
MemoryStick:
|
115
|
+
type: carrier
|
116
|
+
label: other computer carrier
|
117
|
+
uri: http://id.loc.gov/vocabulary/carriers/cz
|
118
|
+
Microcassette:
|
119
|
+
type: carrier
|
120
|
+
label: audiocassette
|
121
|
+
uri: http://id.loc.gov/vocabulary/carriers/ss
|
122
|
+
Minidisc:
|
123
|
+
type: carrier
|
124
|
+
label: audio disc
|
125
|
+
uri: http://id.loc.gov/vocabulary/carriers/sd
|
126
|
+
MiniDV:
|
127
|
+
type: carrier
|
128
|
+
label: videocassette
|
129
|
+
uri: http://id.loc.gov/vocabulary/carriers/vf
|
130
|
+
MVD:
|
131
|
+
type: carrier
|
132
|
+
label: audio disc
|
133
|
+
uri: http://id.loc.gov/vocabulary/carriers/sd
|
134
|
+
PathéDisc:
|
135
|
+
type: carrier
|
136
|
+
label: audio disc
|
137
|
+
uri: http://id.loc.gov/vocabulary/carriers/sd
|
138
|
+
PlayTape:
|
139
|
+
type: carrier
|
140
|
+
label: audio cartridge
|
141
|
+
uri: http://id.loc.gov/vocabulary/carriers/sg
|
142
|
+
RCATapeCartridge:
|
143
|
+
type: carrier
|
144
|
+
label: audio cartridge
|
145
|
+
uri: http://id.loc.gov/vocabulary/carriers/sg
|
146
|
+
Reel-To-Reel:
|
147
|
+
type: carrier
|
148
|
+
label: audiotape reel
|
149
|
+
uri: http://id.loc.gov/vocabulary/carriers/st
|
150
|
+
SACD:
|
151
|
+
type: carrier
|
152
|
+
label: audiodisc
|
153
|
+
uri: http://id.loc.gov/vocabulary/carriers/sd
|
154
|
+
SelectaVision:
|
155
|
+
type: carrier
|
156
|
+
label: videocassette
|
157
|
+
uri: http://id.loc.gov/vocabulary/carriers/vf
|
158
|
+
Shellac:
|
159
|
+
type: carrier
|
160
|
+
label: audio disc
|
161
|
+
uri: http://id.loc.gov/vocabulary/carriers/sd
|
162
|
+
Tefifon:
|
163
|
+
type: carrier
|
164
|
+
label: audio cartridge
|
165
|
+
uri: http://id.loc.gov/vocabulary/carriers/sg
|
166
|
+
U-matic:
|
167
|
+
type: carrier
|
168
|
+
label: videocassette
|
169
|
+
uri: http://id.loc.gov/vocabulary/carriers/vf
|
170
|
+
UMD:
|
171
|
+
type: carrier
|
172
|
+
label: computer disc
|
173
|
+
uri: http://id.loc.gov/vocabulary/carriers/cd
|
174
|
+
VHD:
|
175
|
+
type: carrier
|
176
|
+
label: computer disc
|
177
|
+
uri: http://id.loc.gov/vocabulary/carriers/cd
|
178
|
+
VHS:
|
179
|
+
type: carrier
|
180
|
+
label: videocassette
|
181
|
+
uri: http://id.loc.gov/vocabulary/carriers/vf
|
182
|
+
Video2000:
|
183
|
+
type: carrier
|
184
|
+
label: videocassette
|
185
|
+
uri: http://id.loc.gov/vocabulary/carriers/vf
|
186
|
+
Video8:
|
187
|
+
type: carrier
|
188
|
+
label: videocassette
|
189
|
+
uri: http://id.loc.gov/vocabulary/carriers/vf
|
190
|
+
Vinyl:
|
191
|
+
type: carrier
|
192
|
+
label: audio disc
|
193
|
+
uri: http://id.loc.gov/vocabulary/carriers/sd
|
194
|
+
WireRecording:
|
195
|
+
type: carrier
|
196
|
+
label: other audio carrier
|
197
|
+
uri: http://id.loc.gov/vocabulary/carriers/sz
|
198
|
+
# playback channels
|
199
|
+
Stereo:
|
200
|
+
type: playbackChannel
|
201
|
+
label: stereo
|
202
|
+
uri: http://id.loc.gov/vocabulary/mplayback/ste
|
203
|
+
Mono:
|
204
|
+
type: playbackChannel
|
205
|
+
label: mono
|
206
|
+
uri: http://id.loc.gov/vocabulary/mplayback/mon
|
207
|
+
Quadraphonic:
|
208
|
+
type: playbackChannel
|
209
|
+
label: surround
|
210
|
+
uri: http://id.loc.gov/vocabulary/mplayback/mul
|
211
|
+
4-TrackStereo:
|
212
|
+
type: playbackChannel
|
213
|
+
label: stereo
|
214
|
+
uri: http://id.loc.gov/vocabulary/mplayback/ste
|
215
|
+
2-TrackStereo:
|
216
|
+
type: playbackChannel
|
217
|
+
label: stereo
|
218
|
+
uri: http://id.loc.gov/vocabulary/mplayback/ste
|
219
|
+
2-TrackMono:
|
220
|
+
type: playbackChannel
|
221
|
+
label: mono
|
222
|
+
uri: http://id.loc.gov/vocabulary/mplayback/mon
|
223
|
+
4-TrackMono:
|
224
|
+
type: playbackChannel
|
225
|
+
label: mono
|
226
|
+
uri: http://id.loc.gov/vocabulary/mplayback/mon
|
227
|
+
Dolby5.1:
|
228
|
+
type: playbackChannel
|
229
|
+
label: surround
|
230
|
+
uri: http://id.loc.gov/vocabulary/mplayback/mul
|
231
|
+
# dimensions
|
232
|
+
10":
|
233
|
+
type: dimension
|
234
|
+
label: 10 inches
|
235
|
+
11":
|
236
|
+
type: dimension
|
237
|
+
label: 11 inches
|
238
|
+
12":
|
239
|
+
type: dimension
|
240
|
+
label: 12 inches
|
241
|
+
16":
|
242
|
+
type: dimension
|
243
|
+
label: 16 inches
|
244
|
+
2":
|
245
|
+
type: dimension
|
246
|
+
label: 2 inches
|
247
|
+
21cm:
|
248
|
+
type: dimension
|
249
|
+
label: 21cm
|
250
|
+
25cm:
|
251
|
+
type: dimension
|
252
|
+
label: 25cm
|
253
|
+
27cm:
|
254
|
+
type: dimension
|
255
|
+
label: 27cm
|
256
|
+
29cm:
|
257
|
+
type: dimension
|
258
|
+
label: 29cm
|
259
|
+
3":
|
260
|
+
type: dimension
|
261
|
+
label: 3 inches
|
262
|
+
3.5":
|
263
|
+
type: dimension
|
264
|
+
label: 3.5 inches
|
265
|
+
35cm:
|
266
|
+
type: dimension
|
267
|
+
label: 35cm
|
268
|
+
3½":
|
269
|
+
type: dimension
|
270
|
+
label: 3 1/2 inches
|
271
|
+
4":
|
272
|
+
type: dimension
|
273
|
+
label: 4 inches
|
274
|
+
5":
|
275
|
+
type: dimension
|
276
|
+
label: 5 inches
|
277
|
+
5.25":
|
278
|
+
type: dimension
|
279
|
+
label: 5.25 inches
|
280
|
+
5½":
|
281
|
+
type: dimension
|
282
|
+
label: 5 1/2 inches
|
283
|
+
6":
|
284
|
+
type: dimension
|
285
|
+
label: 6 inches
|
286
|
+
6½":
|
287
|
+
type: dimension
|
288
|
+
label: 6 1/2 inches
|
289
|
+
7":
|
290
|
+
type: dimension
|
291
|
+
label: 7 inches
|
292
|
+
8":
|
293
|
+
type: dimension
|
294
|
+
label: 8 inches
|
295
|
+
9":
|
296
|
+
type: dimension
|
297
|
+
label: 9 inches
|
298
|
+
⅛":
|
299
|
+
type: dimension
|
300
|
+
label: 1/8 inches
|
301
|
+
¼":
|
302
|
+
type: dimension
|
303
|
+
label: 1/4 inches
|
304
|
+
½":
|
305
|
+
type: dimension
|
306
|
+
label: 1/2 inches
|
307
|
+
# playing speeds
|
308
|
+
1⅞ips:
|
309
|
+
type: playingSpeed
|
310
|
+
label: 1 7/8 ips
|
311
|
+
15ips:
|
312
|
+
type: playingSpeed
|
313
|
+
label: 15 ips
|
314
|
+
15/16ips:
|
315
|
+
type: playingSpeed
|
316
|
+
label: 15/16 ips
|
317
|
+
16⅔RPM:
|
318
|
+
type: playingSpeed
|
319
|
+
label: 16 2/3 RPM
|
320
|
+
3¾ips:
|
321
|
+
type: playingSpeed
|
322
|
+
label: 3 3/4 ips
|
323
|
+
30ips:
|
324
|
+
type: playingSpeed
|
325
|
+
label: 30 ips
|
326
|
+
33⅓RPM:
|
327
|
+
type: playingSpeed
|
328
|
+
label: 33 1/3 RPM
|
329
|
+
45RPM:
|
330
|
+
type: playingSpeed
|
331
|
+
label: 45 RPM
|
332
|
+
7½ips:
|
333
|
+
type: playingSpeed
|
334
|
+
label: 7 1/2 ips
|
335
|
+
78RPM:
|
336
|
+
type: playingSpeed
|
337
|
+
label: 78 RPM
|
338
|
+
8⅓RPM:
|
339
|
+
type: playingSpeed
|
340
|
+
label: 8 1/3 RPM
|
341
|
+
80RPM:
|
342
|
+
type: playingSpeed
|
343
|
+
label: 80 RPM
|
344
|
+
90RPM:
|
345
|
+
type: playingSpeed
|
346
|
+
label: 90 RPM
|