marc2linkeddata 0.0.1 → 0.0.2

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
  SHA1:
3
- metadata.gz: fa055fa139e900737ad34ddc5a70fe3b256c3570
4
- data.tar.gz: 5a9b29792f26b0f7a48cf522aa77cc7535f72ad9
3
+ metadata.gz: 227e609a3b3365fe1dffcc0f6ceb8f031f323086
4
+ data.tar.gz: 2fb95f69142e4d670bf89be06d7cc5288461a737
5
5
  SHA512:
6
- metadata.gz: 7ea8a770cff4eeca40054df514aff320200d807b360a9bcce8538c65f31139e6a68d40c940b5e60038379a67f832d9b34e326b42cf7100cc9912397934959c40
7
- data.tar.gz: 806dcea47e0ab546acc347765e2d241faab174dc1add50b380a84774d717fb7f075667ef2d67a3fd2da6c78075c2e6515a809fe5207596dbb124eb1a9abb2bd1
6
+ metadata.gz: f4feb2a4e3d8ac8b8bc3412937371f28d480b68878022dc2efcbe65bfa05d33daf108ee93b7ace716f149f229b9c05cb01dea35352edbb9d3c4e29a7c5f37158
7
+ data.tar.gz: dda7c077716e8e5daf223403989179de7c9ebf976fa5467c378590ceddab98b6a6e1606e73e50f0d8207b7bab5a17f32abbe276ac354f637878399641942e823
data/README.md CHANGED
@@ -2,7 +2,8 @@
2
2
  marc2linkeddata
3
3
  ===============
4
4
 
5
- Utilities for translating MARC21 into linked data.
5
+ Utilities for translating MARC21 into linked data. The project has
6
+ focused on authority records (as of Feb, 2015).
6
7
 
7
8
  Optional Dependencies
8
9
 
@@ -48,7 +49,9 @@ Clone
48
49
 
49
50
  Script
50
51
 
51
- # First configure (see above).
52
+ # First configure (see .env_example). Performance will
53
+ # slow with more retrieval of linked data resources, such
54
+ # as OCLC works for authorities.
52
55
 
53
56
  # Translate a MARC21 authority file to a turtle file.
54
57
  # readMarcAuthority [ authfile1.mrc .. authfileN.mrc ]
@@ -7,11 +7,6 @@ module Marc2LinkedData
7
7
 
8
8
  class ParseMarcAuthority
9
9
 
10
- # TODO: provide iterator pattern on an entire file of records.
11
- # @leader = ParseMarcAuthority::parse_leader(marc_file)
12
- # raw = marc_file.read(@leader[:length])
13
- # @record = MARC::Reader.decode(raw)
14
-
15
10
  @@config = nil
16
11
 
17
12
  attr_reader :loc
@@ -258,7 +253,7 @@ module Marc2LinkedData
258
253
  # http://www.loc.gov/marc/authority/concise/ad110.html
259
254
  begin
260
255
  # 110 is a corporate name
261
- field = @record.fields.select {|f| f if f.tag == '110' }.first
256
+ field = get_fields('110').first
262
257
  a = field.subfields.collect {|f| f.value if f.code == 'a' }.compact rescue []
263
258
  b = field.subfields.collect {|f| f.value if f.code == 'b' }.compact rescue []
264
259
  c = field.subfields.collect {|f| f.value if f.code == 'c' }.compact rescue []
@@ -273,6 +268,7 @@ module Marc2LinkedData
273
268
  # http://www.loc.gov/marc/authority/concise/ad111.html
274
269
  begin
275
270
  # 111 is a meeting name
271
+ field = get_fields('111').first
276
272
  field = @record.fields.select {|f| f if f.tag == '111' }.first
277
273
  a = field.subfields.collect {|f| f.value if f.code == 'a' }.compact rescue []
278
274
  # TODO: incorporate additional subfields?
@@ -290,7 +286,7 @@ module Marc2LinkedData
290
286
  # http://www.loc.gov/marc/authority/concise/ad151.html
291
287
  begin
292
288
  # 151 is a geographic name
293
- field = @record.fields.select {|f| f if f.tag == '151' }.first
289
+ field = get_fields('151').first
294
290
  name = field.subfields.collect {|f| f.value if f.code == 'a' }.first rescue ''
295
291
  name.force_encoding('UTF-8')
296
292
  rescue
@@ -428,7 +424,7 @@ module Marc2LinkedData
428
424
  @graph.insert RDF::Statement(creative_work.rdf_uri, RDF::SCHEMA.editor, oclc_auth.rdf_uri)
429
425
  end
430
426
  end
431
- # TODO: Is auth the subject of the work (as in biography) or both (as in autobiography).
427
+ # TODO: Is auth the subject of the work (as in biography) or both (as in autobiography)?
432
428
  # binding.pry if @@config.debug
433
429
  # binding.pry if creative_work.iri.to_s == 'http://www.worldcat.org/oclc/006626542'
434
430
  # Try to find the generic work entity for this example work.
@@ -441,7 +437,7 @@ module Marc2LinkedData
441
437
  end
442
438
  end
443
439
 
444
- # TODO: use an 'affiliation' entry, maybe 373? (optional field)
440
+ # TODO: use an institutional 'affiliation' entry, maybe 373? (optional field)
445
441
 
446
442
  def to_ttl
447
443
  graph.to_ttl
@@ -7,6 +7,9 @@ require 'pry'
7
7
  #EXAMPLE_RECORD_FILE='../marc/catalog/stf.00.mrc'
8
8
  EXAMPLE_RECORD_FILE='../marc/catalog/stf.51.mrc'
9
9
 
10
+
11
+ ## TODO: Try to find SUL PURL in the 856 field of a Symphony record
12
+
10
13
  ## reading records from a batch file
11
14
  #reader = MARC::Reader.new(EXAMPLE_RECORD_FILE, :external_encoding => "MARC-8")
12
15
  #reader = MARC::Reader.new(EXAMPLE_RECORD_FILE, :external_encoding => "UTF-8", :validate_encoding => true)
@@ -4,7 +4,7 @@ $:.unshift lib unless $:.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = 'marc2linkeddata'
7
- s.version = '0.0.1'
7
+ s.version = '0.0.2'
8
8
  s.licenses = ['Apache-2.0']
9
9
 
10
10
  s.platform = Gem::Platform::RUBY
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marc2linkeddata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darren Weber
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-29 00:00:00.000000000 Z
11
+ date: 2015-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable