oai_talia 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/README +81 -0
- data/Rakefile +127 -0
- data/bin/oai +68 -0
- data/examples/models/file_model.rb +63 -0
- data/examples/providers/dublin_core.rb +474 -0
- data/lib/oai/client/get_record.rb +15 -0
- data/lib/oai/client/header.rb +18 -0
- data/lib/oai/client/identify.rb +30 -0
- data/lib/oai/client/list_identifiers.rb +12 -0
- data/lib/oai/client/list_metadata_formats.rb +12 -0
- data/lib/oai/client/list_records.rb +21 -0
- data/lib/oai/client/list_sets.rb +19 -0
- data/lib/oai/client/metadata_format.rb +12 -0
- data/lib/oai/client/record.rb +26 -0
- data/lib/oai/client/response.rb +35 -0
- data/lib/oai/client.rb +301 -0
- data/lib/oai/constants.rb +34 -0
- data/lib/oai/exception.rb +75 -0
- data/lib/oai/harvester/config.rb +41 -0
- data/lib/oai/harvester/harvest.rb +150 -0
- data/lib/oai/harvester/logging.rb +70 -0
- data/lib/oai/harvester/mailer.rb +17 -0
- data/lib/oai/harvester/shell.rb +338 -0
- data/lib/oai/harvester.rb +39 -0
- data/lib/oai/provider/metadata_format/oai_dc.rb +29 -0
- data/lib/oai/provider/metadata_format/oai_europeana.rb +38 -0
- data/lib/oai/provider/metadata_format.rb +143 -0
- data/lib/oai/provider/model/activerecord_caching_wrapper.rb +134 -0
- data/lib/oai/provider/model/activerecord_wrapper.rb +139 -0
- data/lib/oai/provider/model.rb +74 -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 +26 -0
- data/lib/oai/provider/response/identify.rb +25 -0
- data/lib/oai/provider/response/list_identifiers.rb +35 -0
- data/lib/oai/provider/response/list_metadata_formats.rb +34 -0
- data/lib/oai/provider/response/list_records.rb +34 -0
- data/lib/oai/provider/response/list_sets.rb +23 -0
- data/lib/oai/provider/response/record_response.rb +70 -0
- data/lib/oai/provider/response.rb +161 -0
- data/lib/oai/provider/resumption_token.rb +106 -0
- data/lib/oai/provider.rb +304 -0
- data/lib/oai/set.rb +29 -0
- data/lib/oai/xpath.rb +75 -0
- data/lib/oai.rb +8 -0
- data/lib/test.rb +25 -0
- data/test/activerecord_provider/config/connection.rb +5 -0
- data/test/activerecord_provider/config/database.yml +6 -0
- data/test/activerecord_provider/database/ar_migration.rb +59 -0
- data/test/activerecord_provider/database/oaipmhtest +0 -0
- data/test/activerecord_provider/fixtures/dc.yml +1501 -0
- data/test/activerecord_provider/helpers/providers.rb +44 -0
- data/test/activerecord_provider/helpers/set_provider.rb +36 -0
- data/test/activerecord_provider/models/dc_field.rb +7 -0
- data/test/activerecord_provider/models/dc_set.rb +6 -0
- data/test/activerecord_provider/models/oai_token.rb +3 -0
- data/test/activerecord_provider/tc_ar_provider.rb +113 -0
- data/test/activerecord_provider/tc_ar_sets_provider.rb +72 -0
- data/test/activerecord_provider/tc_caching_paging_provider.rb +55 -0
- data/test/activerecord_provider/tc_simple_paging_provider.rb +57 -0
- data/test/activerecord_provider/test_helper.rb +4 -0
- data/test/client/helpers/provider.rb +68 -0
- data/test/client/helpers/test_wrapper.rb +11 -0
- data/test/client/tc_exception.rb +36 -0
- data/test/client/tc_get_record.rb +37 -0
- data/test/client/tc_identify.rb +13 -0
- data/test/client/tc_libxml.rb +61 -0
- data/test/client/tc_list_identifiers.rb +52 -0
- data/test/client/tc_list_metadata_formats.rb +18 -0
- data/test/client/tc_list_records.rb +13 -0
- data/test/client/tc_list_sets.rb +19 -0
- data/test/client/tc_low_resolution_dates.rb +14 -0
- data/test/client/tc_utf8_escaping.rb +11 -0
- data/test/client/tc_xpath.rb +26 -0
- data/test/client/test_helper.rb +5 -0
- data/test/provider/models.rb +234 -0
- data/test/provider/tc_exceptions.rb +96 -0
- data/test/provider/tc_functional_tokens.rb +43 -0
- data/test/provider/tc_provider.rb +71 -0
- data/test/provider/tc_resumption_tokens.rb +46 -0
- data/test/provider/tc_simple_provider.rb +92 -0
- data/test/provider/test_helper.rb +36 -0
- data/test/test.xml +22 -0
- metadata +181 -0
data/lib/test.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'oai'
|
2
|
+
|
3
|
+
buffer = ""
|
4
|
+
start_time = Time.now()
|
5
|
+
|
6
|
+
client = OAI::Client.new 'http://digitalcollections.library.oregonstate.edu/cgi-bin/oai.exe', :parser =>'libxml'
|
7
|
+
|
8
|
+
last_check = Date.new(2006,9,5)
|
9
|
+
records = client.list_records
|
10
|
+
# :set => 'archives', :metadata_prefix => 'oai_dc', :from => last_check
|
11
|
+
|
12
|
+
x = 0
|
13
|
+
records.each do |record|
|
14
|
+
#fields = record.serialize_metadata(record.metadata, "oai_dc", "Oai_Dc")
|
15
|
+
#puts "Primary Title: " + fields.title[0] + "\n"
|
16
|
+
puts "Identifier: " + record.header.identifier + "\n"
|
17
|
+
x += 1
|
18
|
+
end
|
19
|
+
|
20
|
+
end_time = Time.now()
|
21
|
+
|
22
|
+
puts buffer
|
23
|
+
puts "Time to run: " + (end_time - start_time).to_s + "\n"
|
24
|
+
puts "Records returned: " + x.to_s
|
25
|
+
|
@@ -0,0 +1,59 @@
|
|
1
|
+
ActiveRecord::Migration.verbose = false
|
2
|
+
|
3
|
+
class OAIPMHTables < ActiveRecord::Migration
|
4
|
+
def self.up
|
5
|
+
create_table :oai_tokens, :force => true do |t|
|
6
|
+
t.column :token, :string, :null => false
|
7
|
+
t.column :created_at, :timestamp
|
8
|
+
end
|
9
|
+
|
10
|
+
create_table :oai_entries, :force => true do |t|
|
11
|
+
t.column :record_id, :integer, :null => false
|
12
|
+
t.column :oai_token_id, :integer, :null => false
|
13
|
+
end
|
14
|
+
|
15
|
+
create_table :dc_fields, :force => true do |t|
|
16
|
+
t.column :title, :string
|
17
|
+
t.column :creator, :string
|
18
|
+
t.column :subject, :string
|
19
|
+
t.column :description, :string
|
20
|
+
t.column :contributor, :string
|
21
|
+
t.column :publisher, :string
|
22
|
+
t.column :date, :datetime
|
23
|
+
t.column :type, :string
|
24
|
+
t.column :format, :string
|
25
|
+
t.column :source, :string
|
26
|
+
t.column :language, :string
|
27
|
+
t.column :relation, :string
|
28
|
+
t.column :coverage, :string
|
29
|
+
t.column :rights, :string
|
30
|
+
t.column :updated_at, :datetime
|
31
|
+
t.column :created_at, :datetime
|
32
|
+
t.column :deleted, :boolean, :default => false
|
33
|
+
end
|
34
|
+
|
35
|
+
create_table :dc_fields_dc_sets, :force => true, :id => false do |t|
|
36
|
+
t.column :dc_field_id, :integer
|
37
|
+
t.column :dc_set_id, :integer
|
38
|
+
end
|
39
|
+
|
40
|
+
create_table :dc_sets, :force => true do |t|
|
41
|
+
t.column :name, :string
|
42
|
+
t.column :spec, :string
|
43
|
+
t.column :description, :string
|
44
|
+
end
|
45
|
+
|
46
|
+
add_index :oai_tokens, [:token], :uniq => true
|
47
|
+
add_index :oai_tokens, :created_at
|
48
|
+
add_index :oai_entries, [:oai_token_id]
|
49
|
+
add_index :dc_fields, :updated_at
|
50
|
+
add_index :dc_fields, :deleted
|
51
|
+
add_index :dc_fields_dc_sets, [:dc_field_id, :dc_set_id]
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.down
|
55
|
+
drop_table :oai_tokens
|
56
|
+
drop_table :dc_fields
|
57
|
+
drop_table :dc_sets
|
58
|
+
end
|
59
|
+
end
|
Binary file
|