relaton-nist 1.2.0 → 1.2.1

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: c27ee448a739133b46c5b46073a5370b8407ff9389deab931df5a450586a2694
4
- data.tar.gz: 6a53926d3e09a53e53d37de7b45c62b72111c85e30d9cc1cf4d97a838d7c4980
3
+ metadata.gz: d852851cf220ab63699584b62e0d5a051ad39eb9b7ef287840cbd782ce67bed9
4
+ data.tar.gz: 25208ad1822a38f658cb9d1a857451f614598b2dddcc969a84c31fd3c204ac1d
5
5
  SHA512:
6
- metadata.gz: a12935d087796f27121b84bc8d78bae367533da85e89487643f13bb4cffbd81c1dc104f6f05f4f77298b7a8940b82ca5e237e17522541bd1bbfd48449257ca64
7
- data.tar.gz: a602a206c6d2dcdcade816ef4596c4c374984b5b2eb8a45fce161102d31709706c33b7c783b7f2eb3be0bdeff183356ce484ad4c7d5e154f7b7db9673a8ad5c4
6
+ metadata.gz: 8e60c1f19d96a5d289a780ea29cec5830db57ca84c3007d5f0380b0fca6338538d75456bf963fb2f64208105a18b3b08073f642c66b2323fe481fd2d15f578c1
7
+ data.tar.gz: c19983c79a538c1bd0357ffbefc2b3e4450115f505f01b38fbf44e5028e67d8a544e339d2f4e88b5532c4d8ec6e22caa6e12e3b7e592ecf4849f7c34064a5cb3
@@ -0,0 +1,5 @@
1
+ module RelatonNist
2
+ class DocumentRelation < RelatonBib::DocumentRelation
3
+ TYPES += %w[obsoletedBy supersedes supersededBy].freeze
4
+ end
5
+ end
@@ -26,6 +26,24 @@ module RelatonNist
26
26
 
27
27
  ret[:commentperiod] = CommentPeriod.new ret[:commentperiod]
28
28
  end
29
+
30
+ # @param ret [Hash]
31
+ def relations_hash_to_bib(ret)
32
+ super
33
+ return unless ret[:relation]
34
+
35
+ ret[:relation] = ret[:relation].map { |r| DocumentRelation.new r }
36
+
37
+ # ret[:relation] = array(ret[:relation])
38
+ # ret[:relation]&.each do |r|
39
+ # if r[:description]
40
+ # r[:description] = FormattedString.new r[:description]
41
+ # end
42
+ # relation_bibitem_hash_to_bib(r)
43
+ # relation_locality_hash_to_bib(r)
44
+ # relation_source_locality_hash_to_bib(r)
45
+ # end
46
+ end
29
47
  end
30
48
  end
31
49
  end
@@ -51,7 +51,7 @@ module RelatonNist
51
51
  # @option abstract [String] :script
52
52
  # @option abstract [String] :type
53
53
  #
54
- # @param relation [Array<Hash>]
54
+ # @param relation [Array<Hash, RelatonNist::DocumentRelation>]
55
55
  # @option relation [String] :type
56
56
  # @option relation [RelatonBib::BibliographicItem] :bibitem
57
57
  # @option relation [Array<RelatonBib::BibItemLocality>] :bib_locality
@@ -1,5 +1,6 @@
1
1
  require "relaton_bib"
2
2
  require "relaton_nist/nist_bibliographic_item"
3
+ require "relaton_nist/document_relation"
3
4
  require "relaton_nist/scrapper"
4
5
  require "relaton_nist/hit_collection"
5
6
  require "relaton_nist/xml_parser"
@@ -235,15 +235,18 @@ module RelatonNist
235
235
  )
236
236
  end
237
237
  if contr["surname"]
238
- affiliation = RelatonBib::Affiliation.new organization: org
238
+ affiliation = []
239
+ affiliation << RelatonBib::Affiliation.new(organization: org) if org
239
240
  entity = RelatonBib::Person.new(
240
- name: full_name(contr, lang, script), affiliation: [affiliation],
241
+ name: full_name(contr, lang, script), affiliation: affiliation,
241
242
  )
242
- else
243
+ elsif org
243
244
  entity = org
244
245
  end
245
- RelatonBib::ContributionInfo.new entity: entity, role: [type: role]
246
- end
246
+ if entity
247
+ RelatonBib::ContributionInfo.new entity: entity, role: [type: role]
248
+ end
249
+ end.compact
247
250
  end
248
251
 
249
252
  # rubocop:disable Metrics/CyclomaticComplexity
@@ -373,7 +376,7 @@ module RelatonNist
373
376
 
374
377
  # Fetch relations.
375
378
  # @param doc [Nokogiri::HTML::Document]
376
- # @return [Array<RelatonBib::DocumentRelation>]
379
+ # @return [Array<RelatonNist::DocumentRelation>]
377
380
  def fetch_relations(doc)
378
381
  relations = doc.xpath('//span[@id="pub-supersedes-container"]/a').map do |r|
379
382
  doc_relation "supersedes", r.text, DOMAIN + r[:href]
@@ -402,9 +405,9 @@ module RelatonNist
402
405
  # @param type [String]
403
406
  # @param ref [String]
404
407
  # @param uri [String]
405
- # @return [RelatonBib::DocumentRelation]
408
+ # @return [RelatonNist::DocumentRelation]
406
409
  def doc_relation(type, ref, uri, lang = "en", script = "Latn")
407
- RelatonBib::DocumentRelation.new(
410
+ DocumentRelation.new(
408
411
  type: type,
409
412
  bibitem: RelatonBib::BibliographicItem.new(
410
413
  formattedref: RelatonBib::FormattedRef.new(
@@ -1,3 +1,3 @@
1
1
  module RelatonNist
2
- VERSION = "1.2.0".freeze
2
+ VERSION = "1.2.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-nist
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-26 00:00:00.000000000 Z
11
+ date: 2020-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debase
@@ -204,6 +204,7 @@ files:
204
204
  - grammars/reqt.rng
205
205
  - lib/relaton_nist.rb
206
206
  - lib/relaton_nist/comment_period.rb
207
+ - lib/relaton_nist/document_relation.rb
207
208
  - lib/relaton_nist/document_status.rb
208
209
  - lib/relaton_nist/hash_converter.rb
209
210
  - lib/relaton_nist/hit.rb