-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
starting on switch to using OM::Terminologies and relying on Solrizer…
… to provide solr mappings. Putting on hold to merge Rick's updates
- Loading branch information
1 parent
0fb0496
commit ceb6a3c
Showing
6 changed files
with
140 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,100 +1,63 @@ | ||
require "hydra" | ||
module Hydra | ||
class Hydra::SampleModsDatastream < ActiveFedora::NokogiriDatastream | ||
|
||
# have to call this in order to set namespace & schema | ||
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" | ||
|
||
property :title_info, :path=>"titleInfo", | ||
:convenience_methods => { | ||
:main_title => {:path=>"title"}, | ||
:language => {:path=>{:attribute=>"lang"}}, | ||
} | ||
property :abstract, :path=>"abstract" | ||
property :topic_tag, :path=>'subject',:default_content_path => "topic" | ||
|
||
property :name_, :path=>"name", | ||
:attributes=>[:xlink, :lang, "xml:lang", :script, :transliteration, {:type=>["personal", "enumerated", "corporate"]} ], | ||
:subelements=>["namePart", "displayForm", "affiliation", :role, "description"], | ||
:default_content_path => "namePart", | ||
:convenience_methods => { | ||
:date => {:path=>"namePart", :attributes=>{:type=>"date"}}, | ||
:family_name => {:path=>"namePart", :attributes=>{:type=>"family"}}, | ||
:first_name => {:path=>"namePart", :attributes=>{:type=>"given"}}, | ||
:terms_of_address => {:path=>"namePart", :attributes=>{:type=>"termsOfAddress"}} | ||
} | ||
|
||
property :person, :variant_of=>:name_, :attributes=>{:type=>"personal"} | ||
property :organizaton, :variant_of=>:name_, :attributes=>{:type=>"institutional"} | ||
property :conference, :variant_of=>:name_, :attributes=>{:type=>"conference"} | ||
|
||
property :role, :path=>"role", | ||
:parents=>[:name_], | ||
:convenience_methods => { | ||
:text => {:path=>"roleTerm", :attributes=>{:type=>"text"}}, | ||
:code => {:path=>"roleTerm", :attributes=>{:type=>"code"}}, | ||
} | ||
|
||
property :journal, :path=>'relatedItem', :attributes=>{:type=>"host"}, | ||
:subelements=>[:title_info, :origin_info, :issue], | ||
:convenience_methods => { | ||
:issn => {:path=>"identifier", :attributes=>{:type=>"issn"}}, | ||
} | ||
|
||
property :origin_info, :path=>'originInfo', | ||
:subelements=>["publisher","dateIssued"] | ||
|
||
property :issue, :path=>'part', | ||
:subelements=>[:start_page, :end_page], | ||
:convenience_methods => { | ||
:volume => {:path=>"detail", :attributes=>{:type=>"volume"}}, | ||
:level => {:path=>"detail", :attributes=>{:type=>"level"}}, | ||
:publication_date => {:path=>"date"} | ||
} | ||
property :start_page, :path=>"extent", :attributes=>{:unit=>"pages"}, :default_content_path => "start" | ||
property :end_page, :path=>"extent", :attributes=>{:unit=>"pages"}, :default_content_path => "end" | ||
|
||
generate_accessors_from_properties | ||
# accessor :title_info, :relative_xpath=>'oxns:titleInfo', :children=>[ | ||
# {:main_title=>{:relative_xpath=>'oxns:title'}}, | ||
# {:language =>{:relative_xpath=>{:attribute=>"lang"} }} | ||
# ] | ||
# accessor :abstract | ||
# accessor :topic_tag, :relative_xpath=>'oxns:subject/oxns:topic' | ||
# accessor :person, :relative_xpath=>'oxns:name[@type="personal"]', :children=>[ | ||
# {:last_name=>{:relative_xpath=>'oxns:namePart[@type="family"]'}}, | ||
# {:first_name=>{:relative_xpath=>'oxns:namePart[@type="given"]'}}, | ||
# {:institution=>{:relative_xpath=>'oxns:affiliation'}}, | ||
# {:role=>{:children=>[ | ||
# {:text=>{:relative_xpath=>'oxns:roleTerm[@type="text"]'}}, | ||
# {:code=>{:relative_xpath=>'oxns:roleTerm[@type="code"]'}} | ||
# ]}} | ||
# ] | ||
# accessor :organization, :relative_xpath=>'oxns:name[@type="institutional"]', :children=>[ | ||
# {:role=>{:children=>[ | ||
# {:text=>{:relative_xpath=>'oxns:roleTerm[@type="text"]'}}, | ||
# {:code=>{:relative_xpath=>'oxns:roleTerm[@type="code"]'}} | ||
# ]}} | ||
# ] | ||
# accessor :conference, :relative_xpath=>'oxns:name[@type="conference"]', :children=>[ | ||
# {:role=>{:children=>[ | ||
# {:text=>{:relative_xpath=>'oxns:roleTerm[@type="text"]'}}, | ||
# {:code=>{:relative_xpath=>'oxns:roleTerm[@type="code"]'}} | ||
# ]}} | ||
# ] | ||
# accessor :journal, :relative_xpath=>'oxns:relatedItem[@type="host"]', :children=>[ | ||
# {:title=>{:relative_xpath=>'oxns:titleInfo/oxns:title'}}, | ||
# {:publisher=>{:relative_xpath=>'oxns:originInfo/oxns:publisher'}}, | ||
# {:issn=>{:relative_xpath=>'oxns:identifier[@type="issn"]'}}, | ||
# {:date_issued=>{:relative_xpath=>'oxns:originInfo/oxns:dateIssued'}}, | ||
# {:issue => {:relative_xpath=>"oxns:part", :children=>[ | ||
# {:volume=>{:relative_xpath=>'oxns:detail[@type="volume"]'}}, | ||
# {:level=>{:relative_xpath=>'oxns:detail[@type="level"]'}}, | ||
# {:start_page=>{:relative_xpath=>'oxns:extent[@unit="pages"]/oxns:start'}}, | ||
# {:end_page=>{:relative_xpath=>'oxns:extent[@unit="pages"]/oxns:end'}}, | ||
# {:publication_date=>{:relative_xpath=>'oxns:date'}} | ||
# ]}} | ||
# ] | ||
|
||
set_terminology do |t| | ||
t.root(:path=>"mods", :xmlns=>"http://www.loc.gov/mods/v3", :schema=>"http://www.loc.gov/standards/mods/v3/mods-3-2.xsd") | ||
|
||
t.title_info(:path=>"titleInfo") { | ||
t.main_title(:path=>"title", :label=>"title") | ||
t.language(:path=>{:attribute=>"lang"}) | ||
} | ||
t.abstract | ||
t.topic_tag(:path=>"subject", :default_content_path=>"topic") | ||
# This is a mods:name. The underscore is purely to avoid namespace conflicts. | ||
t.name_ { | ||
# this is a namepart | ||
t.namePart(:index_as=>[:searchable, :displayable, :facetable, :sortable], :required=>:true, :type=>:string, :label=>"generic name") | ||
# affiliations are great | ||
t.affiliation | ||
t.displayForm | ||
t.role(:ref=>[:role]) | ||
t.description | ||
t.date(:path=>"namePart", :attributes=>{:type=>"date"}) | ||
t.last_name(:path=>"namePart", :attributes=>{:type=>"family"}) | ||
t.first_name(:path=>"namePart", :attributes=>{:type=>"given"}, :label=>"first name") | ||
t.terms_of_address(:path=>"namePart", :attributes=>{:type=>"termsOfAddress"}) | ||
} | ||
# lookup :person, :first_name | ||
t.person(:ref=>:name, :attributes=>{:type=>"personal"}) | ||
t.organizaton(:ref=>:name, :attributes=>{:type=>"institutional"}) | ||
t.conference(:ref=>:name, :attributes=>{:type=>"conference"}) | ||
|
||
t.role { | ||
t.text(:path=>"roleTerm",:attributes=>{:type=>"text"}) | ||
t.code(:path=>"roleTerm",:attributes=>{:type=>"code"}) | ||
} | ||
t.journal(:path=>'relatedItem', :attributes=>{:type=>"host"}) { | ||
t.title_info | ||
t.origin_info(:path=>"originInfo") { | ||
t.publisher | ||
t.date_issued(:path=>"dateIssued") | ||
} | ||
t.issn(:path=>"identifier", :attributes=>{:type=>"issn"}) | ||
t.issue(:path=>"part") { | ||
t.volume(:path=>"detail", :attributes=>{:type=>"volume"}, :default_content_path=>"number") | ||
t.level(:path=>"detail", :attributes=>{:type=>"number"}, :default_content_path=>"number") | ||
t.extent | ||
t.pages(:path=>"extent", :attributes=>{:type=>"pages"}) { | ||
t.start | ||
t.end | ||
} | ||
t.publication_date(:path=>"date") | ||
} | ||
} | ||
|
||
end | ||
|
||
# Changes from OM::Properties implementation | ||
# renamed family_name => last_name | ||
# start_page & end_page now accessible as [:journal, :issue, :pages, :start] (etc.) | ||
|
||
end | ||
end |
Oops, something went wrong.