From c35301b50c8099236049fd35c2dbcab40b115878 Mon Sep 17 00:00:00 2001 From: Ben Companjen Date: Tue, 20 Jun 2023 12:32:51 +0200 Subject: [PATCH 1/2] Improve JSON-LD conformation to BioSchemas profile - use `LearningResource` as type - expand `dct:conformsTo` to full URI - use (still hardcoded) `Active` as `creativeWorkStatus` --- inst/templates/metadata-template.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/inst/templates/metadata-template.txt b/inst/templates/metadata-template.txt index 7aeee2756..a3285712e 100644 --- a/inst/templates/metadata-template.txt +++ b/inst/templates/metadata-template.txt @@ -1,13 +1,13 @@ {{=<% %>=}} { "@context": "https://schema.org", - "@type": "TrainingMaterial", + "@type": "LearningResource", "@id": "<% url %>", - "dct:conformsTo": "https://bioschemas.org/profiles/TrainingMaterial/1.0-RELEASE", + "http://purl.org/dc/terms/conformsTo": "https://bioschemas.org/profiles/TrainingMaterial/1.0-RELEASE", "description": "<% desc %><% ^desc %>A Carpentries Lesson teaching foundational data and coding skills to researchers worldwide<% /desc %>", "keywords": "<% keywords %><% ^keywords %>software,data,lesson,The Carpentries<% /keywords %>", "name": "<% &pagetitle %>", - "creativeWorkStatus": "active", + "creativeWorkStatus": "Active", "url": "<% url %>", "identifier": "<% url %>", <% #date %>"dateCreated": "<% created %>", From 5ef3c3b6b78f379d5a051f6b08aa0dc282deb32b Mon Sep 17 00:00:00 2001 From: Ben Companjen Date: Tue, 20 Jun 2023 13:25:57 +0200 Subject: [PATCH 2/2] Adjust test and test fixture for updated JSON-LD --- tests/testthat/_snaps/utils-metadata.md | 2 +- tests/testthat/test-build_lesson.R | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/testthat/_snaps/utils-metadata.md b/tests/testthat/_snaps/utils-metadata.md index 19853540d..b17ad6e36 100644 --- a/tests/testthat/_snaps/utils-metadata.md +++ b/tests/testthat/_snaps/utils-metadata.md @@ -1,4 +1,4 @@ # metadata can be initialised with custom items added - "{\n \"@context\": \"https://schema.org\",\n \"@type\": \"TrainingMaterial\",\n \"@id\": \"https://zkamvar.github.io/lesson-example/vern.html\",\n \"dct:conformsTo\": \"https://bioschemas.org/profiles/TrainingMaterial/1.0-RELEASE\",\n \"description\": \"A Carpentries Lesson teaching foundational data and coding skills to researchers worldwide\",\n \"keywords\": \"software, data, lesson, The Carpentries\",\n \"name\": \"The Importance of Being Ernest Scared Stupid\",\n \"creativeWorkStatus\": \"active\",\n \"url\": \"https://zkamvar.github.io/lesson-example/vern.html\",\n \"identifier\": \"https://zkamvar.github.io/lesson-example/vern.html\",\n \"dateCreated\": \"2022-02-01\",\n \"dateModified\": \"2022-02-08\",\n \"datePublished\": \"2022-02-09\"\n}\n" + "{\n \"@context\": \"https://schema.org\",\n \"@type\": \"LearningResource\",\n \"@id\": \"https://zkamvar.github.io/lesson-example/vern.html\",\n \"http://purl.org/dc/terms/conformsTo\": \"https://bioschemas.org/profiles/TrainingMaterial/1.0-RELEASE\",\n \"description\": \"A Carpentries Lesson teaching foundational data and coding skills to researchers worldwide\",\n \"keywords\": \"software, data, lesson, The Carpentries\",\n \"name\": \"The Importance of Being Ernest Scared Stupid\",\n \"creativeWorkStatus\": \"Active\",\n \"url\": \"https://zkamvar.github.io/lesson-example/vern.html\",\n \"identifier\": \"https://zkamvar.github.io/lesson-example/vern.html\",\n \"dateCreated\": \"2022-02-01\",\n \"dateModified\": \"2022-02-08\",\n \"datePublished\": \"2022-02-09\"\n}\n" diff --git a/tests/testthat/test-build_lesson.R b/tests/testthat/test-build_lesson.R index 248b3a4a8..039ebab09 100644 --- a/tests/testthat/test-build_lesson.R +++ b/tests/testthat/test-build_lesson.R @@ -174,7 +174,7 @@ test_that("sitemap exists", { test_that("Metadata is recorded as the correct type", { - expect_match(metadata_json, "\"@type\": \"TrainingMaterial\"", fixed = TRUE) + expect_match(metadata_json, "\"@type\": \"LearningResource\"", fixed = TRUE) }) test_that("Lesson websites contains metadata", {