cul-fedora 0.8.5 → 0.8.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.5
1
+ 0.8.6
data/cul-fedora.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cul-fedora}
8
- s.version = "0.8.5"
8
+ s.version = "0.8.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["James Stuart"]
12
- s.date = %q{2011-07-11}
12
+ s.date = %q{2011-07-14}
13
13
  s.description = %q{Columbia-specific Fedora libraries}
14
14
  s.email = %q{tastyhat@jamesstuart.org}
15
15
  s.extra_rdoc_files = [
@@ -8,6 +8,7 @@ module Cul
8
8
  include Open3
9
9
 
10
10
  URI_TO_PID = 'info:fedora/'
11
+ MAX_LIST_MEMBERS_PER_REQUEST = 500
11
12
 
12
13
  def <=>(other)
13
14
  pid <=> other.pid
@@ -69,16 +70,31 @@ module Cul
69
70
 
70
71
  def listMembers()
71
72
  begin
72
- result = Nokogiri::XML(request(:method => "/objects", :sdef => "methods/ldpd:sdef.Aggregator", :request => "listMembers", :format => "", :max => "", :start => ""))
73
-
74
- result.css("sparql>results>result>member").collect do |result_node|
75
- @server.item(result_node.attributes["uri"].value)
73
+ i = 1
74
+ size = getSize
75
+ items = []
76
+ while (i <= size)
77
+ result = Nokogiri::XML(request(:method => "/objects", :sdef => "methods/ldpd:sdef.Aggregator", :request => "listMembers", :format => "sparql", :max => MAX_LIST_MEMBERS_PER_REQUEST, :start => (i - 1)))
78
+
79
+ result.css("sparql>results>result>member").collect do |result_node|
80
+ items << @server.item(result_node.attributes["uri"].value)
81
+ end
82
+ i = i + MAX_LIST_MEMBERS_PER_REQUEST
76
83
  end
84
+ return items
77
85
  rescue
78
86
  []
79
87
  end
80
88
  end
81
89
 
90
+ def getSize()
91
+ begin
92
+ request(:method => "/objects", :sdef => "methods/ldpd:sdef.Aggregator", :request => "getSize").to_i
93
+ rescue
94
+ -1
95
+ end
96
+ end
97
+
82
98
  def describedBy
83
99
  begin
84
100
  params = {:method => '/objects', :request => "describedBy", :sdef => "methods/ldpd:sdef.Core"}
@@ -72,6 +72,7 @@ module Cul
72
72
  delete_removed(fedora_server)
73
73
  end
74
74
 
75
+ logger.info "Preparing the items for indexing..."
75
76
  collections.each do |collection|
76
77
  items |= collection.listMembers
77
78
  end
@@ -82,6 +83,8 @@ module Cul
82
83
  results = Hash.new { |h,k| h[k] = [] }
83
84
  errors = {}
84
85
 
86
+ logger.info "Preparing to index " + items.length.to_s + " items..."
87
+
85
88
  items.each do |i|
86
89
 
87
90
  if(ignore.index(i.pid).nil? == false)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cul-fedora
3
3
  version: !ruby/object:Gem::Version
4
- hash: 53
4
+ hash: 51
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 5
10
- version: 0.8.5
9
+ - 6
10
+ version: 0.8.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - James Stuart
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-11 00:00:00 -04:00
18
+ date: 2011-07-14 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency