readium / r2-shared-js

Shared models for Readium Desktop
BSD 3-Clause "New" or "Revised" License
11 stars 11 forks source link

OPF package metadata link element + prefix (support is missing) #16

Open danielweck opened 5 years ago

danielweck commented 5 years ago

For example: https://github.com/IDPF/epub3-samples/blob/master/30/wasteland/EPUB/wasteland.opf

<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://www.idpf.org/2007/opf" version="3.0" unique-identifier="uid" xml:lang="en-US" prefix="cc: http://creativecommons.org/ns#">
    <metadata xmlns:dc="http://purl.org/dc/elements/1.1/">
        <dc:identifier id="uid">code.google.com.epub-samples.wasteland-basic</dc:identifier>
        <dc:title>The Waste Land</dc:title>
        <dc:creator>T.S. Eliot</dc:creator>
        <dc:language>en-US</dc:language>
        <dc:date>2011-09-01</dc:date>
        <meta property="dcterms:modified">2012-01-18T12:47:00Z</meta>
        <!-- rights expressions for the work as a whole -->
        <dc:rights>This work is shared with the public using the Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) license.</dc:rights>        
        <link rel="cc:license" href="http://creativecommons.org/licenses/by-sa/3.0/"/>
        <meta property="cc:attributionURL">http://code.google.com/p/epub-samples/</meta>
        <!-- rights expression for the cover image -->       
        <link rel="cc:license" refines="#cover" href="http://creativecommons.org/licenses/by-sa/3.0/" />
        <link rel="cc:attributionURL" refines="#cover" href="http://en.wikipedia.org/wiki/Simon_Fieldhouse" />        
        <!-- cover meta element included for 2.0 reading system compatibility: -->
        <meta name="cover" content="cover"/>
    </metadata> 
    <manifest>
        <item id="t1" href="wasteland-content.xhtml" media-type="application/xhtml+xml" />
        <item id="nav" href="wasteland-nav.xhtml" properties="nav" media-type="application/xhtml+xml" />
        <item id="cover" href="wasteland-cover.jpg" media-type="image/jpeg" properties="cover-image" />
        <item id="css" href="wasteland.css" media-type="text/css" />
        <item id="css-night" href="wasteland-night.css" media-type="text/css" />
        <!-- ncx included for 2.0 reading system compatibility: -->
        <item id="ncx" href="wasteland.ncx" media-type="application/x-dtbncx+xml" />
    </manifest>
    <spine toc="ncx">
        <itemref idref="t1" />        
    </spine>    
</package>

EDIT: see comment below https://github.com/readium/r2-shared-js/issues/16#issuecomment-1480842292

Note how <meta property="cc:attributionURL">http://code.google.com/p/epub-samples/</meta> is missing in the ReadiumWebPubManifest: http://readium2.herokuapp.com/pub/L2FwcC9taXNjL2VwdWJzL3dhc3RlbGFuZC1vdGYtb2JmLmVwdWI%3D/manifest.json/show/all (or https://readium2.now.sh/pub/L2hvbWUvbm93dXNlci9zcmMvbWlzYy9lcHVicy93YXN0ZWxhbmQtb3RmLW9iZi5lcHVi/manifest.json/show/all )

{
    "@context": "https://readium.org/webpub-manifest/context.jsonld",
    "metadata": {
        "@type": "http://schema.org/Book",
        "title": "The Waste Land",
        "identifier": "code.google.com.epub-samples.wasteland-otf-obfuscated",
        "author": "T.S. Eliot",
        "language": "en-US",
        "modified": "2019-04-24T16:58:39.677Z",
        "published": "2011-09-01T00:00:00.000Z",
        "description": "OTF font obfuscated using algorithm defined in OCF 3.0, fallback to sans-serif system font",
        "rights": "This work is shared with the public using the Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) license."
    }
}
danielweck commented 5 years ago

Also, prefix="cc: http://creativecommons.org/ns#"

danielweck commented 5 years ago

If I am not mistaken, the ReadiumWebPublicationManifest (aka RWPM) does not encode the EPUB OPF package > metadata > link as such. See the JSON Schema: https://github.com/readium/webpub-manifest/blob/master/schema/metadata.schema.json

EDIT: see issue https://github.com/readium/webpub-manifest/issues/28

Consequently, the TypeScript model reflects that too: https://github.com/readium/r2-shared-js/blob/develop/src/models/metadata.ts

However, the OPF model should indeed include support for the link XML element of OPF. It currently does not: https://github.com/readium/r2-shared-js/blob/develop/src/parser/epub/opf-metadata.ts

I am not seeing a clear definition in the architecture document either: https://github.com/readium/architecture/blob/master/streamer/parser/metadata.md ...so perhaps this is an opportunity to contribute, once we figure out the formal definition of link parsing (CC @JayPanoz )

danielweck commented 5 years ago

Related issue (Readium "1" C++ SDK): https://github.com/readium/readium-sdk/pull/318#issuecomment-444562130

danielweck commented 5 years ago

Prominent use case: accessibility metadata, e.g.

http://kb.daisy.org/publishing/docs/metadata/evaluation.html a11y:certifiedBy ( http://www.idpf.org/epub/vocab/package/a11y/# ) dcterms:conformsTo

http://kb.daisy.org/publishing/docs/metadata/schema-org.html schema:accessModeSufficient

http://www.idpf.org/epub/a11y/accessibility.html#sec-disc-package

danielweck commented 5 years ago

See: https://github.com/readium/webpub-manifest/issues/14

danielweck commented 1 year ago

The prefix URI is not preserved, only the prefix name:

prefix="cc: http://creativecommons.org/ns#" + <meta property="cc:attributionURL">http://code.google.com/p/epub-samples/</meta>

in:

https://github.com/IDPF/epub3-samples/blob/main/30/wasteland/META-INF/container.xml

==>

https://raw.githubusercontent.com/IDPF/epub3-samples/main/30/wasteland/META-INF/container.xml

==>

https://streamer.edrlab.org/pub/aHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL0lEUEYvZXB1YjMtc2FtcGxlcy9tYWluLzMwL3dhc3RlbGFuZC9NRVRBLUlORi9jb250YWluZXIueG1s/manifest.json/show/all