Class: Qa::LinkedData::Mapper::GraphPredicateMapperService
- Inherits:
-
Object
- Object
- Qa::LinkedData::Mapper::GraphPredicateMapperService
- Defined in:
- app/services/qa/linked_data/mapper/graph_predicate_mapper_service.rb
Class Method Summary collapse
-
.map_values(graph:, predicate_map:, subject_uri:) ⇒ <Hash<Symbol><Array<Object>>] mapped result values with hash of map key = array of object values for predicates identified in predicate_map.
Extract predicates specified in the predicate_map from the graph and return as a value map for a single subject URI.
Class Method Details
.map_values(graph:, predicate_map:, subject_uri:) ⇒ <Hash<Symbol><Array<Object>>] mapped result values with hash of map key = array of object values for predicates identified in predicate_map.
Extract predicates specified in the predicate_map from the graph and return as a value map for a single subject URI.
28 29 30 31 32 33 34 35 36 |
# File 'app/services/qa/linked_data/mapper/graph_predicate_mapper_service.rb', line 28 def self.map_values(graph:, predicate_map:, subject_uri:) value_map = {} predicate_map.each do |key, predicate| values = predicate == :subject_uri ? [subject_uri] : graph_service.object_values(graph: graph, subject: subject_uri, predicate: predicate) value_map[key] = values end value_map = yield value_map if block_given? value_map end |