rdf 3.2.6 → 3.2.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58dcc9836c4302cad4bb46a86596235794a664d508cc002ce298b6c964265ba9
4
- data.tar.gz: 941a3daf3a379acf33fe09688ea9cabefd25eb88dc80a7b31d05ac380b2cb2f9
3
+ metadata.gz: 62ac7574f98336ccea36385134d2007029e6e4edb182920c45fefb8f50fcccb7
4
+ data.tar.gz: b89e554b9961e6038408a29e8ca104aac8b6692a39fa9dddbab0779479e1b2bc
5
5
  SHA512:
6
- metadata.gz: f384a93b62b93d574c3dae02e8285f77a3ea6fa26c60eb30aa387e7213343e763a00d9a58f33d0caf4acc5f68a4b27e55361beb792127486059e8afeb333053e
7
- data.tar.gz: ed8a19309a2b2f042a3f10df60465b56bd5ea9ace1a305cbe595bab507a7606eae99438fe3ce1edbcd653f513bd015aaf19d5e7203c5903278e275dc591e9d15
6
+ metadata.gz: 15af5338e8d3a4ff0c1601aad011a9b340b2b1b0f93da4d383bfb4b81da58c3dda68ea8e6e03a034b7decf81650f5f6e3b398b564205f5a0a39ffbf134974dde
7
+ data.tar.gz: 7ba7aa6f6af2a6e61b5b0da249bf084a84d0ef75245438bf091acbdb55e6fcc4c0c8dc904058e8ad0e11ced53cd373e68a4ebaef93867b7cf60f253f4581ded8
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.2.6
1
+ 3.2.7
data/lib/rdf/cli.rb CHANGED
@@ -572,7 +572,8 @@ module RDF
572
572
  # @param [Hash{Symbol => Object}] options already set
573
573
  # @return [Array<String>] list of executable commands
574
574
  # @overload commands(format: :json, **options)
575
- # @param [:json] format (:json)
575
+ # Returns commands as JSON, for API usage.
576
+ # @param [:json] format
576
577
  # @param [Hash{Symbol => Object}] options already set
577
578
  # @return [Array{Object}]
578
579
  # Returns an array of commands including the command symbol
@@ -593,7 +594,7 @@ module RDF
593
594
  # Subset commands based on filter options
594
595
  cmds = COMMANDS.reject do |k, c|
595
596
  c.fetch(:filter, {}).any? do |opt, val|
596
- options[opt].to_s != val.to_s
597
+ options.merge(format: format)[opt].to_s != val.to_s
597
598
  end
598
599
  end
599
600
 
data/lib/rdf/format.rb CHANGED
@@ -23,7 +23,9 @@ module RDF
23
23
  #
24
24
  # @example Defining a new RDF serialization format class
25
25
  # class RDF::NTriples::Format < RDF::Format
26
- # content_type 'application/n-triples', extension: :nt
26
+ # content_type 'application/n-triples',
27
+ # extension: :nt,
28
+ # uri: RDF::URI("http://www.w3.org/ns/formats/N-Triples")
27
29
  # content_encoding 'utf-8'
28
30
  #
29
31
  # reader RDF::NTriples::Reader
@@ -222,6 +224,19 @@ module RDF
222
224
  @@file_extensions
223
225
  end
224
226
 
227
+ ##
228
+ # Returns the unique URI for the format.
229
+ #
230
+ # @example retrieving a list of supported file format URIs
231
+ #
232
+ # RDF::Format.uris.keys
233
+ #
234
+ # @see https://www.w3.org/ns/formats/
235
+ # @return [Hash{Symbol => URI}]
236
+ def self.uris
237
+ @@uris
238
+ end
239
+
225
240
  ##
226
241
  # Returns the set of format symbols for available RDF::Reader subclasses.
227
242
  #
@@ -465,6 +480,7 @@ module RDF
465
480
  # @option options [Array<String>] :aliases (nil)
466
481
  # @option options [Symbol] :extension (nil)
467
482
  # @option options [Array<Symbol>] :extensions (nil)
483
+ # @option options [URI] :uri (nil)
468
484
  # @return [void]
469
485
  #
470
486
  # @overload content_type
@@ -504,6 +520,10 @@ module RDF
504
520
  @@content_types[aa] << self unless @@content_types[aa].include?(self)
505
521
  end
506
522
  end
523
+ # URI identifying this format
524
+ if uri = options[:uri]
525
+ @@uris[RDF::URI(uri)] = self
526
+ end
507
527
  end
508
528
  end
509
529
 
@@ -517,7 +537,7 @@ module RDF
517
537
  end
518
538
 
519
539
  ##
520
- # Retrieves or defines file extensions for this RDF serialization format.
540
+ # Retrieves file extensions for this RDF serialization format.
521
541
  #
522
542
  # The return is an array where the first element is the cannonical
523
543
  # file extension for the format and following elements are alias file extensions.
@@ -527,6 +547,17 @@ module RDF
527
547
  @@file_extensions.map {|ext, formats| ext if formats.include?(self)}.compact
528
548
  end
529
549
 
550
+ ##
551
+ # Retrieves any format URI defined for this format..
552
+ #
553
+ # @return [URI]
554
+ def self.uri
555
+ @@uris.invert[self]
556
+ end
557
+ class << self
558
+ alias_method :to_uri, :uri
559
+ end
560
+
530
561
  protected
531
562
 
532
563
  ##
@@ -568,6 +599,7 @@ module RDF
568
599
  @@readers = {} # @private
569
600
  @@writers = {} # @private
570
601
  @@subclasses = [] # @private
602
+ @@uris = {} # @private
571
603
 
572
604
  ##
573
605
  # @private
data/lib/rdf/model/uri.rb CHANGED
@@ -76,6 +76,7 @@ module RDF
76
76
  IRI = Regexp.compile("^#{SCHEME}:(?:#{IHIER_PART})(?:\\?#{IQUERY})?(?:\\##{IFRAGMENT})?$").freeze
77
77
 
78
78
  # Split an IRI into it's component parts
79
+ # scheme, authority, path, query, fragment
79
80
  IRI_PARTS = /^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(\?[^#]*)?(#.*)?$/.freeze
80
81
 
81
82
  # Remove dot expressions regular expressions
@@ -872,6 +873,12 @@ module RDF
872
873
  parts = {}
873
874
  if matchdata = IRI_PARTS.match(value)
874
875
  scheme, authority, path, query, fragment = matchdata[1..-1]
876
+
877
+ if Gem.win_platform? && scheme && !authority && scheme.match?(/^[a-zA-Z]$/)
878
+ # A drive letter, not a scheme
879
+ scheme, path = nil, "#{scheme}:#{path}"
880
+ end
881
+
875
882
  userinfo, hostport = authority.to_s.split('@', 2)
876
883
  hostport, userinfo = userinfo, nil unless hostport
877
884
  user, password = userinfo.to_s.split(':', 2)
data/lib/rdf/nquads.rb CHANGED
@@ -20,7 +20,10 @@ module RDF
20
20
  # @see http://www.w3.org/TR/n-quads/
21
21
  # @since 0.4.0
22
22
  class Format < RDF::Format
23
- content_type 'application/n-quads', extension: :nq, alias: 'text/x-nquads;q=0.2'
23
+ content_type 'application/n-quads',
24
+ extension: :nq,
25
+ alias: 'text/x-nquads;q=0.2',
26
+ uri: RDF::URI("http://www.w3.org/ns/formats/N-Quads")
24
27
  content_encoding 'utf-8'
25
28
 
26
29
  reader { RDF::NQuads::Reader }
@@ -16,7 +16,10 @@ module RDF::NTriples
16
16
  # @see http://www.w3.org/TR/rdf-testcases/#ntriples
17
17
  # @see http://www.w3.org/TR/n-triples/
18
18
  class Format < RDF::Format
19
- content_type 'application/n-triples', extension: :nt, alias: 'text/plain;q=0.2'
19
+ content_type 'application/n-triples',
20
+ extension: :nt,
21
+ alias: 'text/plain;q=0.2',
22
+ uri: RDF::URI("http://www.w3.org/ns/formats/N-Triples")
20
23
  content_encoding 'utf-8'
21
24
 
22
25
  reader { RDF::NTriples::Reader }
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.2.6
4
+ version: 3.2.7
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: 2022-03-14 00:00:00.000000000 Z
13
+ date: 2022-04-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: link_header