bel_parser 1.0.0.alpha.47-java → 1.0.0.alpha.48-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/bel_parser/expression/model/namespace.rb +60 -20
- data/lib/bel_parser/expression/model/parameter.rb +30 -36
- data/lib/bel_parser/expression/model/statement.rb +28 -3
- data/lib/bel_parser/expression/model/term.rb +46 -7
- data/lib/bel_parser/expression/parser.rb +15 -3
- data/lib/bel_parser/expression/validator.rb +13 -15
- data/lib/bel_parser/language/apply_namespace_encoding.rb +14 -18
- data/lib/bel_parser/language/expression_validator.rb +398 -23
- data/lib/bel_parser/language/semantics_ast_warnings.rb +1 -1
- data/lib/bel_parser/language/specification.rb +4 -0
- data/lib/bel_parser/language/syntax/undefined_namespace.rb +1 -1
- data/lib/bel_parser/language/syntax/undefined_namespace_value.rb +2 -1
- data/lib/bel_parser/language/version2_0/functions/activity.rb +2 -2
- data/lib/bel_parser/language/version2_0/functions/biological_process.rb +1 -2
- data/lib/bel_parser/language/version2_0/functions/cell_secretion.rb +2 -2
- data/lib/bel_parser/language/version2_0/functions/cell_surface_expression.rb +2 -2
- data/lib/bel_parser/language/version2_0/functions/complex_abundance.rb +1 -1
- data/lib/bel_parser/language/version2_0/functions/composite_abundance.rb +1 -1
- data/lib/bel_parser/language/version2_0/functions/degradation.rb +2 -2
- data/lib/bel_parser/language/version2_0/functions/fragment.rb +1 -1
- data/lib/bel_parser/language/version2_0/functions/from_location.rb +1 -1
- data/lib/bel_parser/language/version2_0/functions/fusion.rb +1 -1
- data/lib/bel_parser/language/version2_0/functions/micro_rna_abundance.rb +1 -1
- data/lib/bel_parser/language/version2_0/functions/molecular_activity.rb +1 -1
- data/lib/bel_parser/language/version2_0/functions/protein_modification.rb +1 -1
- data/lib/bel_parser/language/version2_0/functions/reaction.rb +1 -1
- data/lib/bel_parser/language/version2_0/functions/to_location.rb +1 -1
- data/lib/bel_parser/language/version2_0/functions/translocation.rb +1 -1
- data/lib/bel_parser/language/version2_0/functions/variant.rb +1 -1
- data/lib/bel_parser/resource.rb +8 -6
- data/lib/bel_parser/resource/concept_scheme.rb +8 -0
- data/lib/bel_parser/resource/dataset.rb +24 -0
- data/lib/bel_parser/resource/file_resource.rb +8 -0
- data/lib/bel_parser/resource/file_resource_value.rb +1 -0
- data/lib/bel_parser/resource/sparql_reader.rb +3 -1
- data/lib/bel_parser/resource/value.rb +20 -0
- metadata +1 -1
| @@ -24,10 +24,38 @@ module BELParser | |
| 24 24 | 
             
                  # @return [BELParser::Language::Syntax::SyntaxResult] syntax results
         | 
| 25 25 | 
             
                  def validate(expression_node)
         | 
| 26 26 | 
             
                    @transform.process(expression_node)
         | 
| 27 | 
            -
             | 
| 28 | 
            -
                     | 
| 29 | 
            -
                     | 
| 30 | 
            -
             | 
| 27 | 
            +
             | 
| 28 | 
            +
                    case expression_node
         | 
| 29 | 
            +
                    when BELParser::Parsers::AST::SimpleStatement
         | 
| 30 | 
            +
                      SimpleStatementResult.new(
         | 
| 31 | 
            +
                        validate(expression_node.statement.subject.term),
         | 
| 32 | 
            +
                        validate(expression_node.statement.object.child),
         | 
| 33 | 
            +
                        syntax(expression_node),
         | 
| 34 | 
            +
                        semantics(expression_node))
         | 
| 35 | 
            +
                    when BELParser::Parsers::AST::ObservedTerm
         | 
| 36 | 
            +
                      ObservedTermResult.new(
         | 
| 37 | 
            +
                        validate(expression_node.statement.subject.term),
         | 
| 38 | 
            +
                        syntax(expression_node),
         | 
| 39 | 
            +
                        semantics(expression_node))
         | 
| 40 | 
            +
                    when BELParser::Parsers::AST::NestedStatement
         | 
| 41 | 
            +
                      NestedStatementResult.new(
         | 
| 42 | 
            +
                        validate(expression_node.statement.subject.term),
         | 
| 43 | 
            +
                        validate(expression_node.statement.object.child),
         | 
| 44 | 
            +
                        syntax(expression_node),
         | 
| 45 | 
            +
                        semantics(expression_node))
         | 
| 46 | 
            +
                    when BELParser::Parsers::AST::Statement
         | 
| 47 | 
            +
                      SimpleStatementResult.new(
         | 
| 48 | 
            +
                        validate(expression_node.subject.term),
         | 
| 49 | 
            +
                        validate(expression_node.object.child),
         | 
| 50 | 
            +
                        syntax(expression_node),
         | 
| 51 | 
            +
                        semantics(expression_node))
         | 
| 52 | 
            +
                    when BELParser::Parsers::AST::Term
         | 
| 53 | 
            +
                      TermResult.new(syntax(expression_node), semantics(expression_node))
         | 
| 54 | 
            +
                    when BELParser::Parsers::AST::Parameter
         | 
| 55 | 
            +
                      ParameterResult.new(syntax(expression_node), semantics(expression_node))
         | 
| 56 | 
            +
                    else
         | 
| 57 | 
            +
                      nil
         | 
| 58 | 
            +
                    end
         | 
| 31 59 | 
             
                  end
         | 
| 32 60 |  | 
| 33 61 | 
             
                  private
         | 
| @@ -39,29 +67,376 @@ module BELParser | |
| 39 67 | 
             
                  end
         | 
| 40 68 |  | 
| 41 69 | 
             
                  def semantics(expression_node)
         | 
| 42 | 
            -
                     | 
| 43 | 
            -
                       | 
| 44 | 
            -
             | 
| 45 | 
            -
             | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
| 70 | 
            +
                    expression_node.traverse.flat_map do |node|
         | 
| 71 | 
            +
                      @semantics_functions.flat_map { |func| func.map(node, @spec, @namespaces) }
         | 
| 72 | 
            +
                    end.compact
         | 
| 73 | 
            +
                  end
         | 
| 74 | 
            +
             | 
| 75 | 
            +
                  module Result
         | 
| 76 | 
            +
                    def valid?
         | 
| 77 | 
            +
                      valid_syntax? && valid_semantics?
         | 
| 78 | 
            +
                    end
         | 
| 79 | 
            +
             | 
| 80 | 
            +
                    def valid_syntax?
         | 
| 81 | 
            +
                      @syntax_results.empty?
         | 
| 82 | 
            +
                    end
         | 
| 83 | 
            +
             | 
| 84 | 
            +
                    def valid_semantics?
         | 
| 85 | 
            +
                      @semantics_results.empty?
         | 
| 86 | 
            +
                    end
         | 
| 87 | 
            +
             | 
| 88 | 
            +
                    def valid_signature_mappings
         | 
| 89 | 
            +
                      @semantics_results
         | 
| 90 | 
            +
                        .select do |res|
         | 
| 91 | 
            +
                          res.is_a?(Semantics::SignatureMappingSuccess)
         | 
| 92 | 
            +
                        end.uniq
         | 
| 93 | 
            +
                    end
         | 
| 94 | 
            +
             | 
| 95 | 
            +
                    def invalid_signature_mappings
         | 
| 96 | 
            +
                      @semantics_results
         | 
| 97 | 
            +
                        .select do |res|
         | 
| 98 | 
            +
                          res.is_a?(Semantics::SignatureMappingWarning)
         | 
| 99 | 
            +
                        end
         | 
| 100 | 
            +
                    end
         | 
| 101 | 
            +
             | 
| 102 | 
            +
                    def detail
         | 
| 103 | 
            +
                      ''
         | 
| 104 | 
            +
                    end
         | 
| 105 | 
            +
             | 
| 106 | 
            +
                    def to_s
         | 
| 107 | 
            +
                      <<-HEADER.gsub(/^ {12}/, '')
         | 
| 108 | 
            +
                        Syntax:    #{valid_syntax?    ? 'Valid' : 'Invalid'}
         | 
| 109 | 
            +
                        Semantics: #{valid_semantics? ? 'Valid' : 'Invalid'}
         | 
| 110 | 
            +
             | 
| 111 | 
            +
                        #{syntax_errors_s}#{semantics_errors_s}#{detail}
         | 
| 112 | 
            +
                      HEADER
         | 
| 113 | 
            +
                    end
         | 
| 114 | 
            +
             | 
| 115 | 
            +
                    private
         | 
| 116 | 
            +
             | 
| 117 | 
            +
                    def syntax_errors_s
         | 
| 118 | 
            +
                      return nil if @syntax_results.empty?
         | 
| 119 | 
            +
             | 
| 120 | 
            +
                      report = "Syntax errors\n"
         | 
| 121 | 
            +
                      @syntax_results.each { |res| report += "#{res}\n" }
         | 
| 122 | 
            +
                      report
         | 
| 123 | 
            +
                    end
         | 
| 124 | 
            +
             | 
| 125 | 
            +
                    def semantics_errors_s
         | 
| 126 | 
            +
                      return nil if @semantics_results.empty?
         | 
| 127 | 
            +
             | 
| 128 | 
            +
                      report = "Semantic errors\n"
         | 
| 129 | 
            +
                      @semantics_results.each { |res| report += "#{res}\n" }
         | 
| 130 | 
            +
                      report
         | 
| 131 | 
            +
                    end
         | 
| 132 | 
            +
                  end
         | 
| 133 | 
            +
             | 
| 134 | 
            +
                  class ParameterResult
         | 
| 135 | 
            +
                    attr_reader :syntax_results, :semantics_results
         | 
| 136 | 
            +
                    include Result
         | 
| 137 | 
            +
             | 
| 138 | 
            +
                    def initialize(syntax_results, semantics_results)
         | 
| 139 | 
            +
                      @syntax_results    = syntax_results
         | 
| 140 | 
            +
                      @semantics_results = semantics_results
         | 
| 141 | 
            +
                    end
         | 
| 142 | 
            +
             | 
| 143 | 
            +
                    def valid_signature_mappings
         | 
| 144 | 
            +
                      nil
         | 
| 145 | 
            +
                    end
         | 
| 146 | 
            +
             | 
| 147 | 
            +
                    def invalid_signature_mappings
         | 
| 148 | 
            +
                      nil
         | 
| 149 | 
            +
                    end
         | 
| 150 | 
            +
                  end
         | 
| 151 | 
            +
             | 
| 152 | 
            +
                  class TermResult
         | 
| 153 | 
            +
                    attr_reader :syntax_results, :semantics_results
         | 
| 154 | 
            +
                    include Result
         | 
| 155 | 
            +
             | 
| 156 | 
            +
                    def initialize(syntax_results, semantics_results)
         | 
| 157 | 
            +
                      @syntax_results    = syntax_results
         | 
| 158 | 
            +
                      @semantics_results = semantics_results
         | 
| 159 | 
            +
                    end
         | 
| 160 | 
            +
             | 
| 161 | 
            +
                    def valid_semantics?
         | 
| 162 | 
            +
                      @semantics_results.any? do |res|
         | 
| 163 | 
            +
                        res.is_a?(Semantics::SignatureMappingSuccess)
         | 
| 164 | 
            +
                      end
         | 
| 165 | 
            +
                    end
         | 
| 166 | 
            +
             | 
| 167 | 
            +
                    def detail
         | 
| 168 | 
            +
                      report = "Valid signatures\n"
         | 
| 169 | 
            +
                      valid_signature_mappings.each do |mapping|
         | 
| 170 | 
            +
                        report += "  #{mapping.signature}\n"
         | 
| 171 | 
            +
                        mapping.results.each do |reason|
         | 
| 172 | 
            +
                          report += "    #{reason}\n"
         | 
| 173 | 
            +
                        end
         | 
| 174 | 
            +
                      end
         | 
| 175 | 
            +
                      report += "\n"
         | 
| 176 | 
            +
             | 
| 177 | 
            +
                      report += "Invalid signatures\n"
         | 
| 178 | 
            +
                      invalid_signature_mappings.each do |mapping|
         | 
| 179 | 
            +
                        report += "  #{mapping.signature}\n"
         | 
| 180 | 
            +
                        mapping.results.each do |reason|
         | 
