diff --git a/app/authorities/qa/authorities/publisher.rb b/app/authorities/qa/authorities/publisher.rb index b7d13b0fb..5972b4377 100644 --- a/app/authorities/qa/authorities/publisher.rb +++ b/app/authorities/qa/authorities/publisher.rb @@ -8,5 +8,15 @@ class Publisher < BaseAuthority def controlled_vocabulary OregonDigital::ControlledVocabularies::Publisher end + + # WikiData doesn't support a native .jsonld implementation, so we shim in the id here + # And parse the label as regular JSON + def json(url) + json = super + return json unless controlled_vocabulary.query_to_vocabulary(url) == OregonDigital::ControlledVocabularies::Vocabularies::Wikidata + + json['@id'] = url + json + end end end diff --git a/app/authorities/qa/authorities/subject.rb b/app/authorities/qa/authorities/subject.rb index 5c990445d..a8895ff09 100644 --- a/app/authorities/qa/authorities/subject.rb +++ b/app/authorities/qa/authorities/subject.rb @@ -18,5 +18,15 @@ def parse_authority_response(term, vocabulary) def find_term(response, q) { q: q, response: super } end + + # WikiData doesn't support a native .jsonld implementation, so we shim in the id here + # And parse the label as regular JSON + def json(url) + json = super + return json unless controlled_vocabulary.query_to_vocabulary(url) == OregonDigital::ControlledVocabularies::Vocabularies::Wikidata + + json['@id'] = url + json + end end end