enju_ndl 0.1.0.pre16 → 0.1.0.pre17
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 +4 -4
- data/lib/enju_ndl/ndl_search.rb +14 -14
- data/lib/enju_ndl/version.rb +1 -1
- data/spec/dummy/config/application.rb +1 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- metadata +15 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7440506c610a3cdc7455dde95874262a99f7fba2
|
4
|
+
data.tar.gz: df84a8f2a5e4e1bea8a3e7a9945b67a30cc801f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0803f949b3c97530cf67512b3444ddef0466c76f7ff1a0007705ef4879f78e771d351aa0adbbd000340a7498f1331ce0e7b32bf58b2e0d9ddb4589b52c06cc36
|
7
|
+
data.tar.gz: 52b69f574cd8eb61fd378c6ae05491882be6b37a627745f2ea64bb3ded0ce2ef9371739eba475f969c02b25a9817fe8423e4149f341dfc42df49c52246355af5
|
data/lib/enju_ndl/ndl_search.rb
CHANGED
@@ -54,19 +54,6 @@ module EnjuNdl
|
|
54
54
|
|
55
55
|
isbn = Lisbn.new(doc.at('//dcterms:identifier[@rdf:datatype="http://ndl.go.jp/dcndl/terms/ISBN"]').try(:content).to_s).try(:isbn)
|
56
56
|
issn_l = StdNum::ISSN.normalize(doc.at('//dcterms:identifier[@rdf:datatype="http://ndl.go.jp/dcndl/terms/ISSNL"]').try(:content))
|
57
|
-
classification_urls = doc.xpath('//dcterms:subject[@rdf:resource]').map{|subject| subject.attributes['resource'].value}
|
58
|
-
if classification_urls
|
59
|
-
ndc9_url = classification_urls.map{|url| URI.parse(URI.escape(url))}.select{|u| u.path.split('/').reverse[1] == 'ndc9'}.first
|
60
|
-
if ndc9_url
|
61
|
-
ndc = ndc9_url.path.split('/').last
|
62
|
-
classification_type = ClassificationType.where(:name => 'ndc9').first
|
63
|
-
unless classification_type
|
64
|
-
classification_type = ClassificationType.create!(:name => 'ndc9', :display_name => 'NDC9')
|
65
|
-
end
|
66
|
-
classification = Classification.new(:category => ndc)
|
67
|
-
classification.classification_type = classification_type
|
68
|
-
end
|
69
|
-
end
|
70
57
|
|
71
58
|
carrier_type = content_type = nil
|
72
59
|
doc.xpath('//dcndl:materialType[@rdf:resource]').each do |d|
|
@@ -118,7 +105,6 @@ module EnjuNdl
|
|
118
105
|
manifestation.publishers << publisher_patrons
|
119
106
|
create_additional_attributes(doc, manifestation)
|
120
107
|
create_series_statement(doc, manifestation)
|
121
|
-
manifestation.classifications << classification if classification
|
122
108
|
end
|
123
109
|
end
|
124
110
|
|
@@ -132,6 +118,7 @@ module EnjuNdl
|
|
132
118
|
language = get_language(doc)
|
133
119
|
subjects = get_subjects(doc).uniq
|
134
120
|
classifications = get_classifications(doc).uniq
|
121
|
+
classification_urls = doc.xpath('//dcterms:subject[@rdf:resource]').map{|subject| subject.attributes['resource'].value}
|
135
122
|
|
136
123
|
Patron.transaction do
|
137
124
|
creator_patrons = Patron.import_patrons(creators)
|
@@ -156,6 +143,19 @@ module EnjuNdl
|
|
156
143
|
subject.subject_heading_types << subject_heading_type if subject.subject_heading_types.where(:id => subject_heading_type.id).empty?
|
157
144
|
end
|
158
145
|
end
|
146
|
+
if classification_urls
|
147
|
+
ndc9_url = classification_urls.map{|url| URI.parse(URI.escape(url))}.select{|u| u.path.split('/').reverse[1] == 'ndc9'}.first
|
148
|
+
if ndc9_url
|
149
|
+
ndc = ndc9_url.path.split('/').last
|
150
|
+
classification_type = ClassificationType.where(:name => 'ndc9').first
|
151
|
+
unless classification_type
|
152
|
+
classification_type = ClassificationType.create!(:name => 'ndc9', :display_name => 'NDC9')
|
153
|
+
end
|
154
|
+
classification = Classification.new(:category => ndc)
|
155
|
+
classification.classification_type = classification_type
|
156
|
+
manifestation.classifications << classification if classification
|
157
|
+
end
|
158
|
+
end
|
159
159
|
end
|
160
160
|
end
|
161
161
|
end
|
data/lib/enju_ndl/version.rb
CHANGED
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enju_ndl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.pre17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kosuke Tanabe
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: enju_subject
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.1.0.pre13
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.1.0.pre13
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: sqlite3
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,20 +150,6 @@ dependencies:
|
|
136
150
|
- - ~>
|
137
151
|
- !ruby/object:Gem::Version
|
138
152
|
version: 0.1.0.pre36
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: enju_subject
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - ~>
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: 0.1.0.pre13
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - ~>
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: 0.1.0.pre13
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: enju_question
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|