| 181 | 
            +
                          report += "    #{reason}\n"
         | 
| 182 | 
            +
                        end
         | 
| 183 | 
            +
                      end
         | 
| 184 | 
            +
                      report
         | 
| 185 | 
            +
                    end
         | 
| 186 | 
            +
                  end
         | 
| 187 | 
            +
             | 
| 188 | 
            +
                  class ObservedTermResult
         | 
| 189 | 
            +
                    attr_reader :syntax_results, :semantics_results
         | 
| 190 | 
            +
                    include Result
         | 
| 191 | 
            +
             | 
| 192 | 
            +
                    def initialize(subject_result, syntax, semantics)
         | 
| 193 | 
            +
                      @subject_result    = subject_result
         | 
| 194 | 
            +
                      @syntax_results    = syntax
         | 
| 195 | 
            +
                      @semantics_results =
         | 
| 196 | 
            +
                        semantics.reject! do |res|
         | 
| 197 | 
            +
                          res.is_a?(Semantics::SignatureMappingWarning) ||
         | 
| 198 | 
            +
                          res.is_a?(Semantics::SignatureMappingSuccess)
         | 
| 199 | 
            +
                        end
         | 
| 200 | 
            +
                    end
         | 
| 201 | 
            +
             | 
| 202 | 
            +
                    def valid_syntax?
         | 
| 203 | 
            +
                      @subject_result.valid_syntax? && @syntax_results.empty?
         | 
| 204 | 
            +
                    end
         | 
| 205 | 
            +
             | 
| 206 | 
            +
                    def valid_semantics?
         | 
| 207 | 
            +
                      @subject_result.valid_semantics? && @semantics_results.empty?
         | 
| 208 | 
            +
                    end
         | 
| 209 | 
            +
             | 
| 210 | 
            +
                    def subject_valid?
         | 
| 211 | 
            +
                      valid?
         | 
| 212 | 
            +
                    end
         | 
| 213 | 
            +
             | 
| 214 | 
            +
                    def detail
         | 
| 215 | 
            +
                      report = "Subject term - Valid signatures\n"
         | 
| 216 | 
            +
                      @subject_result.valid_signature_mappings.each do |mapping|
         | 
| 217 | 
            +
                        report += "  #{mapping.signature}\n"
         | 
| 218 | 
            +
                        mapping.results.each do |reason|
         | 
| 219 | 
            +
                          report += "    #{reason}\n"
         | 
| 220 | 
            +
                        end
         | 
| 221 | 
            +
                      end
         | 
| 222 | 
            +
                      report += "\n"
         | 
| 223 | 
            +
             | 
| 224 | 
            +
                      report += "Subject term - Invalid signatures\n"
         | 
| 225 | 
            +
                      @subject_result.invalid_signature_mappings.each do |mapping|
         | 
| 226 | 
            +
                        report += "  #{mapping.signature}\n"
         | 
| 227 | 
            +
                        mapping.results.each do |reason|
         | 
| 228 | 
            +
                          report += "    #{reason}\n"
         | 
| 229 | 
            +
                        end
         | 
| 230 | 
            +
                      end
         | 
| 231 | 
            +
                      report
         | 
| 232 | 
            +
                    end
         | 
| 233 | 
            +
                  end
         | 
| 234 | 
            +
             | 
| 235 | 
            +
                  class SimpleStatementResult
         | 
| 236 | 
            +
                    attr_reader :syntax_results, :semantics_results
         | 
| 237 | 
            +
                    include Result
         | 
| 238 | 
            +
             | 
| 239 | 
            +
                    def initialize(subject_result, object_result, syntax, semantics)
         | 
| 240 | 
            +
                      @subject_result    = subject_result
         | 
| 241 | 
            +
                      @object_result     = object_result
         | 
| 242 | 
            +
                      @syntax_results    = syntax
         | 
| 243 | 
            +
                      @semantics_results =
         | 
| 244 | 
            +
                        semantics.reject! do |res|
         | 
| 245 | 
            +
                          res.is_a?(Semantics::SignatureMappingWarning) ||
         | 
| 246 | 
            +
                          res.is_a?(Semantics::SignatureMappingSuccess)
         | 
| 247 | 
            +
                        end
         | 
| 248 | 
            +
                    end
         | 
| 249 | 
            +
             | 
