oai 0.0.1 → 1.3.0
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 +7 -0
- data/README.md +128 -0
- data/Rakefile +64 -0
- data/bin/oai +66 -0
- data/examples/models/file_model.rb +63 -0
- data/examples/providers/dublin_core.rb +474 -0
- data/lib/oai/{get_record.rb → client/get_record.rb} +5 -1
- data/lib/oai/client/header.rb +18 -0
- data/lib/oai/{identify.rb → client/identify.rb} +2 -0
- data/lib/oai/{list_identifiers.rb → client/list_identifiers.rb} +1 -0
- data/lib/oai/{list_records.rb → client/list_records.rb} +6 -5
- data/lib/oai/{list_sets.rb → client/list_sets.rb} +7 -6
- data/lib/oai/client/record.rb +27 -0
- data/lib/oai/client/response.rb +53 -0
- data/lib/oai/client/resumable.rb +42 -0
- data/lib/oai/client.rb +313 -108
- data/lib/oai/constants.rb +34 -0
- data/lib/oai/exception.rb +80 -1
- data/lib/oai/harvester/config.rb +41 -0
- data/lib/oai/harvester/harvest.rb +162 -0
- data/lib/oai/harvester/logging.rb +68 -0
- data/lib/oai/harvester/mailer.rb +17 -0
- data/lib/oai/harvester/shell.rb +337 -0
- data/lib/oai/harvester.rb +43 -0
- data/lib/oai/provider/metadata_format/oai_dc.rb +28 -0
- data/lib/oai/provider/metadata_format.rb +119 -0
- data/lib/oai/provider/model/activerecord_caching_wrapper.rb +129 -0
- data/lib/oai/provider/model/activerecord_wrapper.rb +217 -0
- data/lib/oai/provider/model.rb +80 -0
- data/lib/oai/provider/partial_result.rb +18 -0
- data/lib/oai/provider/response/error.rb +16 -0
- data/lib/oai/provider/response/get_record.rb +27 -0
- data/lib/oai/provider/response/identify.rb +37 -0
- data/lib/oai/provider/response/list_identifiers.rb +30 -0
- data/lib/oai/provider/response/list_metadata_formats.rb +39 -0
- data/lib/oai/provider/response/list_records.rb +47 -0
- data/lib/oai/provider/response/list_sets.rb +23 -0
- data/lib/oai/provider/response/record_response.rb +103 -0
- data/lib/oai/provider/response.rb +133 -0
- data/lib/oai/provider/resumption_token.rb +155 -0
- data/lib/oai/provider.rb +487 -0
- data/lib/oai/set.rb +14 -5
- data/lib/oai/xpath.rb +59 -5
- data/lib/oai.rb +7 -13
- data/lib/test.rb +25 -0
- data/test/activerecord_provider/config/connection.rb +30 -0
- data/test/activerecord_provider/database/0001_oaipmh_tables.rb +70 -0
- data/test/activerecord_provider/fixtures/dc.yml +1501 -0
- data/test/activerecord_provider/helpers/providers.rb +68 -0
- data/test/activerecord_provider/helpers/set_provider.rb +24 -0
- data/test/activerecord_provider/helpers/transactional_test_case.rb +35 -0
- data/test/activerecord_provider/models/dc_field.rb +15 -0
- data/test/activerecord_provider/models/dc_lang.rb +3 -0
- data/test/activerecord_provider/models/dc_set.rb +7 -0
- data/test/activerecord_provider/models/exclusive_set_dc_field.rb +17 -0
- data/test/activerecord_provider/models/oai_token.rb +3 -0
- data/test/activerecord_provider/tc_activerecord_wrapper.rb +63 -0
- data/test/activerecord_provider/tc_ar_provider.rb +199 -0
- data/test/activerecord_provider/tc_ar_sets_provider.rb +159 -0
- data/test/activerecord_provider/tc_caching_paging_provider.rb +50 -0
- data/test/activerecord_provider/tc_simple_paging_provider.rb +71 -0
- data/test/activerecord_provider/test_helper_ar_provider.rb +7 -0
- data/test/client/helpers/provider.rb +65 -0
- data/test/client/helpers/test_wrapper.rb +6 -0
- data/test/client/tc_exception.rb +36 -0
- data/test/client/tc_get_record.rb +39 -0
- data/test/client/tc_http_client.rb +129 -0
- data/test/client/tc_identify.rb +13 -0
- data/test/client/tc_libxml.rb +61 -0
- data/test/{tc_list_identifiers.rb → client/tc_list_identifiers.rb} +28 -9
- data/test/{tc_list_metadata_formats.rb → client/tc_list_metadata_formats.rb} +4 -1
- data/test/client/tc_list_records.rb +26 -0
- data/test/client/tc_list_sets.rb +34 -0
- data/test/client/tc_low_resolution_dates.rb +14 -0
- data/test/client/tc_utf8_escaping.rb +19 -0
- data/test/client/tc_xpath.rb +26 -0
- data/test/client/test_helper_client.rb +5 -0
- data/test/harvester/tc_harvest.rb +42 -0
- data/test/harvester/test_helper_harvester.rb +6 -0
- data/test/provider/models.rb +246 -0
- data/test/provider/tc_exceptions.rb +81 -0
- data/test/provider/tc_functional_tokens.rb +53 -0
- data/test/provider/tc_instance_provider.rb +41 -0
- data/test/provider/tc_provider.rb +136 -0
- data/test/provider/tc_resumption_tokens.rb +52 -0
- data/test/provider/tc_simple_provider.rb +138 -0
- data/test/provider/test_helper_provider.rb +62 -0
- data/test/test.xml +22 -0
- metadata +238 -56
- data/lib/oai/header.rb +0 -12
- data/lib/oai/record.rb +0 -11
- data/lib/oai/response.rb +0 -20
- data/test/tc_get_record.rb +0 -27
- data/test/tc_identify.rb +0 -8
- data/test/tc_list_records.rb +0 -9
- data/test/tc_list_sets.rb +0 -17
- data/test.rb +0 -12
- /data/lib/oai/{list_metadata_formats.rb → client/list_metadata_formats.rb} +0 -0
- /data/lib/oai/{metadata_format.rb → client/metadata_format.rb} +0 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
class OaipmhTables < ActiveRecord::Migration[5.2]
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :oai_tokens do |t|
|
|
4
|
+
t.column :token, :string, :null => false
|
|
5
|
+
t.column :created_at, :timestamp
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
create_table :oai_entries do |t|
|
|
9
|
+
t.column :record_id, :integer, :null => false
|
|
10
|
+
t.column :oai_token_id, :integer, :null => false
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
create_table :dc_langs do |t|
|
|
14
|
+
t.column :name, :string
|
|
15
|
+
t.column :updated_at, :datetime
|
|
16
|
+
t.column :created_at, :datetime
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
dc_fields = proc do |t|
|
|
20
|
+
t.column :title, :string
|
|
21
|
+
t.column :creator, :string
|
|
22
|
+
t.column :subject, :string
|
|
23
|
+
t.column :description, :string
|
|
24
|
+
t.column :contributor, :string
|
|
25
|
+
t.column :publisher, :string
|
|
26
|
+
t.column :date, :datetime
|
|
27
|
+
t.column :type, :string
|
|
28
|
+
t.column :format, :string
|
|
29
|
+
t.column :source, :string
|
|
30
|
+
t.column :dc_lang_id, :integer
|
|
31
|
+
t.column :relation, :string
|
|
32
|
+
t.column :coverage, :string
|
|
33
|
+
t.column :rights, :string
|
|
34
|
+
t.column :updated_at, :datetime
|
|
35
|
+
t.column :created_at, :datetime
|
|
36
|
+
t.column :deleted, :boolean, :default => false
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
create_table :exclusive_set_dc_fields do |t|
|
|
40
|
+
dc_fields.call(t)
|
|
41
|
+
t.column :set, :string
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
create_table :dc_fields, &dc_fields
|
|
45
|
+
|
|
46
|
+
create_table :dc_fields_dc_sets, :id => false do |t|
|
|
47
|
+
t.column :dc_field_id, :integer
|
|
48
|
+
t.column :dc_set_id, :integer
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
create_table :dc_sets do |t|
|
|
52
|
+
t.column :name, :string
|
|
53
|
+
t.column :spec, :string
|
|
54
|
+
t.column :description, :string
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
add_index :oai_tokens, [:token], :unique => true
|
|
58
|
+
add_index :oai_tokens, :created_at
|
|
59
|
+
add_index :oai_entries, [:oai_token_id]
|
|
60
|
+
add_index :dc_fields, :updated_at
|
|
61
|
+
add_index :dc_fields, :deleted
|
|
62
|
+
add_index :dc_fields_dc_sets, [:dc_field_id, :dc_set_id]
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def self.down
|
|
66
|
+
drop_table :oai_tokens
|
|
67
|
+
drop_table :dc_fields
|
|
68
|
+
drop_table :dc_sets
|
|
69
|
+
end
|
|
70
|
+
end
|