Skip to content
Snippets Groups Projects
Commit 4181cc4a authored by Mike Lynch's avatar Mike Lynch
Browse files

Licenses test written and passing

parent 84c59bdd
Branches
Tags
No related merge requests found
...@@ -50,7 +50,7 @@ const DEFAULT_IRI_PREFS = { ...@@ -50,7 +50,7 @@ const DEFAULT_IRI_PREFS = {
}, },
'spatialCoverage': '_:spatial/', 'spatialCoverage': '_:spatial/',
'funder': '_:funder/', 'funder': '_:funder/',
'licence': '_:licence/', 'license': '_:license/',
'citation': '_:citation/' 'citation': '_:citation/'
}; };
...@@ -59,7 +59,7 @@ const DEFAULT_IRI_PREFS = { ...@@ -59,7 +59,7 @@ const DEFAULT_IRI_PREFS = {
// dataset -> spatialCoverage -> place // dataset -> spatialCoverage -> place
// dataset -> temporalCoverage -> time // dataset -> temporalCoverage -> time
// dataset -> funder -> organisation // dataset -> funder -> organisation
// dataset -> licence -> licence (CreativeWork or URL) // dataset -> license -> licence (CreativeWork or URL)
// dataset -> citation -> related publications, websites, articles, datasets // dataset -> citation -> related publications, websites, articles, datasets
...@@ -71,7 +71,7 @@ const DATASET_PROPERTIES = { ...@@ -71,7 +71,7 @@ const DATASET_PROPERTIES = {
'about': make_subjects, 'about': make_subjects,
'spatialCoverage': make_spatial, 'spatialCoverage': make_spatial,
'funder': make_funders, 'funder': make_funders,
'licence': make_licence, 'license': make_license,
'citation': make_related_works 'citation': make_related_works
}; };
...@@ -496,8 +496,27 @@ function make_temporal(datapub) { ...@@ -496,8 +496,27 @@ function make_temporal(datapub) {
function make_licence(datapub) { // this assumes that the license_other supersedes
return undefined; // the license_statement
function make_license(datapub, prefix) {
if( datapub['license_other_url'] ) {
return [{
'@id': datapub['license_other_url'],
'type': 'CreativeWork',
'name': datapub['license_notes']
}];
}
if( datapub['license_statement'] ) {
return [{
'@id': datapub['license_identifier'],
'type': 'CreativeWork',
'name': datapub['license_statement'],
'url': datapub['license_statement_url']
}];
}
return [];
} }
module.exports = { module.exports = {
......
...@@ -232,15 +232,30 @@ describe("Convert a ReDBox 2.0 DataPub to CATALOG.json", () => { ...@@ -232,15 +232,30 @@ describe("Convert a ReDBox 2.0 DataPub to CATALOG.json", () => {
}); });
it("has funders", () => { it("has funders", () => {
assert(false); assert(false, "Not written yet");
}); });
it("has a licence", () => { it("has a licence", () => {
assert(false); const licenses = cjds['license'];
if( dp['license_other_url'] || dp['license_identifier'] ) {
expect(licenses).to.be.an('array');
const license = licenses[0];
const id = license['@id'];
const litem = get_id(cj, id);
expect(litem).to.be.a('object');
if( dp['license_other_url']) {
expect(id).to.equal(dp['license_other_url']);
expect(litem['name']).to.equal(dp['license_notes']);
} else {
expect(id).to.equal(dp['license_identifier']);
expect(litem['name']).to.equal(dp['license_statement']);
expect(litem['url]']).to.equal(dp['license_statement_url']);
}
}
}); });
it("has related works", () => { it("has related works", () => {
assert(false); assert(false, "Not written yet");
}); });
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment