<div dir="ltr"><font face="arial, helvetica, sans-serif">Sorry Brian, the message got cut off. <span style="font-size:12.8px">It's concatenating the names to the agent accordingly, however the names are still separated and I believe it is still looking for a primary name in that name </span></font><div style="font-size:12.8px"><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Here is an example of the JSON</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714px;white-space:pre;background-color:rgb(255,255,255)"><font color="#000000">For JSONModel(:agent_person):
#<JSONModel(:agent_person) {"jsonmodel_type"=>"agent_person", "agent_contacts"=>[], "linked_agent_roles"=>[], "external_documents"=>[], "rights_statements"=>[], "notes"=>[], "dates_of_existence"=>[], "names"=>[{"jsonmodel_type"=>"name_person", "use_dates"=>[], "authorized"=>false, "is_display_name"=>false, "sort_name_auto_generate"=>true, "uri"=>nil, "primary_name"=>"Goodman", "rest_of_name"=>"Oscar Baylin,", "dates"=>"1939-", "name_order"=>"inverted", "source"=>"ingest"}, {"jsonmodel_type"=>"name_person", "use_dates"=>[], "authorized"=>false, "is_display_name"=>false, "sort_name_auto_generate"=>true, "uri"=>nil, "authority_id"=>"n 2003051366", "name_order"=>"direct", "source"=>"ingest"}], "related_agents"=>[], "uri"=>"/agents/people/import_4cd10c10-330e-4d71-916d-1f354f4e1f89"}></font></span><br></font></div><div><span style="line-height:18.5714px;white-space:pre;background-color:rgb(255,255,255)"><font color="#000000" face="arial, helvetica, sans-serif"><br></font></span></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714px;white-space:pre;background-color:rgb(255,255,255)"><font color="#000000">and here is the code for the plugin </font></span><font color="#000000"><span style="line-height:18.5714px;white-space:pre"><a href="https://github.com/UNLV-Libraries/ArchivesSpace-authority-project/tree/master/unlv_importer">https://github.com/UNLV-Libraries/ArchivesSpace-authority-project/tree/master/unlv_importer</a></span></font></font></div><div><br></div><div>I am still having trouble making it only one name_person instead of two under the agent person. I appreciate your help, sorry again for the delay and the double message.</div><div><br></div><div>Thank you,</div><div>Carlos Lemus</div><div class="gmail_extra"><font face="arial, helvetica, sans-serif"><br></font><div class="gmail_quote"><font face="arial, helvetica, sans-serif">On Mon, Sep 21, 2015 at 3:30 PM, Carlos Lemus <span dir="ltr"><<a href="mailto:carlos.lemus@unlv.edu" target="_blank">carlos.lemus@unlv.edu</a>></span> wrote:<br></font><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><font face="arial, helvetica, sans-serif">Hello Brian,</font><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Sorry for getting back to you so late, I have been attempting to implement your code. It's concatenating the names to the agent accordingly, however the names are still separated and I believe it is still looking for a primary name in that name </font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Here is an example of the JSON</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><font face="arial, helvetica, sans-serif"><br></font><div class="gmail_quote"><font face="arial, helvetica, sans-serif">On Fri, Sep 11, 2015 at 6:55 AM, Brian Hoffman <span dir="ltr"><<a href="mailto:brianjhoffman@gmail.com" target="_blank">brianjhoffman@gmail.com</a>></span> wrote:<br></font><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><font face="arial, helvetica, sans-serif">Hi Carlos,</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Yes, that’s actually something I overlooked. The way the importers are constructed, you can’t actually access the queue of records to import from the configuration code. So, I posted an example of a workaround (and some workarounds for a few other issues with the way importers are sub-classed):</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><a href="https://github.com/quoideneuf/aspace_single_agent_marcxml/blob/master/backend/model/marcxml_accession_converter.rb" target="_blank"><font face="arial, helvetica, sans-serif">https://github.com/quoideneuf/aspace_single_agent_marcxml/blob/master/backend/model/marcxml_accession_converter.rb</font></a></div><span><font color="#888888" face="arial, helvetica, sans-serif"><div><br></div><div>Brian</div></font></span><div><div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><font face="arial, helvetica, sans-serif"><br></font><div><blockquote type="cite"><div><font face="arial, helvetica, sans-serif">On Sep 10, 2015, at 12:44 AM, Carlos Lemus <<a href="mailto:carlos.lemus@unlv.edu" target="_blank">carlos.lemus@unlv.edu</a>> wrote:</font></div><font face="arial, helvetica, sans-serif"><br></font><div><div dir="ltr"><font face="arial, helvetica, sans-serif">Hello Brian,</font><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Sorry if I'm not replying to our current thread correctly. I have yet to set up git for the plugin, but as soon as I do I will let you know. It is mostly some of the yale marcxml plugin setup and a lot of commented trial and error code at this point anyways. </font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">I tried the code you gave me and I think you understand perfectly what my issue is and I understand what you're trying to do by matching the agent to the current resource, exactly what I need. </font></div><div><font face="arial, helvetica, sans-serif">However, it's not working because the batch object seems to be Null. Not sure if maybe I'm required to import something.</font></div><div><span style="color:rgb(51,238,51);font-size:13px;line-height:18.5714282989502px;white-space:pre-wrap;background-color:rgb(51,51,51)"><font face="arial, helvetica, sans-serif"><br></font></span></div><div><span style="color:rgb(51,238,51);font-size:13px;line-height:18.5714282989502px;white-space:pre-wrap;background-color:rgb(51,51,51)"><font face="arial, helvetica, sans-serif">Error: #<NoMethodError: undefined method `working_area' for nil:NilClass></font></span></div><div><span style="color:rgb(51,238,51);font-size:13px;line-height:18.5714282989502px;white-space:pre-wrap;background-color:rgb(51,51,51)"><font face="arial, helvetica, sans-serif"><br></font></span></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px;white-space:pre-wrap">Here is the current state of my code </span></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px;white-space:pre-wrap"><div><br></div><div>UNLVMarcXMLAgentsConverter.configure do |config|</div></span></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px;white-space:pre-wrap">config["/record"][:map]["controlfield[@tag='001']"] = -> resource, node {</span></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px"><span style="white-space:pre-wrap"> </span>existing_agent_uri = resource.linked_agents.find {|link| link[:ref] =~ /people/ }</span></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px"><span style="white-space:pre-wrap"> </span>existing_agent = @batch.working_area.find {|obj| obj.uri == existing_agent_uri }</span></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px"><span style="white-space:pre-wrap"> </span>make(:name_person) do |name|</span></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px"><span style="white-space:pre-wrap"> </span>name.primary = node.xpath("subfield[@code='a']").inner_text</span></font></div><div><span style="white-space:pre-wrap;line-height:18.5714282989502px"><font face="arial, helvetica, sans-serif"> </font></span></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px"><span style="white-space:pre-wrap"> </span># add more name fields as necessary</span></font></div><div><span style="white-space:pre-wrap;line-height:18.5714282989502px"><font face="arial, helvetica, sans-serif"> </font></span></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px"><span style="white-space:pre-wrap"> </span>val = node.inner_text</span></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px"><span style="white-space:pre-wrap"> </span>name['authority_id'] = val </span></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px"><span style="white-space:pre-wrap"> </span>existing_agent.names << name</span></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px"><span style="white-space:pre-wrap"> </span> end</span></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px"><span style="white-space:pre-wrap"> </span>}</span></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px">end</span><br></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px;white-space:pre-wrap">Thanks for the quick reply by the way. I would have gotten to you sooner, but I didn't get an email </span><span style="line-height:18.5714px;white-space:pre-wrap">that you had replied. I'll keep an eye on the listserv from now on. </span></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px;white-space:pre-wrap"><br></span></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px;white-space:pre-wrap">Carlos Lemus</span></font></div></div>
</div></blockquote></div><font face="arial, helvetica, sans-serif"><br></font></div></div></div></blockquote></div><font face="arial, helvetica, sans-serif"><br></font></div>
</div></div></blockquote></div><br></div></div>