Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LIBHYDRA-562. Added "presentation_set" field to content models #395

Merged
merged 11 commits into from
Apr 4, 2024

Conversation

dsteelma-umd
Copy link
Contributor

Added an optional, repeatable "presentation_set" field to each of
the following content models:

  • Item
  • Letter
  • Poster
  • Issue

https://umd-dit.atlassian.net/browse/LIBHYDRA-562

Based on a discussion on April 3, 2024, in the "archelon" WebEx channel,
Peter Eichman indicated that the "access" field for all content models
should have a "terms" entry matching that of the "Item" model, i.e.:

```
      terms: ['Public', 'Campus']

```

https://umd-dit.atlassian.net/browse/LIBHYDRA-564
Added the "webmock" gem (as recommended by the "http" gem documentation)
to the "test" dependencies, to support mocking the HTTP requests to the
vocabulary server in tests.

https://umd-dit.atlassian.net/browse/LIBHYDRA-564
Replaced custom mocks that intercept HTTP requests in existing tests
with the "webmock" equivalent.

In "retrieve_controller_test.rb", some tests no longer needed to be
mocked because the code return before actually reaching the network
call.

https://umd-dit.atlassian.net/browse/LIBHYDRA-564
Moved the "app/services/plastron_services/http/send_json_request.rb"
file to "app/services/send_json_request.rb" as it is a generic class
that is not specific to Plastron, and is useful for other services.

Updated "Plastron::HTTP::SendActivityStreamMessage" class to reflect
the change.

https://umd-dit.atlassian.net/browse/LIBHYDRA-564
Added a "follow_redirects" constructor argument, which defaults to
"false". When set to "true", the request will follow redirects, which
is necessary when communicating with the vocabulary server, as the
vocabulary URIs typically use an "http" scheme.

https://umd-dit.atlassian.net/browse/LIBHYDRA-564
Added the "VocabService" class which contains a "vocab_options_hash"
method to query a vocabulary server for a list of terms, and returns
an "options" hash for terms indexed by their Local URI suitable for
display in a ControlledURI drop-down list.

https://umd-dit.atlassian.net/browse/LIBHYDRA-564
When a vocabulary only has one term, there is no "@graph" element in
the JSON returned from the vocabulary server. Once a second term is
added, the "@graph" element is added, and populated with the
terms.

For example, a "collection" vocabulary with only one term looks like:

```
{
  "@context": {
    "owl": "http://www.w3.org/2002/07/owl#",
    "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
    "dc": "http://purl.org/dc/elements/1.1/"
  },
  "@id": "http://vocab.lib.umd.edu/collection#0001-GDOC",
  "dc:identifier": "0001-GDOC",
  "rdfs:label": "United States Government Posters"
}
```

while a "collection" vocabulary with two terms looks like:

```
{
  "@context": {
    "owl": "http://www.w3.org/2002/07/owl#",
    "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
    "dc": "http://purl.org/dc/elements/1.1/"
  },
  "@graph": [
    {
      "@id": "http://vocab.lib.umd.edu/collection#0211-UA",
      "rdfs:label": "Diamondback Photos",
      "dc:identifier": "0211-UA",
      "owl:sameAs": {
        "@id": "http://vocab.lib.umd.edu/collection#0211-UA"
      }
    },
    {
      "@id": "http://vocab.lib.umd.edu/collection#0001-GDOC",
      "rdfs:label": "United States Government Posters",
      "dc:identifier": "0001-GDOC"
    }
  ]
}
```

While we don't expect to have "one term" vocabularies very often, they
may occur when a new vocabulary is being rolled out, so it was decided
to handle that case.

These changes modify the "parse_options" method in
"app/services/vocab_service.rb" to handle both "one term" and multi-term
vocabularies.

Added a test to verify the "one term" vocabulary.

https://umd-dit.atlassian.net/browse/LIBHYDRA-564
Added an optional, repeatable "presentation_set" field to each of
the following content models:

* Item
* Letter
* Poster
* Issue

https://umd-dit.atlassian.net/browse/LIBHYDRA-562
@peichman-umd peichman-umd merged commit 59a5e06 into umd-lib:develop Apr 4, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants