active-fedora 1.1.8 → 1.1.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,7 +15,6 @@ describe ActiveFedora::MetadataDatastream do
15
15
  :empty_field => {:values => {}}
16
16
  }
17
17
  @sample_xml = XmlSimple.xml_in("<fields><coverage>coverage1</coverage><coverage>coverage2</coverage><creation_date>fake-date</creation_date><mydate>fake-date</mydate><publisher>publisher1</publisher></fields>")
18
-
19
18
  end
20
19
 
21
20
  before(:each) do
@@ -48,6 +47,115 @@ describe ActiveFedora::MetadataDatastream do
48
47
  end
49
48
  end
50
49
 
50
+ describe ".update_indexed_attributes" do
51
+
52
+ before(:each) do
53
+ @test_ds.field "fubar", :string
54
+ @test_ds.field "swank", :text
55
+ end
56
+
57
+ it "should apply submitted hash to corresponding datastream field values" do
58
+ att= {"fubar"=>{"-1"=>"mork", "0"=>"york"}}
59
+ @test_ds.update_indexed_attributes(att)
60
+ @test_ds.fubar_values.should == ['mork', 'york']
61
+ @test_ds.fubar_values.should == ['mork', 'york']
62
+
63
+ att= {"fubar"=>{"0"=>"zork", "1"=>"tork", "2"=>'mangle'}}
64
+ @test_ds.update_indexed_attributes(att)
65
+ @test_ds.fubar_values.should == ['zork', 'tork', 'mangle']
66
+
67
+ att= {"fubar"=>{"0"=>"hork", "1"=>"tork", '-1'=>'dang'}}
68
+ result = @test_ds.update_indexed_attributes(att)
69
+ result.should == {"fubar"=>{"0"=>"hork", "1"=>"tork", '3'=>'dang'}}
70
+ @test_ds.fubar_values.should == ['hork', 'tork', 'mangle', 'dang']
71
+ end
72
+
73
+ it "should support single-value arguments (as opposed to a hash of values with array indexes as keys)" do
74
+ # In other words, { "fubar"=>"dork" } should have the same effect as { "fubar"=>{"0"=>"dork"} }
75
+ pending "this should be working, but for some reason, the updates don't stick"
76
+ result = @test_ds.update_indexed_attributes( { "fubar"=>"dork" } )
77
+ result.should == {"fubar"=>{"0"=>"dork"}}
78
+ @test_ds.fubar_values.should == ["dork"]
79
+ end
80
+
81
+ it "should work for text fields" do
82
+ att= {"swank"=>{"-1"=>"mork", "1"=>"york"}}
83
+ result = @test_ds.update_indexed_attributes(att)
84
+ result.should == {"swank"=>{"1"=>"york", "0"=>"mork"}}
85
+ @test_ds.swank_values.should == ['mork', 'york']
86
+ att= {"swank"=>{"-1"=>"dork"}}
87
+ result2 = @test_ds.update_indexed_attributes(att)
88
+ result2.should == {"swank"=>{"2"=>"dork"}}
89
+ @test_ds.swank_values.should == ['mork', 'york', 'dork']
90
+ end
91
+
92
+ it "should do nothing if there is no accessor corresponding to the given field key" do
93
+ xml_before = @test_ds.to_xml
94
+ @test_ds.update_indexed_attributes( { "style"=>"the style" } ).should == {}
95
+ @test_ds.to_xml.should == xml_before
96
+ end
97
+
98
+ it "should return the new index of any added values" do
99
+ @test_ds.swank_values = ["my_val1","my_val2"]
100
+ result = @test_ds.update_indexed_attributes "swank"=>{"-1"=>"mork"}
101
+ result.should == {"swank"=>{"2"=>"mork"}}
102
+ end
103
+
104
+ it "should return accurate response when multiple values have been added in a single run" do
105
+ pending
106
+ att= {"swank"=>{"-1"=>"mork", "0"=>"york"}}
107
+ @test_ds.update_indexed_attributes(att).should == {"swank"=>{"0"=>"york", "1"=>"mork"}}
108
+ end
109
+
110
+ it "should deal gracefully with adding new values at explicitly declared indexes" do
111
+ @test_ds.fubar_values = ["all", "for", "the"]
112
+ att = {"fubar"=>{"3"=>'glory'}}
113
+ result = @test_ds.update_indexed_attributes(att)
114
+ result.should == {"fubar"=>{"3"=>"glory"}}
115
+ @test_ds.fubar_values.should == ["all", "for", "the", "glory"]
116
+
117
+ @test_ds.fubar_values = []
118
+ result = @test_ds.update_indexed_attributes(att)
119
+ result.should == {"fubar"=>{"0"=>"glory"}}
120
+ @test_ds.fubar_values.should == ["glory"]
121
+ end
122
+
123
+ it "should allow deleting of values and should delete values so that to_xml does not return emtpy nodes" do
124
+ att= {"fubar"=>{"-1"=>"mork", "0"=>"york", "1"=>"mangle"}}
125
+ @test_ds.update_indexed_attributes(att)
126
+ @test_ds.fubar_values.should == ['mork', 'york', 'mangle']
127
+ rexml = REXML::Document.new(@test_ds.to_xml)
128
+ #puts rexml.root.elements.each {|el| el.to_s}
129
+ #puts rexml.root.elements.to_a.inspect
130
+ rexml.root.elements.to_a.length.should == 3
131
+ @test_ds.update_indexed_attributes({"fubar"=>{"1"=>""}})
132
+ @test_ds.fubar_values.should == ['mork', 'mangle']
133
+ rexml = REXML::Document.new(@test_ds.to_xml)
134
+ rexml.root.elements.to_a.length.should == 2
135
+ @test_ds.update_indexed_attributes({"fubar"=>{"0"=>:delete}})
136
+ @test_ds.fubar_values.should == ['mangle']
137
+ rexml = REXML::Document.new(@test_ds.to_xml)
138
+ rexml.root.elements.to_a.length.should == 1
139
+
140
+ @test_ds.fubar_values = ["val1", nil, "val2"]
141
+ @test_ds.update_indexed_attributes({"fubar"=>{"1"=>""}})
142
+ @test_ds.fubar_values.should == ["val1", "val2"]
143
+ end
144
+
145
+ end
146
+
147
+ describe ".get_values" do
148
+ it "should call the _values method corresponding to the field_name" do
149
+ @test_ds.expects(:abstract_values).returns(["val1", "val2"])
150
+ @test_ds.get_values(:abstract).should == ["val1", "val2"]
151
+ end
152
+ it "should return a default value if one is supplied" do
153
+ @test_ds.stubs(:abstract_values).returns([])
154
+ @test_ds.get_values(:abstract, "default value").should == "default value"
155
+ @test_ds.get_values(:abstract, nil).should == nil
156
+ end
157
+ end
158
+
51
159
  describe '.to_xml' do
52
160
  it "should provide .to_xml" do
53
161
  @test_ds.should respond_to(:to_xml)
@@ -1,5 +1,5 @@
1
1
  require File.join( File.dirname(__FILE__), "../spec_helper" )
2
-
2
+ require "hydra"
3
3
  describe ActiveFedora::NokogiriDatastream do
4
4
 
5
5
  before(:all) do
@@ -31,17 +31,159 @@ describe ActiveFedora::NokogiriDatastream do
31
31
  end
32
32
  end
33
33
 
34
+ describe ".update_indexed_attributes" do
35
+
36
+ before(:each) do
37
+ @mods_ds = Hydra::SampleModsDatastream.new(:blob=>fixture(File.join("mods_articles","hydrangea_article1.xml")))
38
+ end
39
+
40
+ it "should apply submitted hash to corresponding datastream field values" do
41
+ result = @mods_ds.update_indexed_attributes( {[{":person"=>"0"}, "role"]=>{"0"=>"role1", "1"=>"role2", "2"=>"role3"} })
42
+ result.should == {"person_0_role"=>{"0"=>"role1", "1"=>"role2", "2"=>"role3"}}
43
+ # xpath = ds.class.accessor_xpath(*field_key)
44
+ # result = ds.property_values(xpath)
45
+
46
+ @mods_ds.property_values('//oxns:name[@type="personal"][1]/oxns:role').should == ["role1","role2","role3"]
47
+ end
48
+ it "should support single-value arguments (as opposed to a hash of values with array indexes as keys)" do
49
+ # In other words, { "fubar"=>"dork" } should have the same effect as { "fubar"=>{"0"=>"dork"} }
50
+ result = @mods_ds.update_indexed_attributes( { [{":person"=>"0"}, "role"]=>"the role" } )
51
+ result.should == {"person_0_role"=>{"0"=>"the role"}}
52
+ @mods_ds.property_values('//oxns:name[@type="personal"][1]/oxns:role').first.should == "the role"
53
+ end
54
+ it "should do nothing if field key is a string (must be an array or symbol). Will not accept xpath queries!" do
55
+ xml_before = @mods_ds.to_xml
56
+ @mods_ds.update_indexed_attributes( { "fubar"=>"the role" } ).should == {}
57
+ @mods_ds.to_xml.should == xml_before
58
+ end
59
+ it "should do nothing if there is no accessor corresponding to the given field key" do
60
+ xml_before = @mods_ds.to_xml
61
+ @mods_ds.update_indexed_attributes( { [{"fubar"=>"0"}]=>"the role" } ).should == {}
62
+ @mods_ds.to_xml.should == xml_before
63
+ end
64
+
65
+ ### Examples copied over form metadata_datastream_spec
66
+
67
+ # it "should support single-value arguments (as opposed to a hash of values with array indexes as keys)" do
68
+ # # In other words, { "fubar"=>"dork" } should have the same effect as { "fubar"=>{"0"=>"dork"} }
69
+ # pending "this should be working, but for some reason, the updates don't stick"
70
+ # result = @test_ds.update_indexed_attributes( { "fubar"=>"dork" } )
71
+ # result.should == {"fubar"=>{"0"=>"dork"}}
72
+ # @test_ds.fubar_values.should == ["dork"]
73
+ # end
74
+ #
75
+ it "should work for text fields" do
76
+ att= {[{"person"=>"0"},"description"]=>{"-1"=>"mork", "1"=>"york"}}
77
+ result = @mods_ds.update_indexed_attributes(att)
78
+ result.should == {"person_0_description"=>{"0"=>"mork","1"=>"york"}}
79
+ @mods_ds.get_values([{:person=>0},:description]).should == ['mork', 'york']
80
+ att= {[{"person"=>"0"},"description"]=>{"-1"=>"dork"}}
81
+ result2 = @mods_ds.update_indexed_attributes(att)
82
+ result2.should == {"person_0_description"=>{"2"=>"dork"}}
83
+ @mods_ds.get_values([{:person=>0},:description]).should == ['mork', 'york', 'dork']
84
+ end
85
+
86
+ it "should return the new index of any added values" do
87
+ @mods_ds.get_values([{:title_info=>0},:main_title]).should == ["ARTICLE TITLE HYDRANGEA ARTICLE 1", "TITLE OF HOST JOURNAL"]
88
+ result = @mods_ds.update_indexed_attributes [{"title_info"=>"0"},"main_title"]=>{"-1"=>"mork"}
89
+ result.should == {"title_info_0_main_title"=>{"2"=>"mork"}}
90
+ end
91
+ #
92
+ # it "should return accurate response when multiple values have been added in a single run" do
93
+ # pending
94
+ # att= {"swank"=>{"-1"=>"mork", "0"=>"york"}}
95
+ # @test_ds.update_indexed_attributes(att).should == {"swank"=>{"0"=>"york", "1"=>"mork"}}
96
+ # end
97
+
98
+ # it "should deal gracefully with adding new values at explicitly declared indexes" do
99
+ # @mods_ds.update_indexed_attributes([:journal, :title]=>["all", "for", "the"]
100
+ # att = {"fubar"=>{"3"=>'glory'}}
101
+ # result = @test_ds.update_indexed_attributes(att)
102
+ # result.should == {"fubar"=>{"3"=>"glory"}}
103
+ # @test_ds.fubar_values.should == ["all", "for", "the", "glory"]
104
+ #
105
+ # @test_ds.fubar_values = []
106
+ # result = @test_ds.update_indexed_attributes(att)
107
+ # result.should == {"fubar"=>{"0"=>"glory"}}
108
+ # @test_ds.fubar_values.should == ["glory"]
109
+ # end
110
+ #
111
+ # it "should allow deleting of values and should delete values so that to_xml does not return emtpy nodes" do
112
+ # att= {"fubar"=>{"-1"=>"mork", "0"=>"york", "1"=>"mangle"}}
113
+ # @test_ds.update_indexed_attributes(att)
114
+ # @test_ds.fubar_values.should == ['mork', 'york', 'mangle']
115
+ # rexml = REXML::Document.new(@test_ds.to_xml)
116
+ # #puts rexml.root.elements.each {|el| el.to_s}
117
+ # #puts rexml.root.elements.to_a.inspect
118
+ # rexml.root.elements.to_a.length.should == 3
119
+ # @test_ds.update_indexed_attributes({"fubar"=>{"1"=>""}})
120
+ # @test_ds.fubar_values.should == ['mork', 'mangle']
121
+ # rexml = REXML::Document.new(@test_ds.to_xml)
122
+ # rexml.root.elements.to_a.length.should == 2
123
+ # @test_ds.update_indexed_attributes({"fubar"=>{"0"=>:delete}})
124
+ # @test_ds.fubar_values.should == ['mangle']
125
+ # rexml = REXML::Document.new(@test_ds.to_xml)
126
+ # rexml.root.elements.to_a.length.should == 1
127
+ #
128
+ # @test_ds.fubar_values = ["val1", nil, "val2"]
129
+ # @test_ds.update_indexed_attributes({"fubar"=>{"1"=>""}})
130
+ # @test_ds.fubar_values.should == ["val1", "val2"]
131
+ # end
132
+
133
+ it "should set @dirty to true" do
134
+ @mods_ds.get_values([{:title_info=>0},:main_title]).should == ["ARTICLE TITLE HYDRANGEA ARTICLE 1", "TITLE OF HOST JOURNAL"]
135
+ @mods_ds.update_indexed_attributes [{"title_info"=>"0"},"main_title"]=>{"-1"=>"mork"}
136
+ @mods_ds.dirty?.should be_true
137
+ end
138
+ end
139
+
140
+ describe ".get_values" do
141
+
142
+ before(:each) do
143
+ @mods_ds = Hydra::SampleModsDatastream.new(:blob=>fixture(File.join("mods_articles","hydrangea_article1.xml")))
144
+ end
145
+
146
+ it "should call lookup with field_name and return the text values from each resulting node" do
147
+ @mods_ds.expects(:property_values).with("--my xpath--").returns(["value1", "value2"])
148
+ @mods_ds.get_values("--my xpath--").should == ["value1", "value2"]
149
+ end
150
+ it "should assume that field_name that are strings are xpath queries" do
151
+ ActiveFedora::NokogiriDatastream.expects(:accessor_xpath).never
152
+ @mods_ds.expects(:property_values).with("--my xpath--").returns(["abstract1", "abstract2"])
153
+ @mods_ds.get_values("--my xpath--").should == ["abstract1", "abstract2"]
154
+ end
155
+ it "should assume field_names that are symbols or arrays are pointers to accessors declared in this datastreams model" do
156
+ pending "This shouldn't be necessary -- OX::XML::PropertyValueOpertators.property_values deals with it internally..."
157
+ ActiveFedora::NokogiriDatastream.expects(:accessor_xpath).with(:abstract).returns("--abstract xpath--")
158
+ ActiveFedora::NokogiriDatastream.expects(:accessor_xpath).with(*[{:person=>1}]).returns("--person xpath--")
159
+ ActiveFedora::NokogiriDatastream.expects(:accessor_xpath).with(*[{:person=>1},{:role=>1},:text]).returns("--person role text xpath--")
160
+
161
+ @mods_ds.expects(:property_values).with("--abstract xpath--").returns(["abstract1", "abstract2"])
162
+ @mods_ds.expects(:property_values).with("--person xpath--").returns(["person1", "person2"])
163
+ @mods_ds.expects(:property_values).with("--person role text xpath--").returns(["text1"])
164
+
165
+ @mods_ds.get_values(:abstract).should == ["abstract1", "abstract2"]
166
+ @mods_ds.get_values([{:person=>1}]).should == ["person1", "person2"]
167
+ @mods_ds.get_values([{:person=>1},{:role=>1},:text]).should == ["text1"]
168
+ end
169
+ end
170
+
34
171
  describe '#from_xml' do
