lib/solis/model.rb in solis-0.67.0 vs lib/solis/model.rb in solis-0.68.0

- old
+ new

@@ -24,13 +24,16 @@ inner_model = self.class.graph.shape_as_model(self.class.metadata[:attributes][attribute.to_s][:datatype].to_s) value = inner_model.new(value) elsif self.class.metadata[:attributes][attribute.to_s][:node_kind].is_a?(RDF::URI) && value.is_a?(Array) new_value = [] value.each do |v| - next unless v.class.is_a?(Hash) - inner_model = self.class.graph.shape_as_model(self.class.metadata[:attributes][attribute.to_s][:datatype].to_s) - new_value << inner_model.new(v) + if v.is_a?(Hash) + inner_model = self.class.graph.shape_as_model(self.class.metadata[:attributes][attribute.to_s][:datatype].to_s) + new_value << inner_model.new(v) + else + new_value << v + end end value = new_value end # switched off. currently language query parameters returns the value @@ -145,11 +148,11 @@ id = attributes.delete('id') sparql = SPARQL::Client.new(self.class.sparql_endpoint) - original_klass = self.query.filter({language: nil, filters: { id: [id] } }).find_all.map { |m| m }&.first + original_klass = self.query.filter({ language: nil, filters: { id: [id] } }).find_all.map { |m| m }&.first raise Solis::Error::NotFoundError if original_klass.nil? updated_klass = original_klass.deep_dup attributes.each_pair do |key, value| updated_klass.send(:"#{key}=", value) @@ -406,14 +409,14 @@ data = [data] unless data.is_a?(Array) data.each do |d| if defined?(d.name) && self.class.graph.shape?(d.name) - if self.class.graph.shape_as_model(d.name.to_s).metadata[:attributes].select{|_,v| v[:node_kind].is_a?(RDF::URI)}.size > 0 && - hierarchy.select{|s| s =~ /^#{d.name.to_s}/}.size == 0 + if self.class.graph.shape_as_model(d.name.to_s).metadata[:attributes].select { |_, v| v[:node_kind].is_a?(RDF::URI) }.size > 0 && + hierarchy.select { |s| s =~ /^#{d.name.to_s}/ }.size == 0 internal_resolve = false d = build_ttl_objekt2(graph, d, hierarchy, internal_resolve) - elsif self.class.graph.shape_as_model(d.name.to_s) && hierarchy.select{|s| s =~ /^#{d.name.to_s}/}.size == 0 + elsif self.class.graph.shape_as_model(d.name.to_s) && hierarchy.select { |s| s =~ /^#{d.name.to_s}/ }.size == 0 internal_resolve = false d = build_ttl_objekt2(graph, d, hierarchy, internal_resolve) else #d = "#{klass.class.graph_name}#{attribute.tableize}/#{d.id}" d = "#{klass.class.graph_name}#{d.name.tableize}/#{d.id}" \ No newline at end of file