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:, predicate_map:, 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:, predicate_map:, 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.
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/services/qa/linked_data/mapper/search_results_mapper_service.rb', line 36 def map_values(graph:, predicate_map:, sort_key:, preferred_language: nil, context_map: nil) search_matches = [] graph.subjects.each do |subject| next if subject.anonymous? # skip blank nodes values = graph_mapper_service.map_values(graph: graph, predicate_map: predicate_map, subject_uri: subject) do |value_map| map_context(graph, sort_key, context_map, value_map, subject) 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 |