root/main/trunk/greenstone2/runtime-src/src/oaiservr/qualified_dublincore.cpp @ 22739

Revision 22739, 5.1 KB (checked in by mdewsnip, 9 years ago)

Added copyright header to runtime-src/src/oaiserver/*.cpp and runtime-src/src/oaiserver/*.h.

Line 
1/**********************************************************************
2 *
3 * qualified_dublincore.cpp --
4 *
5 * Copyright (C) 2004-2010  The New Zealand Digital Library Project
6 *
7 * A component of the Greenstone digital library software
8 * from the New Zealand Digital Library Project at the
9 * University of Waikato, New Zealand.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 *
25 *********************************************************************/
26
27
28#include "qualified_dublincore.h"
29
30qualified_dublin_core::qualified_dublin_core() : dublin_core() {
31  // These element names taken from the schema
32  //http://www.greenstone.org/namespace/gsdl_qdc/1.0/gsdl_qdc.xsd
33
34  // We have the following elements already by inheriting from dublin_core
35  /*   elementSet.insert("title");
36   elementSet.insert("creator");
37   elementSet.insert("subject");
38   elementSet.insert("description");
39   elementSet.insert("publisher");
40   elementSet.insert("contributor");
41   elementSet.insert("date");
42   elementSet.insert("type");
43   elementSet.insert("format");
44   elementSet.insert("identifier");
45   elementSet.insert("source");
46   elementSet.insert("language");
47   elementSet.insert("relation");
48   elementSet.insert("coverage");
49   elementSet.insert("rights");
50  */
51   elementSet.insert("alternative");
52   elementSet.insert("tableOfContents");
53   elementSet.insert("abstract");
54   elementSet.insert("created");
55   elementSet.insert("valid");
56   elementSet.insert("available");
57   elementSet.insert("issued");
58   elementSet.insert("modified");
59   elementSet.insert("dateAccepted");
60   elementSet.insert("dateCopyrighted");
61   elementSet.insert("dateSubmitted");
62   elementSet.insert("extent");
63   elementSet.insert("medium");
64   elementSet.insert("isVersionOf");
65   elementSet.insert("hasVersion");
66   elementSet.insert("isReplacedBy");
67   elementSet.insert("replaces");
68   elementSet.insert("isRequiredBy");
69   elementSet.insert("requires");
70   elementSet.insert("isPartOf");
71   elementSet.insert("hasPart");
72   elementSet.insert("isReferencedBy");
73   elementSet.insert("references");
74   elementSet.insert("isFormatOf");
75   elementSet.insert("hasFormat");
76   elementSet.insert("conformsTo");
77   elementSet.insert("spatial");
78   elementSet.insert("temporal");
79   elementSet.insert("audience");
80   elementSet.insert("accrualMethod");
81   elementSet.insert("accrualPeriodicity");
82   elementSet.insert("accrualPolicy");
83   elementSet.insert("instructionalMethod");
84   elementSet.insert("provenance");
85   elementSet.insert("rightsHolder");
86   elementSet.insert("mediator");
87   elementSet.insert("educationLevel");
88   elementSet.insert("accessRights");
89   elementSet.insert("license");
90   elementSet.insert("bibliographicCitation");
91}
92const text_t qualified_dublin_core::formatName() {
93  return "gsdl_qdc";
94}
95
96const text_t qualified_dublin_core::formatPrefix() {
97  return "dc";
98}
99
100
101void qualified_dublin_core::output_metadata_header(ostream &output)
102{
103  output << "    <metadata>\n";
104 
105  if (this->oaiConfigure->getOAIVersion() <= 110){
106    // output dublin core wrapper for OAI v1.1
107    output << "      <gsdl_qdc xmlns=\"http://greenstone.org/namespace/gsdl_qdc/1.0/\"\n"
108       << "          xmlns:xsi=\"http://www.w3c.org/2001/XMLSchema-instance\"\n"
109       << "          xsi:schemaLocation=\"http://greenstone.org/namespace/gsdl_qdc/1.0/ \n"
110       << "                              http://greenstone.org/namespace/gsdl_qdc/1.0/gsdl_qdc.xsd\">\n";
111  }
112  else {
113    output << "      <gsdl_qdc:gsdl_qdc\n"
114       << "          xmlns:gsdl_qdc=\"http://greenstone.org/namespace/gsdl_qdc/1.0/\"\n"
115       << "          xmlns:dc=\"http://purl.org/dc/terms/\"\n"
116       << "          xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
117       << "          xsi:schemaLocation=\"http://greenstone.org/namespace/gsdl_qdc/1.0/ \n"
118       << "                              http://greenstone.org/namespace/gsdl_qdc/1.0/gsdl_qdc.xsd\">\n";
119  }
120}
121
122void qualified_dublin_core::output_metadata_footer(ostream &output)
123{
124  if (this->oaiConfigure->getOAIVersion() <= 110) {
125    output << "      </gsdl_qdc>" << endl;
126  }
127  else {
128    output << "      </gsdl_qdc:gsdl_qdc>" << endl;
129  }
130
131  output << "    </metadata>" << endl;
132  output.flush();
133}
134
135bool qualified_dublin_core::output_formatdata(ostream &output)
136{
137  output << "    <metadataPrefix>gsdl_qdc</metadataPrefix>" << endl;
138  output << "    <schema>http://greenstone.org/namespace/gsdl_qdc/1.0/gsdl_qdc.xsd</schema>" << endl;
139  output << "    <metadataNamespace>http://greenstone.org/namespace/gsdl_qdc/1.0/</metadataNamespace>"<<endl;
140  return true;
141}
Note: See TracBrowser for help on using the browser.