Class: Qa::LinkedData::Mapper::GraphLdpathMapperService
- Inherits:
-
Object
- Object
- Qa::LinkedData::Mapper::GraphLdpathMapperService
- Defined in:
- app/services/qa/linked_data/mapper/graph_ldpath_mapper_service.rb
Class Method Summary collapse
-
.map_values(graph:, ldpath_map:, subject_uri:, prefixes: {}) ⇒ <Hash<Symbol><Array<Object>>] mapped result values with hash of map key = array of object values identified by the ldpath map.
Extract values for ldpath specified in the ldpath_map from the graph and return as a value map for a single subject URI.
Class Method Details
.map_values(graph:, ldpath_map:, subject_uri:, prefixes: {}) ⇒ <Hash<Symbol><Array<Object>>] mapped result values with hash of map key = array of object values identified by the ldpath map.
Extract values for ldpath specified in the ldpath_map from the graph and return as a value map for a single subject URI.
35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/services/qa/linked_data/mapper/graph_ldpath_mapper_service.rb', line 35 def self.map_values(graph:, ldpath_map:, subject_uri:, prefixes: {}) value_map = {} ldpath_map.each do |key, ldpath| next value_map[key] = [subject_uri] if ldpath == :subject_uri ldpath_program = ldpath_service.ldpath_program(ldpath: ldpath, prefixes: prefixes) values = ldpath_service.ldpath_evaluate(program: ldpath_program, graph: graph, subject_uri: subject_uri) value_map[key] = values end value_map = yield value_map if block_given? value_map end |