[8219] | 1 |
|
---|
[8182] | 2 | #include "dublincore.h"
|
---|
| 3 |
|
---|
[18895] | 4 | dublin_core::dublin_core() : metaformat() {
|
---|
| 5 | // These element names taken from the schema
|
---|
| 6 | // http://www.openarchives.org/OAI/2.0/oai_dc.xsd
|
---|
| 7 | elementSet.insert("contributor");
|
---|
| 8 | elementSet.insert("coverage");
|
---|
| 9 | elementSet.insert("creator");
|
---|
| 10 | elementSet.insert("date");
|
---|
| 11 | elementSet.insert("description");
|
---|
| 12 | elementSet.insert("format");
|
---|
| 13 | elementSet.insert("identifier");
|
---|
| 14 | elementSet.insert("language");
|
---|
| 15 | elementSet.insert("publisher");
|
---|
| 16 | elementSet.insert("relation");
|
---|
| 17 | elementSet.insert("rights");
|
---|
| 18 | elementSet.insert("source");
|
---|
| 19 | elementSet.insert("subject");
|
---|
| 20 | elementSet.insert("title");
|
---|
| 21 | elementSet.insert("type");
|
---|
| 22 |
|
---|
| 23 |
|
---|
| 24 | }
|
---|
| 25 |
|
---|
[8182] | 26 | const text_t dublin_core::formatName() {
|
---|
| 27 | return "oai_dc";
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | const text_t dublin_core::formatPrefix() {
|
---|
[8219] | 31 | return "dc";
|
---|
[8182] | 32 | }
|
---|
| 33 |
|
---|
| 34 | bool dublin_core::output_record(ostream &output, recptproto *protocol, const text_t &collection,
|
---|
| 35 | const text_t &record_OID)
|
---|
| 36 | {
|
---|
| 37 | return metaformat::output_record(output, protocol, collection, record_OID);
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | void dublin_core::output_metadata_header(ostream &output)
|
---|
| 41 | {
|
---|
| 42 | output << " <metadata>\n";
|
---|
| 43 |
|
---|
| 44 | if (this->oaiConfigure->getOAIVersion() <= 110){
|
---|
| 45 | // output dublin core wrapper for OAI v1.1
|
---|
| 46 | output << " <dc xmlns=\"http://purl.org/dc/elements/1.1/\"\n"
|
---|
| 47 | << " xmlns:xsi=\"http://www.w3c.org/2001/XMLSchema-instance\"\n"
|
---|
| 48 | << " xsi:schemaLocation=\"http://purl.org/dc/elements/1.1/\n"
|
---|
| 49 | << " http://www.openarchives.org/OAI/1.1/dc.xsd\">\n";
|
---|
| 50 | }
|
---|
| 51 | else {
|
---|
| 52 | output << " <oai_dc:dc\n"
|
---|
| 53 | << " xmlns:oai_dc=\"http://www.openarchives.org/OAI/2.0/oai_dc/\"\n"
|
---|
| 54 | << " xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n"
|
---|
| 55 | << " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
|
---|
| 56 | << " xsi:schemaLocation=\"http://www.openarchives.org/OAI/2.0/oai_dc/\n"
|
---|
| 57 | << " http://www.openarchives.org/OAI/2.0/oai_dc.xsd\">\n";
|
---|
| 58 | }
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | void dublin_core::output_metadata_footer(ostream &output)
|
---|
| 62 | {
|
---|
| 63 | if (this->oaiConfigure->getOAIVersion() <= 110) {
|
---|
| 64 | output << " </dc>" << endl;
|
---|
| 65 | }
|
---|
| 66 | else {
|
---|
| 67 | output << " </oai_dc:dc>" << endl;
|
---|
| 68 | }
|
---|
| 69 |
|
---|
| 70 | output << " </metadata>" << endl;
|
---|
| 71 | output.flush();
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 | bool dublin_core::output_formatdata(ostream &output)
|
---|
| 75 | {
|
---|
| 76 | output << " <metadataPrefix>oai_dc</metadataPrefix>" << endl;
|
---|
| 77 |
|
---|
| 78 | if (this->oaiConfigure->getOAIVersion() <= 110) {
|
---|
| 79 | output << " <schema>http://www.openarchives.org/OAI/1.1/dc.xsd</schema>" << endl
|
---|
| 80 | << " <metadataNamespace>http://purl.org/dc/elements/1.1/</metadataNamespace>" << endl;
|
---|
| 81 | }
|
---|
| 82 | else {
|
---|
| 83 | output << " <schema>http://www.openarchives.org/OAI/2.0/oai_dc.xsd</schema>" << endl
|
---|
| 84 | << " <metadataNamespace>http://www.openarchives.org/OAI/2.0/oai_dc/</metadataNamespace>"
|
---|
| 85 | << endl;
|
---|
| 86 | }
|
---|
| 87 | return true;
|
---|
| 88 | }
|
---|
| 89 |
|
---|