|
| 1 | +class Epdcx |
| 2 | + def initialize(xml, submission) |
| 3 | + @xml = xml |
| 4 | + @xml['mets'].xmlData do |
| 5 | + @xml['epdcx'].descriptionSet( |
| 6 | + 'xmlns:epdcx' => 'http://purl.org/eprint/epdcx/2006-11-16/', |
| 7 | + 'xsi:schemaLocation' => |
| 8 | + 'http://purl.org/eprint/epdcx/xsd/2006-11-16/epdcx.xsd') do |
| 9 | + work(submission) |
| 10 | + entity(submission) |
| 11 | + end |
| 12 | + end |
| 13 | + end |
| 14 | + |
| 15 | + private |
| 16 | + |
| 17 | + def entity(submission) |
| 18 | + @xml['epdcx'].description('epdcx:resourceId' => 'sword-mets-expr-1') do |
| 19 | + expression |
| 20 | + lang |
| 21 | + journal_article |
| 22 | + statement('http://purl.org/eprint/terms/bibliographicCitation', |
| 23 | + submission.journal) |
| 24 | + doi(submission) |
| 25 | + end |
| 26 | + end |
| 27 | + |
| 28 | + def work(submission) |
| 29 | + @xml['epdcx'].description('epdcx:resourceId' => 'sword-mets-epdcx-1') do |
| 30 | + scholarly_work |
| 31 | + statement('http://purl.org/dc/elements/1.1/title', submission.title) |
| 32 | + statement('http://purl.org/dc/elements/1.1/creator', submission.author) |
| 33 | + |
| 34 | + @xml['epdcx'].statement('epdcx:propertyURI' => |
| 35 | + 'http://purl.org/eprint/terms/isExpressedAs') do |
| 36 | + @xml['epdcx'].valueRef('sword-mets-expr-1') |
| 37 | + end |
| 38 | + end |
| 39 | + end |
| 40 | + |
| 41 | + def doi(submission) |
| 42 | + @xml['epdcx'].statement('epdcx:propertyURI' => |
| 43 | + 'http://purl.org/dc/elements/1.1/identifier') do |
| 44 | + @xml['epdcx'].valueString('epdcx:sesURI' => |
| 45 | + 'http://purl.org/dc/terms/URI') do |
| 46 | + @xml.text(submission.doi) |
| 47 | + end |
| 48 | + end |
| 49 | + end |
| 50 | + |
| 51 | + def expression |
| 52 | + @xml['epdcx'].statement('epdcx:propertyURI' => |
| 53 | + 'http://purl.org/dc/elements/1.1/type', |
| 54 | + 'epdcx:valueURI' => |
| 55 | + 'http://purl.org/eprint/entityType/Expression') |
| 56 | + end |
| 57 | + |
| 58 | + def journal_article |
| 59 | + @xml['epdcx'].statement('epdcx:propertyURI' => |
| 60 | + 'http://purl.org/dc/elements/1.1/type', |
| 61 | + 'epdcx:vesURI' => |
| 62 | + 'http://purl.org/eprint/terms/Type', |
| 63 | + 'epdcx:valueURI' => |
| 64 | + 'http://purl.org/eprint/type/JournalArticle') |
| 65 | + end |
| 66 | + |
| 67 | + def lang |
| 68 | + @xml['epdcx'].statement('epdcx:propertyURI' => |
| 69 | + 'http://purl.org/dc/elements/1.1/language', |
| 70 | + 'epdcx:vesURI' => |
| 71 | + 'http://purl.org/dc/terms/RFC3066') do |
| 72 | + @xml['epdcx'].valueString('en') |
| 73 | + end |
| 74 | + end |
| 75 | + |
| 76 | + def scholarly_work |
| 77 | + @xml['epdcx'].statement('epdcx:propertyURI' => |
| 78 | + 'http://purl.org/dc/elements/1.1/type', |
| 79 | + 'epdcx:valueURI' => |
| 80 | + 'http://purl.org/eprint/entityType/ScholarlyWork') |
| 81 | + end |
| 82 | + |
| 83 | + def statement(prop_uri, value) |
| 84 | + @xml['epdcx'].statement('epdcx:propertyURI' => prop_uri) do |
| 85 | + @xml['epdcx'].valueString(value) |
| 86 | + end |
| 87 | + end |
| 88 | +end |
0 commit comments