35
172
  it "should work when a template datastream is passed in" do
36
173
  mods_xml = Nokogiri::XML::Document.parse( fixture(File.join("mods_articles", "hydrangea_article1.xml")) )
37
- tmpl = Hydra::ModsArticle.new
38
- Hydra::ModsArticle.from_xml(mods_xml,tmpl).ng_xml.root.to_xml.should == mods_xml.root.to_xml
174
+ tmpl = Hydra::SampleModsDatastream.new
175
+ Hydra::SampleModsDatastream.from_xml(mods_xml,tmpl).ng_xml.root.to_xml.should == mods_xml.root.to_xml
39
176
  end
40
177
  it "should work when foxml datastream xml is passed in" do
41
178
  pending "at least for now, just updated Base.deserialize to feed in the xml content rather than the foxml datstream xml. Possibly we can update MetadataDatstream to assume the same and leave it at that? -MZ 23-06-2010"
42
179
  hydrangea_article_foxml = Nokogiri::XML::Document.parse( fixture("hydrangea_fixture_mods_article1.foxml.xml") )
43
180
  ds_xml = hydrangea_article_foxml.at_xpath("//foxml:datastream[@ID='descMetadata']")
44
- Hydra::ModsArticle.from_xml(ds_xml).ng_xml.to_xml.should == hydrangea_article_foxml.at_xpath("//foxml:datastream[@ID='descMetadata']/foxml:datastreamVersion[last()]/foxml:xmlContent").first_element_child.to_xml
181
+ Hydra::SampleModsDatastream.from_xml(ds_xml).ng_xml.to_xml.should == hydrangea_article_foxml.at_xpath("//foxml:datastream[@ID='descMetadata']/foxml:datastreamVersion[last()]/foxml:xmlContent").first_element_child.to_xml
182
+ end
183
+ it "should set @dirty to false" do
184
+ hydrangea_article_foxml = Nokogiri::XML::Document.parse( fixture("hydrangea_fixture_mods_article1.foxml.xml") )
185
+ ds_xml = hydrangea_article_foxml.at_xpath("//foxml:datastream[@ID='descMetadata']")
186
+ Hydra::SampleModsDatastream.from_xml(ds_xml).dirty?.should be_false
45
187
  end
46
188
  end
47
189
 
@@ -148,6 +290,10 @@ describe ActiveFedora::NokogiriDatastream do
148
290
  root_property :mods, "mods", "http://www.loc.gov/mods/v3", :attributes=>["id", "version"], :schema=>"http://www.loc.gov/standards/mods/v3/mods-3-2.xsd"
149
291
 
150
292
  accessor :title_info, :relative_xpath=>'oxns:titleInfo', :children=>[
293
+ {:main_title=>{:relative_xpath=>'oxns:title'}},
294
+ {:language =>{:relative_xpath=>{:attribute=>"lang"} }}
295
+ ]
296
+ accessor :finnish_title_info, :relative_xpath=>'oxns:titleInfo[@lang="finnish"]', :children=>[
151
297
  {:main_title=>{:relative_xpath=>'oxns:title'}},
152
298
  {:language =>{:relative_xpath=>{:attribute=>"lang"} }}
153
299
  ]
@@ -216,10 +362,13 @@ describe ActiveFedora::NokogiriDatastream do
216
362
 
217
363
  solr_doc = @accessorized_ds.to_solr
218
364
  #should have these
219
-
365
+
220
366
  solr_doc[:abstract_t].should == "ABSTRACT"
221
367
  solr_doc[:title_info_1_language_t].should == "finnish"
