From edcd253a99b55e325a68f51c11aba4784256c8c4 Mon Sep 17 00:00:00 2001 From: Romain Deltour Date: Thu, 25 Feb 2021 23:58:24 +0100 Subject: [PATCH] feat: check required cardinality of meta properties The cardinality of refining properties defined with the `meta` element is defined in Appendix C "Meta Properties Vocabulary": https://www.w3.org/publishing/epub32/epub-packages.html#app-meta-property-vocab Summary: - add schematron rules to check that properties defined as "zero or one" are not defined more than once - add test for all properties - rename some existing tests for consistency Fixes #1121 --- .../adobe/epubcheck/schema/30/package-30.sch | 141 +++++++++++++---- ...data-meta-authority-cardinality-error.opf} | 0 ...metadata-meta-authority-no-term-error.opf} | 0 ...eta-authority-refines-disallowed-error.opf | 17 ++ ....opf => metadata-meta-authority-valid.opf} | 0 ...meta-collection-type-cardinality-error.opf | 22 +++ ...ata-meta-display-seq-cardinality-error.opf | 19 +++ ...etadata-meta-file-as-cardinality-error.opf | 19 +++ .../metadata-meta-file-as-valid.opf | 18 +++ ...-meta-group-position-cardinality-error.opf | 19 +++ .../metadata-meta-group-position-valid.opf | 18 +++ ...meta-identifier-type-cardinality-error.opf | 18 +++ ...entifier-type-refines-disallowed-error.opf | 17 ++ ...entifier-type-refines-identifier-valid.opf | 17 ++ ...a-identifier-type-refines-source-valid.opf | 18 +++ .../metadata-meta-role-cardinality-error.opf | 21 +++ .../metadata-meta-scheme-list-error.opf | 2 +- .../metadata-meta-scheme-unknown-error.opf | 2 +- .../metadata-meta-scheme-valid.opf | 2 +- ...adata-meta-source-of-cardinality-error.opf | 19 +++ ... metadata-meta-term-cardinality-error.opf} | 0 ...metadata-meta-term-no-authority-error.opf} | 0 ...ata-meta-term-refines-disallowed-error.opf | 17 ++ .../metadata-meta-term-valid.opf | 19 +++ ...data-meta-title-type-cardinality-error.opf | 18 +++ ...ta-title-type-refines-disallowed-error.opf | 17 ++ .../metadata-meta-title-type-valid.opf | 17 ++ .../resources/epub3/package-document.feature | 148 ++++++++++++++---- 28 files changed, 560 insertions(+), 65 deletions(-) rename src/test/resources/epub3/files/package-document/{metadata-subject-authority-multiple-error.opf => metadata-meta-authority-cardinality-error.opf} (100%) rename src/test/resources/epub3/files/package-document/{metadata-subject-authority-no-term-error.opf => metadata-meta-authority-no-term-error.opf} (100%) create mode 100644 src/test/resources/epub3/files/package-document/metadata-meta-authority-refines-disallowed-error.opf rename src/test/resources/epub3/files/package-document/{metadata-subject-authority-valid.opf => metadata-meta-authority-valid.opf} (100%) create mode 100644 src/test/resources/epub3/files/package-document/metadata-meta-collection-type-cardinality-error.opf create mode 100644 src/test/resources/epub3/files/package-document/metadata-meta-display-seq-cardinality-error.opf create mode 100644 src/test/resources/epub3/files/package-document/metadata-meta-file-as-cardinality-error.opf create mode 100644 src/test/resources/epub3/files/package-document/metadata-meta-file-as-valid.opf create mode 100644 src/test/resources/epub3/files/package-document/metadata-meta-group-position-cardinality-error.opf create mode 100644 src/test/resources/epub3/files/package-document/metadata-meta-group-position-valid.opf create mode 100644 src/test/resources/epub3/files/package-document/metadata-meta-identifier-type-cardinality-error.opf create mode 100644 src/test/resources/epub3/files/package-document/metadata-meta-identifier-type-refines-disallowed-error.opf create mode 100644 src/test/resources/epub3/files/package-document/metadata-meta-identifier-type-refines-identifier-valid.opf create mode 100644 src/test/resources/epub3/files/package-document/metadata-meta-identifier-type-refines-source-valid.opf create mode 100644 src/test/resources/epub3/files/package-document/metadata-meta-role-cardinality-error.opf create mode 100644 src/test/resources/epub3/files/package-document/metadata-meta-source-of-cardinality-error.opf rename src/test/resources/epub3/files/package-document/{metadata-subject-term-multiple-error.opf => metadata-meta-term-cardinality-error.opf} (100%) rename src/test/resources/epub3/files/package-document/{metadata-subject-term-no-authority-error.opf => metadata-meta-term-no-authority-error.opf} (100%) create mode 100644 src/test/resources/epub3/files/package-document/metadata-meta-term-refines-disallowed-error.opf create mode 100644 src/test/resources/epub3/files/package-document/metadata-meta-term-valid.opf create mode 100644 src/test/resources/epub3/files/package-document/metadata-meta-title-type-cardinality-error.opf create mode 100644 src/test/resources/epub3/files/package-document/metadata-meta-title-type-refines-disallowed-error.opf create mode 100644 src/test/resources/epub3/files/package-document/metadata-meta-title-type-valid.opf diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/package-30.sch b/src/main/resources/com/adobe/epubcheck/schema/30/package-30.sch index 02a5d1859..2383716a4 100644 --- a/src/main/resources/com/adobe/epubcheck/schema/30/package-30.sch +++ b/src/main/resources/com/adobe/epubcheck/schema/30/package-30.sch @@ -3,6 +3,8 @@ + + @@ -27,25 +29,9 @@ >dcterms:modified illegal syntax (expecting: "CCYY-MM-DDThh:mm:ssZ") - - - - - @refines missing target id: "" - - - - - - The "source-of" property must have the - value "pagination" - The "source-of" property must refine a "dc:source" element. - - - + + + The type of "record" references must be identifiable @@ -61,6 +47,35 @@ "voicing" links must have a "refines" attribute. + + + + + + + @refines missing target id: "" + + + + + + + + + A term property must be associated with a dc:subject when an authority is specified + An authority property must be associated with a dc:subject when a term is specified + Only one pair of authority and term properties can be associated with a dc:subject + + + + + + Property "authority" must refine a "subject" property. + + + @@ -70,15 +85,86 @@ properties. - + Property "collection-type" must refine a "belongs-to-collection" property. + Property "collection-type" cannot be declared more than once to refine the same "belongs-to-collection" expression. - + + + + Property "display-seq" cannot be declared more than once to refine the same expression. + + + + + + Property "file-as" cannot be declared more than once to refine the same expression. + + + + + + Property "group-position" cannot be declared more than once to refine the same expression. + + + + + + Property "identifier-type" must refine an "identifier" or "source" property. + Property "identifier-type" cannot be declared more than once to refine the same expression. + + + + + + Property "role" must refine a "creator" or "contributor" property. + Property "role" cannot be declared more than once to refine a single "creator" or "contributor" property. + + + + + + The "source-of" property must have the + value "pagination" + The "source-of" property must refine a "source" property. + Property "source-of" cannot be declared more than once to refine the same "source" expression. + + + + + + Property "term" must refine a "subject" property. + + + + + + + Property "title-type" must refine a "title" property. + Property "title-type" cannot be declared more than once to refine the same "title" expression. + + + + @@ -162,6 +248,8 @@ (number of "cover-image" items: ). + + @@ -337,17 +425,6 @@ - - - - - - A term property must be associated with a dc:subject when an authority is specified - An authority property must be associated with a dc:subject when a term is specified - Only one pair of authority and term properties can be associated with a dc:subject - - - diff --git a/src/test/resources/epub3/files/package-document/metadata-subject-authority-multiple-error.opf b/src/test/resources/epub3/files/package-document/metadata-meta-authority-cardinality-error.opf similarity index 100% rename from src/test/resources/epub3/files/package-document/metadata-subject-authority-multiple-error.opf rename to src/test/resources/epub3/files/package-document/metadata-meta-authority-cardinality-error.opf diff --git a/src/test/resources/epub3/files/package-document/metadata-subject-authority-no-term-error.opf b/src/test/resources/epub3/files/package-document/metadata-meta-authority-no-term-error.opf similarity index 100% rename from src/test/resources/epub3/files/package-document/metadata-subject-authority-no-term-error.opf rename to src/test/resources/epub3/files/package-document/metadata-meta-authority-no-term-error.opf diff --git a/src/test/resources/epub3/files/package-document/metadata-meta-authority-refines-disallowed-error.opf b/src/test/resources/epub3/files/package-document/metadata-meta-authority-refines-disallowed-error.opf new file mode 100644 index 000000000..f8af3d8ad --- /dev/null +++ b/src/test/resources/epub3/files/package-document/metadata-meta-authority-refines-disallowed-error.opf @@ -0,0 +1,17 @@ + + + + Title + en + NOID + 2019-01-01T12:00:00Z + something + + + + + + + + diff --git a/src/test/resources/epub3/files/package-document/metadata-subject-authority-valid.opf b/src/test/resources/epub3/files/package-document/metadata-meta-authority-valid.opf similarity index 100% rename from src/test/resources/epub3/files/package-document/metadata-subject-authority-valid.opf rename to src/test/resources/epub3/files/package-document/metadata-meta-authority-valid.opf diff --git a/src/test/resources/epub3/files/package-document/metadata-meta-collection-type-cardinality-error.opf b/src/test/resources/epub3/files/package-document/metadata-meta-collection-type-cardinality-error.opf new file mode 100644 index 000000000..55821458f --- /dev/null +++ b/src/test/resources/epub3/files/package-document/metadata-meta-collection-type-cardinality-error.opf @@ -0,0 +1,22 @@ + + + + Title + en + NOID + 2019-01-01T12:00:00Z + + A Collection + A Super Collection + set + set + set + + + + + + + + diff --git a/src/test/resources/epub3/files/package-document/metadata-meta-display-seq-cardinality-error.opf b/src/test/resources/epub3/files/package-document/metadata-meta-display-seq-cardinality-error.opf new file mode 100644 index 000000000..00bdc504b --- /dev/null +++ b/src/test/resources/epub3/files/package-document/metadata-meta-display-seq-cardinality-error.opf @@ -0,0 +1,19 @@ + + + + Title + en + NOID + 2019-01-01T12:00:00Z + Me + 1 + 2 + + + + + + + + diff --git a/src/test/resources/epub3/files/package-document/metadata-meta-file-as-cardinality-error.opf b/src/test/resources/epub3/files/package-document/metadata-meta-file-as-cardinality-error.opf new file mode 100644 index 000000000..8f250d4f4 --- /dev/null +++ b/src/test/resources/epub3/files/package-document/metadata-meta-file-as-cardinality-error.opf @@ -0,0 +1,19 @@ + + + + Title + en + NOID + 2019-01-01T12:00:00Z + Me + Me + Also Me + + + + + + + + diff --git a/src/test/resources/epub3/files/package-document/metadata-meta-file-as-valid.opf b/src/test/resources/epub3/files/package-document/metadata-meta-file-as-valid.opf new file mode 100644 index 000000000..49044bd72 --- /dev/null +++ b/src/test/resources/epub3/files/package-document/metadata-meta-file-as-valid.opf @@ -0,0 +1,18 @@ + + + + Title + en + NOID + 2019-01-01T12:00:00Z + Me + Me + + + + + + + + diff --git a/src/test/resources/epub3/files/package-document/metadata-meta-group-position-cardinality-error.opf b/src/test/resources/epub3/files/package-document/metadata-meta-group-position-cardinality-error.opf new file mode 100644 index 000000000..f7b89069c --- /dev/null +++ b/src/test/resources/epub3/files/package-document/metadata-meta-group-position-cardinality-error.opf @@ -0,0 +1,19 @@ + + + + Title + en + NOID + 2019-01-01T12:00:00Z + collection + 1 + 2 + + + + + + + + diff --git a/src/test/resources/epub3/files/package-document/metadata-meta-group-position-valid.opf b/src/test/resources/epub3/files/package-document/metadata-meta-group-position-valid.opf new file mode 100644 index 000000000..9dfc26921 --- /dev/null +++ b/src/test/resources/epub3/files/package-document/metadata-meta-group-position-valid.opf @@ -0,0 +1,18 @@ + + + + Title + en + NOID + 2019-01-01T12:00:00Z + collection + 1 + + + + + + + + diff --git a/src/test/resources/epub3/files/package-document/metadata-meta-identifier-type-cardinality-error.opf b/src/test/resources/epub3/files/package-document/metadata-meta-identifier-type-cardinality-error.opf new file mode 100644 index 000000000..78ead1e2b --- /dev/null +++ b/src/test/resources/epub3/files/package-document/metadata-meta-identifier-type-cardinality-error.opf @@ -0,0 +1,18 @@ + + + + Title + en + NOID + 2019-01-01T12:00:00Z + 06 + 15 + + + + + + + + diff --git a/src/test/resources/epub3/files/package-document/metadata-meta-identifier-type-refines-disallowed-error.opf b/src/test/resources/epub3/files/package-document/metadata-meta-identifier-type-refines-disallowed-error.opf new file mode 100644 index 000000000..9555ab721 --- /dev/null +++ b/src/test/resources/epub3/files/package-document/metadata-meta-identifier-type-refines-disallowed-error.opf @@ -0,0 +1,17 @@ + + + + Title + en + NOID + 2019-01-01T12:00:00Z + 06 + + + + + + + + diff --git a/src/test/resources/epub3/files/package-document/metadata-meta-identifier-type-refines-identifier-valid.opf b/src/test/resources/epub3/files/package-document/metadata-meta-identifier-type-refines-identifier-valid.opf new file mode 100644 index 000000000..fe916f1d7 --- /dev/null +++ b/src/test/resources/epub3/files/package-document/metadata-meta-identifier-type-refines-identifier-valid.opf @@ -0,0 +1,17 @@ + + + + Title + en + NOID + 2019-01-01T12:00:00Z + 06 + + + + + + + + diff --git a/src/test/resources/epub3/files/package-document/metadata-meta-identifier-type-refines-source-valid.opf b/src/test/resources/epub3/files/package-document/metadata-meta-identifier-type-refines-source-valid.opf new file mode 100644 index 000000000..e2f4e209d --- /dev/null +++ b/src/test/resources/epub3/files/package-document/metadata-meta-identifier-type-refines-source-valid.opf @@ -0,0 +1,18 @@ + + + + Title + en + NOID + 2019-01-01T12:00:00Z + urn:isbn:0000000000000 + 06 + + + + + + + + diff --git a/src/test/resources/epub3/files/package-document/metadata-meta-role-cardinality-error.opf b/src/test/resources/epub3/files/package-document/metadata-meta-role-cardinality-error.opf new file mode 100644 index 000000000..cd542d640 --- /dev/null +++ b/src/test/resources/epub3/files/package-document/metadata-meta-role-cardinality-error.opf @@ -0,0 +1,21 @@ + + + + Title + en + NOID + 2019-01-01T12:00:00Z + Jane Doe + John Doe + aut + edt + aut + + + + + + + + diff --git a/src/test/resources/epub3/files/package-document/metadata-meta-scheme-list-error.opf b/src/test/resources/epub3/files/package-document/metadata-meta-scheme-list-error.opf index 840f67e0c..eec93b5ea 100644 --- a/src/test/resources/epub3/files/package-document/metadata-meta-scheme-list-error.opf +++ b/src/test/resources/epub3/files/package-document/metadata-meta-scheme-list-error.opf @@ -6,7 +6,7 @@ Title en 2019-01-01T12:00:00Z - 06 + 06 diff --git a/src/test/resources/epub3/files/package-document/metadata-meta-scheme-unknown-error.opf b/src/test/resources/epub3/files/package-document/metadata-meta-scheme-unknown-error.opf index 5ed713500..e3fad95d7 100644 --- a/src/test/resources/epub3/files/package-document/metadata-meta-scheme-unknown-error.opf +++ b/src/test/resources/epub3/files/package-document/metadata-meta-scheme-unknown-error.opf @@ -6,7 +6,7 @@ Title en 2019-01-01T12:00:00Z - 06 + 06 diff --git a/src/test/resources/epub3/files/package-document/metadata-meta-scheme-valid.opf b/src/test/resources/epub3/files/package-document/metadata-meta-scheme-valid.opf index 86f84b0a7..fe916f1d7 100644 --- a/src/test/resources/epub3/files/package-document/metadata-meta-scheme-valid.opf +++ b/src/test/resources/epub3/files/package-document/metadata-meta-scheme-valid.opf @@ -6,7 +6,7 @@ en NOID 2019-01-01T12:00:00Z - 06 + 06 diff --git a/src/test/resources/epub3/files/package-document/metadata-meta-source-of-cardinality-error.opf b/src/test/resources/epub3/files/package-document/metadata-meta-source-of-cardinality-error.opf new file mode 100644 index 000000000..fe963648b --- /dev/null +++ b/src/test/resources/epub3/files/package-document/metadata-meta-source-of-cardinality-error.opf @@ -0,0 +1,19 @@ + + + + Title + en + NOID + 2019-01-01T12:00:00Z + urn:isbn:9780375704024 + pagination + pagination + + + + + + + + diff --git a/src/test/resources/epub3/files/package-document/metadata-subject-term-multiple-error.opf b/src/test/resources/epub3/files/package-document/metadata-meta-term-cardinality-error.opf similarity index 100% rename from src/test/resources/epub3/files/package-document/metadata-subject-term-multiple-error.opf rename to src/test/resources/epub3/files/package-document/metadata-meta-term-cardinality-error.opf diff --git a/src/test/resources/epub3/files/package-document/metadata-subject-term-no-authority-error.opf b/src/test/resources/epub3/files/package-document/metadata-meta-term-no-authority-error.opf similarity index 100% rename from src/test/resources/epub3/files/package-document/metadata-subject-term-no-authority-error.opf rename to src/test/resources/epub3/files/package-document/metadata-meta-term-no-authority-error.opf diff --git a/src/test/resources/epub3/files/package-document/metadata-meta-term-refines-disallowed-error.opf b/src/test/resources/epub3/files/package-document/metadata-meta-term-refines-disallowed-error.opf new file mode 100644 index 000000000..ecc6e15dc --- /dev/null +++ b/src/test/resources/epub3/files/package-document/metadata-meta-term-refines-disallowed-error.opf @@ -0,0 +1,17 @@ + + + + Title + en + NOID + 2019-01-01T12:00:00Z + something + + + + + + + + diff --git a/src/test/resources/epub3/files/package-document/metadata-meta-term-valid.opf b/src/test/resources/epub3/files/package-document/metadata-meta-term-valid.opf new file mode 100644 index 000000000..3ef1ad0f2 --- /dev/null +++ b/src/test/resources/epub3/files/package-document/metadata-meta-term-valid.opf @@ -0,0 +1,19 @@ + + + + Title + en + NOID + 2019-01-01T12:00:00Z + Something + https://example.org/authority + something + + + + + + + + diff --git a/src/test/resources/epub3/files/package-document/metadata-meta-title-type-cardinality-error.opf b/src/test/resources/epub3/files/package-document/metadata-meta-title-type-cardinality-error.opf new file mode 100644 index 000000000..a63b22cf6 --- /dev/null +++ b/src/test/resources/epub3/files/package-document/metadata-meta-title-type-cardinality-error.opf @@ -0,0 +1,18 @@ + + + + Title + en + NOID + 2019-01-01T12:00:00Z + main + short + + + + + + + + diff --git a/src/test/resources/epub3/files/package-document/metadata-meta-title-type-refines-disallowed-error.opf b/src/test/resources/epub3/files/package-document/metadata-meta-title-type-refines-disallowed-error.opf new file mode 100644 index 000000000..0662cf184 --- /dev/null +++ b/src/test/resources/epub3/files/package-document/metadata-meta-title-type-refines-disallowed-error.opf @@ -0,0 +1,17 @@ + + + + Title + en + NOID + 2019-01-01T12:00:00Z + main + + + + + + + + diff --git a/src/test/resources/epub3/files/package-document/metadata-meta-title-type-valid.opf b/src/test/resources/epub3/files/package-document/metadata-meta-title-type-valid.opf new file mode 100644 index 000000000..50123c605 --- /dev/null +++ b/src/test/resources/epub3/files/package-document/metadata-meta-title-type-valid.opf @@ -0,0 +1,17 @@ + + + + Title + en + NOID + 2019-01-01T12:00:00Z + main + + + + + + + + diff --git a/src/test/resources/epub3/package-document.feature b/src/test/resources/epub3/package-document.feature index a7528e07d..c5e3a740e 100644 --- a/src/test/resources/epub3/package-document.feature +++ b/src/test/resources/epub3/package-document.feature @@ -156,34 +156,6 @@ Feature: EPUB 3 ▸ Packages ▸ Package Document Checks Scenario: 'dc:source' valid values are allowed When checking file 'metadata-source-valid.opf' Then no errors or warnings are reported - - Scenario: 'dc:subject' can be refined with a code term and authority - When checking file 'metadata-subject-authority-valid.opf' - Then no errors or warnings are reported - - Scenario: 'dc:subject' authority must be associated to a term - When checking file 'metadata-subject-authority-no-term-error.opf' - Then error RSC-005 is reported - And the message contains "A term property must be associated" - And no other errors or warnings are reported - - Scenario: 'dc:subject' authority must not be defined more than once - When checking file 'metadata-subject-authority-multiple-error.opf' - Then error RSC-005 is reported - And the message contains "Only one pair of authority and term properties" - And no other errors or warnings are reported - - Scenario: 'dc:subject' term must be associated to an authority - When checking file 'metadata-subject-term-no-authority-error.opf' - Then error RSC-005 is reported - And the message contains "An authority property must be associated" - And no other errors or warnings are reported - - Scenario: 'dc:subject' term must not be defined more than once - When checking file 'metadata-subject-term-multiple-error.opf' - Then error RSC-005 is reported - And the message contains "Only one pair of authority and term properties" - And no other errors or warnings are reported Scenario: 'dc:type' valid values are allowed When checking file 'metadata-type-valid.opf' @@ -656,6 +628,28 @@ Feature: EPUB 3 ▸ Packages ▸ Package Document Checks # C. Meta Properties Vocabulary + Scenario: 'authority' metadata can refine a subject expression + When checking file 'metadata-meta-authority-valid.opf' + Then no errors or warnings are reported + + Scenario: 'authority' metadata can only refine a subject expression + When checking file 'metadata-meta-authority-refines-disallowed-error.opf' + Then error RSC-005 is reported + And the message contains 'Property "authority" must refine a "subject" property' + Then no errors or warnings are reported + + Scenario: 'authority' metadata must be associated to a term + When checking file 'metadata-meta-authority-no-term-error.opf' + Then error RSC-005 is reported + And the message contains "A term property must be associated" + And no other errors or warnings are reported + + Scenario: 'authority' metadata must not be defined more than once + When checking file 'metadata-meta-authority-cardinality-error.opf' + Then error RSC-005 is reported + And the message contains "Only one pair of authority and term properties" + And no other errors or warnings are reported + Scenario: 'belongs-to-collection' metadata can identify the publication’s collection When checking file 'metadata-meta-collection-valid.opf' Then no errors or warnings are reported @@ -677,16 +671,66 @@ Feature: EPUB 3 ▸ Packages ▸ Package Document Checks Then error RSC-005 is reported And the message contains 'Property "collection-type" must refine a "belongs-to-collection" property' And no other errors or warnings are reported + + Scenario: 'collection-type' metadata cannot be defined more than once to refine the same expression + When checking file 'metadata-meta-collection-type-cardinality-error.opf' + Then error RSC-005 is reported + And the message contains '"collection-type" cannot be declared more than once' + And no other errors or warnings are reported Scenario: 'display-seq' metadata is allowed When checking file 'metadata-meta-display-seq-valid.opf' Then no errors or warnings are reported + + Scenario: 'display-seq' metadata cannot be defined more than once to refine the same expression + When checking file 'metadata-meta-display-seq-cardinality-error.opf' + Then error RSC-005 is reported + And the message contains '"display-seq" cannot be declared more than once' + And no other errors or warnings are reported + + Scenario: 'file-as' metadata is allowed + When checking file 'metadata-meta-file-as-valid.opf' + Then no errors or warnings are reported + + Scenario: 'file-as' metadata cannot be defined more than once to refine the same expression + When checking file 'metadata-meta-file-as-cardinality-error.opf' + Then error RSC-005 is reported + And the message contains '"file-as" cannot be declared more than once' + And no other errors or warnings are reported + + Scenario: 'group-position' metadata is allowed + When checking file 'metadata-meta-group-position-valid.opf' + Then no errors or warnings are reported + + Scenario: 'group-position' metadata cannot be defined more than once to refine the same expression + When checking file 'metadata-meta-group-position-cardinality-error.opf' + Then error RSC-005 is reported + And the message contains '"group-position" cannot be declared more than once' + And no other errors or warnings are reported + + Scenario: 'identifier-type' metadata can only refine a 'source' or 'identifier' property + When checking file 'metadata-meta-identifier-type-refines-disallowed-error.opf' + Then error RSC-005 is reported + And the message contains 'Property "identifier-type" must refine an "identifier" or "source" property' + And no other errors or warnings are reported + + Scenario: 'identifier-type' metadata cannot be defined more than once to refine the same expression + When checking file 'metadata-meta-identifier-type-cardinality-error.opf' + Then error RSC-005 is reported + And the message contains '"identifier-type" cannot be declared more than once' + And no other errors or warnings are reported Scenario: 'meta-auth' metadata is deprecated When checking file 'metadata-meta-meta-auth-deprecated-warning.opf' Then warning RSC-017 is reported And the message contains "the meta-auth property is deprecated" And no other errors or warnings are reported + + Scenario: 'role' metadata cannot be defined more than once to refine the same expression + When checking file 'metadata-meta-role-cardinality-error.opf' + Then error RSC-005 is reported + And the message contains '"role" cannot be declared more than once' + And no other errors or warnings are reported Scenario: 'source-of' metadata can be used to refine the pagination source When checking file 'metadata-meta-source-of-valid.opf' @@ -701,13 +745,57 @@ Feature: EPUB 3 ▸ Packages ▸ Package Document Checks Scenario: 'source-of' metadata cannot be used as a primary metadata When checking file 'metadata-meta-source-of-refines-missing-error.opf' Then error RSC-005 is reported - And the message contains 'The "source-of" property must refine a "dc:source" element' + And the message contains 'The "source-of" property must refine a "source" property' And no other errors or warnings are reported Scenario: 'source-of' metadata must refine a 'dc:source' metadata entry When checking file 'metadata-meta-source-of-refines-not-dcsource-error.opf' Then error RSC-005 is reported - And the message contains 'The "source-of" property must refine a "dc:source" element' + And the message contains 'The "source-of" property must refine a "source" property' + And no other errors or warnings are reported + + Scenario: 'source-of' metadata cannot be defined more than once to refine the same expression + When checking file 'metadata-meta-source-of-cardinality-error.opf' + Then error RSC-005 is reported + And the message contains '"source-of" cannot be declared more than once' + And no other errors or warnings are reported + + Scenario: 'term' metadata can refine a subject expression + When checking file 'metadata-meta-term-valid.opf' + Then no errors or warnings are reported + + Scenario: 'term' metadata can only refine a subject expression + When checking file 'metadata-meta-term-refines-disallowed-error.opf' + Then error RSC-005 is reported + And the message contains 'Property "term" must refine a "subject" property' + Then no errors or warnings are reported + + Scenario: 'term' metadata must be associated to an authority + When checking file 'metadata-meta-term-no-authority-error.opf' + Then error RSC-005 is reported + And the message contains "An authority property must be associated" + And no other errors or warnings are reported + + Scenario: 'term' metadata must not be defined more than once + When checking file 'metadata-meta-term-cardinality-error.opf' + Then error RSC-005 is reported + And the message contains "Only one pair of authority and term properties" + And no other errors or warnings are reported + + Scenario: 'title-type' metadata can be used to refine a title expression + When checking file 'metadata-meta-title-type-valid.opf' + Then no errors or warnings are reported + + Scenario: 'title-type' metadata can only refine a 'title' expression + When checking file 'metadata-meta-title-type-refines-disallowed-error.opf' + Then error RSC-005 is reported + And the message contains 'Property "title-type" must refine a "title" property' + And no other errors or warnings are reported + + Scenario: 'title-type' metadata cannot be defined more than once to refine the same expression + When checking file 'metadata-meta-title-type-cardinality-error.opf' + Then error RSC-005 is reported + And the message contains '"title-type" cannot be declared more than once' And no other errors or warnings are reported # D. Metadata Link Vocabulary