Collection AIP api does not expect nil description, but we have many like this.
pgwillia opened this issue · 5 comments
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
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'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's a separate line in the <em>same paragraph</em>.</p>
<p><a href="https://www.google.com" title="Google's Homepage" rel="noopener noreferrer" target="_blank">I'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
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!
@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).
Deployed into production!