rdf 3.1.6 → 3.1.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: 4a2f065f2ef318b5183512ee7cbe816d3c86cf497a1822d886d1a5cb12ae7c7c
4
- data.tar.gz: b51e9e8d120f8441da1cc4478a4a8bf470010cd8009eef992fb91d39fce2aeea
3
+ metadata.gz: 7e220d98b1d53ade20bf5999761a948e495597dc74eaccd6830c22adadc77fa4
4
+ data.tar.gz: 13b643963aeb32f99e2c455490e3cbc661c56153abb6dd38ff192e42ce0ee5f5
5
5
  SHA512:
6
- metadata.gz: efe71f0a3278321dacffe85afac3b9fad8fd9c0be2736689ced8fcfa27164cf1f9a0221438c851fe8d61f375889ab6ca124f026a6a675b64b38792aa5c9f7e91
7
- data.tar.gz: c9228398f6a2e3236bdfc878bbe083713648acee8e26c72a1bed358deea5041420667167976607b2942f24b026ab3d6aae03c046632ca41e6fa9760f997d752e
6
+ metadata.gz: 9a845aa06b3cb0af80aa3e2ca0d9f051d4158258d5007032f73b974c4976e0dd9a34b8d1c55eda3fe2b5fd8c5f9ee9528647514f81387f0032e4adcbc8a0f46d
7
+ data.tar.gz: 388f74852651a13a7a24f10c6dee8767d76d44b7d002d58efc356dfae76629c7fccd0c462a19df874ee64c39516b838661e4b586847718084a41ad72644483fa
data/README.md CHANGED
@@ -438,7 +438,10 @@ This repository uses [Git Flow](https://github.com/nvie/gitflow) to mange develo
438
438
  enough, be assured we will eventually add you in there.
439
439
  * Do note that in order for us to merge any non-trivial changes (as a rule
440
440
  of thumb, additions larger than about 15 lines of code), we need an
441
- explicit [public domain dedication][PDD] on record from you.
441
+ explicit [public domain dedication][PDD] on record from you,
442
+ which you will be asked to agree to on the first commit to a repo within the organization.
443
+ Note that the agreement applies to all repos in the [Ruby RDF](https://github.com/ruby-rdf/) organization.
444
+
442
445
 
443
446
  ## License
444
447
 
@@ -450,7 +453,7 @@ see <https://unlicense.org/> or the accompanying {file:UNLICENSE} file.
450
453
  [N-Quads]: https://www.w3.org/TR/n-quads/
451
454
  [YARD]: https://yardoc.org/
452
455
  [YARD-GS]: https://rubydoc.info/docs/yard/file/docs/GettingStarted.md
453
- [PDD]: https://lists.w3.org/Archives/Public/public-rdf-ruby/2010May/0013.html
456
+ [PDD]: https://unlicense.org/#unlicensing-contributions
454
457
  [JSONLD doc]: https://rubydoc.info/github/ruby-rdf/json-ld
455
458
  [LinkedData doc]: https://rubydoc.info/github/ruby-rdf/linkeddata
456
459
  [Microdata doc]: https://rubydoc.info/github/ruby-rdf/rdf-microdata
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.6
1
+ 3.1.7
@@ -63,9 +63,15 @@ module RDF; class Literal
63
63
  ##
64
64
  # Returns the number with no fractional part that is closest to the argument. If there are two such numbers, then the one that is closest to positive infinity is returned. An error is raised if arg is not a numeric value.
65
65
  #
66
- # @return [RDF::Literal::Integer]
66
+ # @return [RDF::Literal::Decimal]
67
67
  def round
68
- RDF::Literal::Integer.new(to_d.round)
68
+ rounded = to_d.round(half: (to_d < 0 ? :down : :up))
69
+ if rounded == -0.0
70
+ # to avoid -0.0
71
+ self.class.new(0.0)
72
+ else
73
+ self.class.new(rounded)
74
+ end
69
75
  end
70
76
 
71
77
  ##
@@ -181,11 +181,11 @@ module RDF; class Literal
181
181
  end
182
182
 
183
183
  ##
184
- # Returns the integer with no fractional part that is closest to the argument. If there are two such numbers, then the one that is closest to positive infinity is returned. An error is raised if arg is not a numeric value.
184
+ # Returns the number with no fractional part that is closest to the argument. If there are two such numbers, then the one that is closest to positive infinity is returned. An error is raised if arg is not a numeric value.
185
185
  #
186
- # @return [RDF::Literal::Integer]
186
+ # @return [RDF::Literal::Double]
187
187
  def round
188
- RDF::Literal::Integer.new(to_f.round)
188
+ self.class.new(to_d.round(half: (to_d < 0 ? :down : :up)))
189
189
  end
190
190
 
191
191
  ##
@@ -311,12 +311,22 @@ module RDF
311
311
  # @param [#to_s] base_uri
312
312
  # @return [RDF::URI]
313
313
  def relativize(base_uri)
314
- if base_uri.to_s.end_with?("/", "#") &&
314
+ if self.to_s.start_with?(base_uri.to_s) && %w(# ?).include?(self.to_s[base_uri.to_s.length, 1]) ||
315
+ base_uri.to_s.end_with?("/", "#") &&
315
316
  self.to_s.start_with?(base_uri.to_s)
316
- RDF::URI(self.to_s[base_uri.to_s.length..-1])
317
+ return RDF::URI(self.to_s[base_uri.to_s.length..-1])
317
318
  else
318
- self
319
+ # Create a list of parents, for which this IRI may be relative.
320
+ u = RDF::URI(base_uri)
321
+ iri_set = u.to_s.end_with?('/') ? [u.to_s] : []
322
+ iri_set << u.to_s while (u = u.parent)
323
+ iri_set.each_with_index do |bb, index|
324
+ next unless self.to_s.start_with?(bb)
325
+ rel = "../" * index + self.to_s[bb.length..-1]
326
+ return rel.empty? ? "./" : rel
327
+ end
319
328
  end
329
+ self
320
330
  end
321
331
 
322
332
  ##
@@ -731,7 +731,7 @@ module RDF
731
731
  # @param [#to_s] property
732
732
  # @return [URI]
733
733
  def [](property)
734
- Term.intern([to_s, property.to_s].join(''), vocab: self.class, attributes: {})
734
+ Term.intern([to_s, property.to_s].join(''), vocab: self, attributes: {})
735
735
  end
736
736
 
737
737
  ##
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.6
4
+ version: 3.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arto Bendiken
8
8
  - Ben Lavender
9
9
  - Gregg Kellogg
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-09-04 00:00:00.000000000 Z
13
+ date: 2020-11-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: link_header
@@ -288,7 +288,7 @@ metadata:
288
288
  homepage_uri: https://ruby-rdf.github.io/rdf
289
289
  mailing_list_uri: https://lists.w3.org/Archives/Public/public-rdf-ruby/
290
290
  source_code_uri: https://github.com/ruby-rdf/rdf
291
- post_install_message:
291
+ post_install_message:
292
292
  rdoc_options: []
293
293
  require_paths:
294
294
  - lib
@@ -303,8 +303,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
303
303
  - !ruby/object:Gem::Version
304
304
  version: '0'
305
305
  requirements: []
306
- rubygems_version: 3.1.3
307
- signing_key:
306
+ rubygems_version: 3.1.4
307
+ signing_key:
308
308
  specification_version: 4
309
309
  summary: A Ruby library for working with Resource Description Framework (RDF) data.
310
310
  test_files: []