| 250 | 
            +
                    def valid?
         | 
| 251 | 
            +
                      valid_syntax? && valid_semantics?
         | 
| 252 | 
            +
                    end
         | 
| 253 | 
            +
             | 
| 254 | 
            +
                    def valid_syntax?
         | 
| 255 | 
            +
                      @subject_result.valid_syntax? &&
         | 
| 256 | 
            +
                        @object_result.valid_syntax? &&
         | 
| 257 | 
            +
                        @syntax_results.empty?
         | 
| 258 | 
            +
                    end
         | 
| 259 | 
            +
             | 
| 260 | 
            +
                    def valid_semantics?
         | 
| 261 | 
            +
                      @subject_result.valid_semantics? &&
         | 
| 262 | 
            +
                        @object_result.valid_semantics? &&
         | 
| 263 | 
            +
                        @semantics_results.empty?
         | 
| 264 | 
            +
                    end
         | 
| 265 | 
            +
             | 
| 266 | 
            +
                    def subject_valid?
         | 
| 267 | 
            +
                      @subject_result.valid?
         | 
| 268 | 
            +
                    end
         | 
| 269 | 
            +
             | 
| 270 | 
            +
                    def object_valid?
         | 
| 271 | 
            +
                      @object_result.valid?
         | 
| 272 | 
            +
                    end
         | 
| 273 | 
            +
             | 
| 274 | 
            +
                    def valid_subject_signatures
         | 
| 275 | 
            +
                      @subject_result.semantics_results
         | 
| 276 | 
            +
                        .select do |res|
         | 
| 277 | 
            +
                          res.is_a?(Semantics::SignatureMappingSuccess)
         | 
| 278 | 
            +
                        end.uniq
         | 
| 279 | 
            +
                    end
         | 
| 280 | 
            +
             | 
| 281 | 
            +
                    def invalid_subject_signatures
         | 
| 282 | 
            +
                      @subject_result.semantics_results
         | 
| 283 | 
            +
                        .select do |res|
         | 
| 284 | 
            +
                          res.is_a?(Semantics::SignatureMappingWarning)
         | 
| 285 | 
            +
                        end
         | 
| 286 | 
            +
                    end
         | 
| 287 | 
            +
             | 
| 288 | 
            +
                    def valid_object_signatures
         | 
| 289 | 
            +
                      @object_result.semantics_results
         | 
| 290 | 
            +
                        .select do |res|
         | 
| 291 | 
            +
                          res.is_a?(Semantics::SignatureMappingSuccess)
         | 
| 292 | 
            +
                        end.uniq
         | 
| 293 | 
            +
                    end
         | 
| 294 | 
            +
             | 
| 295 | 
            +
                    def invalid_object_signatures
         | 
| 296 | 
            +
                      @object_result.semantics_results
         | 
| 297 | 
            +
                        .select do |res|
         | 
| 298 | 
            +
                          res.is_a?(Semantics::SignatureMappingWarning)
         | 
| 299 | 
            +
                        end
         | 
| 300 | 
            +
                    end
         | 
| 301 | 
            +
             | 
| 302 | 
            +
                    def detail
         | 
| 303 | 
            +
                      report = "Subject term - Valid signatures\n"
         | 
| 304 | 
            +
                      @subject_result.valid_signature_mappings.each do |mapping|
         | 
| 305 | 
            +
                        report += "  #{mapping.signature}\n"
         | 
| 306 | 
            +
                        mapping.results.each do |reason|
         | 
| 307 | 
            +
                          report += "    #{reason}\n"
         | 
| 308 | 
            +
                        end
         | 
| 309 | 
            +
                      end
         | 
| 310 | 
            +
                      report += "\n"
         | 
| 311 | 
            +
             | 
| 312 | 
            +
                      report += "Subject term - Invalid signatures\n"
         | 
| 313 | 
            +
                      @subject_result.invalid_signature_mappings.each do |mapping|
         | 
| 314 | 
            +
                        report += "  #{mapping.signature}\n"
         | 
| 315 | 
            +
                        mapping.results.each do |reason|
         | 
| 316 | 
            +
                          report += "    #{reason}\n"
         | 
| 317 | 
            +
                        end
         | 
| 50 318 | 
             
                      end
         | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 53 | 
            -
                       | 
| 54 | 
            -
             | 
