|
8 | 8 | require 'linkeddata'
|
9 | 9 | rescue LoadError
|
10 | 10 | # Silently load without linkeddata, but try some others
|
11 |
| - %w(microdata n3 rdfa rdfxml reasoner tabular trig trix turtle vocab xsd json/ld ld/patch).each do |ser| |
| 11 | + %w( |
| 12 | + json/ld |
| 13 | + ld/patch |
| 14 | + rdf/microdata |
| 15 | + rdf/n3 |
| 16 | + rdf/ordered_repo |
| 17 | + rdf/rdfa |
| 18 | + rdf/rdfxml |
| 19 | + rdf/reasoner |
| 20 | + rdf/tabular |
| 21 | + rdf/trig |
| 22 | + rdf/trix |
| 23 | + rdf/turtle |
| 24 | + rdf/vocab |
| 25 | + rdf/xsd |
| 26 | + shacl |
| 27 | + shex |
| 28 | + ).each do |ser| |
12 | 29 | begin
|
13 |
| - require ser.include?('/') ? ser : "rdf/#{ser}" |
| 30 | + require ser |
14 | 31 | rescue LoadError
|
15 | 32 | end
|
16 | 33 | end
|
@@ -457,7 +474,7 @@ def self.usage(options, cmd_opts: {}, banner: nil)
|
457 | 474 | # @param [Array<String>] args
|
458 | 475 | # @param [IO] output
|
459 | 476 | # @param [OptionParser] option_parser
|
460 |
| - # @param [Hash{Symbol => Hash{Symbol => Array[String]}}] messages used for confeying non primary-output which is structured. |
| 477 | + # @param [Hash{Symbol => Hash{Symbol => Array[String]}}] messages used for conveying non primary-output which is structured. |
461 | 478 | # @param [Hash{Symbol => Object}] options
|
462 | 479 | # @return [Boolean]
|
463 | 480 | def self.exec(args, output: $stdout, option_parser: nil, messages: {}, **options)
|
@@ -506,10 +523,12 @@ def self.exec(args, output: $stdout, option_parser: nil, messages: {}, **options
|
506 | 523 | options[:output_format] = options[:output_format].to_sym if options[:output_format]
|
507 | 524 |
|
508 | 525 | # Allow repository to be set via option.
|
509 |
| - @repository = options[:repository] || |
510 |
| - (options[:ordered] ? |
511 |
| - [].extend(RDF::Enumerable, RDF::Queryable) : |
512 |
| - RDF::Repository.new) |
| 526 | + # If RDF::OrderedRepo is present, use it if the `ordered` option is specified, otherwise extend an Array. |
| 527 | + @repository = options[:repository] || case |
| 528 | + when RDF.const_defined?(:OrderedRepo) then RDF::OrderedRepo.new |
| 529 | + when options[:ordered] then [].extend(RDF::Enumerable, RDF::Queryable) |
| 530 | + else RDF::Repository.new |
| 531 | + end |
513 | 532 |
|
514 | 533 | # Parse input files if any command requires it
|
515 | 534 | if cmds.any? {|c| COMMANDS[c.to_sym][:parse]}
|
|
0 commit comments