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

Collection AIP api does not expect nil description, but we have many like this. #3117

Closed
pgwillia opened this issue Apr 13, 2023 · 5 comments

Comments

@pgwillia
Copy link
Member

View details in Rollbar: https://rollbar.com/ualbertalib/jupiter/items/1678/


ArgumentError: Statement #<RDF::Statement:0xd2c44(<https://era.library.ualberta.ca/aip/v1/collections/fcc9187b-2c44-4694-ba79-ac4348b3c6f2> <http://purl.org/dc/terms/description> nil .)> is incomplete
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/rdf-3.2.9/lib/rdf/repository.rb", line 513, in insert_to
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/rdf-3.2.9/lib/rdf/repository.rb", line 462, in insert_statement
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/rdf-3.2.9/lib/rdf/mixin/writable.rb", line 133, in block in insert_statements
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/rdf-3.2.9/lib/rdf/model/graph.rb", line 325, in <<
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/rdf-3.2.9/lib/rdf/model/graph.rb", line 325, in block (2 levels) in insert_statements
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/rdf-3.2.9/lib/rdf/model/graph.rb", line 322, in each
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/rdf-3.2.9/lib/rdf/model/graph.rb", line 322, in block in insert_statements
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/rdf-3.2.9/lib/rdf/mixin/enumerable.rb", line 183, in each
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/rdf-3.2.9/lib/rdf/mixin/enumerable.rb", line 183, in each
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/rdf-3.2.9/lib/rdf/mixin/enumerable.rb", line 183, in each_statement
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/rdf-3.2.9/lib/rdf/mixin/writable.rb", line 129, in insert_statements
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/rdf-3.2.9/lib/rdf/mixin/writable.rb", line 64, in block in insert
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/rdf-3.2.9/lib/rdf/util/coercions.rb", line 38, in block in coerce_statements
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/rdf-3.2.9/lib/rdf/util/coercions.rb", line 35, in map
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/rdf-3.2.9/lib/rdf/util/coercions.rb", line 35, in coerce_statements
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/rdf-3.2.9/lib/rdf/mixin/writable.rb", line 64, in insert
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/rdf-3.2.9/lib/rdf/mixin/mutable.rb", line 96, in insert
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/rdf-3.2.9/lib/rdf/model/graph.rb", line 328, in insert_statements
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/rdf-3.2.9/lib/rdf/mixin/writable.rb", line 64, in block in insert
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/rdf-3.2.9/lib/rdf/util/coercions.rb", line 52, in coerce_statements
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/rdf-3.2.9/lib/rdf/mixin/writable.rb", line 64, in insert
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/rdf-3.2.9/lib/rdf/mixin/mutable.rb", line 96, in insert
  File "/var/www/sites/jupiter/app/controllers/aip/v1/collections_controller.rb", line 29, in show
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/actionpack-6.1.7/lib/action_controller/metal/basic_implicit_render.rb", line 6, in send_action
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/actionpack-6.1.7/lib/abstract_controller/base.rb", line 228, in process_action
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/actionpack-6.1.7/lib/action_controller/metal/rendering.rb", line 30, in process_action
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/actionpack-6.1.7/lib/abstract_controller/callbacks.rb", line 42, in block in process_action
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/activesupport-6.1.7/lib/active_support/callbacks.rb", line 117, in block in run_callbacks
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/actiontext-6.1.7/lib/action_text/rendering.rb", line 20, in with_renderer
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/actiontext-6.1.7/lib/action_text/engine.rb", line 59, in block (4 levels) in <class:Engine>
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/activesupport-6.1.7/lib/active_support/callbacks.rb", line 126, in instance_exec
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/activesupport-6.1.7/lib/active_support/callbacks.rb", line 126, in block in run_callbacks
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/activesupport-6.1.7/lib/active_support/callbacks.rb", line 137, in run_callbacks
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/actionpack-6.1.7/lib/abstract_controller/callbacks.rb", line 41, in process_action
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/actionpack-6.1.7/lib/action_controller/metal/rescue.rb", line 22, in process_action
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/actionpack-6.1.7/lib/action_controller/metal/instrumentation.rb", line 34, in block in process_action
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/activesupport-6.1.7/lib/active_support/notifications.rb", line 203, in block in instrument
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/activesupport-6.1.7/lib/active_support/notifications/instrumenter.rb", line 24, in instrument
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/activesupport-6.1.7/lib/active_support/notifications.rb", line 203, in instrument
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/actionpack-6.1.7/lib/action_controller/metal/instrumentation.rb", line 33, in process_action
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/actionpack-6.1.7/lib/action_controller/metal/params_wrapper.rb", line 249, in process_action
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/activerecord-6.1.7/lib/active_record/railties/controller_runtime.rb", line 27, in process_action
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/actionpack-6.1.7/lib/abstract_controller/base.rb", line 165, in process
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/actionview-6.1.7/lib/action_view/rendering.rb", line 39, in process
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/actionpack-6.1.7/lib/action_controller/metal.rb", line 190, in dispatch
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/actionpack-6.1.7/lib/action_controller/metal.rb", line 254, in dispatch
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/actionpack-6.1.7/lib/action_dispatch/routing/route_set.rb", line 50, in dispatch
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/actionpack-6.1.7/lib/action_dispatch/routing/route_set.rb", line 33, in serve
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/actionpack-6.1.7/lib/action_dispatch/journey/router.rb", line 50, in block in serve
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/actionpack-6.1.7/lib/action_dispatch/journey/router.rb", line 32, in each
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/actionpack-6.1.7/lib/action_dispatch/journey/router.rb", line 32, in serve
  File "/var/www/sites/jupiter/vendor/ruby/2.7.0/gems/actionpack-6.1.7/lib/action_dispatch/routing