222
368
  solr_doc[:person_1_role_0_text_t].should == "teacher"
369
+ solr_doc[:finnish_title_info_language_t].should == "finnish"
370
+ solr_doc[:finnish_title_info_main_title_t].should == "Artikkelin otsikko Hydrangea artiklan 1"
371
+
223
372
  # solr_doc[:mydate_date].should == "fake-date"
224
373
  #
225
374
  # solr_doc[:publisher_t].should be_nil
@@ -81,9 +81,11 @@ describe ActiveFedora do
81
81
 
82
82
  it "should prevent Base.save from calling update_index if false" do
83
83
  Fedora::Repository.instance.stubs(:save)
84
- mock1 = mock("ds1", :dirty? => true, :save => true, :kind_of? => ActiveFedora::MetadataDatastream)
84
+ dirty_ds = ActiveFedora::MetadataDatastream.new
85
+ dirty_ds.expects(:dirty?).returns(true)
86
+ dirty_ds.expects(:save).returns(true)
85
87
  @test_object.instance_variable_set(:@metadata_is_dirty, true)
86
- @test_object.stubs(:datastreams_in_memory).returns({:ds1 => mock1})
88
+ @test_object.stubs(:datastreams_in_memory).returns({:ds1 => dirty_ds})
87
89
  @test_object.expects(:update_index).never
88
90
  @test_object.expects(:refresh)
89
91
  @test_object.save
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active-fedora
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 8
10
- version: 1.1.8
9
+ - 9
10
+ version: 1.1.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matt Zumwalt
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-06-23 00:00:00 -05:00
19
+ date: 2010-07-02 00:00:00 -05:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -102,12 +102,12 @@ dependencies:
102
102
  requirements:
103
103
  - - ">="
104
104
  - !ruby/object:Gem::Version
105
- hash: 17
105
+ hash: 21
106
106
  segments:
107
107
  - 0
108
108
  - 1
109
- - 5
110
- version: 0.1.5
109
+ - 7
110
+ version: 0.1.7
111
111
  type: :runtime
112
112
  version_requirements: *id006
113
113
  - !ruby/object:Gem::Dependency
@@ -358,8 +358,7 @@ files:
358
358
  - lib/fedora/generic_search.rb
359
359
  - lib/fedora/repository.rb
360
360
  - lib/hydra.rb
361
- - lib/hydra/mods_article.rb
362
- - lib/hydra/opinionated_mods_document.rb
361
+ - lib/hydra/sample_mods_datastream.rb
363
362
  - lib/ruby-fedora.rb
364
363
  - lib/util/class_level_inheritable_attributes.rb
365
364
  - script/console
@@ -375,6 +374,7 @@ files:
375
374
  - spec/fixtures/mods_articles/hydrangea_article1.xml
376
375
  - spec/fixtures/oh_qdc.xml
377
376
  - spec/fixtures/test_12.foxml.xml
377
+ - spec/hydrangea_fixture_mods_article1.foxml.xml
378
378
  - spec/integration/base_file_management_spec.rb
379
379
  - spec/integration/base_loader_spec.rb
380
380
  - spec/integration/base_spec.rb
@@ -384,6 +384,7 @@ files:
384
384
  - spec/integration/fedora_object_spec.rb
385
385
  - spec/integration/full_featured_model_spec.rb
386
386
  - spec/integration/model_spec.rb
387
+ - spec/integration/mods_article_integration_spec.rb
387
388
  - spec/integration/rels_ext_datastream_spec.rb
