Class: Qa::LinkedData::Mapper::SearchResultsMapperService
- Inherits:
-
Object
- Object
- Qa::LinkedData::Mapper::SearchResultsMapperService
- Defined in:
- app/services/qa/linked_data/mapper/search_results_mapper_service.rb
Class Method Summary collapse
-
.map_values(graph:, prefixes: {}, ldpath_map: nil, predicate_map: nil, sort_key:, preferred_language: nil, context_map: nil) ⇒ Array<Hash<Symbol><Array<Object>>>
Extract predicates specified in the predicate_map from the graph and return as an array of value maps for each search result subject URI.
Class Method Details
.map_values(graph:, prefixes: {}, ldpath_map: nil, predicate_map: nil, sort_key:, preferred_language: nil, context_map: nil) ⇒ Array<Hash<Symbol><Array<Object>>>
Extract predicates specified in the predicate_map from the graph and return as an array of value maps for each search result subject URI. If a sort key is present, a subject will only be included in the results if it has a statement with the sort predicate.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'app/services/qa/linked_data/mapper/search_results_mapper_service.rb', line 65 def map_values(graph:, prefixes: {}, ldpath_map: nil, predicate_map: nil, sort_key:, preferred_language: nil, context_map: nil) # rubocop:disable Metrics/ParameterLists search_matches = [] graph.subjects.each do |subject| next if subject.anonymous? # skip blank nodes values = if ldpath_map.present? map_values_with_ldpath_map(graph: graph, ldpath_map: ldpath_map, prefixes: prefixes, subject_uri: subject, sort_key: sort_key, context_map: context_map) else map_values_with_predicate_map(graph: graph, predicate_map: predicate_map, subject_uri: subject, sort_key: sort_key, context_map: context_map) end search_matches << values if result_subject? values, sort_key end search_matches = deep_sort_service.new(search_matches, sort_key, preferred_language).sort search_matches end |