Fixed generation of the Creative Commons RDF, including the parsing change for the cc namespace.

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2312 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Graham Triggs
2007-11-06 12:43:56 +00:00
parent acfcf672f1
commit c46b3d9d3b

View File

@@ -129,6 +129,7 @@ public class CreativeCommons
String cc_license_url) throws SQLException, IOException,
AuthorizeException
{
boolean hasCCnamespace = true;
Bundle bundle = getCcBundle(item);
// get some more information
@@ -137,20 +138,46 @@ public class CreativeCommons
// here we need to transform the license_rdf into a document_rdf
// first we find the beginning of "<License"
int license_start = license_rdf.indexOf("<License");
int license_start = license_rdf.indexOf("<cc:License");
if (license_start < 0)
{
hasCCnamespace = false;
license_start = license_rdf.indexOf("<License");
}
int license_end;
String document_rdf;
if (hasCCnamespace)
{
// the 13 is the length of the license closing tag.
license_end = license_rdf.indexOf("</cc:License>") + 13;
document_rdf = "<rdf:RDF xmlns:cc=\"http://web.resource.org/cc/\"\n"
+ " xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n"
+ " xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"
+ "<cc:Work rdf:about=\"\">\n"
+ "<cc:License rdf:resource=\""
+ cc_license_url
+ "\"/>\n"
+ "</cc:Work>\n\n"
+ license_rdf.substring(license_start, license_end)
+ "\n\n</rdf:RDF>";
}
else
{
// the 10 is the length of the license closing tag.
int license_end = license_rdf.indexOf("</License>") + 10;
String document_rdf = "<rdf:RDF xmlns=\"http://web.resource.org/cc/\"\n"
license_end = license_rdf.indexOf("</License>") + 10;
document_rdf = "<rdf:RDF xmlns=\"http://web.resource.org/cc/\"\n"
+ " xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n"
+ " xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"
+ "<Work rdf:about=\"\">\n"
+ "<license rdf:resource=\""
+ "<License rdf:resource=\""
+ cc_license_url
+ "\">\n"
+ "\"/>\n"
+ "</Work>\n\n"
+ license_rdf.substring(license_start, license_end)
+ "\n\n</rdf:RDF>";
}
// set the format
BitstreamFormat bs_format = BitstreamFormat.findByShortDescription(