Closed mark-dce closed 3 years ago
E.G. (and pardon my pseudo-code)
creator = Creator.new
# assign values
creator.display_name = "Sumner, Gordon"
creator.save
pub = Publication.new
# expect pub.creator == nil
# expect pub.creator_id == nil
# assign required values
pub.creator_id = creator.id
pub.save
pub.reload
# expect pub.creator == "Sumner, Gordon"
# expect pub.creator_id == creator.id
irb(main):036:0> creator.id => 889 irb(main):037:0> pub.creator => [] irb(main):038:0> creator.display_name => "Sumner, Gordon" irb(main):039:0> pub.creator_id => [] irb(main):041:0> pub.creator_id = [889] => [889] irb(main):043:0> pub.title = ["Sting from console"] => ["Sting from console"] irb(main):044:0> pub.save Load LDP (7.6ms) http://fcrepo:8080/rest/dev/71/4b/46/8a/714b468a-6086-4d89-9e92-346bdf04e93a Service: 70323500039180 (0.3ms) BEGIN [.........] Load LDP (3.2ms) http://fcrepo:8080/rest/dev/9s/16/16/16/9s1616164/list_source Service: 70323500039180 => true irb(main):045:0> pub.reload Load LDP (11.9ms) http://fcrepo:8080/rest/dev/9s/16/16/16/9s1616164 Service: 70323500039180 => #<Publication id: "9s1616164", head: [], tail: [], depositor: nil, title: ["Sting from console"], date_uploaded: nil, date_modified: nil, state: nil, proxy_depositor: nil, on_behalf_of: nil, arkivo_checksum: nil, owner: nil, creator_id: [889], series: [], issue_number: [], abstract: [], alternative_title: [], bibliographic_citation: [], corporate_name: [], date_available: [], extent: [], has_part: [], is_version_of: [], has_version: [], is_replaced_by: [], replaces: [], requires: [], geographic_name: [], table_of_contents: [], temporal: [], label: nil, relative_path: nil, import_url: nil, resource_type: [], creator: [], contributor: [], description: [], keyword: [], license: [], rights_statement: [], publisher: [], date_created: [], subject: [], language: [], identifier: [], based_near: [], related_url: [], source: [], access_control_id: "714b468a-6086-4d89-9e92-346bdf04e93a", representative_id: nil, thumbnail_id: nil, rendering_ids: [], admin_set_id: nil, embargo_id: nil, lease_id: nil> irb(main):046:0> pub.creator => [] irb(main):047:0> pub.creator_id => [889]
Yeah, in order to get the creator name as a string you would have to assign it separately in order for Fedora to have access to it.
I think you can get the solr_do via something like this:
pub2 = Publication.search(id: pub.id)
# pub2.class ==> solr_document
pub2.creator
on index-alternates-fresh branch.
With current main (index-alternates-fresh merged), creating a work from the UI results in a fedora document with creator populated but creator_id blank; the solr indexing copes.
{"system_create_dtsi"=>"2021-04-23T14:19:40Z", "system_modified_dtsi"=>"2021-04-23T14:19:54Z", "has_model_ssim"=>["Publication"], :id=>"wm117p12h", "accessControl_ssim"=>["30ab6a06-1392-4448-84ff-f0908742ece0"], "hasRelatedMediaFragment_ssim"=>["sf268520m"], "hasRelatedImage_ssim"=>["sf268520m"], "depositor_ssim"=>["max@curationexperts.com"], "depositor_tesim"=>["max@curationexperts.com"], "title_tesim"=>["Autocomplete test - I am expecting this to have a creator name via the UI, but not an ID"], "title_sim"=>["Autocomplete test - I am expecting this to have a creator name via the UI, but not an ID"], "date_uploaded_dtsi"=>"2021-04-23T14:19:39Z", "date_modified_dtsi"=>"2021-04-23T14:19:39Z", "isPartOf_ssim"=>["admin_set/default"], "creator_tesim"=>["Farmer, Roger E. A."], "creator_sim"=>["Farmer, Roger E. A."], "thumbnail_path_ss"=>"/downloads/sf268520m?file=thumbnail", "suppressed_bsi"=>false, "actionable_workflow_roles_ssim"=>["admin_set/default-default-managing", "admin_set/default-default-approving", "admin_set/default-default-depositing"], "workflow_state_name_ssim"=>"deposited", "member_ids_ssim"=>["sf268520m"], "member_of_collections_ssim"=>[], "member_of_collection_ids_ssim"=>[], "generic_type_sim"=>["Work"], "file_set_ids_ssim"=>["sf268520m"], "visibility_ssi"=>"open", "admin_set_sim"=>["Research Division Entire Collection"], "admin_set_tesim"=>["Research Division Entire Collection"], "title_ssi"=>"Autocomplete test - I am expecting this to have a creator name via the UI, but not an ID", "date_created_ssi"=>nil, "alpha_creator_tesim"=>["Farmer, Roger E. A."], "human_readable_type_sim"=>"Publication", "human_readable_type_tesim"=>"Publication", "read_access_group_ssim"=>["public"], "edit_access_group_ssim"=>["admin"], "edit_access_person_ssim"=>["max@curationexperts.com"]}
(so backward-compatible ui-wise)
With a work created from the console, assigning a creator_id for an authority record with alternate names, the name and alternates are indexed as expected.
{"system_create_dtsi"=>"2021-04-23T15:13:45Z", "system_modified_dtsi"=>"2021-04-23T15:13:45Z", "has_model_ssim"=>["Publication"], :id=>"fj236226r", "accessControl_ssim"=>["8b616e75-9177-481e-a0e1-3ddf62cdb92c"], "title_tesim"=>["New publication from console with authority-based creator"], "title_sim"=>["New publication from console with authority-based creator"], "creator_id_ssim"=>["557"], "thumbnail_path_ss"=>"/assets/work-ff055336041c3f7d310ad69109eda4a887b16ec501f35afc0a547c4adb97ee72.png", "suppressed_bsi"=>false, "member_ids_ssim"=>[], "member_of_collections_ssim"=>[], "member_of_collection_ids_ssim"=>[], "generic_type_sim"=>["Work"], "file_set_ids_ssim"=>[], "visibility_ssi"=>"restricted", "admin_set_sim"=>"", "admin_set_tesim"=>"", "title_ssi"=>"New publication from console with authority-based creator", "date_created_ssi"=>nil, "creator_tesim"=>["Nelson, Clarence Walford", "Nelson, Clarence W., 1924-"], "alpha_creator_tesim"=>["Nelson, Clarence W., 1924-"], "creator_sim"=>["Nelson, Clarence W., 1924-"], "human_readable_type_sim"=>"Publication", "human_readable_type_tesim"=>"Publication"}
![image.png] (https://images.zenhubusercontent.com/5e4c418d8f780f6e39f8f8ce/782a6ebb-2808-48fb-9b64-4c76f19805b5)
ISSUE We want to be able to persist relationships between creators and works in the backend.
ASSUMPTIONS
ACCEPTANCE When I am in the rails console, and I assign a new creator ID to a work (publication/research data/conference proceedings) and save it