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

Fixed AIP api collections with nil descriptions #3121

Merged
merged 2 commits into from
Apr 26, 2023

Conversation

pgwillia
Copy link
Member

Context

After running the rake task to enqueue all the collections and communities we received many errors like: ArgumentError: Statement #<RDF::Statement:0x9808(<http://era.ualberta.localhost/aip/v1/collections/a93cbb63-4bb2-4deb-a952-c96c4c851c8c> <http://purl.org/dc/terms/description> nil .)> is incomplete

274 of our collections have no description.
Related to #3117

What's New

If there is no description than we can leave out the statement about description.

Also added a test that demonstrates that markdown will not be stripped or rendered by the AIP api.

lagoan
lagoan previously approved these changes Apr 20, 2023
Copy link
Contributor

@lagoan lagoan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines 16 to 32
statements = []
statements << RDF::Statement(subject: self_subject, predicate: RDF.type, object: RDF::Vocab::PCDM.Collection)
statements << RDF::Statement(subject: self_subject, predicate: RDF::Vocab::PCDM.memberOf,
object: @collection.community_id)
statements << RDF::Statement(subject: self_subject, predicate: RDF::Vocab::DC.title, object: @collection.title)
if @collection.description.present?
statements << RDF::Statement(subject: self_subject, predicate: RDF::Vocab::DC.description,
object: @collection.description)
end
statements << RDF::Statement(subject: self_subject, predicate: RDF::Vocab::DC.accessRights,
object: @collection.visibility)
statements << RDF::Statement(subject: self_subject, predicate: TERMS[:ual].restricted_collection,
object: @collection.restricted)
statements << RDF::Statement(subject: self_subject, predicate: RDF::Vocab::DC.created,
object: @collection.created_at)
statements << RDF::Statement(subject: self_subject, predicate: TERMS[:ual].record_created_in_jupiter,
object: @collection.record_created_at)
Copy link
Member Author

@pgwillia pgwillia Apr 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
statements = []
statements << RDF::Statement(subject: self_subject, predicate: RDF.type, object: RDF::Vocab::PCDM.Collection)
statements << RDF::Statement(subject: self_subject, predicate: RDF::Vocab::PCDM.memberOf,
object: @collection.community_id)
statements << RDF::Statement(subject: self_subject, predicate: RDF::Vocab::DC.title, object: @collection.title)
if @collection.description.present?
statements << RDF::Statement(subject: self_subject, predicate: RDF::Vocab::DC.description,
object: @collection.description)
end
statements << RDF::Statement(subject: self_subject, predicate: RDF::Vocab::DC.accessRights,
object: @collection.visibility)
statements << RDF::Statement(subject: self_subject, predicate: TERMS[:ual].restricted_collection,
object: @collection.restricted)
statements << RDF::Statement(subject: self_subject, predicate: RDF::Vocab::DC.created,
object: @collection.created_at)
statements << RDF::Statement(subject: self_subject, predicate: TERMS[:ual].record_created_in_jupiter,
object: @collection.record_created_at)
statements = [
RDF::Statement(subject: self_subject, predicate: RDF.type, object: RDF::Vocab::PCDM.Collection),
RDF::Statement(subject: self_subject, predicate: RDF::Vocab::PCDM.memberOf, object: @collection.community_id),
RDF::Statement(subject: self_subject, predicate: RDF::Vocab::DC.title, object: @collection.title),
RDF::Statement(subject: self_subject, predicate: RDF::Vocab::DC.description, object: @collection.description),
RDF::Statement(subject: self_subject, predicate: RDF::Vocab::DC.accessRights, object: @collection.visibility),
RDF::Statement(subject: self_subject, predicate: TERMS[:ual].restricted_collection,
object: @collection.restricted),
RDF::Statement(subject: self_subject, predicate: RDF::Vocab::DC.created, object: @collection.created_at),
RDF::Statement(subject: self_subject, predicate: TERMS[:ual].record_created_in_jupiter,
object: @collection.record_created_at)
]
if @collection.description.present?
statements << RDF::Statement(subject: self_subject, predicate: RDF::Vocab::DC.description,
object: @collection.description)
end

This could work.

After running the rake task to enqueue all the collections and communities we received many errors like:
`ArgumentError: Statement #<RDF::Statement:0x9808(<http://era.ualberta.localhost/aip/v1/collections/a93cbb63-4bb2-4deb-a952-c96c4c851c8c> <http://purl.org/dc/terms/description> nil .)> is incomplete`

274 of our collections have no description.

If there is no description than we can leave out the statement about description.

I checked for which attributes are required, and `description` is the only one here that might be nil https://github.com/ualbertalib/jupiter/blob/18351c928226b3d6883b1d78da24a820374b73d1/db/schema.rb#L91-L107
…rendered by the AIP api.

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.
@pgwillia pgwillia force-pushed the 3117_aip_api_nil_description branch from e4a68a4 to ee949ea Compare April 26, 2023 15:58
Copy link
Contributor

@lagoan lagoan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Buen trabajo!

@pgwillia pgwillia merged commit 0e41ae1 into master Apr 26, 2023
@pgwillia pgwillia deleted the 3117_aip_api_nil_description branch April 26, 2023 16:13
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