iso-bib-item 0.1.4 → 0.1.5

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
  SHA1:
3
- metadata.gz: 59ade325759b72b547cb68792cd68fb87acf8671
4
- data.tar.gz: c8c7b6428d783a3481ea23ffcec25e94d22c8cda
3
+ metadata.gz: 26c9b1fc49d80b621d0f5c4ba81effcd2f689b4d
4
+ data.tar.gz: 80dc767d218051b8b222fd3e306ec34a02fd9304
5
5
  SHA512:
6
- metadata.gz: bba1fe703f87d03747303659283786f0830ec273b5c35475bce558ba8bd497b3e13a83c1a8979a7d80a36aa41bbb7c401cbecef553154ab4281873faba0d851d
7
- data.tar.gz: 886fb4844ca6477f3ea90c1b060df0ab3fc28a1a3af29baa95c195714fae4c3e08857bd16299a41e57d6bf3d1a45e5ca33d12bf1a9517f15ec5d33978392bc91
6
+ metadata.gz: 61331746a10bc3ec3bf180f6ff2f64989e906cb823312843df3e5f9cddc5e2baa5a698c0c75b66e008e4cca780623126b10fc29a1ce355106e9e157f60ae6c93
7
+ data.tar.gz: dd9fca7f9cdd711873f3bd1cb6f8ca46414650a82f7387fc1d681f1f4178af3ef0b3ec675cacc9aac9e89c8eec6ba605be2f4233b153b455cc08c4532b325772
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- iso-bib-item (0.1.4)
4
+ iso-bib-item (0.1.5)
5
5
  isoics (~> 0.1.6)
6
6
  nokogiri
7
7
 
data/README.adoc CHANGED
@@ -1,16 +1,15 @@
1
- # IsoBibItem
1
+ = IsoBibItem
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/iso/bib/item`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ IsoBib is a Ruby gem that implements the https://github.com/riboseinc/isodoc-models#iso-bibliographic-item[IsoBibliographicItem model].
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
- ## Installation
5
+ == Installation
8
6
 
9
7
  Add this line to your application's Gemfile:
10
8
 
11
- ```ruby
9
+ [source,ruby]
10
+ ----
12
11
  gem 'iso-bib-item'
