Index JSON object to Solr / Goobi viewer

Hi!

I was wondering how to index nested object into Solr / Goobi viewer?. Let’s say, instead of having structure like this:

"MD_CREATORS" :["Selmer, Marcus ; Berge, Øyvind"]

I would like to have something like:

"actors": [
{ 
  "name": "Selmer, Marcus" ,
  "uri": "https://kulturnav.org/e031df43-b0d9-455f-8234-ed428e126b86" ,
  "role" : {
      "name" :  "creator"
 }
},
{ 
 "name": "Berge, Øyvind" , 
 "uri": "https://kulturnav.org/3f0d2140-9fc4-4972-99ea-eb7c75550094", 
  "role" : {
      "name" :  "author"
   }
 }
]

How do I achieve that? Thank you!

Hi @hemed ,

is the basis for indexing METS/MODS? If yes, can you please provide an example MODS snippet for the two persons you mentioned above?

Cheers,

Jan :slight_smile:

Hi @jan ! Thank you for the reply. Please find below the METS/MODS snippet for the persons. You can also see full METS from our test instance here: https://viewer.goobi.ubbe.no/viewer/metsresolver?id=ubb-hru-01

<mods:name type="personal" valueURI="https://kulturnav.org/3af20d5e-3aaf-4efb-b254-a805c3a9aa7e">
<mods:role>
<mods:roleTerm authority="marcrelator" type="code">aut</mods:roleTerm>
</mods:role>
<mods:namePart type="family">Paulsen</mods:namePart>
<mods:namePart type="given">Bernth</mods:namePart>
<mods:displayForm>Paulsen, Bernth</mods:displayForm>
</mods:name>
<mods:name type="personal" valueURI="https://kulturnav.org/e031df43-b0d9-455f-8234-ed428e126b86">
<mods:role>
<mods:roleTerm authority="marcrelator" type="code">aut</mods:roleTerm>
</mods:role>
<mods:namePart type="family">Selmer</mods:namePart>
<mods:namePart type="given">Marcus</mods:namePart>
<mods:displayForm>Selmer, Marcus</mods:displayForm>
</mods:name>
<mods:name type="personal" valueURI="https://kulturnav.org/3f0d2140-9fc4-4972-99ea-eb7c75550094">
<mods:role>
<mods:roleTerm authority="marcrelator" type="code">cre</mods:roleTerm>
</mods:role>
<mods:namePart type="family">Berge</mods:namePart>
<mods:namePart type="given">Øyvind</mods:namePart>
<mods:displayForm>Berge, Øyvind</mods:displayForm>
</mods:name>

Do you visually mean something like this?
Bildschirmfoto von 2021-08-19 11-43-35

This is encoded in MODS the following way:

<mods:name authority="gnd" authorityURI="http://d-nb.info/gnd/" type="personal" valueURI="http://d-nb.info/gnd/101241771">
  <mods:role>
    <mods:roleTerm authority="marcrelator" type="code">edt</mods:roleTerm>
  </mods:role>
  <mods:namePart type="family">Plenzat</mods:namePart>
  <mods:namePart type="given">Karl</mods:namePart>
  <mods:displayForm>Plenzat, Karl</mods:displayForm>
</mods:name>
<mods:name authority="gnd" authorityURI="http://d-nb.info/gnd/" type="personal" valueURI="http://d-nb.info/gnd/116347880">
  <mods:role>
    <mods:roleTerm authority="marcrelator" type="code">aut</mods:roleTerm>
  </mods:role>
  <mods:namePart type="family">Eckmann</mods:namePart>
  <mods:namePart type="given">Heinrich</mods:namePart>
  <mods:displayForm>Eckmann, Heinrich</mods:displayForm>
</mods:name>

The configuration of the Solr field in the solr_indexerconfig.xml is as follows:

<MD_CREATOR>
  <list>
    <item>
      <xpath>
        <list>
          <item>mets:xmlData/mods:mods/mods:name[@type="personal"][not(mods:role/mods:roleTerm="rcp"[@authority='marcrelator'][@type='code'])]/mods:displayForm</item>
          <item>lido:eventActor/lido:actorInRole[lido:roleActor/lido:term]/lido:actor</item>
          <item>dc:creator</item>
        </list>
      </xpath>
      <addToDefault>true</addToDefault>
      <addSortField>true</addSortField>
      <groupEntity type="PERSON">
        <!-- MODS -->
        <field name="MD_VALUE">mods:displayForm</field>
        <field name="MD_DISPLAYFORM">mods:displayForm</field>
        <field name="MD_LINK">@xlink:href</field>
        <field name="MD_CORPORATION">mods:namePart[not(@type)]</field>
        <field name="MD_LASTNAME">mods:namePart[@type="family"]</field>
        <field name="MD_FIRSTNAME">mods:namePart[@type="given"]</field>
        <field name="MD_LIFEPERIOD">mods:namePart[@type="date"]</field>
        <field name="MD_TERMSOFADDRESS">mods:namePart[@type="termsOfAddress"]</field>

        <!-- LIDO -->
        <field name="MD_VALUE">lido:nameActorSet/lido:appellationValue[@lido:pref="preferred"]</field>
        <field name="MD_DISPLAYFORM">lido:nameActorSet/lido:appellationValue[@lido:pref="preferred"]</field>
        <field name="MD_DOB">lido:vitalDatesActor/lido:earliestDate[@lido:type="Geburtsdatum"]</field>
        <field name="MD_DOD">lido:vitalDatesActor/lido:latestDate[@lido:type="Sterbedatum"]</field>
        <field name="NORM_URI">lido:actorID[@lido:source="http://d-nb.info/gnd"]</field>

        <!-- DUBLIN CORE -->
        <field name="MD_VALUE">text()</field>
        <field name="MD_SUBJECT">text()</field>
      </groupEntity>
    </item>
  </list>
</MD_CREATOR>

It is displayed on the metadata page with the following configuration in the config_viewer.xml:

<metadata label="MD_CREATOR" value="MASTERVALUE_SIMPLE_GROUP" group="true">
  <param type="field" key="MD_VALUE"/>
  <param type="field" key="NORM_WIKIPEDIAURL" value="LINK_WIKIPEDIA_FULL"/>
  <param type="normdatauri" key="NORM_URI"/>
  <param type="normdatasearch" key="NORM_IDENTIFIER"/>
</metadata>

This are grouped metadata, you can find them in the Solr index when you search with the field PI_TOPSTRUCT instead of PI and combine it with the METADATATYPE:PERSON

Does this help?

Best,

Jan :slight_smile:

1 „Gefällt mir“

Thank you @jan . This looks great, I will try it out!

My usecase was actually to query Goobi viewer from another front-end system. I was therefore interested in getting all metadata from a particular record in JSON format, similar to mainifest API. Is this possible? Otherwise I would have to query Solr directly?

Best regards,
Hemed

Hi @hemed,

I don’t think that we have something for your usecase. We usually suggest to work with the IIIF API and we implemented a iiif_simple mode that ignores all resources from files and is faster and simpler, but it still won’t output the information in the desired format.

BUT: You should look at the REST API in case I missed something:

We are open for pull requests, too :wink: