lib/metanorma/modspec/validate.rb in mn-requirements-0.1.7 vs lib/metanorma/modspec/validate.rb in mn-requirements-0.1.8

- old
+ new

@@ -25,10 +25,11 @@ end def type2validate(reqt) type = reqt["type"] type = "general" if type.nil? || type.empty? + type = "verification" if type == "abstracttest" type end CLASS2LABEL = { general: "Requirement", @@ -46,21 +47,21 @@ def reqt_to_conformance(reqt, reqtclass, confclass) return unless type2validate(reqt) == reqtclass r = @ids[:id][reqt["id"]] (r[:label] && @ids[:class][confclass]&.any? do |x| - x[:subject] == r[:label] + x[:subject].include?(r[:label]) end) and return log_reqt(r, reqtclass, confclass) end def conformance_to_reqt(reqt, reqtclass, confclass) return unless type2validate(reqt) == confclass r = @ids[:id][reqt["id"]] (r[:subject] && @ids[:class][reqtclass]&.any? do |x| - r[:subject] == x[:label] + r[:subject].include?(x[:label]) end) and return log_reqt(r, confclass, reqtclass) end def class_to_children(reqt, type, childclass) @@ -98,10 +99,11 @@ hash end def reqt_links_struct(reqt) { id: reqt["id"], elem: reqt, label: reqt.at("./identifier")&.text, - subject: reqt.at("./classification[tag = 'target']/value")&.text, + subject: reqt.xpath("./classification[tag = 'target']/value") + .map(&:text), child: reqt.xpath("./requirement | ./recommendation | ./permission") .map do |r| r.at("./identifier")&.text end } end