hbz / lobid-gnd

UI and API to the Integrated Authority File (Gemeinsame Normdatei, GND)
http://lobid.org/gnd
Eclipse Public License 2.0
24 stars 5 forks source link

Support `label_fieldName` auto-complete templates, e.g. `*_dateOfBirth` (RPB-169) #397

Closed fsteeg closed 3 weeks ago

fsteeg commented 4 weeks ago

E.g. preferredName,*_dateOfBirth in_placeOfBirth,†_dateOfDeath in_placeOfDeath

New sample at https://test.lobid.org/gnd/api#auto-complete

See https://jira.hbz-nrw.de/browse/RPB-169

acka47 commented 4 weeks ago

Looks already quite good. I noticed the following: While several occupation are already automatically concatenated by commas, this is not the case for placeOfActivity. See e.g. this query which contains this:

{
        "image": "https://commons.wikimedia.org/wiki/Special:FilePath/Friedrich%20Schiller%20by%20Ludovike%20Simanowiz.jpg?width=100",
        "label": "Schiller, Friedrich | Schriftsteller, Dramatiker, Erzähler, Historiker, Hochschullehrer, Librettist, Arzt, Hochschullehrer | * 1759 in Marbach am Neckar | † 1805 in Weimar | wirkte in MannheimWeimarJena",
        "id": "https://d-nb.info/gnd/118607626",
        "category": "Individualisierte Person"
  }
acka47 commented 4 weeks ago

I also noticed that the results of these queries are not pretty-printed when queried with curl, e.g.:

$ curl"https://test.lobid.org/gnd/search?q=Twain&format=json%3ApreferredName%2C*_dateOfBirth+in_placeOfBirth%2C%E2%80%A0_dateOfDeath+in_placeOfDeath"
[{"label":"Twain (Musikgruppe)","id":"https://d-nb.info/gnd/1229526226","category":"Musikalische Körperschaft"},{"image":"https://commons.wikimedia.org/wiki/Special:FilePath/Shania%20Twain%20March%202020.png?width=100","label":"Twain, Shania | * 1965 in Windsor (Ontario)","id":"https://d-nb.info/gnd/121570924","category":"Individualisierte Person"},{"label":"These Twain","id":"https://d-nb.info/gnd/1215051689","category":"Werk"},{"image":"https://commons.wikimedia.org/wiki/Special:FilePath/MarkTwain.LOC.jpg?width=100","label":"Twain, Mark | * 1835 in Florida, Mo. | † 1910 in Redding, Conn.","id":"https://d-nb.info/gnd/118624822","category":"Individualisierte Person"},{"label":"Bezirkszentralbibliothek Mark Twain. Schreibwerkstatt","id":"https://d-nb.info/gnd/1045623490","category":"Körperschaft"},{"label":"Mark-Twain-Schule","id":"https://d-nb.info/gnd/1150522305","category":"Körperschaft"},{"label":"Bezirkszentralbibliothek Mark Twain","id":"https://d-nb.info/gnd/1045623113","category":"Körperschaft"},{"label":"Twain, K. V. | * 1981 in Galatz","id":"https://d-nb.info/gnd/1179733045","category":"Individualisierte Person"},{"label":"International Mark Twain Society","id":"https://d-nb.info/gnd/75281-2","category":"Körperschaft"},{"label":"Autobiography of Mark Twain","id":"https://d-nb.info/gnd/1081942517","category":"Werk"}]

As we pretty-print – so far as I knwo – all other responses, this should also be pretty-printed for sake of consistency.

acka47 commented 4 weeks ago

While several occupation are already automatically concatenated by commas, this is not the case for placeOfActivity.

Looking at the implementation in https://github.com/hbz/strapi-rpb/pull/31/files#diff-464e263cd47a4e96e7232665ebc65ba8aeb2f4377fadcef146a855feca83028cR5-R6 it seems to work. So I hav edone something wrong or do not understand fully how this works:

https://test.lobid.org/gnd/search?q=Friedrich+Schiller+arzt&format=json%3ApreferredName,*_dateOfBirth+_placeOfBirth,%E2%80%A0_dateOfDeath+_placeOfDeath,placeOfActivity,professionOrOccupation

fsteeg commented 4 weeks ago

While several occupation are already automatically concatenated by commas, this is not the case for placeOfActivity [...] it seems to work. So I have done something wrong or do not understand fully how this works

No, good catch, it only worked for the old, plain-field syntax, not for the new templates. Fixed on test, see your query and an example in RPPD (I changed the delimiter from , to ; since , is often used in field values).

As we pretty-print – so far as I know – all other responses, this should also be pretty-printed for sake of consistency.

Fixed on test, see "View Page Source" on the examples above or curl "https://test.lobid.org/gnd/search?q=Twain&format=json:suggest"