5 // Created by Heberti Almeida on 04/05/15.
6 // Copyright (c) 2015 Folio Reader. All rights reserved.
12 Represents one of the authors of the book.
19 init(name: String, role: String, fileAs: String) {
34 init(id: String?, scheme: String?, value: String?) {
48 init(date: String, event: String?) {
65 init(name: String? = nil, content: String? = nil, id: String? = nil, property: String? = nil,
66 value: String? = nil, refines: String? = nil) {
68 self.content = content
70 self.property = property
72 self.property = property
74 self.refines = refines
79 Manages book metadata.
82 var creators = [Author]()
83 var contributors = [Author]()
84 var dates = [EventDate]()
85 var language = "en-US"
86 var titles = [String]()
87 var identifiers = [Identifier]()
88 var subjects = [String]()
89 var descriptions = [String]()
90 var publishers = [String]()
91 var format = MediaType.epub.name
92 var rights = [String]()
93 var metaAttributes = [Meta]()
96 Find a book unique identifier by ID
98 - parameter id: The ID
99 - returns: The unique identifier of a book
101 func find(identifierById id: String) -> Identifier? {
102 return identifiers.filter({ $0.id == id }).first
105 func find(byName name: String) -> Meta? {
106 return metaAttributes.filter({ $0.name == name }).first
109 func find(byProperty property: String, refinedBy: String? = nil) -> Meta? {
110 return metaAttributes.filter {
111 if let refinedBy = refinedBy {
112 return $0.property == property && $0.refines == refinedBy
114 return $0.property == property