Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 01-04-2017, 06:59 PM   #1
Evil Overlord
Enthusiast
Evil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-books
 
Posts: 39
Karma: 972
Join Date: Jul 2011
Device: Kindle 3
Question Adding roles in metadata - disappears


I've got an anthology, and I spent a fair time entering the name and role of the editor and each author. Everything looked good, saved the data and file. However, when I imported to Calibre, the book came up as without an author. I reopened the file in sigil, and found that all the role information had disappeared. I examined the opf, and most of the roles were gone there as well.
I added some by hand (edc and edt for the editor, aut for authors), replaced [id="cre"] with [role="aut"] for some, changed <dc:creator> to <dc:contributor> for some, all with no effect.

Also, a Calibre check of the resulting book complains that I have too many creators, and there should be just one. I understood that there could be many creators with different (and overlapping) roles.

Here's an example of some of the opf content:

Code:
<dc:title>Anthology</dc:title>
    <dc:creator id="cre" role="edt">Editor name</dc:creator>
    <meta property="role" refines="#cre" scheme="marc:relators">edt</meta>
    <dc:creator id="cre" role="aut">Author 1</dc:creator>
    <dc:creator role="aut">Author 2</dc:creator>
    <dc:contributor id="cre">Author 3</dc:contributor>
    <dc:creator id="cre">Author 4</dc:creator>
The final entry (Author 4) is what Sigil showed on re-open. Note lack of role, despite entering it for each.

Trial and error shows that changing id="cre" to role="aut" makes them all authors in Calibre. But then trying to edit metadata again in Sigil resets them all.

1. What am I doing wrong?
2. What should be in the opf to show the role of each author?
3. Is there a way to enter this (durably) using the metadata editor?

Last edited by Evil Overlord; 01-04-2017 at 07:10 PM.
Evil Overlord is offline   Reply With Quote
Old 01-04-2017, 10:40 PM   #2
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,699
Karma: 196509000
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
id attributes MUST be unique. If you're using the metadata editor, add an "id" property to each creator entry and choose a unique value for it (rather than leaving it up to chance). Then you can add the roles at your leisure.

Valid metadata for an EPUB3 with four authors and one editor would look something like:

Code:
<dc:creator id="cre1">Author Ay</dc:creator>
<meta scheme="marc:relators" refines="#cre1" property="role">aut</meta>
<dc:creator id="cre2">Author Bee</dc:creator>
<meta scheme="marc:relators" refines="#cre2" property="role">aut</meta>
<dc:creator id="cre3">Author Cee</dc:creator>
<meta scheme="marc:relators" refines="#cre3" property="role">aut</meta>
<dc:creator id="cre4">Author Dee</dc:creator>
<meta scheme="marc:relators" refines="#cre4" property="role">aut</meta>
<dc:creator id="edt">Editor Name</dc:creator>
<meta scheme="marc:relators" refines="#edt" property="role">edt</meta>
Note that the value of the "refines" attribute (in the meta entry) matches the value of the id attribute of the dc:creator entry you widh to add a "role" to.

Use the Epubcheck plugin to verify your metadata is spec-compliant.

I don't know how calibre will respond to multiple creators/refines in the OPF. Calibre isn't 100% EPUB3 compliant. I don't know which portions of the EPUB3 metadata specifications it will support.

Last edited by DiapDealer; 01-04-2017 at 11:04 PM.
DiapDealer is offline   Reply With Quote
Old 01-04-2017, 11:26 PM   #3
Evil Overlord
Enthusiast
Evil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-books
 
Posts: 39
Karma: 972
Join Date: Jul 2011
Device: Kindle 3
@DiapDealer

Thanks! That explains a lot, and your example is very helpful. I misunderstood the nature of the id to be a category descriptor, though it now seems very logical that it would be a unique identifier.

I hadn't thought to use EPUBcheck for this last step, though I've run through it for the rest of the book.

One last question: What would it look like to add two roles for an individual? e.g., edc and edt
Evil Overlord is offline   Reply With Quote
Old 01-05-2017, 12:04 AM   #4
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,699
Karma: 196509000
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by Evil Overlord View Post
One last question: What would it look like to add two roles for an individual? e.g., edc and edt
I THINK you should be able to add multiple roles refines to one dc entry, but the Metadata Editor doesn't seem to accommodate it.

When I do it manually in the OPF file -- something like:

Code:
<dc:creator id="cre1">Author Person</dc:creator>
<meta refines="#cre1" scheme="marc:relators" property="role">aut</meta>
<dc:contributor id="contrib1">Editor Person</dc:contributor>
<meta refines="#contrib1" scheme="marc:relators" property="role">edt</meta>
<meta refines="#contrib1" scheme="marc:relators" property="role">edc</meta>
then EpubCheck has no complaints. but only one role survives when trying to add/edit multiple roles for one dc entry with the Metadata Editor.

I don't know if that's an issue with the Editor, or if my understanding of the spec is faulty. If EpubCheck doesn't complain, though, it's probably the former. I'll let someone else chime in for sure. In the meantime, manually editing the OPF to add multiple roles to one individual seems to work. I'd just make it the last thing you do, so it doesn't get trashed by the editor when you make a change.
DiapDealer is offline   Reply With Quote
Old 01-05-2017, 12:12 AM   #5
Evil Overlord
Enthusiast
Evil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-books
 
Posts: 39
Karma: 972
Join Date: Jul 2011
Device: Kindle 3
Thanks again. That's exactly the info I needed. I was worried that with two 'refines', one would cancel the other.
Evil Overlord is offline   Reply With Quote
Old 01-05-2017, 08:07 AM   #6
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,878
Karma: 5449552
Join Date: Nov 2009
Device: many
Yes, you should be able to use multiple refines in epub3 to build up more information about a particular epub3 metadata entry. That includes providing them with multiple marc:relator role properties. The Sigil epub3 metadata editor should allow that. If not, that is a bug that needs to be fixed. I will look into it.

KevinH
KevinH is offline   Reply With Quote
Old 01-05-2017, 08:21 AM   #7
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,699
Karma: 196509000
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Thanks, Kevin!
DiapDealer is offline   Reply With Quote
Old 01-05-2017, 10:27 AM   #8
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,878
Karma: 5449552
Join Date: Nov 2009
Device: many
Yes, definite bug in metaproc3.py code in the python3lib code in that it remaps all refines targeted at a primary dc metadata element (such as dc:contributor) to be additional attribute/value pair in the attribute dictionary of that specific element. The problem is the property ("role" in this case) is used at the key in the attribute dictionary and so that multiple refines with role properties will simply overwrite each other for the same dc metadata element.

I will either have to allow each property that exists be mapped to a list of values (messy and error prone unless all dictionary values are treated as lists everywhere), convert the attribute dictionary to a simple list of attribute name/value pairs so that multiple role/value pairs can exist in the list, or keep track of the fact that multiple roles for one person can exist by assigning using "role_1", "role_2", etc as keys to keep things unique.

Any approach to fixing this will take time and require some messing around. The sad fact is the whole idea/concept of "refines" and refines on refines is going away in epub 3.1 as an unworkable mess!!!

I will look into better handling this case. As it stands multiple refines are properly handled for epub3 dc metadata elements but only if the property itself is unique. The case of multiple "roles" obviously violates that constraint and needs to be fixed somehow.

FWIW - Few if other cases would need multiple definitions of the exact same property as different properties are given to different title types, and etc.

KevinH
KevinH is offline   Reply With Quote
Old 01-05-2017, 12:14 PM   #9
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,699
Karma: 196509000
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
If you find a way to implement it that doesn't involve an overhaul, then sure. But I don't think we need to upset the apple-cart for a fairly rare event--especially if 3.1 would render such work moot anyway. It can still be achieved manually in the meantime (and there's no reason some edit plugins couldn't be written for specialized metadata entry, as well).
DiapDealer is offline   Reply With Quote
Old 01-05-2017, 12:46 PM   #10
Evil Overlord
Enthusiast
Evil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-books
 
Posts: 39
Karma: 972
Join Date: Jul 2011
Device: Kindle 3
As someone who asked for the multiple roles, I agree that there's no point putting in a lot of work on something that will in any case be revised soon.
Evil Overlord is offline   Reply With Quote
Old 01-05-2017, 01:35 PM   #11
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,878
Karma: 5449552
Join Date: Nov 2009
Device: many
FWIW,
I have been reading up on the epub3.1 metadata

In epub3.1 only one opf:role attribute will be allowed on a dc:creator or dc:contributor element and from what I have been able to find it may only hold a single 3 letter value - not a list of space separated values.

See
http://www.idpf.org/epub/31/spec/epu...-dccontributor

Quote:
As attributes cannot be repeated, only a single alternative representation can be declared for any element.
Quote:
opf:role
Identifies the role of a creator or contributor. The value must be a three-letter lowercase code from [MARC Relators].
So the only way for "Evil Overlord" to be both "edt" and "edc" under epub3.1 would be as follows:

Code:
<dc:contributor opf:role="edt">Evil Overlord</dc:contributor>
<dc:contributor opf:role="edc">Evil Overlord</dc:contributor>
Effectively like giving the same person credits as both actor and director in movie credits as his/her name would then appear twice.

So the safest way to handle this under epub 3.0 might be as follows:

Code:
<dc:contributor id="contrib1">Evil Overlord</dc:contributor>
<dc:contributor id="contrib2">Evil Overlord</dc:contributor>
<meta refines="#contrib1" scheme="marc:relators" property="role">edt</meta>
<meta refines="#contrib2" scheme="marc:relators" property="role">edc</meta>
That may seem strange but as far as I can tell from the epub 3.0 specs is perfectly legal and it would then be mappable back into both older epub2 metadata and future epub3.1 metadata.

So instead of using multiple refines pointing at the same dc:contributor, you may want to use multiple dc:contributor elements each with its own single role related refine.

My 2 cents ...

KevinH

ps. FWIW: Sigil's epub3 metadata editor should already properly handle things things this way

Last edited by KevinH; 01-05-2017 at 02:02 PM.
KevinH is offline   Reply With Quote
Reply

Tags
metadata, opf, role


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing Calibre Libraries, metadata.opf disappears GalacticHull Library Management 5 12-21-2016 01:04 PM
TOC Disappears after adding metadata..Help! CanonFan Sigil 5 05-23-2011 05:30 AM
adding metadata artemisblossom Calibre 3 09-25-2009 03:24 PM


All times are GMT -4. The time now is 04:38 PM.


MobileRead.com is a privately owned, operated and funded community.