diff --git a/README.md b/README.md index fef2f2b..a529313 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@  -This is a WIP gem for creating, manipulating and reading RO-Crates (conforming to version 1.2 of the specification). RO-Crates produced by older versions (1.0, 1.1) of the spec can still be read. +This is a WIP gem for creating, manipulating and reading RO-Crates (conforming to version 1.3 of the specification). RO-Crates produced by older versions (1.0, 1.1, 1.2) of the spec can still be read. * RO-Crate - https://www.researchobject.org/ro-crate/ -* RO-Crate spec (1.2) - https://www.researchobject.org/ro-crate/specification/1.2/ +* RO-Crate spec (1.3) - https://www.researchobject.org/ro-crate/specification/1.3/ ## Installation diff --git a/lib/ro_crate/model/metadata.rb b/lib/ro_crate/model/metadata.rb index 4ef14d6..bae46d1 100644 --- a/lib/ro_crate/model/metadata.rb +++ b/lib/ro_crate/model/metadata.rb @@ -6,8 +6,8 @@ class Metadata < File IDENTIFIER_1_0 = 'ro-crate-metadata.jsonld'.freeze # 1.0 spec identifier RO_CRATE_BASE = 'https://w3id.org/ro/crate/' - SUPPORTED_VERSIONS = %w[1.0 1.0-DRAFT 1.1 1.1-DRAFT 1.2 1.2-DRAFT].freeze - DEFAULT_VERSION = '1.2'.freeze + SUPPORTED_VERSIONS = %w[1.0 1.0-DRAFT 1.1 1.1-DRAFT 1.2 1.2-DRAFT 1.3].freeze + DEFAULT_VERSION = '1.3'.freeze CONTEXT = "#{RO_CRATE_BASE}#{DEFAULT_VERSION}/context".freeze SPEC = "#{RO_CRATE_BASE}#{DEFAULT_VERSION}".freeze diff --git a/test/crate_test.rb b/test/crate_test.rb index 983a1cb..0c0686b 100644 --- a/test/crate_test.rb +++ b/test/crate_test.rb @@ -378,12 +378,12 @@ class CrateTest < Test::Unit::TestCase assert crate.get('#joehouse') end - test 'defaults to RO-Crate spec 1.2' do + test 'defaults to RO-Crate spec 1.3' do crate = ROCrate::Crate.new - assert_equal '1.2', crate.metadata.version - assert_equal 'https://w3id.org/ro/crate/1.2/context', crate.metadata.context - assert_equal 'https://w3id.org/ro/crate/1.2', crate.metadata.spec_url - assert_equal({ '@id' => 'https://w3id.org/ro/crate/1.2' }, crate.metadata.properties['conformsTo']) + assert_equal '1.3', crate.metadata.version + assert_equal 'https://w3id.org/ro/crate/1.3/context', crate.metadata.context + assert_equal 'https://w3id.org/ro/crate/1.3', crate.metadata.spec_url + assert_equal({ '@id' => 'https://w3id.org/ro/crate/1.3' }, crate.metadata.properties['conformsTo']) end test 'can write older spec version' do diff --git a/test/fixtures/crate-spec1.2/file with spaces.txt b/test/fixtures/crate-spec1.2/file with spaces.txt new file mode 100644 index 0000000..a64b0a1 --- /dev/null +++ b/test/fixtures/crate-spec1.2/file with spaces.txt @@ -0,0 +1 @@ +I have spaces in my name diff --git a/test/fixtures/crate-spec1.2/ro-crate-metadata.json b/test/fixtures/crate-spec1.2/ro-crate-metadata.json new file mode 100644 index 0000000..0de55b1 --- /dev/null +++ b/test/fixtures/crate-spec1.2/ro-crate-metadata.json @@ -0,0 +1,42 @@ +{ + "@context": "https://w3id.org/ro/crate/1.2/context", + "@graph": [ + { + "@id": "ro-crate-metadata.json", + "@type": "CreativeWork", + "about": { + "@id": "./" + }, + "conformsTo": { + "@id": "https://w3id.org/ro/crate/1.2" + } + }, + { + "@id": "ro-crate-preview.html", + "@type": "CreativeWork", + "about": { + "@id": "./" + } + }, + { + "@id": "./", + "@type": "Dataset", + "hasPart": [ + { + "@id": "http://example.com/external_ref.txt" + }, + { + "@id": "file%20with%20spaces.txt" + } + ] + }, + { + "@id": "http://example.com/external_ref.txt", + "@type": "File" + }, + { + "@id": "file%20with%20spaces.txt", + "@type": "File" + } + ] +} \ No newline at end of file diff --git a/test/fixtures/crate-spec1.2/ro-crate-preview.html b/test/fixtures/crate-spec1.2/ro-crate-preview.html new file mode 100644 index 0000000..74b881c --- /dev/null +++ b/test/fixtures/crate-spec1.2/ro-crate-preview.html @@ -0,0 +1,82 @@ + + + +
++ +
++ +
+