388
389
  - spec/integration/repository_spec.rb
389
390
  - spec/integration/rf_fedora_object_spec.rb
@@ -470,6 +471,7 @@ test_files:
470
471
  - spec/integration/fedora_object_spec.rb
471
472
  - spec/integration/full_featured_model_spec.rb
472
473
  - spec/integration/model_spec.rb
474
+ - spec/integration/mods_article_integration_spec.rb
473
475
  - spec/integration/rels_ext_datastream_spec.rb
474
476
  - spec/integration/repository_spec.rb
475
477
  - spec/integration/rf_fedora_object_spec.rb
@@ -1,49 +0,0 @@
1
- module Hydra
2
- class ModsArticle < ActiveFedora::NokogiriDatastream
3
-
4
- # have to call this in order to set namespace & schema
5
- root_property :mods, "mods", "http://www.loc.gov/mods/v3", :attributes=>["id", "version"], :schema=>"http://www.loc.gov/standards/mods/v3/mods-3-2.xsd"
6
-
7
- accessor :title_info, :relative_xpath=>'oxns:titleInfo', :children=>[
8
- {:main_title=>{:relative_xpath=>'oxns:title'}},
9
- {:language =>{:relative_xpath=>{:attribute=>"lang"} }}
10
- ]
11
- accessor :abstract
12
- accessor :topic_tag, :relative_xpath=>'oxns:subject/oxns:topic'
13
- accessor :person, :relative_xpath=>'oxns:name[@type="personal"]', :children=>[
14
- {:last_name=>{:relative_xpath=>'oxns:namePart[@type="family"]'}},
15
- {:first_name=>{:relative_xpath=>'oxns:namePart[@type="given"]'}},
16
- {:institution=>{:relative_xpath=>'oxns:affiliation'}},
17
- {:role=>{:children=>[
18
- {:text=>{:relative_xpath=>'oxns:roleTerm[@type="text"]'}},
19
- {:code=>{:relative_xpath=>'oxns:roleTerm[@type="code"]'}}
20
- ]}}
21
- ]
22
- accessor :organization, :relative_xpath=>'oxns:name[@type="institutional"]', :children=>[
23
- {:role=>{:children=>[
24
- {:text=>{:relative_xpath=>'oxns:roleTerm[@type="text"]'}},
25
- {:code=>{:relative_xpath=>'oxns:roleTerm[@type="code"]'}}
26
- ]}}
27
- ]
28
- accessor :conference, :relative_xpath=>'oxns:name[@type="conference"]', :children=>[
29
- {:role=>{:children=>[
30
- {:text=>{:relative_xpath=>'oxns:roleTerm[@type="text"]'}},
31
- {:code=>{:relative_xpath=>'oxns:roleTerm[@type="code"]'}}
32
- ]}}
33
- ]
34
- accessor :journal, :relative_xpath=>'oxns:relatedItem[@type="host"]', :children=>[
35
- {:title=>{:relative_xpath=>'oxns:titleInfo/oxns:title'}},
36
- {:publisher=>{:relative_xpath=>'oxns:originInfo/oxns:publisher'}},
37
- {:issn=>{:relative_xpath=>'oxns:identifier[@type="issn"]'}},
38
- {:date_issued=>{:relative_xpath=>'oxns:originInfo/oxns:dateIssued'}},
39
- {:issue => {:relative_xpath=>"oxns:part", :children=>[
40
- {:volume=>{:relative_xpath=>'oxns:detail[@type="volume"]'}},
41
- {:level=>{:relative_xpath=>'oxns:detail[@type="level"]'}},
42
- {:start_page=>{:relative_xpath=>'oxns:extent[@unit="pages"]/oxns:start'}},
43
- {:end_page=>{:relative_xpath=>'oxns:extent[@unit="pages"]/oxns:end'}},
44
- {:publication_date=>{:relative_xpath=>'oxns:date'}}
45
- ]}}
46
- ]
47
-
48
- end
49
- end