rdf 3.1.4 → 3.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ecf8b966bcaf7510f41e9abcfa06b9fc2ba8bf6f135452055d4070374d8d277
4
- data.tar.gz: 040d4fd90f753fb7775de4faa323dbdf611b72b106c2d739fe49da2782654bf2
3
+ metadata.gz: 3024b8471983ae96eef2df1b95ef2fc1d72bba082d43e3567c9e8c30970cb6db
4
+ data.tar.gz: 3104532cffa328bb403fe3403deb30188ceb00a119b8f4e1dbccc7c01fd69712
5
5
  SHA512:
6
- metadata.gz: 6fef455fbd5119f38c8591b88efd49856fb595ad2a1a35d0aa8124d7ca42f19e30a2e655829b633e362e5fba9723acbb2bb171aa6f0e2176ddd721a18e147ce7
7
- data.tar.gz: ff5f59ab46447637a367f3355aadd005944457c6832264130ab9b9d6566f0ca0eff6a71245562d68de05e46e7cc6a97d74e447df1ff9918b0f4135d3e402f350
6
+ metadata.gz: 2b62e3081278305f44f09c7aa77d3143a5110779bd1963e702ffde2ffacae8fa4ee0abcb861441675ea70c409f33270e7f4a2e0cf45c66c4956188bebef6ae80
7
+ data.tar.gz: 23674e4180517963dd92f26ac4d40c7c3eea672be96e64f8d719ff94c084ef229e5e21473d1d4dd0336fbb8ae3ad2c3b200ff1f7da6b7a352ead2ff98d4dd83c
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.4
1
+ 3.1.5
data/bin/rdf CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
- $:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')))
2
+ $:.unshift(File.expand_path("../../lib", __FILE__))
3
3
  require 'rubygems'
4
- require 'rdf/cli'
4
+ require 'rdf'
5
5
 
6
6
  options = RDF::CLI.options(ARGV)
7
7
 
data/lib/rdf.rb CHANGED
@@ -76,6 +76,9 @@ module RDF
76
76
  # Utilities
77
77
  autoload :Util, 'rdf/util'
78
78
 
79
+ # CLI
80
+ autoload :CLI, 'rdf/cli'
81
+
79
82
  ##
80
83
  # Alias for `RDF::Resource.new`.
81
84
  #
@@ -8,7 +8,7 @@ begin
8
8
  require 'linkeddata'
9
9
  rescue LoadError
10
10
  # Silently load without linkeddata, but try some others
11
- %w(reasoner rdfa rdfxml turtle vocab json/ld ld/patch).each do |ser|
11
+ %w(microdata n3 rdfa rdfxml reasoner tabular trig trix turtle vocab xsd json/ld ld/patch).each do |ser|
12
12
  begin
13
13
  require ser.include?('/') ? ser : "rdf/#{ser}"
14
14
  rescue LoadError
@@ -296,6 +296,12 @@ module RDF
296
296
  control: :none,
297
297
  on: ["-o", "--output FILE"],
298
298
  description: "File to write output, defaults to STDOUT") {|arg| File.open(arg, "w")},
299
+ RDF::CLI::Option.new(
300
+ symbol: :ordered,
301
+ control: :checkbox,
302
+ datatype: TrueClass,
303
+ on: ["--ordered"],
304
+ description: "Use order preserving repository"),
299
305
  RDF::CLI::Option.new(
300
306
  symbol: :format,
301
307
  control: :select,
@@ -495,14 +501,16 @@ module RDF
495
501
  options[:format] = options[:format].to_sym if options[:format]
496
502
  options[:output_format] = options[:output_format].to_sym if options[:output_format]
497
503
 
498
- @repository = RDF::Repository.new
504
+ @repository = options[:ordered] ?
505
+ [].extend(RDF::Enumerable, RDF::Queryable) :
506
+ RDF::Repository.new
499
507
 
500
508
  # Parse input files if any command requires it
501
509
  if cmds.any? {|c| COMMANDS[c.to_sym][:parse]}
502
510
  start = Time.new
503
511
  count = 0
504
512
  self.parse(args, **options) do |reader|
505
- @repository << reader
513
+ reader.each_statement {|st| @repository << st}
506
514
  end
507
515
  secs = Time.new - start
508
516
  options[:logger].info "Parsed #{repository.count} statements with #{@readers.join(', ')} in #{secs} seconds @ #{count/secs} statements/second."
@@ -902,7 +902,7 @@ module RDF
902
902
  # Normalized version of user
903
903
  # @return [String]
904
904
  def normalized_user
905
- URI.encode(CGI.unescape(user), /[^#{IUNRESERVED}|#{SUB_DELIMS}]/) if user
905
+ URI.encode(CGI.unescape(user), /[^#{IUNRESERVED}|#{SUB_DELIMS}]/).force_encoding(Encoding::UTF_8) if user
906
906
  end
907
907
 
908
908
  ##
@@ -928,7 +928,7 @@ module RDF
928
928
  # Normalized version of password
929
929
  # @return [String]
930
930
  def normalized_password
931
- URI.encode(CGI.unescape(password), /[^#{IUNRESERVED}|#{SUB_DELIMS}]/) if password
931
+ URI.encode(CGI.unescape(password), /[^#{IUNRESERVED}|#{SUB_DELIMS}]/).force_encoding(Encoding::UTF_8) if password
932
932
  end
933
933
 
934
934
  HOST_FROM_AUTHORITY_RE = /(?:[^@]+@)?([^:]+)(?::.*)?$/.freeze
@@ -1295,7 +1295,7 @@ module RDF
1295
1295
  value = value.dup.force_encoding(Encoding::UTF_8)
1296
1296
  decoded = CGI.unescape(value)
1297
1297
  decoded.downcase! if downcase
1298
- URI.encode(decoded, /[^(?:#{expr})]/)
1298
+ URI.encode(decoded, /[^(?:#{expr})]/).force_encoding(Encoding::UTF_8)
1299
1299
  end
1300
1300
  end
1301
1301
 
@@ -14,7 +14,7 @@ module RDF; module Util
14
14
  # allowing the use of `Rack::Cache` to avoid network access.
15
15
  #
16
16
  # To use other HTTP clients, consumers can subclass
17
- # {RDF::Util::File::HttpAdapter} and set the {RDF::Util::File.http_adapter}.
17
+ # {RDF::Util::File::HttpAdapter} and set the {RDF::Util::File.}.
18
18
  #
19
19
  # Also supports the file: scheme for access to local files.
20
20
  #
@@ -121,8 +121,8 @@ module RDF; module Util
121
121
 
122
122
  redirect_count = 0
123
123
  max_redirects = 5
124
- parsed_url = ::URI.parse(base_uri)
125
- parsed_proxy = ::URI.parse(proxy.to_s)
124
+ parsed_url = RDF::URI.parse(base_uri)
125
+ parsed_proxy = RDF::URI.parse(proxy.to_s)
126
126
  base_uri = parsed_url.to_s
127
127
  remote_document = nil
128
128
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.4
4
+ version: 3.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arto Bendiken
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-07-01 00:00:00.000000000 Z
13
+ date: 2020-08-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: link_header