| 319 | 
            +
                      report += "\n"
         | 
| 320 | 
            +
             | 
| 321 | 
            +
                      report += "Object term - Valid signatures\n"
         | 
| 322 | 
            +
                      @object_result.valid_signature_mappings.each do |mapping|
         | 
| 323 | 
            +
                        report += "  #{mapping.signature}\n"
         | 
| 324 | 
            +
                        mapping.results.each do |reason|
         | 
| 325 | 
            +
                          report += "    #{reason}\n"
         | 
| 326 | 
            +
                        end
         | 
| 55 327 | 
             
                      end
         | 
| 56 | 
            -
                       | 
| 57 | 
            -
             | 
| 58 | 
            -
             | 
| 59 | 
            -
             | 
| 60 | 
            -
                         | 
| 61 | 
            -
             | 
| 328 | 
            +
                      report += "\n"
         | 
| 329 | 
            +
             | 
| 330 | 
            +
                      report += "Object term - Invalid signatures\n"
         | 
| 331 | 
            +
                      @object_result.invalid_signature_mappings.each do |mapping|
         | 
| 332 | 
            +
                        report += "  #{mapping.signature}\n"
         | 
| 333 | 
            +
                        mapping.results.each do |reason|
         | 
| 334 | 
            +
                          report += "    #{reason}\n"
         | 
| 62 335 | 
             
                        end
         | 
| 63 336 | 
             
                      end
         | 
| 64 | 
            -
             | 
| 337 | 
            +
                      report
         | 
| 338 | 
            +
                    end
         | 
| 339 | 
            +
                  end
         | 
| 340 | 
            +
             | 
| 341 | 
            +
                  class NestedStatementResult
         | 
| 342 | 
            +
                    attr_reader :syntax_results, :semantics_results
         | 
| 343 | 
            +
                    include Result
         | 
| 344 | 
            +
             | 
| 345 | 
            +
                    def initialize(subject_result, object_result, syntax, semantics)
         | 
| 346 | 
            +
                      @subject_result    = subject_result
         | 
| 347 | 
            +
                      @object_result     = object_result
         | 
| 348 | 
            +
                      @syntax_results    = syntax
         | 
| 349 | 
            +
                      @semantics_results =
         | 
| 350 | 
            +
                        semantics.reject! do |res|
         | 
| 351 | 
            +
                          res.is_a?(Semantics::SignatureMappingWarning) ||
         | 
| 352 | 
            +
                          res.is_a?(Semantics::SignatureMappingSuccess)
         | 
| 353 | 
            +
                        end
         | 
| 354 | 
            +
                    end
         | 
| 355 | 
            +
             | 
| 356 | 
            +
                    def valid?
         | 
| 357 | 
            +
                      valid_syntax? && valid_semantics?
         | 
| 358 | 
            +
                    end
         | 
| 359 | 
            +
             | 
| 360 | 
            +
                    def valid_syntax?
         | 
| 361 | 
            +
                      @subject_result.valid_syntax? &&
         | 
| 362 | 
            +
                        @object_result.valid_syntax? &&
         | 
| 363 | 
            +
                        @syntax_results.empty?
         | 
| 364 | 
            +
                    end
         | 
| 365 | 
            +
             | 
| 366 | 
            +
                    def valid_semantics?
         | 
| 367 | 
            +
                      @subject_result.valid_semantics? &&
         | 
| 368 | 
            +
                        @object_result.valid_semantics? &&
         | 
| 369 | 
            +
                        @semantics_results.empty?
         | 
| 370 | 
            +
                    end
         | 
| 371 | 
            +
             | 
| 372 | 
            +
                    def subject_valid?
         | 
| 373 | 
            +
                      @subject_result.valid?
         | 
| 374 | 
            +
                    end
         | 
| 375 | 
            +
             | 
| 376 | 
            +
                    def object_valid?
         | 
| 377 | 
            +
                      @object_result.valid?
         | 
| 378 | 
            +
                    end
         | 
| 379 | 
            +
             | 
| 380 | 
            +
                    def valid_subject_signatures
         | 
| 381 | 
            +
                      @subject_result.semantics_results
         | 
| 382 | 
            +
                        .select do |res|
         | 
| 383 | 
            +
                          res.is_a?(Semantics::SignatureMappingSuccess)
         | 