13
- ```
12
+ ----
14
13
 
15
14
  And then execute:
16
15
 
@@ -20,20 +19,335 @@ Or install it yourself as:
20
19
 
21
20
  $ gem install iso-bib-item
22
21
 
23
- ## Usage
22
+ == Usage
23
+
24
+ === Create ISO bibliographic item
25
+
26
+ [source,ruby]
27
+ ----
28
+ item = IsoBibItem::IsoBibliographicItem.new(
29
+ docid: { project_number: "19115", part_number: "1" },
30
+ edition: "1",
31
+ language: ["en", "fr"],
32
+ script: ["Latn"],
33
+ titles: [
34
+ {
35
+ title_intro: "Geographic information",
36
+ title_main: "Metadata",
37
+ title_part: "Part 1: Fundamentals",
38
+ language: "en", script: "Latn"
39
+ },
40
+ {
41
+ title_intro: "Information géographique",
42
+ title_main: "Métadonnées",
43
+ title_part: "Partie 1: Principes de base",
44
+ language: "fr", script: "Latn"
45
+ }
46
+ ],
47
+ type: "international-standard",
48
+ docstatus: { status: "Published", stage: "60", substage: "60" },
49
+ ics: [{ field: "35", group: "240", subgroup: "70" }],
50
+ dates: [{ type: "published", on: "2014-04" }],
51
+ contributors: [{ entity: {
52
+ name: "International Organization for Standardization",
53
+ url: "www.iso.org", abbreviation: "ISO"
54
+ }, roles: ["publisher"]}],
55
+ workgroup: {
56
+ name=>"International Organization for Standardization",
57
+ abbreviation: "ISO",
58
+ url: "www.iso.org",
59
+ technical_committee: {
60
+ name: "ISO/TC 211Geographic information/Geomatics",
61
+ type: "technicalCommittee", number: 211
62
+ }
63
+ },
64
+ abstract: [
65
+ {
66
+ content: "ISO 19115-1:2014 defines the schema required for describing geographic information and services by means of metadata. It provides information about the identification, the extent, the quality, the spatial and temporal aspects, the content, the spatial reference, the portrayal, distribution, and other properties of digital geographic data and services.ISO 19115-1:2014 is applicable to:-the cataloguing of all types of resources, clearinghouse activities, and the full description of datasets and services;-geographic services, geographic datasets, dataset series, and individual geographic features and feature properties.ISO 19115-1:2014 defines:-mandatory and conditional metadata sections, metadata entities, and metadata elements;-the minimum set of metadata required to serve most metadata applications (data discovery, determining data fitness for use, data access, data transfer, and use of digital data and services);-optional metadata elements to allow for a more extensive standard description of resources, if required;-a method for extending metadata to fit specialized needs.Though ISO 19115-1:2014 is applicable to digital data and services, its principles can be extended to many other types of resources such as maps, charts, and textual documents as well as non-geographic data. Certain conditional metadata elements might not apply to these other forms of data.",
67
+ language: "en", script: "Latn"
68
+ },
69
+ {
70
+ content: "L'ISO 19115-1:2014 définit le schéma requis pour décrire des informations géographiques et des services au moyen de métadonnées. Elle fournit des informations concernant l'identification, l'étendue, la qualité, les aspects spatiaux et temporels, le contenu, la référence spatiale, la représentation des données, la distribution et d'autres propriétés des données géographiques numériques et des services.L'ISO 19115-1:2014 est applicable:-au catalogage de tous les types de ressources, des activités des centres d'informations et à la description complète des jeux de données et des services,-aux services géographiques, jeux de données géographiques, séries de jeux de données, entités géographiques individuelles et propriétés d'entités.L'ISO 19115-1:2014 définit:-des sections relatives aux métadonnées obligatoires et facultatives, aux entités de métadonnées et aux éléments de métadonnées,-le jeu minimal de métadonnées requis pour répondre au besoin de la plupart des applications des métadonnées (la découverte des données, la détermination de l'adéquation des données à une utilisation, l'accès aux données, le transfert des données et l'utilisation des données numériques et des services),-les éléments de métadonnées facultatifs pour permettre une description standard plus poussée des ressources, si cela est nécessaire,-un procédé d'extension des métadonnées pour s'adapter aux besoins spéciaux.L'ISO 19115-1:2014 est applicable aux données numériques et services, ses principes peuvent être étendus à bien d'autres types de ressources telles que les cartes, les graphes et les documents textes, de même qu'à des données non géographiques. Certains éléments de métadonnées conditionnels peuvent ne pas s'appliquer à ces autres formes de données.",
71
+ language: "fr", script: "Latn"
72
+ }
73
+ ],
74
+ copyright: { owner: { name: "ISO" }, from: "2014" },
75
+ source: [
76
+ { type: "src", content: "https://www.iso.org/standard/53798.html" },
77
+ { type: "obp", content: "https://www.iso.org/obp/ui/#!iso:std:53798:en" },
78
+ { type: "rss", content: "https://www.iso.org/contents/data/standard/05/37/53798.detail.rss" }
79
+ ],
80
+ relations: [
81
+ { type: "obsoletes", identifier: "ISO 19115:2003", url: "/standard/26020.html" },
82
+ { type: "obsoletes", identifier: "ISO 19115:2003/Cor 1:2006", url: "/standard/44361.html" },
83
+ { type: "updates", identifier: "ISO 19115-1:2014/Amd 1:2018", url: "/standard/73118.html" }
84
+ ]
85
+ )
86
+ ----
87
+
88
+ === IsoBibliographicItem Localized Strings
89
+
90
+ [source,ruby]
91
+ ----
92
+ item.title
93
+ [<IsoBibItem::IsoLocalizedTitle:0x007fd1d92e2b30
94
+ @language="en",
95
+ @script="Latn",
96
+ @title_intro="Geographic information",
97
+ @title_main="Metadata",
98
+ @title_part="Part 1: Fundamentals">,
99
+ <IsoBibItem::IsoLocalizedTitle:0x007fd1d92e2ae0
100
+ @language="fr",
101
+ @script="Latn",
102
+ @title_intro="Information géographique",
103
+ @title_main="Métadonnées",
104
+ @title_part="Partie 1: Principes de base">]
105
+
106
+ item.title(lang: "en")
107
+ => <IsoBibItem::IsoLocalizedTitle:0x007fd1d92e2b30
108
+ @language="en",
109
+ @script="Latn",
110
+ @title_intro="Geographic information",
111
+ @title_main="Metadata",
112
+ @title_part="Part 1: Fundamentals">
113
+
114
+ item.title(lang: "en").to_s
115
+ => "Geographic information -- Metadata -- Part 1: Fundamentals"
116
+
117
+ item.abstract(lang: "en").to_s
118
+ => "ISO 19115-1:2014 defines the schema required for describing geographic information and services by means of metadata. It provides information about the identification, the extent, the quality, the spatial and temporal aspects, the content, the spatial reference, the portrayal, distribution, and other properties of digital geographic data and services.
119
+ ...
120
+ "
121
+ ----
122
+
123
+ === IsoBibliographicItem references
124
+
125
+ [source,ruby]
126
+ ----
127
+ item.shortref
128
+ => "ISO 19115-1:2014"
129
+ ----
130
+
131
+ === IsoBibliographicItem URLs
132
+
133
+ [source,ruby]
134
+ ----
135
+ item.url
136
+ => "https://www.iso.org/standard/53798.html"
137
+
138
+ item.url(:obp)
139
+ => "https://www.iso.org/obp/ui/#!iso:std:53798:en"
140
+
141
+ item.url(:rss)
142
+ => "https://www.iso.org/contents/data/standard/05/37/53798.detail.rss"
143
+ ----
144
+
145
+
146
+ === IsoBibliographicItem ICS
147
+
148
+ [source,ruby]
149
+ ----
150
+ item.ics
151
+ [<IsoBibItem::Ics:0x007fd1d92334f0
152
+ @code="35.240.70",
153
+ @description="IT applications in science",
154
+ @description_full="Information technology. Applications of information technology. IT applications in science.",
155
+ @fieldcode="35",
156
+ @groupcode="240",
157
+ @notes=[#<Isoics::Note:0x007fd1d9232f28 @ics_code=nil, @text="Including digital geographic information">],
158
+ @subgroupcode="70">]
159
+ ----
160
+
161
+ === IsoBibliographicItem BibliographicDates
162
+
163
+ [source,ruby]
164
+ ----
165
+ item.dates
166
+ => [<IsoBibItem::BibliographicDate:0x007fd1d92e33c8 @on=2014-01-04 00:00:00 +0100, @type="published">]
167
+
168
+ item.dates.filter(type: "published").first.on
169
+ => 2014-01-04 00:00:00 +0100
170
+ ----
171
+
172
+ === IsoBibliographicItem DocumentStatus
173
+
174
+ [source,ruby]
175
+ ----
176
+ item.status
177
+ => <IsoBibItem::IsoDocumentStatus:0x007f983c3c2658
178
+ @stage="60",
179
+ @status=#<IsoBibItem::LocalizedString:0x007f983c3c2608 @content="Published", @language=[], @script=[]>,
180
+ @substage="60">
181
+ ----
182
+
183
+ [source,ruby]
184
+ ----
185
+ wg = item.workgroup
186
+ => <IsoBibItem::IsoProjectGroup:0x007f983e0d91b0
187
+ @abbreviation=#<IsoBibItem::LocalizedString:0x007f983e0d8558 @content="ISO", @language=[], @script=[]>,
188
+ @contacts=[],
189
+ @identifiers=[],
190
+ @name=#<IsoBibItem::LocalizedString:0x007f983e0d8828 @content="International Organization for Standardization", @language=[], @script=[]>,
191
+ @technical_committe=#<IsoBibItem::IsoSubgroup:0x007f983e0d8148 @name="ISO/TC 211Geographic information/Geomatics", @number=211, @type="technicalCommittee">,
192
+ @uri=#<URI::Generic www.iso.org>>
193
+
194
+ wg.uri
195
+ => <URI::Generic www.iso.org>
196
+ ----
197
+
198
+ === Document relations of a standard
199
+
200
+ [source,ruby]
201
+ ----
202
+ iso191152.relations
203
+ => [<IsoBibItem::DocumentRelation:0x007f983c3c2a18 @bib_locality=[], @identifier="ISO 19115:2003", @type="obsoletes", @url="/standard/26020.html">,
204
+ <IsoBibItem::DocumentRelation:0x007f983c3c2950 @bib_locality=[], @identifier="ISO 19115:2003/Cor 1:2006", @type="obsoletes", @url="/standard/44361.html">,
205
+ <IsoBibItem::DocumentRelation:0x007f983c3c28d8 @bib_locality=[], @identifier="ISO 19115-1:2014/Amd 1:2018", @type="updates", @url="/standard/73118.html">]
206
+ ----
207
+
208
+ === XML serialization
209
+
210
+ [source,ruby]
211
+ ----
212
+ item.to_xml
213
+ =>"<bibitem type='international-standard' id='ISO19115-1'>
214
+ <title format='text/plain' language='en' script='Latn'>Geographic information -- Metadata -- Part 1: Fundamentals</title>
215
+ <title format='text/plain' language='fr' script='Latn'>Information géographique -- Métadonnées -- Partie 1: Principes de base</title>
216
+ <source type='src'>https://www.iso.org/standard/53798.html</source>
217
+ <source type='obp'>https://www.iso.org/obp/ui/#!iso:std:53798:en</source>
218
+ <source type='rss'>https://www.iso.org/contents/data/standard/05/37/53798.detail.rss</source>
219
+ <docidentifier>ISO 19115-1</docidentifier>
220
+ <date type='published'>
221
+ <on>2014</on>
222
+ </date>
223
+ <contributor>
224
+ <role type='publisher'/>
225
+ <organization>
226
+ <name>International Organization for Standardization</name>
227
+ <abbreviation>ISO</abbreviation>
228
+ <uri>www.iso.org</uri>
229
+ </organization>
230
+ </contributor>
231
+ <edition>1</edition>
232
+ <language>en</language>
233
+ <language>fr</language>
234
+ <script>Latn</script>
235
+ <abstract format='plain' language='en' script='Latn'>
236
+ ISO 19115-1:2014 defines the schema required for describing geographic
237
+ information and services by means of metadata. It provides information about
238
+ the identification, the extent, the quality, the spatial and temporal
239
+ aspects, the content, the spatial reference, the portrayal, distribution,
240
+ and other properties of digital geographic data and services.ISO
241
+ 19115-1:2014 is applicable to:-the cataloguing of all types of resources,
242
+ clearinghouse activities, and the full description of datasets and
243
+ services;-geographic services, geographic datasets, dataset series, and
244
+ individual geographic features and feature properties.ISO 19115-1:2014
245
+ defines:-mandatory and conditional metadata sections, metadata entities, and
246
+ metadata elements;-the minimum set of metadata required to serve most
247
+ metadata applications (data discovery, determining data fitness for use,
248
+ data access, data transfer, and use of digital data and services);-optional
249
+ metadata elements to allow for a more extensive standard description of
250
+ resources, if required;-a method for extending metadata to fit specialized
251
+ needs.Though ISO 19115-1:2014 is applicable to digital data and services,
252
+ its principles can be extended to many other types of resources such as
253
+ maps, charts, and textual documents as well as non-geographic data. Certain
254
+ conditional metadata elements might not apply to these other forms of data.
255
+ </abstract>
256
+ <abstract format='plain' language='fr' script='Latn'>
257
+ L'ISO 19115-1:2014 définit le schéma requis pour décrire des informations
258
+ géographiques et des services au moyen de métadonnées. Elle fournit des
259
+ informations concernant l'identification, l'étendue, la qualité, les aspects
260
+ spatiaux et temporels, le contenu, la référence spatiale, la représentation
261
+ des données, la distribution et d'autres propriétés des données
262
+ géographiques numériques et des services.L'ISO 19115-1:2014 est
263
+ applicable:-au catalogage de tous les types de ressources, des activités des
264
+ centres d'informations et à la description complète des jeux de données et
265
+ des services,-aux services géographiques, jeux de données géographiques,
266
+ séries de jeux de données, entités géographiques individuelles et propriétés
267
+ d'entités.L'ISO 19115-1:2014 définit:-des sections relatives aux métadonnées
268
+ obligatoires et facultatives, aux entités de métadonnées et aux éléments de
269
+ métadonnées,-le jeu minimal de métadonnées requis pour répondre au besoin de
270
+ la plupart des applications des métadonnées (la découverte des données, la
271
+ détermination de l'adéquation des données à une utilisation, l'accès aux
272
+ données, le transfert des données et l'utilisation des données numériques et
273
+ des services),-les éléments de métadonnées facultatifs pour permettre une
274
+ description standard plus poussée des ressources, si cela est nécessaire,-un
275
+ procédé d'extension des métadonnées pour s'adapter aux besoins
276
+ spéciaux.L'ISO 19115-1:2014 est applicable aux données numériques et
277
+ services, ses principes peuvent être étendus à bien d'autres types de
278
+ ressources telles que les cartes, les graphes et les documents textes, de
279
+ même qu'à des données non géographiques. Certains éléments de métadonnées
280
+ conditionnels peuvent ne pas s'appliquer à ces autres formes de données.
281
+ </abstract>
282
+ <status>Published</status>
283
+ <copyright>
284
+ <from>2014</from>
285
+ <owner>
286
+ <organization>
287
+ <name>ISO</name>
288
+ <abbreviation/>
289
+ </organization>
290
+ </owner>
291
+ </copyright>
292
+ <relation type='obsoletes'>
293
+ <bibitem>
294
+ <formattedref>ISO 19115:2003</formattedref>
295
+ <docidentifier>ISO 19115:2003</docidentifier>
296
+ </bibitem>
297
+ </relation>
298
+ <relation type='obsoletes'>
299
+ <bibitem>
300
+ <formattedref>ISO 19115:2003/Cor 1:2006</formattedref>
301
+ <docidentifier>ISO 19115:2003/Cor 1:2006</docidentifier>
302
+ </bibitem>
303
+ </relation>
304
+ <relation type='updates'>
305
+ <bibitem>
306
+ <formattedref>ISO 19115-1:2014/Amd 1:2018</formattedref>
307
+ <docidentifier>ISO 19115-1:2014/Amd 1:2018</docidentifier>
308
+ </bibitem>
309
+ </relation>
310
+ <ics>IT applications in science</ics>
311
+ </bibitem>"
312
+ ----
313
+
314
+ == BibliographicItem
315
+
316
+ The ISO standards use a subset of the generic bibliographic fields specified in the https://github.com/riboseinc/isodoc-models#iso-bibliographic-item[IsoBibliographicItem model]:
317
+
318
+ * Title:
319
+ ** English; French
320
+ ** titleIntro; titleMain; titlePart
321
+ * DocIdentifier:
322
+ ** project number; part number; technical committee document number
323
+ * Source: the ISO page from which the standard may be purchased or downloaded
324
+ * Type: IsoDocumentType (International Standard, Technical Specification, Technical Report, Publicly Available Specification, International Workshop Agreement, Guide)
325
+ * Project Group:
326
+ ** Technical Committee, Subcommittee, Workgroup, Secretariat
327
+ ** Technical Committee Number, Subcommittee Number, Workgroup Number
328
+ ** Technical Committee Type, Subcommittee Type, Workgroup Type (e.g. JTC)
329
+ ** Organization:Name (ISO; other standards organisations, for standards jointly published with ISO)
330
+ * ICS: refer https://www.iso.org/publication/PUB100033.html
331
+ * Status
332
+ ** Stage, Substage
333
+ * Edition
334
+ * Date:Published
335
+ * Abstract
336
+ * Relations
337
+ ** Obsoletes, Updates
24
338
 
25
- TODO: Write usage instructions here
339
+ All FormattedString instances are returned by default as a text/plain string; if required, they are returned as a text/html string.
26
340
 
27
- ## Development
341
+ == Development
28
342
 
29
343
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
344
 
31
345
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
346
 
33
- ## Contributing
347
+ == Contributing
34
348
 
35
349
  Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/iso-bib-item.
36
350
 
37
- ## License
351
+ == License
38
352
 
39
353
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -42,9 +42,9 @@ module IsoBibItem
42
42
  end
43
43
 
44
44
  # @return [String]
45
- # def url
46
- # @uri.to_s
47
- # end
45
+ def url
46
+ @uri.to_s
47
+ end
48
48
 
49
49
  def to_xml(builder)
50
50
  contacts.each { |contact| contact.to_xml builder }
@@ -9,11 +9,11 @@ require 'iso_bib_item/iso_project_group'
9
9
  require 'iso_bib_item/document_relation_collection'
10
10
 
11
11
  # Add filter method to Array.
12
- # class Array
13
- # def filter(type:)
14
- # select { |e| e.type == type }
15
- # end
16
- # end
12
+ class Array
13
+ def filter(type:)
14
+ select { |e| e.type == type }
15
+ end
16
+ end
17
17
 
18
18
  module IsoBibItem
19
19
  # Iso document id.
@@ -57,7 +57,10 @@ module IsoBibItem
57
57
  end
58
58
 
59
59
  def to_xml(builder)
60
- builder.ics description
60
+ builder.ics do
61
+ builder.code code
62
+ builder.text_ description
63
+ end
61
64
  end
62
65
  end
63
66
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module IsoBibItem
4
- VERSION = '0.1.4'.freeze
4
+ VERSION = '0.1.5'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iso-bib-item
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-05 00:00:00.000000000 Z
11
+ date: 2018-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler