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

Got a complete datapub from a more up-to-date stash to test all of the

metadata values
parent fccf68d0
Branches
Tags
No related merge requests found
......@@ -44,7 +44,8 @@ const SUBJECT_FIELDS = [ 'dc:subject_anzsrc:for', 'dc:subject_anzsrc:seo' ];
const SUBJECT_IRI_PREFIX = {
'dc:subject_anzsrc:for': '_:FOR/',
'dc:subject_anzsrc:seo': '_:SEO/'
'dc:subject_anzsrc:seo': '_:SEO/',
'finalKeywords': '_:keywords/'
};
// dataset -> about -> subjects
......
......@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
const chai = require('chai');
const chaiFiles = require('chai-files');
chai.use(chaiFiles);
const _ = require('lodash');
const assert = chai.assert;
const expect = chai.expect;
const file = chaiFiles.file;
......@@ -32,8 +33,8 @@ const ORG = {
'name': 'University of Technology Sydney'
};
const OWNER = 'Michael.Lynch@uts.edu.au';
const APPROVER = 'data.librarian@uts.edu.au';
const OWNER = 'https://orcid.org/0000-0001-5152-5307';
const APPROVER = 'admin';
const DATASET_ID = 'DATASET_ID';
......@@ -61,13 +62,14 @@ function get_type(c, t) {
}
var dp, cj;
var mdp, dp, cj, cjds;
describe("DataPub to DataCrate: core metadata", () => {
describe("Convert a ReDBox 2.0 DataPub to CATALOG.json", () => {
before(async () => {
dp = await fs.readJson('./test_data/datapub.json');
mdp = await fs.readJson('./test_data/datapub.json');
dp = mdp['metadata'];
cj = await catalog.datapub2catalog({
'id': DATASET_ID,
'datapub': dp,
......@@ -75,6 +77,10 @@ describe("DataPub to DataCrate: core metadata", () => {
'owner': OWNER,
'approver': APPROVER
});
const roots = cj['@graph'].filter((item) => {item['path'] === './'});
cjds = roots[0];
console.log("cjds = " + JSON.stringify(cjds));
console.log("cj = " + JSON.stringify(cj));
});
......@@ -111,7 +117,42 @@ describe("DataPub to DataCrate: core metadata", () => {
expect(fids).to.eql(dlids);
});
it("", () => {
// const DATASET_PROPERTIES = {
// 'about': make_subjects,
// 'spatialCoverage': make_spatial,
// 'temporalCoverate': make_temporal,
// 'funder': make_funders,
// 'licence': make_licence,
// 'citation': make_related_works
// };
it("has subjects", () => {
// finalKeywords, FORs and SEOs
const fields = [ 'finalKeywords', 'dc:subject_anzsrc:for', 'dc:subject_anzsrc:seo'];
const about = cjds['about'].map((i) => i['@id']);
_.forEach(fields, (field) => {
const subjects = cj.filter((i) => { i['name'] === dp[field]});
expect(subjects.length).to.equal(1);
})
});
it("has spatial coverage", () => {
});
it("has temporal coverage", () => {
});
it("has funders", () => {
});
it("has a licence", () => {
});
it("has related works", () => {
});
......
{
"parameterRetriever": "",
"dataRecordGetter": "",
"": {},
"dataRecord": {
"oid": "6a84b33c2d2db4be8a9804a5a570d734",
"title": "Test"
},
"title": "Test",
"description": "Test",
"dc:subject_anzsrc:toa_rdf:resource": "dataset",
"finalKeywords": [
"test"
],
"foaf:fundedBy_foaf:Agent": [
{}
],
"foaf:fundedBy_vivo:Grant": [
{}
],
"dc:subject_anzsrc:for": [],
"dc:subject_anzsrc:seo": [],
"startDate": "",
"endDate": "",
"timePeriod": "",
"geolocations": [
""
],
"geospatial": {},
"accessRightsToggle": "",
"dataLocations": [
{
"type": "attachment",
"location": "6a84b33c2d2db4be8a9804a5a570d734/attach/4d91abb2ffa496b2d3c78737fe74efcf",
"mimeType": "image/jpeg",
"name": "clyde_inception_3b_3x3.jpg",
"fileId": "4d91abb2ffa496b2d3c78737fe74efcf",
"uploadUrl": "http://localhost:1500/default/rdmp/record/6a84b33c2d2db4be8a9804a5a570d734/attach/4d91abb2ffa496b2d3c78737fe74efcf",
"selected": true
"metaMetadata" : {
"brandId" : "5bad6d9e02fbffa0394073b0",
"createdBy" : "aHR0cHM6Ly9yYXBpZC50ZXN0LmFhZi5lZHUuYXUhaHR0cHM6Ly9zdGFzaC11YXQucmVzZWFyY2gudXRzLmVkdS5hdSFPMHhGdGlPSmVaeW9UMkloeHF3bXp0Mm9VNDA9",
"type" : "dataPublication",
"form" : "dataPublication-1.0-published",
"lastSavedBy" : "admin",
"lastSaveDate" : "2018-11-14T15:46:09+11:00",
"attachmentFields" : null
},
{
"type": "attachment",
"location": "6a84b33c2d2db4be8a9804a5a570d734/attach/792957fbdae8b70ee597908374dc14ad",
"mimeType": "image/jpeg",
"name": "clyde_inception_3b_3x3_reduce.jpg",
"fileId": "792957fbdae8b70ee597908374dc14ad",
"uploadUrl": "http://localhost:1500/default/rdmp/record/6a84b33c2d2db4be8a9804a5a570d734/attach/792957fbdae8b70ee597908374dc14ad",
"selected": true
}
],
"dataLicensingAccess_manager": "Local Admin",
"dc:accessRights": "Open",
"accessRights_url": "",
"related_publications": [
{
"related_title": "",
"related_url": "",
"related_notes": ""
}
],
"related_websites": [
{
"related_title": "",
"related_url": "",
"related_notes": ""
}
],
"related_metadata": [
{
"related_title": "",
"related_url": "",
"related_notes": ""
}
],
"related_data": [
{
"related_title": "",
"related_url": "",
"related_notes": ""
}
],
"related_services": [
{
"related_title": "",
"related_url": "",
"related_notes": ""
}
],
"license_identifier": "",
"license_notes": "",
"license_other_url": "",
"license_statement": "Copyright ReDBox Research Data 2018",
"license_statement_url": "",
"citation_doi": "",
"requestIdentifier": [],
"citation_title": "Test dataset",
"creators": [
{
"text_full_name": "Michael Lynch",
"email": "Michael.Lynch@uts.edu.au",
"role": "Chief Investigator",
"username": "",
"orcid": "",
"family_name": "Lynch",
"given_name": "Michael"
"authorization" : {
"view" : [
"aHR0cHM6Ly9yYXBpZC50ZXN0LmFhZi5lZHUuYXUhaHR0cHM6Ly9zdGFzaC11YXQucmVzZWFyY2gudXRzLmVkdS5hdSFPMHhGdGlPSmVaeW9UMkloeHF3bXp0Mm9VNDA9"
],
"edit" : [
"aHR0cHM6Ly9yYXBpZC50ZXN0LmFhZi5lZHUuYXUhaHR0cHM6Ly9zdGFzaC11YXQucmVzZWFyY2gudXRzLmVkdS5hdSFPMHhGdGlPSmVaeW9UMkloeHF3bXp0Mm9VNDA9"
],
"viewRoles" : [
"Admin",
"Librarians"
],
"editRoles" : [
"Admin",
"Librarians"
]
},
{
"text_full_name": "Local Admin",
"email": "admin@redboxresearchdata.com.au",
"role": "Data manager",
"username": "admin",
"orcid": "",
"family_name": "Admin",
"given_name": "Local"
"metadata" : {
"parameterRetriever" : "",
"dataRecordGetter" : "",
"" : {},
"dataRecord" : {
"oid" : "f46d6f43fa3f71a7c03b23b3c2c9d6a4",
"title" : "Photographs of the Clyde Gorge"
},
"description" : "Two photographs of the Clyde Gorge with a lot of metadata for the crosswalk tests",
"dc:subject_anzsrc:toa_rdf:resource" : "dataset",
"finalKeywords" : [
"photography",
"test"
],
"foaf:fundedBy_foaf:Agent" : [
{
"dc_title" : "Cancer Australia",
"dc_identifier" : [
"redbox-mint.googlecode.com/funding_bodies/Cancer Australia"
],
"ID" : [
"Cancer Australia"
],
"repository_name" : [
"Funding Bodies"
]
},
{
"dc_title" : "National Health & Medical Research Council",
"dc_identifier" : [
"redbox-mint.googlecode.com/funding_bodies/National Health & Medical Research Council"
],
"ID" : [
"National Health & Medical Research Council"
],
"repository_name" : [
"Funding Bodies"
]
}
],
"foaf:fundedBy_vivo:Grant" : [
{
"dc_title" : "Healthy Worker Initiative on active travel [13184]",
"dc_identifier" : [
"2013001337"
],
"known_ids" : [
"2013001337"
],
"repository_name" : [
"Research Activities"
]
},
{
"dc_title" : "New routes to highly active zinc active nanoparticles",
"dc_identifier" : [
"2007002664"
],
"known_ids" : [
"2007002664"
],
"repository_name" : [
"Research Activities"
]
}
],
"dc:subject_anzsrc:for" : [
{
"name" : "01 - MATHEMATICAL SCIENCES",
"label" : "MATHEMATICAL SCIENCES",
"notation" : "01"
},
{
"name" : "0806 - INFORMATION SYSTEMS",
"label" : "INFORMATION SYSTEMS",
"notation" : "0806",
"geneaology" : [
"08"
]
},
{
"name" : "130302 - Comparative and Cross-Cultural Education",
"label" : "Comparative and Cross-Cultural Education",
"notation" : "130302",
"geneaology" : [
"13",
"1303"
]
}
],
"dc:subject_anzsrc:seo" : [],
"startDate" : "2018-11-18",
"endDate" : "2018-12-02",
"timePeriod" : "The Anthropocene",
"geolocations" : [
{
"basic_name" : "Budawang Range",
"latitude" : "-35.28333",
"longitude" : "150.16667"
},
{
"basic_name" : "Clyde River",
"latitude" : "-35.71153",
"longitude" : "150.19206"
},
{
"basic_name" : "Termeil",
"latitude" : "-35.46667",
"longitude" : "150.35"
}
],
"geospatial" : {
"type" : "FeatureCollection",
"features" : [
{
"type" : "Feature",
"properties" : {},
"geometry" : {
"type" : "Point",
"coordinates" : [
"150.233121",
"-35.402006"
]
}
}
]
},
"accessRightsToggle" : "",
"dataLocations" : [],
"dataLicensingAccess_manager" : "Michael Lynch",
"dc:accessRights" : "Open",
"accessRights_url" : "",
"related_publications" : [
{
"related_title" : "Relpub1",
"related_url" : "https://related.thing/1",
"related_notes" : "Notes 1"
},
{
"related_title" : "Relpub2",
"related_url" : "https://related.thing/2",
"related_notes" : "Notes 2"
}
],
"related_websites" : [
{
"related_title" : "Relweb1",
"related_url" : "https://related.thing/3",
"related_notes" : "Relweb 1"
}
],
"related_metadata" : [
{
"related_title" : "Relmetadata",
"related_url" : "https://related.thing/4",
"related_notes" : "Relmetadata 4"
}
],
"related_data" : [
{
"related_title" : "Reldata",
"related_url" : "https://related.thing/5",
"related_notes" : "Reldata 5"
}
],
"related_services" : [
{
"related_title" : "Relservice",
"related_url" : "https://related.thing/6",
"related_notes" : "Related service"
}
],
"license_identifier" : "undefined",
"license_notes" : "Other License",
"license_other_url" : "https://other.license/",
"license_statement" : "Copyright University of Technology Sydney",
"license_statement_url" : "https://statement.of.rights/",
"title" : "Photographs of the Clyde Gorge",
"creators" : [
{
"text_full_name" : "Michael Lynch",
"email" : "Michael.Lynch@uts.edu.au",
"role" : "Chief Investigator",
"username" : "",
"orcid" : " https://orcid.org/0000-0001-5152-5307",
"family_name" : "Lynch",
"given_name" : "Michael"
},
{
"text_full_name" : "Michael Lynch",
"email" : "Peter.Sefton@uts.edu.au",
"role" : "Data manager",
"username" : "",
"orcid" : "https://orcid.org/0000-0002-3545-944X",
"family_name" : "Sefton",
"given_name" : "Peter"
},
{
"text_full_name" : null,
"email" : null,
"role" : "Contributors",
"username" : "",
"orcid" : "",
"family_name" : "",
"given_name" : ""
},
{
"text_full_name" : null,
"email" : null,
"role" : "Supervisor",
"username" : "",
"orcid" : "",
"family_name" : "",
"given_name" : ""
}
],
"citation_publisher" : "University of Technology Sydney",
"citation_url" : "",
"citation_publication_date" : "2018-11-30",
"citation_doi" : "Lynch, Michael; Sefton, Peter (2018): undefined. University of Technology Sydney. {ID_WILL_BE_HERE}",
"dataowner_name" : "Michael Lynch",
"dataowner_email" : "Michael.Lynch@uts.edu.au",
"contributor_ci" : {
"text_full_name" : "Michael Lynch",
"full_name_honorific" : "Mr Michael Lynch",
"email" : "Michael.Lynch@uts.edu.au",
"given_name" : "Michael",
"family_name" : "Lynch",
"honorific" : "Mr",
"full_name_family_name_first" : "Michael, Lynch",
"username" : "",
"role" : "Chief Investigator"
},
"contributor_data_manager" : {
"text_full_name" : "Michael Lynch",
"full_name_honorific" : "Mr Michael Lynch",
"email" : "Michael.Lynch@uts.edu.au",
"given_name" : "Michael",
"family_name" : "Lynch",
"honorific" : "Mr",
"full_name_family_name_first" : "Michael, Lynch",
"username" : "",
"role" : "Data manager"
},
"contributor_supervisor" : {
"full_name_honorific" : "",
"given_name" : "",
"family_name" : "",
"honorific" : "",
"full_name_family_name_first" : "",
"username" : "",
"role" : "Supervisor"
},
"embargoByDate" : "",
"embargoUntil" : null,
"reviewerNote" : ""
},
{
"role": "Contributors",
"username": "",
"orcid": "",
"family_name": "",
"given_name": ""
"workflow" : {
"stage" : "published",
"stageLabel" : "Published"
},
{
"role": "Supervisor",
"username": "",
"orcid": "",
"family_name": "",
"given_name": ""
}
],
"citation_publisher": "ReDBox Research Data",
"citation_url": "http://mikelynch.org/",
"citation_publication_date": "",
"citation_generated": "Lynch, Michael; Admin, Local; , ; , (Invalid date): Test dataset. ReDBox Research Data. {ID_WILL_BE_HERE}",
"dataowner_name": "Michael Lynch",
"dataowner_email": "Michael.Lynch@uts.edu.au",
"contributor_ci": {
"text_full_name": "Michael Lynch",
"full_name_honorific": "Dr Michael Lynch",
"email": "Michael.Lynch@uts.edu.au",
"given_name": "Michael",
"family_name": "Lynch",
"honorific": "Dr",
"full_name_family_name_first": "Lynch, Michael",
"username": "",
"role": "Chief Investigator"
},
"contributor_data_manager": {
"text_full_name": "Local Admin",
"full_name_honorific": "",
"email": "admin@redboxresearchdata.com.au",
"given_name": "Local",
"family_name": "Admin",
"honorific": "",
"full_name_family_name_first": "Admin, Local",
"username": "admin",
"role": "Data manager"
},
"contributor_supervisor": {
"full_name_honorific": "",
"given_name": "",
"family_name": "",
"honorific": "",
"full_name_family_name_first": "",
"username": "",
"role": "Supervisor"
},
"embargoByDate": "",
"embargoNote": "",
"reviewerNote": "",
"ckanLocation": ""
"notification" : {
"state" : "draft"
},
"previousWorkflow" : {
"stage" : "reviewing",
"stageLabel" : "Reviewing"
},
"redboxOid" : "517a4377c668b874dd059f4b3edbba78",
"packageType" : [
"dataPublication"
],
"date_object_created" : [
"2018-11-14T15:13:53.557+11:00"
],
"date_object_modified" : [
"2018-11-14T15:46:09.361+11:00"
]
}
\ No newline at end of file
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