| 384 | 
            +
                        end.uniq
         | 
| 385 | 
            +
                    end
         | 
| 386 | 
            +
             | 
| 387 | 
            +
                    def invalid_subject_signatures
         | 
| 388 | 
            +
                      @subject_result.semantics_results
         | 
| 389 | 
            +
                        .select do |res|
         | 
| 390 | 
            +
                          res.is_a?(Semantics::SignatureMappingWarning)
         | 
| 391 | 
            +
                        end
         | 
| 392 | 
            +
                    end
         | 
| 393 | 
            +
             | 
| 394 | 
            +
                    def valid_object_signatures
         | 
| 395 | 
            +
                      @object_result.semantics_results
         | 
| 396 | 
            +
                        .select do |res|
         | 
| 397 | 
            +
                          res.is_a?(Semantics::SignatureMappingSuccess)
         | 
| 398 | 
            +
                        end.uniq
         | 
| 399 | 
            +
                    end
         | 
| 400 | 
            +
             | 
| 401 | 
            +
                    def invalid_object_signatures
         | 
| 402 | 
            +
                      @object_result.semantics_results
         | 
| 403 | 
            +
                        .select do |res|
         | 
| 404 | 
            +
                          res.is_a?(Semantics::SignatureMappingWarning)
         | 
| 405 | 
            +
                        end
         | 
| 406 | 
            +
                    end
         | 
| 407 | 
            +
             | 
| 408 | 
            +
                    def to_s
         | 
| 409 | 
            +
                      report = @object_result.to_s
         | 
| 410 | 
            +
                      <<-HEADER.gsub(/^ {12}/, '')
         | 
| 411 | 
            +
                        Syntax:    #{valid_syntax?    ? 'Valid' : 'Invalid'}
         | 
| 412 | 
            +
                        Semantics: #{valid_semantics? ? 'Valid' : 'Invalid'}
         | 
| 413 | 
            +
             | 
| 414 | 
            +
                        #{syntax_errors_s}#{semantics_errors_s}#{detail}
         | 
| 415 | 
            +
                      HEADER
         | 
| 416 | 
            +
                    end
         | 
| 417 | 
            +
             | 
| 418 | 
            +
                    def detail
         | 
| 419 | 
            +
                      report = "Subject term - Valid signatures\n"
         | 
| 420 | 
            +
                      @subject_result.valid_signature_mappings.each do |mapping|
         | 
| 421 | 
            +
                        report += "  #{mapping.signature}\n"
         | 
| 422 | 
            +
                        mapping.results.each do |reason|
         | 
| 423 | 
            +
                          report += "    #{reason}\n"
         | 
| 424 | 
            +
                        end
         | 
| 425 | 
            +
                      end
         | 
| 426 | 
            +
                      report += "\n"
         | 
| 427 | 
            +
             | 
| 428 | 
            +
                      report += "Subject term - Invalid signatures\n"
         | 
| 429 | 
            +
                      @subject_result.invalid_signature_mappings.each do |mapping|
         | 
| 430 | 
            +
                        report += "  #{mapping.signature}\n"
         | 
| 431 | 
            +
                        mapping.results.each do |reason|
         | 
| 432 | 
            +
                          report += "    #{reason}\n"
         | 
| 433 | 
            +
                        end
         | 
| 434 | 
            +
                      end
         | 
| 435 | 
            +
                      report += "\n"
         | 
| 436 | 
            +
             | 
| 437 | 
            +
                      report += @object_result.detail
         | 
| 438 | 
            +
                      report
         | 
| 439 | 
            +
                    end
         | 
| 65 440 | 
             
                  end
         | 
| 66 441 | 
             
                end
         | 
| 67 442 | 
             
              end
         | 
| @@ -126,7 +126,7 @@ module BELParser | |
| 126 126 |  | 
| 127 127 | 
             
                    def to_s
         | 
| 128 128 | 
             
                      function = @expression_node.string_literal
         | 
| 129 | 
            -
                      %(Function of "#{function}" does not match return types: #{@expected_return_types.join(', ')})
         | 
| 129 | 
            +
                      %(Function of "#{function}" does not match return types: #{@expected_return_types.map(&:to_sym).join(', ')})
         | 
| 130 130 | 
             
                    end
         | 
| 131 131 | 
             
                  end
         | 
| 132 132 |  |