Skip to content

Commit

Permalink
Merge pull request #3179 from OregonDigital/bugfix/wikidataURILabels
Browse files Browse the repository at this point in the history
Fix wikidata URI json id for subject and publisher fields
  • Loading branch information
lamtu1 authored Oct 18, 2024
2 parents 73aa6fa + 22e592f commit 4d552d2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/authorities/qa/authorities/publisher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 10 additions & 0 deletions app/authorities/qa/authorities/subject.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 4d552d2

Please sign in to comment.