@pgwillia pgwillia changed the title ArgumentError: Statement #<RDF::Statement:0x39814(<https://era.library.ualberta.ca/aip/v1/collections/006de635-b20b-4344-9abe-c6947609f1a3> <http://purl.org/dc/terms/description> nil .)> is incomplete Collection AIP api does not expect nil description, but we have many like this. Apr 13, 2023
@pgwillia
Copy link
Member Author

pgwillia commented Apr 19, 2023

ArgumentError: Statement #<RDF::Statement:0x75e04(http://era.ualberta.localhost/aip/v1/collections/a93cbb63-4bb2-4deb-a952-c96c4c851c8c http://purl.org/dc/terms/description nil .)> is incomplete

@ualbertalib/metadata-team, if a collection doesn't have a description, can I leave it out of the AIP?

@prefix dc: <http://purl.org/dc/terms/> .
@prefix pcdm: <http://pcdm.org/models#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://era.ualberta.localhost/aip/v1/collections/a93cbb63-4bb2-4deb-a952-c96c4c851c8c> a pcdm:Collection;
    dc:title "AIP Collection";
    pcdm:memberOf "b644bf7f-d950-56bb-ba68-c4271a175491";
    dc:accessRights "http://terms.library.ualberta.ca/public";
    dc:created "2015-12-12T00:00:00Z"^^xsd:dateTime;
    <http://terms.library.ualberta.ca/recordCreatedInJupiter> "2015-12-12T00:00:00Z"^^xsd:dateTime;
    <http://terms.library.ualberta.ca/restrictedCollection> false .

Another related question. If a collection description contains markdown, should the AIP contain the markdown, how it would render as HTML, or should that markdown be stripped so that the AIP description is just plain text?

MARKDOWN = <<~MARKDOWN.freeze
  **Itaque _est_** ~~incidunt~~. Magnam *repellendus* id. Eos qui **voluptatem**.

  Here's a line for us to start with.

  This line is separated from the one above by two newlines, so it will be a *separate paragraph*.

  This line is also a separate paragraph, but...
  This line is only separated by a single newline, so it's a separate line in the *same paragraph*.

  [I'm an inline-style link with title](https://www.google.com "Google's Homepage")

  URLs and URLs in angle brackets will automatically get turned into links.
  http://www.example.com or <http://www.example.com> and sometimes
  example.com (but not on Github, for example).
MARKDOWN
  RENDERED_HTML = <<~RENDERED.freeze
    <p><strong>Itaque <em>est</em></strong> <del>incidunt</del>. Magnam <em>repellendus</em> id. Eos qui <strong>voluptatem</strong>.</p>

    <p>Here&#39;s a line for us to start with.</p>

    <p>This line is separated from the one above by two newlines, so it will be a <em>separate paragraph</em>.</p>

    <p>This line is also a separate paragraph, but...<br>
    This line is only separated by a single newline, so it&#39;s a separate line in the <em>same paragraph</em>.</p>

    <p><a href="https://www.google.com" title="Google&#39;s Homepage" rel="noopener noreferrer" target="_blank">I&#39;m an inline-style link with title</a></p>

    <p>URLs and URLs in angle brackets will automatically get turned into links.<br>
    <a href="http://www.example.com" rel="noopener noreferrer" target="_blank">http://www.example.com</a> or <a href="http://www.example.com" rel="noopener noreferrer" target="_blank">http://www.example.com</a> and sometimes<br>
    example.com (but not on Github, for example).</p>
  RENDERED
  STRIPPED_MARKDOWN = <<~STRIPPED.freeze
    Itaque est incidunt. Magnam repellendus id. Eos qui voluptatem.
    Here's a line for us to start with.
    This line is separated from the one above by two newlines, so it will be a separate paragraph.
    This line is also a separate paragraph, but...
    This line is only separated by a single newline, so it's a separate line in the same paragraph.
    I'm an inline-style link with title (https://www.google.com)
    URLs and URLs in angle brackets will automatically get turned into links.
    http://www.example.com or http://www.example.com and sometimes
    example.com (but not on Github, for example).
  STRIPPED

@sfarnel
Copy link
Member

sfarnel commented Apr 20, 2023

Thanks @pgwillia If there is no description then it can be left out. In terms of the markdown, what we really want here is the content as opposed to the display per se. That said, if there is a link to something external it would be ideal to be able to keep the url even if it doesn't display as a hyperlink. Hope that helps!

@pgwillia
Copy link
Member Author

@sfarnel Thanks for the quick response!

I'm hearing that we want the content, including the links. The best solution that matches this is the first example with what the user creates as the description for the collection, not what the user sees on the collection page. If it's okay I'll go with this.

 **Itaque _est_** ~~incidunt~~. Magnam *repellendus* id. Eos qui **voluptatem**.

  Here's a line for us to start with.

  This line is separated from the one above by two newlines, so it will be a *separate paragraph*.

  This line is also a separate paragraph, but...
  This line is only separated by a single newline, so it's a separate line in the *same paragraph*.

  [I'm an inline-style link with title](https://www.google.com "Google's Homepage")

  URLs and URLs in angle brackets will automatically get turned into links.
  http://www.example.com or <http://www.example.com> and sometimes
  example.com (but not on Github, for example).

@sfarnel
Copy link
Member

sfarnel commented Apr 21, 2023

Thanks @pgwillia This looks good to me

@pgwillia
Copy link
Member Author

pgwillia commented May 1, 2023

Deployed into production!

@pgwillia pgwillia closed this as completed May 1, 2023
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

No branches or pull requests

2 participants